:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  --ink: #294f4b;
  --muted: #69817c;
  --paper: #fffdf7;
  --line: #ddd5b9;
  --green: #62b78a;
  --green-dark: #34775e;
  --gold: #f3bd4c;
  --coral: #ef7468;
  --blue: #62acd6;
  --purple: #8b73bd;
  --shadow: 0 18px 44px rgba(62, 83, 75, .14);
  --soft-shadow: 0 9px 23px rgba(62, 83, 75, .1);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #f3f9ed; }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: clip; color: var(--ink); background: radial-gradient(circle at 7% 9%, rgba(245,195,78,.2) 0 118px, transparent 120px), radial-gradient(circle at 94% 8%, rgba(98,172,214,.18) 0 152px, transparent 154px), linear-gradient(145deg, #f3f9ed 0%, #fffaf1 53%, #f2effc 100%); }
body::before { position: fixed; inset: 0; z-index: -1; opacity: .14; background-image: radial-gradient(#6f9186 1px, transparent 1px); background-size: 26px 26px; content: ''; pointer-events: none; }
button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible { outline: 4px solid rgba(241,185,67,.72); outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }

.app { width: min(1120px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; padding: 22px 0 50px; }
.loading-card { display: grid; width: min(410px,100%); min-height: 250px; margin: 20vh auto 0; place-items: center; align-content: center; gap: 10px; text-align: center; background: var(--paper); border: 3px solid var(--line); border-radius: 37px; box-shadow: var(--shadow); }
.loading-card span { font-size: 64px; animation: float 1.3s ease-in-out infinite alternate; }
.loading-card p { margin: 0; font-size: 19px; font-weight: 900; }

.topbar, .topbar-actions, .brand, .collection-button, .sound-button, .section-heading, .level-top, .level-footer, .game-heading, .mission-strip, .board-label, .feedback-card, .result-actions, .result-stats { display: flex; align-items: center; }
.topbar { position: relative; z-index: 30; min-height: 66px; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand { min-width: 0; gap: 12px; padding: 0; text-align: left; background: none; border: 0; }
.brand-mark { display: grid; flex: 0 0 auto; width: 56px; height: 56px; place-items: center; font-size: 29px; background: #fff6cd; border: 3px solid #dfd2a8; border-radius: 19px; box-shadow: 0 7px 16px rgba(67,87,78,.12); transform: rotate(-4deg); }
.brand strong, .brand small, .collection-button strong, .collection-button small { display: block; }
.brand strong { overflow: hidden; font-size: 25px; font-weight: 1000; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.topbar-actions { flex: 0 0 auto; gap: 8px; }
.top-spark { color: var(--gold); font-size: 27px; animation: twinkle 2s ease-in-out infinite; }
.collection-button, .sound-button, .back-button { min-height: 49px; color: var(--ink); font-weight: 900; background: rgba(255,253,247,.94); border: 2px solid var(--line); border-radius: 17px; box-shadow: 0 7px 16px rgba(65,83,76,.08); }
.collection-button { gap: 8px; padding: 5px 12px; text-align: left; }
.collection-button > span:first-child { font-size: 21px; }
.collection-button strong { font-size: 12px; line-height: 1.05; }
.collection-button small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.sound-button { gap: 8px; padding: 0 14px; font-size: 12px; }
.sound-button > span:first-child { font-size: 18px; }
.back-button { width: 49px; padding: 0 0 3px; font-size: 23px; }

.eyebrow { margin: 0 0 8px; color: #397b62; font-family: Georgia, serif; font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.primary-button, .secondary-button, .hint-button { display: inline-flex; min-height: 53px; align-items: center; justify-content: center; gap: 8px; padding: 0 21px; font-weight: 1000; border-radius: 17px; transition: transform 150ms ease, box-shadow 150ms ease; }
.primary-button { color: #fff; background: #3e9875; border: 0; box-shadow: 0 8px 0 #2f785e, 0 16px 27px rgba(49,122,94,.2); }
.secondary-button { color: var(--ink); background: #fffdf6; border: 2px solid #d7d2b9; box-shadow: 0 6px 0 #ddd7c4; }
.secondary-button.compact { min-height: 46px; padding-inline: 15px; font-size: 12px; box-shadow: 0 5px 0 #ddd7c4; }
.hint-button { min-height: 48px; color: #715418; background: #fff3c5; border: 2px solid #e7bd50; box-shadow: 0 5px 0 #d8aa39; }
.primary-button:not(:disabled):hover, .secondary-button:not(:disabled):hover, .hint-button:not(:disabled):hover, .collection-button:not(:disabled):hover, .sound-button:not(:disabled):hover { transform: translateY(-2px); }
.primary-button:not(:disabled):active, .secondary-button:not(:disabled):active, .hint-button:not(:disabled):active { transform: translateY(3px); box-shadow: none; }

.hero { position: relative; display: grid; min-height: 408px; grid-template-columns: minmax(0,1fr) minmax(400px,.96fr); align-items: center; gap: 38px; overflow: hidden; padding: 48px 51px; background: radial-gradient(circle at 95% 4%,rgba(101,172,214,.2) 0 105px,transparent 107px), radial-gradient(circle at 68% -10%,rgba(245,190,70,.2) 0 115px,transparent 117px), linear-gradient(120deg,#fffaf0,#f3f0fd 68%,#ebf8ef); border: 3px solid #ded6ba; border-radius: 40px; box-shadow: var(--shadow); }
.hero::after { position: absolute; right: -45px; bottom: -75px; width: 195px; height: 195px; background: rgba(99,184,139,.15); border-radius: 50%; content: ''; }
.hero-copy { position: relative; z-index: 3; }
.hero h1 { margin: 0 0 16px; font-size: clamp(47px,5.2vw,69px); font-weight: 1000; line-height: .96; letter-spacing: -.045em; }
.hero-copy > p:not(.eyebrow) { max-width: 540px; margin-bottom: 25px; color: var(--muted); font-size: 17px; font-weight: 700; line-height: 1.5; }
.hero-scene { position: relative; z-index: 2; min-height: 300px; }
.hero-sheet { position: absolute; inset: 5px 17px 9px; overflow: hidden; background: #fffdfa; border: 6px solid #fff; border-radius: 32px; box-shadow: 0 21px 31px rgba(60,82,75,.17); transform: rotate(2deg); }
.hero-sheet::before { position: absolute; inset: 0; opacity: .34; background-image: radial-gradient(#8fb1a1 1px,transparent 1px); background-size: 18px 18px; content: ''; }
.hero-sheet svg { position: absolute; left: 50%; top: 48%; width: 220px; height: 250px; transform: translate(-50%,-50%); }
.hero-guide { fill: none; stroke: #cbc8bd; stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 34; }
.hero-ink { fill: none; stroke: #f39a45; stroke-width: 25; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 470; stroke-dashoffset: 160; }
.hero-start { fill: #62b78a; stroke: #fff; stroke-width: 7; animation: markerPulse 1.2s ease-in-out infinite alternate; }
.hero-pencil { position: absolute; z-index: 3; right: 39px; bottom: 52px; font-size: 52px; filter: drop-shadow(0 7px 5px rgba(55,75,69,.18)); transform: rotate(-30deg); }
.hero-caption { position: absolute; z-index: 4; right: 22px; bottom: 16px; padding: 8px 13px; color: #fff; font-size: 11px; font-weight: 900; background: #477e71; border-radius: 13px; }
.sheet-line { position: absolute; right: 0; left: 0; height: 2px; background: rgba(98,172,214,.2); }
.sheet-line.one { top: 37%; }
.sheet-line.two { top: 74%; }

.how-section, .levels-section, .collection-section { margin-top: 54px; scroll-margin-top: 22px; }
.section-heading { justify-content: space-between; gap: 25px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 39px; font-weight: 1000; line-height: 1; letter-spacing: -.035em; }
.section-heading > p { max-width: 410px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.45; text-align: right; }
.steps-grid, .levels-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.step-card { display: flex; min-width: 0; min-height: 130px; align-items: center; gap: 16px; padding: 23px; background: rgba(255,253,247,.92); border: 2px solid var(--line); border-radius: 29px; box-shadow: var(--soft-shadow); }
.step-number { display: grid; flex: 0 0 auto; width: 62px; height: 62px; place-items: center; padding-bottom: 3px; color: #fff; font-family: Georgia,serif; font-size: 27px; font-weight: 900; background: #66b98e; border: 8px solid #dcf1e5; border-radius: 50%; }
.step-card:nth-child(2) .step-number { background: #f3b944; border-color: #fff0c7; }
.step-card:nth-child(3) .step-number { background: #ed756b; border-color: #fde2df; }
.step-card strong, .step-card small { display: block; }
.step-card strong { margin-bottom: 7px; font-size: 18px; font-weight: 1000; }
.step-card small { color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.45; }

.level-card { min-width: 0; min-height: 345px; padding: 22px; text-align: left; background: rgba(255,253,247,.96); border: 3px solid color-mix(in srgb,var(--accent) 35%,#ddd2b4); border-radius: 31px; box-shadow: var(--soft-shadow); transition: transform 170ms ease,box-shadow 170ms ease; }
.level-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.level-top { justify-content: space-between; gap: 10px; }
.level-icon { display: grid; width: 50px; height: 50px; place-items: center; font-size: 25px; background: color-mix(in srgb,var(--accent) 22%,#fff); border-radius: 17px; }
.level-best { color: #d69f2b; font-size: 12px; font-weight: 1000; }
.level-preview { display: flex; justify-content: center; margin: 25px 0 21px; }
.level-preview i { display: grid; width: 52px; height: 62px; place-items: center; margin-left: -6px; color: #fff; font-size: 25px; font-style: normal; font-weight: 1000; background: var(--preview-color); border: 4px solid rgba(255,255,255,.67); border-radius: 18px; box-shadow: 0 6px 0 color-mix(in srgb,var(--preview-color) 66%,#355b54); }
.level-preview i:first-child { margin-left: 0; }
.level-copy, .level-copy small, .level-copy strong, .level-copy > span { display: block; }
.level-copy small { color: color-mix(in srgb,var(--accent) 72%,#345d56); font-family: Georgia,serif; font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.level-copy strong { margin: 7px 0 8px; font-size: 27px; font-weight: 1000; line-height: 1.05; }
.level-copy > span { min-height: 42px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.45; }
.level-footer { justify-content: space-between; gap: 9px; margin-top: 16px; padding-top: 15px; font-size: 12px; border-top: 2px dashed #ded8c5; }
.level-footer span { color: var(--muted); font-weight: 900; }
.level-footer b { color: color-mix(in srgb,var(--accent) 76%,#24594e); }

.collection-section { padding: 30px; background: rgba(255,253,248,.78); border: 3px solid #ded6ba; border-radius: 37px; box-shadow: var(--shadow); }
.collection-grid { display: grid; grid-template-columns: repeat(11,minmax(0,1fr)); gap: 8px; }
.collection-tile { position: relative; display: flex; min-width: 0; min-height: 91px; align-items: baseline; justify-content: center; padding-top: 27px; color: #a8aeaa; background: #f3f1ed; border: 2px dashed #cbc8bd; border-radius: 19px; }
.collection-tile > small { position: absolute; top: 6px; left: 7px; display: grid; width: 19px; height: 19px; place-items: center; padding-bottom: 1px; color: #7d827d; font-family: Georgia,serif; font-size: 9px; font-weight: 900; background: #fff; border: 1px solid #d4d0c6; border-radius: 50%; }
.collection-tile strong { font-size: 34px; line-height: 1; }
.collection-tile i { margin-left: 2px; font-size: 15px; font-style: normal; font-weight: 1000; }
.collection-tile.learned { color: #fff; background: var(--tile-color); border: 3px solid rgba(255,255,255,.63); box-shadow: 0 6px 0 var(--tile-dark),0 12px 14px rgba(54,75,68,.11); }
.parent-tip { display: flex; align-items: center; gap: 17px; margin-top: 22px; padding: 18px 24px; background: rgba(222,242,228,.92); border: 2px solid #b7d7c2; border-radius: 24px; }
.parent-tip > span { font-size: 28px; }
.parent-tip p { margin: 0; color: #507169; font-size: 13px; font-weight: 700; line-height: 1.5; }

.game-shell { padding: 26px; background: rgba(255,253,247,.8); border: 3px solid #ded6ba; border-radius: 37px; box-shadow: var(--shadow); }
.game-heading { justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.game-heading h1 { margin: 0 0 6px; font-size: 41px; font-weight: 1000; line-height: 1; letter-spacing: -.035em; }
.game-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: 13px; font-weight: 900; }
.round-badge { display: grid; flex: 0 0 auto; width: 75px; height: 75px; place-items: center; align-content: center; color: #fff; background: var(--level-accent); border: 8px solid color-mix(in srgb,var(--level-accent) 25%,#fff); border-radius: 50%; }
.round-badge strong { font-family: Georgia,serif; font-size: 25px; line-height: .9; }
.round-badge span { font-size: 9px; font-weight: 900; }
.mission-strip { justify-content: space-between; gap: 15px; margin-bottom: 16px; padding: 12px 16px; background: #f2f0e9; border-radius: 18px; }
.mission-strip > span { color: var(--muted); font-size: 11px; font-weight: 900; }
.progress-dots { display: flex; flex: 1 1 auto; gap: 6px; }
.progress-dot { width: 100%; max-width: 52px; height: 9px; background: #d9d6cd; border-radius: 20px; }
.progress-dot.done { background: #65b78b; }
.progress-dot.current { background: var(--level-accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--level-accent) 18%,transparent); }

.trace-layout { display: grid; grid-template-columns: minmax(0,1fr) 285px; gap: 17px; }
.trace-board-card { position: relative; min-width: 0; padding: 17px; background: #fffefa; border: 3px solid color-mix(in srgb,var(--letter-color) 32%,#ddd3b9); border-radius: 32px; transition: box-shadow 180ms ease,transform 180ms ease; }
.board-label { justify-content: space-between; gap: 10px; margin-bottom: 10px; padding-inline: 5px; color: var(--muted); font-size: 11px; font-weight: 900; }
.board-label b { color: color-mix(in srgb,var(--letter-color) 70%,#345b54); }
.board-label i { font-style: normal; }
.trace-svg { display: block; width: min(100%,510px); aspect-ratio: 8 / 9; margin: 0 auto; overflow: visible; touch-action: none; user-select: none; background: #fffdf7; border: 3px solid #e1dccb; border-radius: 26px; box-shadow: inset 0 0 24px rgba(74,94,86,.05); }
.writing-line { fill: none; stroke: #7ab5d3; stroke-width: 2; stroke-dasharray: 8 8; opacity: .24; }
.guide-path, .trace-path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.guide-path { stroke: #cbc9c0; stroke-width: 20; stroke-dasharray: 1 32; }
.stroke-group.future .guide-path { opacity: .38; }
.stroke-group.completed .guide-path { stroke: #c7dfcf; opacity: .75; }
.stroke-group.current .guide-path { stroke: #e0c46f; opacity: .96; }
.trace-path { stroke: var(--letter-color); stroke-width: 27; }
.stroke-group.future .trace-path { opacity: 0; }
.stroke-group.completed .trace-path { stroke: #62b78a; }
.start-ring { fill: rgba(98,183,138,.22); stroke: #62b78a; stroke-width: 3; animation: markerPulse .8s ease-in-out infinite alternate; }
.start-marker { fill: #4cae79; stroke: #fff; stroke-width: 5; }
.start-number { fill: #fff; font-family: Georgia,serif; font-size: 11px; font-weight: 900; pointer-events: none; }
.end-marker { fill: #fffdf7; stroke: #d6bd68; stroke-width: 4; }
.trace-board-card.drawing { box-shadow: 0 0 0 5px rgba(98,183,138,.18),var(--soft-shadow); }
.trace-board-card.wrong-start { animation: wrongShake .42s ease; }
.trace-board-card.hinting .stroke-group.current .guide-path { stroke: #f4b938; animation: dashMove .45s linear infinite; }
.trace-board-card.hinting .start-ring { fill: rgba(244,185,56,.32); stroke: #f4b938; transform-origin: center; animation: markerHint .55s ease-in-out infinite alternate; }
.trace-board-card.letter-complete { box-shadow: 0 0 0 6px rgba(98,183,138,.22),0 20px 38px rgba(61,111,84,.18); animation: completeBoard .65s ease; }
.trace-board-card.letter-complete .trace-path { stroke: #62b78a; }
.trace-board-card.letter-complete .guide-path { opacity: 0; }

.trace-tools { min-width: 0; padding: 24px 19px; text-align: center; background: color-mix(in srgb,var(--letter-color) 11%,#fff); border: 3px solid color-mix(in srgb,var(--letter-color) 30%,#ddd3ba); border-radius: 31px; }
.letter-sample { display: flex; width: 145px; height: 152px; align-items: baseline; justify-content: center; margin: 10px auto 19px; padding-top: 28px; color: #fff; background: var(--letter-color); border: 8px solid rgba(255,255,255,.58); border-radius: 42px 55px 40px 51px; box-shadow: 0 11px 0 var(--letter-dark),0 20px 24px rgba(52,76,69,.14); transform: rotate(-2deg); }
.letter-sample strong { font-size: 79px; line-height: 1; }
.letter-sample small { margin-left: 3px; font-size: 29px; font-weight: 1000; }
.letter-sample.celebrate { animation: celebrate .65s ease both; }
.tool-note { margin-bottom: 17px; color: var(--muted); font-size: 12px; font-weight: 800; line-height: 1.45; }
.stroke-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-bottom: 16px; }
.stroke-chip { display: flex; min-width: 0; align-items: center; gap: 5px; padding: 6px; color: #7a847f; background: rgba(255,255,255,.65); border: 2px solid #ddd8c8; border-radius: 13px; }
.stroke-chip b { display: grid; flex: 0 0 auto; width: 25px; height: 25px; place-items: center; padding-bottom: 1px; color: #fff; font-family: Georgia,serif; font-size: 12px; background: #b9b8b2; border-radius: 50%; }
.stroke-chip small { overflow: hidden; font-size: 9px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.stroke-chip.current { color: #725719; background: #fff4c9; border-color: #e9c35b; }
.stroke-chip.current b { background: #e8ae34; }
.stroke-chip.done { color: #34775e; background: #e8f6ed; border-color: #a8d2b6; }
.stroke-chip.done b { background: #58ad7d; }
.trace-tools button { width: 100%; margin-top: 10px; }
.trace-tools.complete { display: grid; align-content: center; }
.trace-tools .next-letter { margin-top: 12px; }

.feedback-card { min-height: 79px; gap: 13px; margin-top: 15px; padding: 13px 17px; background: #edf6f0; border: 2px solid #bfd9c8; border-radius: 24px; }
.feedback-card > span { flex: 0 0 auto; font-size: 29px; }
.feedback-card p { flex: 1 1 auto; margin: 0; }
.feedback-card strong, .feedback-card small { display: block; }
.feedback-card strong { margin-bottom: 4px; font-size: 16px; }
.feedback-card small { color: var(--muted); font-size: 12px; font-weight: 800; }
.feedback-card.wrong { background: #fff0ed; border-color: #f3b8b1; }
.feedback-card.hint { background: #fff8d9; border-color: #ead28b; }
.feedback-card.drawing { background: #eaf4ff; border-color: #add0e5; }
.feedback-card.stroke, .feedback-card.correct { background: #e8f7ed; border-color: #9ed0b0; }

.result-card { position: relative; overflow: hidden; padding: 44px 34px; text-align: center; background: rgba(255,253,247,.96); border: 3px solid #ded6ba; border-radius: 39px; box-shadow: var(--shadow); }
.result-icon { display: grid; width: 86px; height: 86px; margin: 0 auto 15px; place-items: center; font-size: 49px; background: color-mix(in srgb,var(--level-accent) 23%,#fff); border: 4px solid color-mix(in srgb,var(--level-accent) 42%,#fff); border-radius: 29px; animation: pop .55s ease both; }
.result-card h1 { margin: 0 0 9px; font-size: 52px; font-weight: 1000; line-height: 1; letter-spacing: -.04em; }
.result-lead { max-width: 600px; margin: 0 auto 12px; color: var(--muted); font-size: 15px; font-weight: 800; line-height: 1.45; }
.result-stars { color: #f0b83e; font-size: 37px; letter-spacing: 5px; }
.result-stars span { color: #d9d6cb; }
.result-letters { display: grid; max-width: 880px; grid-template-columns: repeat(11,minmax(0,1fr)); gap: 8px; margin: 24px auto; }
.result-letters > span { display: flex; min-width: 0; height: 82px; align-items: baseline; justify-content: center; padding-top: 20px; color: #fff; background: var(--result-color); border: 4px solid rgba(255,255,255,.65); border-radius: 19px; box-shadow: 0 6px 0 color-mix(in srgb,var(--result-color) 66%,#355b54); animation: pop .45s var(--delay) ease both; }
.result-letters strong { font-size: 31px; line-height: 1; }
.result-letters small { margin-left: 2px; font-size: 14px; font-weight: 1000; }
.result-stats { max-width: 650px; justify-content: center; margin: 0 auto 27px; overflow: hidden; background: #f3f1e9; border-radius: 22px; }
.result-stats > span { flex: 1 1 0; padding: 14px 8px; border-right: 2px solid #ded9ca; }
.result-stats > span:last-child { border-right: 0; }
.result-stats strong, .result-stats small { display: block; }
.result-stats strong { font-size: 21px; }
.result-stats small { color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.result-actions { justify-content: center; gap: 13px; }
.result-confetti i { position: absolute; color: var(--level-accent); font-size: 26px; font-style: normal; font-weight: 1000; opacity: .35; }
.result-confetti i:nth-child(1) { top: 10%; left: 9%; transform: rotate(-12deg); }
.result-confetti i:nth-child(2) { top: 18%; right: 10%; transform: rotate(15deg); }
.result-confetti i:nth-child(3) { bottom: 13%; left: 12%; transform: rotate(8deg); }
.result-confetti i:nth-child(4) { right: 14%; bottom: 12%; transform: rotate(-9deg); }

@keyframes float { to { transform: translateY(-9px); } }
@keyframes twinkle { 50% { opacity: .35; transform: scale(.72) rotate(18deg); } }
@keyframes markerPulse { to { opacity: .5; transform: scale(1.2); } }
@keyframes markerHint { to { opacity: .45; transform: scale(1.35); } }
@keyframes dashMove { to { stroke-dashoffset: -30; } }
@keyframes wrongShake { 20% { transform: translateX(-7px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } }
@keyframes completeBoard { 40% { transform: scale(1.015); } }
@keyframes celebrate { 35% { transform: scale(1.12) rotate(-5deg); } 70% { transform: scale(.97) rotate(3deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.7) translateY(12px); } }

@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; } }

@media (max-width:900px) {
  .hero { min-height: 390px; grid-template-columns: minmax(0,1fr) minmax(340px,.9fr); padding: 39px 32px; }
  .hero h1 { font-size: 51px; }
  .steps-grid { grid-template-columns: 1fr; }
  .step-card { min-height: 104px; }
  .levels-grid { grid-template-columns: 1fr 1fr; }
  .levels-grid .level-card:last-child { grid-column: 1/-1; }
  .collection-grid { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .collection-tile { min-height: 98px; }
  .sound-button span:last-child { display: none; }
  .sound-button { width: 49px; padding: 0; }
  .trace-layout { grid-template-columns: minmax(0,1fr) 235px; }
  .trace-tools { padding-inline: 14px; }
  .letter-sample { width: 125px; height: 132px; padding-top: 25px; }
  .letter-sample strong { font-size: 67px; }
}

@media (max-width:720px) {
  .app { width: min(100% - 22px,1120px); padding-top: 12px; }
  .topbar { align-items: flex-start; margin-bottom: 14px; }
  .brand-mark { width: 48px; height: 48px; font-size: 24px; border-radius: 16px; }
  .brand strong { max-width: 170px; font-size: 18px; white-space: normal; }
  .brand small { display: none; }
  .topbar-actions { gap: 6px; }
  .collection-button { min-height: 46px; padding-inline: 10px; }
  .back-button, .sound-button { width: 46px; min-height: 46px; }
  .top-spark { display: none; }
  .hero { min-height: 680px; grid-template-columns: 1fr; align-content: start; padding: 33px 26px; }
  .hero-copy { text-align: center; }
  .hero-copy > p:not(.eyebrow) { margin-inline: auto; }
  .hero-scene { min-height: 295px; }
  .section-heading { align-items: flex-end; }
  .section-heading h2 { font-size: 34px; }
  .section-heading > p { max-width: 240px; }
  .levels-grid { grid-template-columns: 1fr; }
  .levels-grid .level-card:last-child { grid-column: auto; }
  .trace-layout { grid-template-columns: 1fr; }
  .trace-board-card { order: 1; }
  .trace-tools { order: 2; display: grid; grid-template-columns: 130px minmax(0,1fr); align-items: center; gap: 10px 16px; text-align: left; }
  .trace-tools > .eyebrow { grid-column: 1/-1; margin-bottom: -4px; }
  .trace-tools .letter-sample { grid-row: span 3; margin: 0; }
  .trace-tools .tool-note { margin: 0; }
  .trace-tools .stroke-list { margin: 0; }
  .trace-tools button { margin-top: 0; }
  .trace-tools.complete { display: grid; }
  .trace-tools.complete .letter-sample { grid-row: span 3; }
  .result-letters { grid-template-columns: repeat(6,minmax(0,1fr)); }
}

@media (max-width:520px) {
  .app { width: calc(100% - 18px); }
  .topbar { min-height: 52px; gap: 6px; }
  .brand { gap: 7px; }
  .brand-mark { width: 43px; height: 43px; font-size: 22px; border-width: 2px; }
  .brand strong { max-width: 105px; font-size: 15px; }
  .collection-button > span:first-child { display: none; }
  .collection-button { padding-inline: 8px; }
  .collection-button strong { font-size: 10px; }
  .collection-button small { font-size: 9px; }
  .back-button, .sound-button { width: 40px; min-height: 40px; }
  .hero { min-height: 625px; padding: 28px 18px; border-radius: 30px; }
  .hero h1 { font-size: 42px; }
  .hero-copy > p:not(.eyebrow) { font-size: 14px; }
  .hero-scene { min-height: 265px; }
  .hero-sheet { inset-inline: 0; }
  .hero-sheet svg { width: 185px; height: 218px; }
  .hero-pencil { right: 23px; font-size: 44px; }
  .how-section,.levels-section,.collection-section { margin-top: 42px; }
  .section-heading { display: block; }
  .section-heading h2 { font-size: 31px; }
  .section-heading > p { max-width: none; margin-top: 10px; text-align: left; }
  .step-card { min-height: 114px; gap: 12px; padding: 17px; border-radius: 24px; }
  .step-number { width: 54px; height: 54px; border-width: 7px; }
  .step-card strong { font-size: 17px; }
  .level-card { min-height: 340px; padding: 18px; }
  .level-preview i { width: 48px; height: 58px; font-size: 23px; }
  .collection-section { padding: 17px 12px; border-radius: 29px; }
  .collection-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
  .collection-tile { min-height: 88px; }
  .parent-tip { align-items: flex-start; padding: 16px; }
  .game-shell { padding: 14px 9px; border-radius: 28px; }
  .game-heading h1 { font-size: 30px; }
  .round-badge { width: 62px; height: 62px; border-width: 7px; }
  .round-badge strong { font-size: 21px; }
  .mission-strip { display: block; }
  .mission-strip > span { display: block; margin-top: 10px; text-align: center; }
  .trace-board-card { padding: 9px; border-radius: 25px; }
  .board-label { font-size: 9px; }
  .trace-svg { border-radius: 20px; }
  .trace-tools { display: block; padding: 18px; text-align: center; }
  .trace-tools > .eyebrow { margin-bottom: 8px; }
  .trace-tools .letter-sample { width: 115px; height: 120px; margin: 8px auto 17px; padding-top: 21px; }
  .letter-sample strong { font-size: 61px; }
  .trace-tools .tool-note { margin-bottom: 14px; }
  .trace-tools .stroke-list { margin-bottom: 14px; }
  .trace-tools button { margin-top: 9px; }
  .feedback-card { align-items: flex-start; }
  .result-card { padding: 34px 14px; border-radius: 30px; }
  .result-card h1 { font-size: 39px; }
  .result-letters { gap: 5px; }
  .result-letters > span { height: 69px; padding-top: 16px; border-width: 3px; }
  .result-stats { display: grid; grid-template-columns: 1fr 1fr; }
  .result-stats > span:nth-child(2) { border-right: 0; }
  .result-stats > span:nth-child(-n+2) { border-bottom: 2px solid #ded9ca; }
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; }
}

@media (max-width:350px) { .brand strong { max-width: 78px; font-size: 14px; } .collection-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
