/* Design tokens sampled from the reference tablet screenshots (1600x900). */
:root {
  --navy: #221750;
  --ink: #130F4A;
  --purple: #5031F5;
  --purple-soft: #C9BFFE;
  --red: #F85162;
  --green: #43BE95;
  --green-soft: #9FDFC9;
  --gold: #FDD782;
  --gold-deep: #FDC061;
  --star: #F8C850;
  --star-edge: #FD9882;
  --puck: #3185FF;
  --puck-rim: #EFECF6;
  --white: #FFFFFF;
  --grey-line: #BCB9CA;
  --knob-grip: #DCE0FD;
  --muted: rgba(34, 23, 80, 0.5);

  /* activity card colors */
  --c-song: #66ECFE;
  --c-review: #594CE6;
  --c-new: #EF5F8C;
  --c-story: #FDD782;
  --c-words: #71F7CA;
  --c-sounds: #FF9464;
  --c-blend: #71F7CA;
  --c-write: #C9BFFF;
  --c-check: #588DF0;
  --c-read: #8ED3FB;
  --c-parts: #EF5F8C;
  --c-howto: #4A2FE0;
  --c-spell: #8ED3FB;

  /* activity screen tints */
  --t-new: #F3C5C9;
  --t-review: #D0DFFC;
  --t-blend: #D1FBEB;
  --t-write: #E9E5FF;
  --t-check: #D0DFFC;
  --t-words: #D1FBEB;
  --t-sounds: #FCF0D1;
  --t-soundout: #D9EFFF;
  --t-parts: #FACFDC;
  --t-read: #E9E5FF;
  --t-spell: #DCF2FF;
  --t-book-desk: #DAA774;
  --t-book-page: #C5F7FF;

  --font-ui: 'Quicksand', system-ui, sans-serif;
  --font-read: 'Andika', 'Quicksand', system-ui, sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #140E33; overflow: hidden; }
body { font-family: var(--font-ui); color: var(--navy); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 4px solid var(--purple); outline-offset: 4px; }
svg { display: block; }

/* Fixed 1600x900 tablet stage, letterboxed and scaled to the window. */
#viewport { position: fixed; inset: 0; display: grid; place-items: center; }
#stage {
  position: relative; width: 1600px; height: 900px; overflow: hidden;
  background: var(--white); transform-origin: 0 0; flex: none;
}
.screen { position: absolute; inset: 0; overflow: hidden; }
.screen.enter { animation: screenIn .35s var(--ease-out) both; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* shared chrome */
.round-btn {
  width: 140px; height: 140px; border-radius: 28px; background: var(--white);
  display: grid; place-items: center; box-shadow: 0 6px 0 rgba(34,23,80,.12);
  transition: transform .12s var(--ease-out), opacity .2s;
}
.round-btn:active { transform: translateY(3px) scale(.97); }
.round-btn[disabled] { opacity: .45; cursor: default; box-shadow: none; }
.round-btn.primary { background: var(--purple); }
.round-btn.primary svg path { stroke: var(--white); }
.pill {
  display: inline-flex; align-items: center; gap: 12px; border-radius: 999px;
  font-weight: 700; padding: 0 28px; height: 64px; font-size: 30px;
}
.pill.outline { border: 3px solid var(--grey-line); color: var(--muted); background: transparent; font-size: 26px; height: 58px; padding: 0 24px; }
.close-x { position: absolute; top: 38px; left: 44px; width: 90px; height: 90px; display: grid; place-items: center; z-index: 20; }
.close-x svg { width: 72px; height: 72px; }
.back-arrow { position: absolute; top: 44px; left: 40px; width: 96px; height: 90px; display: grid; place-items: center; z-index: 20; }

/* Walking-letter loading screen */
.loading { position: absolute; inset: 0; background: var(--white); z-index: 900; display: grid; place-items: center; }
.loading .walker { width: 250px; height: 320px; margin-top: -90px; animation: walkBob .5s ease-in-out infinite alternate; }
.loading .shadow { position: absolute; top: 580px; left: 50%; width: 70px; height: 16px; margin-left: -35px; border-radius: 50%; background: #EFEEF4; }
.loading .tip-chip { position: absolute; top: 664px; left: 50%; transform: translateX(-50%); background: #EAE6FD; color: #3D3470; border-radius: 12px; padding: 12px 22px; font-weight: 700; font-size: 30px; display: flex; gap: 12px; align-items: center; }
.loading .tip-chip.green { background: #E0F7EF; }
.loading .tip-text { position: absolute; top: 760px; left: 0; right: 0; text-align: center; font-size: 38px; font-weight: 600; padding: 0 140px; line-height: 1.35; }
@keyframes walkBob { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-14px) rotate(2deg); } }
.walker .leg-a { animation: legA .5s ease-in-out infinite alternate; transform-origin: 50% 0; transform-box: fill-box; }
.walker .leg-b { animation: legA .5s ease-in-out infinite alternate-reverse; transform-origin: 50% 0; transform-box: fill-box; }
@keyframes legA { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }

/* generic hint + script typography */
.script-card {
  position: absolute; background: var(--white); border-radius: 18px; padding: 18px 34px 18px 58px;
  font-size: 32px; line-height: 1.32; box-shadow: 0 5px 0 rgba(34,23,80,.10);
}
.script-card::before { content: '\201C'; position: absolute; left: 20px; top: 2px; font-size: 64px; color: #E3E0EC; font-family: Georgia, serif; }
.script-card .ans { color: rgba(34,23,80,.45); }
.hint { position: absolute; left: 0; right: 0; bottom: 44px; text-align: center; font-size: 30px; color: rgba(34,23,80,.5); display: flex; justify-content: center; align-items: center; gap: 10px; }
.sound-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--white); border-radius: 12px; padding: 4px 12px; box-shadow: 0 3px 0 rgba(34,23,80,.08); font-family: var(--font-read); font-weight: 700; color: var(--purple); font-size: 30px; }
.sound-chip.stop { color: var(--red); }
.sound-chip .wave { width: 26px; height: 24px; }

/* orthography marks shared by every word renderer */
.glyph { position: relative; display: inline-block; }
.glyph.long::after, .glyph.silent::after { content: ''; position: absolute; left: 12%; right: 12%; top: -.02em; height: .1em; border-radius: 99px; }
.glyph.long::after { background: var(--green); }
.glyph.silent::after { border: .03em solid rgba(34,23,80,.35); background: transparent; height: .07em; }
.team { position: relative; display: inline-block; }
.team::before { content: ''; position: absolute; left: 15%; right: 15%; top: -.1em; height: .22em; border: .07em solid var(--red); border-bottom: 0; border-radius: 99px 99px 0 0; }
.stopc { color: var(--red); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* round 3: generated letter on a glowing stage */
.loading { background: radial-gradient(circle at 50% 42%, #FFFFFF 0 22%, #F3EEFF 48%, #E6DDFF 100%); overflow: hidden; }
.ld-lights { position: absolute; inset: 0; pointer-events: none; }
.ld-lights i { position: absolute; width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%; filter: blur(22px); opacity: .55;
  background: hsl(calc(var(--i) * 40), 95%, 70%); animation: ldGlow 2.4s ease-in-out infinite alternate, ldHue 6s linear infinite; animation-delay: calc(var(--i) * -.37s); }
@keyframes ldGlow { from { transform: scale(.6) translateY(0); } to { transform: scale(1.25) translateY(-30px); } }
@keyframes ldHue { to { filter: blur(22px) hue-rotate(360deg); } }
.loading .walker.gen { width: auto; height: auto; display: grid; place-items: end center; position: relative; z-index: 1; animation: walkBob .3s ease-in-out infinite alternate, ldTint 4s linear infinite; }
.walker-img { display: block; height: 260px; filter: drop-shadow(0 14px 10px rgba(80,50,160,.25)); }
@keyframes ldTint { 0%, 100% { filter: none; } 50% { filter: hue-rotate(40deg) saturate(1.2); } }
