:root {
  --bg: #f6f1e4;
  --bg-soft: #fbf8f1;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-deep: rgba(248, 242, 229, 0.94);
  --ink: #23395d;
  --ink-soft: #60728e;
  --line: rgba(35, 57, 93, 0.1);
  --shadow: 0 24px 48px rgba(35, 57, 93, 0.12);
  --gold: #ffd258;
  --gold-deep: #d79c17;
  --teal: #78e2d3;
  --teal-deep: #1fae9d;
  --coral: #ff8e82;
  --coral-deep: #ef6c62;
  --green: #b5ee9d;
  --green-deep: #61b46a;
  --radius-xl: 32px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --font-ui: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-display: "Aptos Display", "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 210, 88, 0.28), transparent 24%),
    radial-gradient(circle at right center, rgba(120, 226, 211, 0.2), transparent 20%),
    radial-gradient(circle at left bottom, rgba(255, 142, 130, 0.15), transparent 18%),
    linear-gradient(180deg, #fffaf0 0%, var(--bg) 100%);
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(35, 57, 93, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(35, 57, 93, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), transparent 82%);
  pointer-events: none;
}

button, input, textarea { font: inherit; }
[hidden] { display: none !important; }

.page-aura {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.9;
}

.glow-gold { width: 360px; height: 360px; top: -120px; left: 8%; background: rgba(255, 210, 88, 0.32); }
.glow-teal { width: 420px; height: 420px; right: -140px; top: 14%; background: rgba(120, 226, 211, 0.2); }
.glow-coral { width: 320px; height: 320px; left: -120px; bottom: 10%; background: rgba(255, 142, 130, 0.16); }

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding:
    calc(18px + env(safe-area-inset-top, 0px))
    max(14px, calc(14px + env(safe-area-inset-right, 0px)))
    calc(54px + env(safe-area-inset-bottom, 0px))
    max(14px, calc(14px + env(safe-area-inset-left, 0px)));
  display: grid;
  gap: 18px;
}

.topbar,
.hero-shell,
.room-section,
.soft-note,
.room-chrome,
.overlay-card,
.celebration-banner,
.feature-doorway,
.story-card,
.studio-panel,
.studio-tools,
.parent-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 28px;
  position: sticky;
  top: calc(10px + env(safe-area-inset-top, 0px));
  z-index: 10;
}

.brand-shell {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 18px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.brand-logo {
  width: 148px;
  max-width: 100%;
  height: auto;
  display: block;
}

.brand-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.hero-copy p,
.mascot-bubble p,
.soft-note p,
.room-card-copy p,
.room-card-copy small,
.launch-body,
.launch-subtitle,
.card-footnote,
.panel-note,
.feature-doorway-copy small,
.wonder-facts span,
.parent-list-item span,
.parent-check small,
.modal-copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.brand-lockup {
  width: clamp(146px, 18vw, 210px);
  height: auto;
  display: block;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  justify-self: end;
}

.top-chip,
.small-chip,
.bubble-chip,
.room-pill,
.card-tag,
.hero-image-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 700;
}

.top-chip {
  cursor: pointer;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.95);
}

.teaching-bar {
  min-width: 0;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 242, 229, 0.92)),
    var(--teaching-wash, rgba(255, 210, 88, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  overflow: hidden;
  display: grid;
  gap: 7px;
}

.teaching-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.teaching-guide {
  flex: 0 0 auto;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(255, 255, 255, 0.82);
  color: var(--teaching-accent, var(--gold-deep));
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.teaching-line {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.teaching-focus {
  font-size: 0.98rem;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}

.teaching-copy {
  margin: 0;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teaching-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 44%;
  overflow: hidden;
  padding-left: 2px;
}

.teaching-cell {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.teaching-cell.is-filled {
  background: var(--teaching-wash, rgba(255, 210, 88, 0.2));
  border-color: rgba(35, 57, 93, 0.12);
}

.teaching-cell.is-current {
  background: var(--teaching-accent, var(--gold-deep));
  border-color: transparent;
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.84);
}

.teaching-cell.has-label {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.84);
  font-size: 0.58rem;
  font-weight: 800;
}

.teaching-cell.has-label.is-school {
  background: rgba(120, 226, 211, 0.12);
}

.teaching-cell.has-label.is-weekend {
  background: rgba(255, 210, 88, 0.18);
}

.teaching-cell.has-label.is-current {
  color: #ffffff;
}

.top-chip-product {
  border-color: rgba(35, 57, 93, 0.14);
  text-decoration: none;
}

.top-chip-parent {
  border-color: rgba(215, 156, 23, 0.22);
  background: rgba(255, 210, 88, 0.18);
}

.section-kicker,
.room-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.hero-shell {
  border-radius: var(--radius-xl);
  padding: 26px;
  display: grid;
  gap: 18px;
}

.home-hero {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  background:
    radial-gradient(circle at top left, rgba(255, 210, 88, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 245, 235, 0.92));
}

.hero-copy {
  display: grid;
  gap: 14px;
  align-content: center;
}

.hero-copy h1,
.hero-copy-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.1rem, 7vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  max-width: 10ch;
}

.hero-actions,
.overlay-actions,
.launch-card-actions,
.inline-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn,
.mini-btn {
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 18px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  text-decoration: none;
}

.btn:hover,
.mini-btn:hover,
.top-chip:hover {
  transform: translateY(-2px);
}

.btn:active,
.mini-btn:active,
.top-chip:active {
  transform: scale(0.98);
}

.btn-gold {
  background: linear-gradient(135deg, #ffeaa5, var(--gold));
  box-shadow: 0 14px 24px rgba(215, 156, 23, 0.18);
}

.btn-teal {
  background: linear-gradient(135deg, #d2fbf5, var(--teal));
  box-shadow: 0 14px 24px rgba(31, 174, 157, 0.16);
}

.btn-coral {
  background: linear-gradient(135deg, #ffd7cf, var(--coral));
  box-shadow: 0 14px 24px rgba(239, 108, 98, 0.16);
}

.btn-ghost,
.mini-btn {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.btn.is-disabled,
.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mascot-shell { display: grid; }

.mascot-card,
.room-hero-card,
.feature-doorway {
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
}

.mascot-card {
  height: 100%;
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: center;
  background:
    radial-gradient(circle at right top, rgba(255, 210, 88, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 245, 235, 0.96));
}

.mascot-portrait,
.room-mascot,
.onboarding-mascot,
.lock-mascot {
  width: min(220px, 100%);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 16px 26px rgba(35, 57, 93, 0.14));
}

.mascot-bubble {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(255, 255, 255, 0.95);
  display: grid;
  gap: 10px;
}

.bubble-chip {
  width: fit-content;
  min-height: 34px;
  background: rgba(255, 210, 88, 0.18);
  color: var(--gold-deep);
}

.soft-note,
.room-section,
.story-card {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.soft-note {
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.soft-note-done {
  background: linear-gradient(135deg, rgba(210, 251, 245, 0.98), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(31, 174, 157, 0.16);
}

.soft-note-path {
  background: linear-gradient(135deg, rgba(255, 250, 236, 0.98), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(215, 156, 23, 0.16);
}

.local-mode-note {
  background: linear-gradient(135deg, rgba(255, 250, 236, 0.96), rgba(246, 255, 241, 0.96));
}

.today-path-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.today-path-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.today-chip-done {
  background: linear-gradient(135deg, rgba(210, 251, 245, 0.96), rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(31, 174, 157, 0.2);
  color: var(--ink);
}

.section-head,
.panel-head,
.room-card-top,
.launch-card-top,
.room-chrome,
.modal-head,
.parent-card-head,
.parent-shell-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.section-head h2,
.panel-head h2,
.room-card-copy h3,
.launch-card h3,
.wonder-card h3,
.parent-card h3,
.modal-head h2,
.soft-note strong,
.feature-doorway-copy h2,
.hero-bubble-title,
.hero-image-chip {
  margin: 0;
}

.room-grid,
.launch-grid,
.parent-grid,
.wonder-grid,
.preview-grid,
.palette,
.parent-list,
.chip-row {
  display: grid;
  gap: 16px;
}

.room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.launch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.launch-grid-small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compact-resource-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.room-card {
  position: relative;
  min-height: 286px;
  padding: 22px;
  border-radius: 30px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  display: grid;
  gap: 18px;
  text-align: left;
}

.room-gold { background: linear-gradient(180deg, rgba(255, 236, 173, 0.92), rgba(255, 210, 88, 0.88)); }
.room-teal { background: linear-gradient(180deg, rgba(210, 251, 245, 0.94), rgba(120, 226, 211, 0.88)); }
.room-coral { background: linear-gradient(180deg, rgba(255, 223, 219, 0.94), rgba(255, 142, 130, 0.88)); }
.room-green { background: linear-gradient(180deg, rgba(238, 255, 211, 0.94), rgba(181, 238, 157, 0.88)); }

.room-card-button {
  width: 100%;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  box-shadow: 0 20px 36px rgba(35, 57, 93, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.room-card-button:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 40px rgba(35, 57, 93, 0.14);
}

.room-card-button:focus-visible {
  outline: 3px solid rgba(35, 57, 93, 0.22);
  outline-offset: 3px;
}

.room-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 138px;
  gap: 18px;
  align-items: center;
}

.room-card-media {
  display: flex;
  justify-content: end;
}

.room-card-thumb-shell,
.launch-icon {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(35, 57, 93, 0.08);
}

.room-card-thumb-shell {
  width: 138px;
  height: 138px;
  padding: 10px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 40%),
    rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

.launch-icon svg {
  width: 30px;
  height: 30px;
}

.room-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 22px;
  display: block;
}

.room-card-copy {
  display: grid;
  gap: 8px;
}

.room-card-copy h3 {
  font-size: clamp(1.9rem, 3vw, 2.45rem);
  line-height: 0.95;
}

.room-card-copy p {
  font-size: 1.02rem;
  color: rgba(35, 57, 93, 0.78);
}

.room-card-copy small {
  font-size: 0.95rem;
  max-width: 30ch;
}

.room-card-foot {
  margin-top: auto;
}

.room-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(35, 57, 93, 0.08);
  font-weight: 800;
}

.room-chrome {
  padding: 14px 18px;
  border-radius: 999px;
}

.room-home-link {
  text-decoration: none;
}

.room-root {
  display: grid;
  gap: 18px;
}

.room-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.room-hero-card {
  padding: 24px;
  border: 1px solid rgba(35, 57, 93, 0.08);
}

.room-hero-gold .room-hero-card:first-child { background: linear-gradient(180deg, rgba(255, 244, 202, 0.98), rgba(255, 234, 165, 0.92)); }
.room-hero-teal .room-hero-card:first-child { background: linear-gradient(180deg, rgba(224, 255, 250, 0.98), rgba(195, 247, 239, 0.92)); }
.room-hero-coral .room-hero-card:first-child { background: linear-gradient(180deg, rgba(255, 234, 230, 0.98), rgba(255, 214, 206, 0.92)); }
.room-hero-green .room-hero-card:first-child { background: linear-gradient(180deg, rgba(248, 255, 233, 0.98), rgba(233, 252, 209, 0.92)); }

.hero-copy-block {
  display: grid;
  gap: 12px;
  align-content: center;
  height: 100%;
}

.hero-copy-block p { margin: 0; max-width: 58ch; }

.mascot-hero-card {
  display: grid;
  gap: 14px;
  align-content: center;
  justify-items: center;
}

.hero-image-chip {
  background: rgba(255, 255, 255, 0.96);
}

.launch-card,
.wonder-card,
.parent-card,
.modal-card-shell,
.inline-panel,
.celebration-banner,
.feature-doorway,
.studio-panel,
.studio-tools {
  padding: 18px;
  border-radius: 26px;
}

.launch-card,
.wonder-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(255, 255, 255, 0.94);
}

.wonder-card-button {
  width: 100%;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.wonder-card-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 36px rgba(35, 57, 93, 0.14);
}

.launch-card.is-disabled {
  opacity: 0.72;
}

.launch-card.is-compact {
  gap: 10px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 246, 238, 0.96));
}

.launch-card.is-compact h3 {
  font-size: 1.35rem;
}

.launch-card.is-compact .launch-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
}

.launch-card.is-compact .launch-icon svg {
  width: 26px;
  height: 26px;
}

.launch-card h3,
.wonder-card h3 {
  font-size: 1.7rem;
}

.launch-subtitle {
  font-weight: 700;
  color: var(--ink);
}

.launch-card-actions {
  justify-content: space-between;
  align-items: center;
}

.card-tag {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.card-footnote {
  font-size: 0.92rem;
}

.chip-row {
  grid-template-columns: repeat(auto-fit, minmax(90px, max-content));
}

.inline-panel,
.story-card,
.studio-panel,
.studio-tools,
.feature-doorway,
.parent-card {
  background: rgba(255, 255, 255, 0.96);
}

.trace-canvas,
.canvas-stage canvas {
  width: 100%;
  max-width: 100%;
  display: block;
  border-radius: 24px;
  background: #fffdf8;
  border: 1px solid rgba(35, 57, 93, 0.08);
}

.celebration-note {
  min-height: 24px;
  font-weight: 700;
  color: var(--ink);
}

.create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.canvas-stage {
  margin-top: 16px;
}

.canvas-stage canvas {
  aspect-ratio: 16 / 9;
  height: auto;
}

.studio-tools,
.story-editors,
.wonder-facts,
.parent-card {
  display: grid;
  gap: 14px;
}

.inspector-group strong,
.story-panel strong,
.story-preview strong {
  color: var(--ink);
}

.palette {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.palette button {
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(35, 57, 93, 0.08);
  cursor: pointer;
}

.mini-btn {
  min-height: 44px;
  padding: 8px 12px;
}

.mini-btn.is-active {
  background: linear-gradient(135deg, #d2fbf5, var(--teal));
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  gap: 18px;
}

.story-starter-shell {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(250, 247, 240, 0.92);
}

.story-starter-row {
  gap: 10px;
}

.story-panel,
.preview-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(250, 247, 240, 0.9);
}

.story-panel textarea {
  min-height: 140px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(35, 57, 93, 0.12);
  resize: vertical;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

.preview-grid {
  grid-template-columns: 1fr;
}

.celebration-banner {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 210, 88, 0.92), rgba(255, 142, 130, 0.92));
}

.feature-doorway {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 18px;
  align-items: center;
}

.feature-doorway-copy {
  display: grid;
  gap: 10px;
}

.feature-doorway-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.book-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 18px 30px rgba(35, 57, 93, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 34px rgba(35, 57, 93, 0.12);
}

.book-card:focus-visible {
  outline: 3px solid rgba(35, 57, 93, 0.2);
  outline-offset: 3px;
}

.book-card-cover,
.book-modal-cover {
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 242, 229, 0.96));
  border: 1px solid rgba(35, 57, 93, 0.08);
}

.book-card-cover {
  aspect-ratio: 5 / 4;
}

.book-card-cover img,
.book-modal-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.book-card-copy {
  display: grid;
  gap: 10px;
}

.book-card-copy h3 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.05;
}

.book-card-copy p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.book-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(248, 242, 229, 0.96);
  border: 1px solid rgba(35, 57, 93, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.wonder-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wonder-facts span {
  display: block;
  padding-left: 18px;
  position: relative;
}

.wonder-facts span::before {
  content: "\2605";
  position: absolute;
  left: 0;
  color: var(--gold-deep);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding:
    max(18px, calc(18px + env(safe-area-inset-top, 0px)))
    max(18px, calc(18px + env(safe-area-inset-right, 0px)))
    max(18px, calc(18px + env(safe-area-inset-bottom, 0px)))
    max(18px, calc(18px + env(safe-area-inset-left, 0px)));
  background: rgba(28, 42, 67, 0.34);
  backdrop-filter: blur(10px);
}

.overlay-card {
  width: min(760px, 100%);
  padding: 22px;
  border-radius: 32px;
}

.overlay-card-wide {
  width: min(1180px, 100%);
}

.onboarding-card {
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.onboarding-copy {
  display: grid;
  gap: 10px;
}

.lock-card {
  display: grid;
  gap: 16px;
}

.lock-card-top {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.field-label {
  font-weight: 800;
  color: var(--ink);
}

.parent-lockup {
  width: min(240px, 100%);
  height: auto;
  display: block;
}

.text-field {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(35, 57, 93, 0.12);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
}

.pin-shell {
  display: grid;
  gap: 14px;
}

.pin-error {
  min-height: 22px;
  color: var(--coral-deep);
}

.parent-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.parent-list {
  max-height: 360px;
  overflow: auto;
}

.parent-list-item,
.parent-check,
.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(250, 247, 240, 0.94);
}

.parent-list-item,
.parent-check span {
  flex: 1;
}

.parent-check span,
.toggle-row span {
  display: grid;
  gap: 4px;
}

.toggle-row input,
.parent-check input {
  accent-color: var(--gold-deep);
}

.progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(35, 57, 93, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  border-radius: inherit;
}

.modal-card-shell {
  width: min(640px, 100%);
  display: grid;
  gap: 16px;
}

.book-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.book-modal-cover {
  min-height: 220px;
}

.book-modal-panel {
  min-height: 100%;
}

.fact-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(250, 247, 240, 0.96);
}

.fact-copy {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--ink);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.memory-card {
  min-height: 100px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
}

.memory-card.is-matched {
  background: linear-gradient(135deg, #d2fbf5, var(--teal));
}

.status-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, calc(8px + env(safe-area-inset-bottom, 0px)));
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  min-width: 240px;
  max-width: calc(100% - 28px);
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 40;
}

.status-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-footer {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 242, 229, 0.96));
  box-shadow: var(--shadow);
  padding: 14px 18px;
}

.app-footer-inner,
.app-footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.app-footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-footer-logo {
  width: min(132px, 100%);
  height: auto;
  display: block;
}

.app-footer-copy {
  display: grid;
  gap: 2px;
}

.app-footer-copy strong,
.app-footer-copy p,
.app-footer-bottom span {
  margin: 0;
}

.app-footer-copy strong {
  font-size: 1rem;
}

.app-footer-copy p,
.app-footer-bottom span {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.app-footer-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.app-footer-links a,
.app-footer-parent {
  min-height: 44px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.app-footer-parent {
  cursor: pointer;
  font: inherit;
}

.app-footer-bottom {
  display: none;
}

.browser-panel {
  display: grid;
  gap: 18px;
}

.browser-panel-head {
  align-items: flex-start;
}

.browser-copy {
  display: grid;
  gap: 10px;
}

.browser-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.browser-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.browser-frame-shell {
  padding: 10px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(35, 57, 93, 0.08);
  background: rgba(250, 247, 240, 0.9);
}

.browser-frame-shell iframe {
  width: 100%;
  min-height: clamp(480px, 70vh, 960px);
  border: 0;
  border-radius: 22px;
  background: #ffffff;
  display: block;
}

/* Tablet landscape: collapse card internals and create/story layouts but keep hero
   and room grid intact so a 1024px screen keeps the side-by-side structure. */
@media (max-width: 1024px) {
  .create-layout,
  .story-layout,
  .feature-doorway,
  .book-modal-layout,
  .parent-grid {
    grid-template-columns: 1fr;
  }

  .launch-grid-small,
  .wonder-grid,
  .book-grid,
  .compact-resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-card-body {
    grid-template-columns: 1fr;
  }

  .room-card-media {
    justify-content: start;
  }
}

/* Tablet portrait: hero stacks, room grid stays 2 cols for a 2×2 card layout.
   Topbar stays 3-column — it fits at 768px without stacking. */
@media (max-width: 768px) {
  .page-shell {
    width: 100%;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }

  .home-hero,
  .room-hero {
    grid-template-columns: 1fr;
  }

  .section-head,
  .panel-head,
  .browser-panel-head,
  .parent-card-head,
  .parent-shell-head,
  .lock-card-top {
    flex-direction: column;
    align-items: stretch;
  }

  .parent-grid,
  .launch-grid-small,
  .compact-resource-grid,
  .wonder-grid,
  .book-grid {
    grid-template-columns: 1fr;
  }

  .teaching-guide {
    display: none;
  }

  .teaching-strip {
    max-width: 48%;
  }

  .room-card-thumb-shell {
    width: min(160px, 100%);
    height: 148px;
  }

  .browser-actions {
    justify-content: flex-start;
  }

  .hero-copy h1,
  .hero-copy-block h1 {
    max-width: 100%;
    font-size: clamp(2.6rem, 7vw, 4rem);
  }

  .lock-card-top {
    grid-template-columns: 1fr;
  }
}

/* Phone: topbar stacks, room grid and launch grid go single column,
   celebration banner wraps, room cards drop their min-height. */
@media (max-width: 560px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 24px;
  }

  .brand-logo {
    width: 118px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .top-chip {
    min-height: 38px;
    padding: 0 12px;
  }

  .top-chip-product {
    display: none;
  }

  .teaching-bar {
    min-height: 44px;
    padding: 7px 10px;
    border-radius: 20px;
  }

  .teaching-ribbon {
    gap: 8px;
  }

  .teaching-focus {
    font-size: 0.9rem;
  }

  .teaching-copy {
    font-size: 0.78rem;
  }

  .teaching-strip {
    max-width: 46%;
    gap: 3px;
  }

  .teaching-cell {
    width: 8px;
    height: 8px;
  }

  .teaching-cell.has-label {
    width: 18px;
    height: 18px;
    font-size: 0.54rem;
  }

  .room-grid,
  .launch-grid,
  .memory-grid {
    grid-template-columns: 1fr;
  }

  .room-card-top,
  .launch-card-top,
  .room-chrome,
  .modal-head,
  .celebration-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .room-card {
    min-height: 0;
  }

  .hero-copy h1,
  .hero-copy-block h1 {
    font-size: clamp(2.9rem, 12vw, 4.4rem);
  }

  .browser-actions .btn {
    width: 100%;
  }
}

/* Low reading mode — hides supporting text for early readers */
body.is-low-reading .launch-subtitle { display: none; }
body.is-low-reading .section-head p.panel-note { display: none; }
body.is-low-reading .room-card p { display: none; }
body.is-low-reading .room-card small { display: none; }
body.is-low-reading .book-card p { display: none; }
body.is-low-reading .card-tag { font-size: 1.1rem; font-weight: 800; }
body.is-low-reading .launch-icon { width: 52px; height: 52px; }
body.is-low-reading .hero-image-chip { font-size: 1.1rem; font-weight: 800; }
.wonder-card-img { border-radius: 18px 18px 0 0; overflow: hidden; height: 120px; }

/* ── End-of-day celebration banner ────────────────────────────────── */
.celebration-day-banner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ffeaa5, #ffd258 60%, #ffb5d3);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  margin-bottom: 8px;
}
.celebration-day-banner img { width: 80px; height: 80px; object-fit: contain; }
.celebration-day-banner p { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.confetti-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-burst span {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes confetti-fall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
  }
  .confetti-burst span { animation: confetti-fall 2.2s ease-in forwards; }
  .confetti-burst span:nth-child(1)  { left: 8%;  background: #ff6b6b; animation-delay: 0s; }
  .confetti-burst span:nth-child(2)  { left: 18%; background: #f7c74a; animation-delay: 0.15s; }
  .confetti-burst span:nth-child(3)  { left: 30%; background: #4ecdc4; animation-delay: 0.05s; }
  .confetti-burst span:nth-child(4)  { left: 44%; background: #88d8b0; animation-delay: 0.25s; }
  .confetti-burst span:nth-child(5)  { left: 57%; background: #fb8d74; animation-delay: 0.1s; }
  .confetti-burst span:nth-child(6)  { left: 68%; background: #7f95d1; animation-delay: 0.3s; }
  .confetti-burst span:nth-child(7)  { left: 79%; background: #ff6b6b; animation-delay: 0.2s; }
  .confetti-burst span:nth-child(8)  { left: 90%; background: #f7c74a; animation-delay: 0.08s; }
}

/* ── Streak greeting chip ──────────────────────────────────────────── */
.streak-greeting {
  background: linear-gradient(135deg, #ffeaa5, #ffd258);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 8px;
}

/* ── Accessibility: visible focus outlines ─────────────────────────── */
:focus-visible {
  outline: 3px solid #1fae9d;
  outline-offset: 2px;
}

/* ── Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
.wonder-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Countdown Creator ──────────────────────────────────────────────── */
.countdown-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(35, 57, 93, 0.12);
  background: white;
  color: var(--gold-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.countdown-btn:hover {
  transform: scale(1.1);
  background: var(--bg-soft);
}

.countdown-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 16px;
  border: 1px solid rgba(215, 156, 23, 0.16);
  background: rgba(255, 210, 88, 0.16);
}

.countdown-ribbon.is-empty {
  border-color: rgba(35, 57, 93, 0.08);
  background: rgba(255, 255, 255, 0.58);
}

.countdown-guide {
  flex: 0 0 auto;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.countdown-line {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.countdown-focus {
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
}

.countdown-copy {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.countdown-strip {
  flex: 0 1 auto;
  min-width: 86px;
  max-width: 38%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.tally-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}

.tally-group {
  display: flex;
  position: relative;
  width: 22px;
  height: 18px;
  align-items: center;
}

.tally-stick {
  width: 2px;
  height: 12px;
  background: var(--teaching-accent, var(--gold-deep));
  border-radius: 999px;
  margin: 0 1px;
}

.tally-group .tally-stick:nth-child(5) {
  position: absolute;
  height: 20px;
  transform: rotate(-70deg);
  left: 8px;
  top: -1px;
  width: 2.5px;
  background: var(--teaching-accent, var(--gold-deep));
  opacity: 0.9;
}

.countdown-empty {
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-style: italic;
}

.countdown-extra {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--ink-soft);
  opacity: 0.8;
}

@media (max-width: 768px) {
  .countdown-ribbon {
    gap: 8px;
  }

  .countdown-strip {
    max-width: 42%;
  }
}

@media (max-width: 560px) {
  .countdown-ribbon {
    padding: 6px;
  }

  .countdown-guide {
    display: none;
  }

  .countdown-focus {
    font-size: 0.84rem;
  }

  .countdown-copy {
    font-size: 0.72rem;
  }

  .countdown-strip {
    min-width: 68px;
    max-width: 40%;
  }

  .tally-strip {
    gap: 5px;
  }
}
