:root {
  color-scheme: light;
  --paper: #fffaf0;
  --ink: #271949;
  --muted: #594970;
  --purple: #542dc8;
  --light-line: #e8def1;
  --accent-strong: #361986;
  --accent-soft: #ece0ff;
  --soft-line: #d7c6f7;
  --accent-glyph: #fff5c3;
  --answer-paper: #f9f4ff;
  --math: #e3dcff;
  --coins: #ffebac;
  --pause: #cdf6e5;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

[data-palette="blue"] {
  --paper: #f4f6f5;
  --ink: #14201c;
  --muted: #3e4c46;
  --purple: #2147c1;
  --light-line: #d3dbd7;
  --accent-strong: #143395;
  --accent-soft: #dce5fc;
  --soft-line: #b6c8ee;
  --accent-glyph: #f2b33d;
  --answer-paper: #eef4fa;
  --math: #dce7ff;
  --coins: #ffebac;
  --pause: #e0ede7;
}

[data-palette="rose"] {
  --paper: #fff5f9;
  --ink: #351c31;
  --muted: #624453;
  --purple: #a02262;
  --light-line: #ead2dd;
  --accent-strong: #711541;
  --accent-soft: #f8dce9;
  --soft-line: #deadc4;
  --accent-glyph: #fff0cc;
  --answer-paper: #fff6fa;
  --math: #eadff8;
  --coins: #ffe5c9;
  --pause: #f7ddeb;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--paper); color: var(--ink); margin: 0; font-size: 1.125rem; line-height: 1.48; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; font: inherit; }
button:disabled { cursor: default; opacity: .53; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.shell { max-width: 1160px; width: calc(100% - 64px); min-width: 0; margin-inline: auto; }
.skip { position: absolute; z-index: 5; top: .8rem; left: .8rem; padding: .7rem; background: white; transform: translateY(-180%); }
.skip:focus { transform: none; }
.masthead { border-bottom: 1px solid var(--light-line); }
.masthead-inner { min-height: 70px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.brand { display: inline-flex; gap: .6rem; align-items: center; color: var(--ink); font-size: clamp(1.05rem,3vw,1.42rem); font-weight: 850; text-decoration: none; letter-spacing: -.055em; }
.brand-mark { display: grid; place-items: center; border-radius: 12px; background: var(--purple); color: var(--accent-glyph); width: 40px; height: 40px; font-size: 1.3rem; }
.parent-link { min-height: 44px; display: flex; align-items: center; font-size: .96rem; font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: .26em; }
.audience-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px clamp(8px,2vw,18px); min-width: 0; }
.child-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 5px 13px; border-radius: 13px; background: var(--purple); color: white; font-size: .96rem; font-weight: 800; text-decoration: none; }
.child-link:hover { background: var(--accent-strong); }
.story-nav-link { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 5px; font-size: .96rem; font-weight: 750; text-underline-offset: .26em; }
.library-stories { display: flex; width: fit-content; gap: .45rem; margin: 0 auto 18px; }
.button.story-book-link { display: flex; width: fit-content; gap: .45rem; margin: 20px auto 0; }
.parent-mark, .step-cue { display: none; }
.view { padding-block: clamp(25px, 4vw, 52px) 55px; }
.intro { text-align: center; margin-bottom: clamp(22px,4vw,42px); }
.eyebrow { color: var(--purple); font-size: .87rem; font-weight: 850; letter-spacing: .125em; text-transform: uppercase; }
h1 { margin-block: .2em .12em; font-weight: 900; letter-spacing: -.065em; line-height: 1.05; font-size: clamp(2.35rem,6.2vw,5.25rem); overflow-wrap: anywhere; }
h1 em { color: var(--purple); font-style: normal; }
.intro > p:not(.eyebrow) { margin-top: .9rem; color: var(--muted); }
.setup-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: clamp(8px,2.4vw,25px); max-width: 860px; margin-inline: auto; }
.age-card, .swatch { display: grid; min-width: 0; min-height: 106px; place-content: center; border: 3px solid transparent; border-radius: clamp(13px,3vw,26px); text-align: center; font-weight: 850; color: var(--ink); }
.age-card { min-height: clamp(116px,23vw,216px); background: #e8ddff; box-shadow: 0 5px 0 #cbb8ef; }
.age-card:nth-child(2) { background: #ffebac; box-shadow: 0 5px 0 #e7c86d; }
.age-card:nth-child(3) { background: #cdf6e5; box-shadow: 0 5px 0 #8ed3b7; }
.age-card span { font-size: clamp(2.85rem,9vw,5.6rem); line-height: 1; }
.age-card small { font-size: clamp(.85rem,2.5vw,1.25rem); }
.goal-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(10px,2vw,18px); max-width: 930px; margin-inline: auto; }
.goal-card { position: relative; display: grid; grid-template-rows: auto auto; justify-items: center; align-content: center; gap: 9px; min-height: 134px; padding: 18px 10px 12px; border: 2px solid var(--light-line); border-radius: 22px; background: #fff; color: var(--ink); font-size: clamp(.99rem,2.3vw,1.18rem); font-weight: 800; line-height: 1.16; }
.goal-card:hover, .goal-card:active { border-color: var(--purple); background: var(--accent-soft); }
.goal-icon { display: grid; place-items: center; min-width: 62px; min-height: 55px; border-radius: 13px; font-size: 2rem; background: var(--goal-paper); }
[data-goal="math"] { --goal-paper: #e8ddff; }
[data-goal="logic"] { --goal-paper: #cdf6e5; }
[data-goal="attention"] { --goal-paper: #ffebac; }
[data-goal="problems"] { --goal-paper: #f9d6dd; }
.goal-actions, .adult-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.goal-actions { justify-content: center; margin-top: 24px; }
.picture-option { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; width: fit-content; margin: 15px auto 0; padding: 5px 13px; border: 2px solid var(--light-line); border-radius: 12px; background: #fff; font-weight: 720; cursor: pointer; }
.picture-option input { width: 20px; height: 20px; accent-color: var(--purple); }
.swatch { place-content: stretch; grid-template-rows: 1fr auto; background: white; padding: clamp(3px,1vw,8px); border-color: var(--light-line); box-shadow: 0 5px 0 var(--accent-soft); }
.swatch-picture { position: relative; isolation: isolate; overflow: hidden; display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: clamp(9px,2vw,18px); background: var(--swatch); color: var(--swatch-ink); font-size: clamp(2.5rem,10vw,6.6rem); line-height: 1; }
.swatch-picture::before { content: ""; z-index: -1; position: absolute; width: 132%; height: 74%; left: -16%; bottom: -34%; border-radius: 50%; background: var(--swatch-ground); border-top: 5px solid var(--swatch-ink); opacity: .8; }
[data-choose-palette="original"] { --swatch: #7844d0; --swatch-ground: #9c76e8; --swatch-ink: #fff5c3; }
[data-choose-palette="blue"] { --swatch: #2147c1; --swatch-ground: #5980e3; --swatch-ink: #fff1b6; }
[data-choose-palette="rose"] { --swatch: #c53b83; --swatch-ground: #ee7bac; --swatch-ink: #fff1df; }
.swatch[aria-pressed="true"] { border-color: var(--purple); }
.age-card:hover, .swatch:hover { border-color: var(--purple); }
.color-word { padding-block: 4px 2px; font-size: clamp(.75rem,2vw,1.15rem); }
.age-back { display: flex !important; width: fit-content; margin: 24px auto 0; }
.icon-control { gap: .47em; }
.icon-control > span:first-child { font-size: 1.4em; line-height: 1; }
.no-hero { color: #861633; background: #ffe4e9; border-color: #eab3c0; }
.no-hero > span:first-child { font-size: 1.8em; }
.no-hero:hover { background: #fbd3de; }
.hero-cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: clamp(12px,2vw,23px); }
.hero-card { width: 100%; padding: 8px; border: 2px solid transparent; border-radius: 24px; color: var(--ink); background: var(--hero-color); font-weight: 850; font-size: clamp(1rem, 2.4vw, 1.38rem); box-shadow: 0 4px 0 var(--hero-shadow); }
.hero-card img { width: 100%; height: auto; display: block; border-radius: 16px; aspect-ratio: 1.12; object-fit: cover; background: var(--hero-color); }
.hero-card .hero-name { display: block; padding-block: 9px 5px; }
.hero-card[aria-pressed="true"] { border-color: var(--purple); box-shadow: 0 4px 0 var(--purple); }
.hero-card[aria-pressed="true"] .hero-name::after { content: " ✓"; }
[data-hero="panda"] { --hero-color: #efdbff; --hero-shadow: #cdb3ed; }
[data-hero="rabbit"] { --hero-color: #ffdea8; --hero-shadow: #e9b468; }
[data-hero="penguin"] { --hero-color: #ccecff; --hero-shadow: #9dccec; }
[data-hero="bear"] { --hero-color: #f9d6dd; --hero-shadow: #e0a7b3; }
.hero-actions, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-block: 25px 0; }
.hero-actions { justify-content: center; }
.button { min-height: 50px; display: inline-flex; justify-content: center; align-items: center; text-align: center; padding: 10px 19px; border-radius: 15px; border: 2px solid transparent; font-weight: 790; line-height: 1.23; text-decoration: none; }
.primary { background: var(--purple); color: white; box-shadow: 0 3px 0 var(--accent-strong); }
.primary:not(:disabled):hover { background: var(--accent-strong); }
.quiet { background: transparent; color: var(--purple); border-color: var(--soft-line); }
.quiet:not(:disabled):hover { background: var(--accent-soft); }
.companion { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 50px; color: var(--muted); font-weight: 680; }
.companion img { width: 48px; height: 48px; object-fit: cover; border-radius: 50%; border: 2px solid #d5c0fa; }
.lesson-cards { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
[data-theme="math"] { --theme: var(--math); }
[data-theme="coins"] { --theme: var(--coins); }
[data-theme="pause"] { --theme: var(--pause); }
.lesson { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 13px; background: var(--theme); padding: 15px; border: 2px solid transparent; border-radius: 23px; text-decoration: none; }
.lesson:hover { border-color: var(--purple); }
.lesson h2 { font-size: clamp(1.15rem, 2.45vw, 1.8rem); margin: 0; line-height: 1.09; letter-spacing: -.03em; }
.lesson-picture { grid-column: 1/-1; display: grid; place-items: center; min-height: 120px; aspect-ratio: 1.55; border-radius: 18px; background: #ffffff9e; font-size: clamp(3.55rem,9vw,6.7rem); font-weight: 900; }
.lesson-play { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--purple); color: white; }
.lesson-recommendation { position: absolute; inset: 21px 21px auto auto; display: grid; place-items: center; width: 31px; aspect-ratio: 1; border-radius: 50%; border: 2px solid #795000; color: #633d00; background: #ffe189; font-size: 1.15rem; line-height: 1; }
.lesson-cards:has(.lesson:only-child) { grid-template-columns: minmax(0, 390px); justify-content: center; }
.glyph { display: grid; place-items: center; min-width: 56px; width: fit-content; padding-inline: 8px; height: 54px; border-radius: 17px; color: var(--ink); background: #fffdf6; font-weight: 900; font-size: 2rem; }
.activity-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-block: 16px 0; padding: 8px 12px; border: 2px solid var(--light-line); border-radius: 16px; background: #fff; }
.progress-steps { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.progress-step { display: grid; width: 44px; height: 44px; place-items: center; border: 2px solid var(--light-line); border-radius: 12px; color: var(--muted); font: 800 1.65rem/1 system-ui, sans-serif; }
.progress-step[data-state="done"] { border-color: #9dc9ac; color: #155734; background: #dcf4e7; }
.progress-step[data-state="current"] { border-color: var(--purple); color: var(--accent-strong); background: var(--accent-soft); }
.progress-status { color: var(--muted); font-size: .95rem; font-weight: 720; }
#activity[data-picture-game] .activity-progress { justify-content: center; }
#activity[data-picture-game] .activity-progress:has(.progress-steps:empty) { display: none; }
#activity[data-puzzle-game] .activity-progress { display: none; }
.reading-layout { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.5fr); gap: 18px; margin-top: 16px; align-items: start; }
.chapter, .story-panel { border-radius: 25px; padding: clamp(18px, 3.2vw, 36px); }
.chapter { background: var(--theme, #e8ddff); }
.chapter-picture img { width: min(100%, 260px); height: auto; display: block; aspect-ratio: 1.2; object-fit: cover; border-radius: 17px; }
.chapter h1, .adult h1 { font-size: clamp(1.85rem, 4.1vw, 3.48rem); margin-block: .5em .22em; }
.story-panel { border: 1px solid var(--light-line); background: #fff; box-shadow: 0 6px 0 var(--accent-soft); }
.story-panel h2 { font-size: clamp(1.46rem, 3.7vw, 2.65rem); line-height: 1.16; letter-spacing: -.042em; margin-block: .33em .6em; }
.story-panel p { margin-block: .3em .6em; }
.story-text { font-size: clamp(1.12rem, 2.5vw, 1.42rem); }
.answers { display: grid; gap: 10px; }
.answer { min-height: 53px; width: 100%; text-align: left; padding: 11px 15px; color: var(--ink); border: 2px solid var(--light-line); background: var(--answer-paper); border-radius: 14px; font-weight: 720; font-size: clamp(1rem, 2.2vw, 1.2rem); }
.answer:hover, .answer[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--purple); }
.feedback { background: #dcf4e7; color: #1d5a40; border-radius: 14px; padding: 11px 15px; font-weight: 640; }
.feedback[data-retry="true"] { background: #fff1d2; color: #70401b; }
#activity[data-counting-lesson] .reading-layout { grid-template-columns: minmax(0, 1fr); max-width: 860px; margin-inline: auto; }
#activity[data-counting-lesson] .chapter { padding: .5rem 1rem; }
#activity[data-counting-lesson] .chapter h1 { margin: 0; font-size: clamp(1.15rem, 3vw, 1.65rem); }
#activity[data-counting-lesson] .chapter-picture { display: none; }
#activity[data-counting-lesson] .story-panel h2 { margin: 0 0 .4rem; }
.counting-scene { display: flex; flex-wrap: wrap; justify-content: center; gap: .65rem; margin-block: 1rem; padding: .75rem; border-radius: 1rem; background: #dcefe9; }
.counting-group { display: flex; flex: 0 1 auto; justify-content: center; align-items: center; gap: .22rem; padding: .4rem; }
.counting-scene[data-surface="mat"] .counting-group { border: 2px solid #d38b4e; border-radius: .7rem; background: #ffd5a9; }
.counting-scene[data-surface="plate"] .counting-group { border: 2px solid #66958d; border-radius: 50%; background: #fffef9; box-shadow: inset 0 0 0 4px #e2eeea; }
.counting-scene[data-surface="tray"] .counting-group { border: 2px solid #b2a1cf; border-radius: .65rem; background: #f9f0ff; }
.counting-object { display: block; width: clamp(32px, 6vw, 54px); height: auto; aspect-ratio: 1; object-fit: contain; }
.counting-group .counting-object:is(span) { width: clamp(20px, 4vw, 29px); box-sizing: border-box; border: 2px solid #693c9a; border-radius: 50%; background: #b97de8; box-shadow: inset 0 0 0 3px #d5a5f2; }
.number-answers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.number-answers .answer { min-height: 64px; text-align: center; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1; }
.sequence { border-radius: 13px; background: #fff1ca; margin-block: 12px 0; padding: 10px 15px 10px 40px; font-weight: 700; }
.sequence li { padding: 5px 0; }
.adult { max-width: 720px; margin-inline: auto; }
.adult .story-panel { margin-top: 14px; }
.adult li { margin-bottom: .35em; }
.parent-goal-settings { margin-top: 14px; padding: 8px 14px; border-radius: 16px; background: white; border: 1px solid var(--light-line); }
.parent-goal-settings summary { min-height: 44px; align-content: center; cursor: pointer; font-weight: 750; }
.parent-goal-settings fieldset { display: grid; margin-block: 4px 8px; border: 0; padding: 0; }
.parent-goal-settings label { display: flex; gap: 9px; align-items: center; min-height: 44px; }
.parent-goal-settings input { width: 20px; height: 20px; accent-color: var(--purple); }
.finish { font-size: 1.15rem; }
.finish-star { text-align: center; color: #a9680d; font-size: clamp(5rem,20vw,9rem); line-height: 1.15; }
.finish-heading { text-align: center; }
.picture-actions { justify-content: center; }
.picture-actions .button { font-size: 1.65rem; }
[data-child-pictures] :is(.brand-word, .parent-word, .color-word, .hero-name, .lesson-name, .control-word, #library-companion span) { display: none; }
[data-child-pictures] :is(#colors-title, #heroes-title, #library-title, #activity-title, .finish-heading),
#activity[data-picture-game] .progress-status { position: absolute; width: 1px; min-width: 0; height: 1px; margin: -1px; padding: 0; overflow: hidden; white-space: nowrap; border: 0; clip-path: inset(50%); }
[data-child-pictures] .parent-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft); font-size: 1.25rem; }
[data-child-pictures] .step-cue { display: grid; place-items: center; width: 59px; height: 59px; margin-inline: auto; border-radius: 19px; background: var(--accent-soft); font-size: 1.95rem; }
[data-child-pictures] .companion { margin-top: 10px; }
[data-child-pictures] .hero-card { padding: clamp(4px,1vw,8px); }
[data-child-pictures] .lesson-play { grid-column: 1/-1; justify-self: center; }
[data-child-pictures] .reading-layout { grid-template-columns: minmax(0,1fr); }
[data-child-pictures] .chapter { display: flex; align-items: center; gap: 14px; padding: 12px; }
[data-child-pictures] .chapter-picture img { width: 60px; }
[data-child-pictures] .chapter h1 { font-size: 1.12rem; margin: 0; }
#activity[data-focus-game] .reading-layout { grid-template-columns: minmax(0, 1fr); max-width: 820px; margin-inline: auto; }
#activity[data-focus-game] .story-panel { min-width: 0; }
#activity[data-focus-game] .chapter { display: block; padding: .5rem 1rem; }
#activity[data-focus-game] .chapter h1 { margin: 0; font-size: clamp(1.15rem, 3vw, 1.75rem); }
#activity[data-focus-game] .chapter-picture { display: none; }
@media (min-width: 741px) and (max-width: 1024px) {
  .shell { width: calc(100% - 40px); }
  .view { padding-top: 22px; }
  .reading-layout { grid-template-columns: minmax(0, 1fr); }
  .chapter { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
  .chapter-picture img { width: 58px; }
  .chapter h1 { margin: 0; font-size: 1.55rem; }
}
@media (max-width: 900px) {
  .goal-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (orientation: portrait) and (max-width: 1024px) {
  #age .intro { margin-bottom: 22px; }
  #age .age-card { min-height: clamp(94px, 17vw, 154px); }
  #age .age-card span { font-size: clamp(2.7rem, 7.3vw, 4.65rem); }
  #age .adventure-featured { margin-top: 24px; }
}
@media (max-width: 740px) {
  .shell { width: calc(100% - 32px); }
  .lesson-cards { grid-template-columns: 1fr; }
  .lesson { min-height: auto; }
  .lesson-picture { aspect-ratio: 1.85; }
  .reading-layout { grid-template-columns: 1fr; }
  .chapter { display: grid; grid-template-columns: 75px minmax(0,1fr); align-items: center; gap: 5px 13px; padding: 14px; }
  .chapter-picture img { border-radius: 11px; }
  .chapter h1 { margin: 0; font-size: 1.52rem; }
}
@media (max-width: 560px) {
  .hero-cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .intro { margin-bottom: 20px; }
  .hero-card { border-radius: 18px; }
  .hero-card img { border-radius: 11px; }
  .masthead-inner { min-height: 59px; }
}
@media (max-width: 390px) {
  .masthead .brand-word { display: none; }
  .child-link { padding-inline: 9px; }
}
@media (max-width: 350px) {
  .audience-nav { gap: 6px; }
  .audience-nav a { font-size: .86rem; }
  .child-link span { display: none; }
  .story-nav-link { padding-inline: 3px; }
}
