/* One world for the whole site, taken from the «حروفي الناطقة» cards and banner (see DESIGN.md). */
:root { --sun:#ffcb05; --sun-deep:#e9a400; --blue:#0070b2; --blue-deep:#004f80; --sky:#6ed2f2; --sky-pale:#e6f5fc; --berry:#f14a26;
  --ink:#123a5c; --muted:#4f6b82; --line:#cfe6f2; --card:#fff; --err:#c2261b;
  --bg:var(--sky-pale); --accent:var(--blue); --star:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5L12 17.4l-5.8 3.1 1.1-6.5L2.6 9.4l6.5-.9z' fill='%23ffcb05' stroke='%23e9a400' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E"); }
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; } /* no blue box on a phone tap: pressed things show their own press */
::selection { background:var(--sun); color:var(--ink); }
body { margin:0; min-height:100vh; background:var(--bg); color:var(--ink); font-family:Vazirmatn, Tahoma, sans-serif; display:flex; justify-content:center;
  padding:24px 16px; accent-color:var(--blue); scrollbar-color:#9fcde4 transparent; }
:focus-visible { outline:3px solid var(--blue); outline-offset:3px; }
h1, h2 { font-family:Rubik, Vazirmatn, sans-serif; font-weight:800; color:var(--blue-deep); }
/* login */
.card { width:100%; max-width:440px; background:var(--card); border-radius:28px; padding:24px; align-self:flex-start;
  box-shadow:0 8px 0 var(--line), 0 18px 30px -18px #00507a55; }
h1 { font-size:1.7rem; margin:0 0 16px; text-align:center; }
.tabs { display:flex; gap:6px; background:var(--sky-pale); padding:5px; border-radius:999px; margin-bottom:18px; }
.tabs button { flex:1; border:0; background:none; padding:10px 8px; border-radius:999px; font:inherit; color:var(--muted); cursor:pointer; line-height:1.4; }
.tabs button.on { background:var(--card); color:var(--blue-deep); font-weight:700; box-shadow:0 3px 0 var(--line), 0 9px 14px -8px #00507a40; }
label { display:block; font-size:.95rem; margin:14px 0 6px; color:var(--muted); font-weight:600; }
input { width:100%; padding:12px 14px; border:2px solid var(--line); border-radius:16px; font:inherit; background:#fff; color:var(--ink); }
input:focus { outline:none; border-color:var(--blue); box-shadow:0 0 0 4px #0070b222; }
.btn { width:100%; margin-top:20px; padding:13px; border:0; border-radius:999px; background:var(--blue); color:#fff; font:inherit; font-weight:700;
  font-size:1.05rem; cursor:pointer; box-shadow:0 5px 0 var(--blue-deep), 0 11px 14px -8px #00507a40; transition:transform .12s, box-shadow .12s; }
.btn:active { transform:translateY(4px); box-shadow:0 1px 0 var(--blue-deep), 0 2px 4px -2px #00507a33; }
.err { background:#fde8e6; color:var(--err); padding:10px 14px; border-radius:14px; font-size:.9rem; }
.link { display:block; margin:14px auto 0; border:0; background:none; color:var(--blue); font:inherit; font-size:.9rem; font-weight:600; cursor:pointer; }
.link:hover { text-decoration:underline; text-underline-offset:4px; }
.hint { font-size:.9rem; color:var(--muted); margin:0 0 4px; line-height:1.8; }
[hidden] { display:none !important; }
.banner { display:block; width:100%; height:auto; aspect-ratio:1600 / 600; object-fit:cover; border-radius:24px; margin-bottom:14px; box-shadow:0 10px 24px -14px #00507a66; }
.card .banner { margin:-8px 0 16px; border-radius:20px; box-shadow:none; }
/* after login (index.php, moved by choice.js): a living banner, a greeting, two big picture buttons, a meadow */
html, body { overflow-x:clip; } /* nothing that flies in (a falling card, a drop of jelly) may ever scroll the page sideways */
.home { min-height:calc(100dvh - 48px); display:flex; flex-direction:column; }
/* the banner: the still picture until its layers are ready, then the background with the moving parts over it (all placed
   in the picture's own 992 × 372 space as percentages, see tools/banner_layers.py) */
.hero { position:relative; direction:ltr; border-radius:24px; overflow:hidden; margin-bottom:14px; box-shadow:0 10px 24px -14px #00507a66; isolation:isolate; }
.hero .banner { margin:0; border-radius:0; box-shadow:none; }
.hero .lay { position:absolute; pointer-events:none; will-change:transform; }
.hero .arm { position:absolute; pointer-events:none; will-change:rotate; }
.hero .arm img { position:absolute; inset:0; width:100%; height:100%; will-change:rotate; }
.lid { position:absolute; border-radius:50%; overflow:hidden; pointer-events:none; }
.lid i { position:absolute; inset:0; transform-origin:50% 0; transform:scaleY(0); border-bottom:3px solid #5a3524; border-radius:0 0 50% 50% / 0 0 30% 30%; }
.ink { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.fly, .twk { position:absolute; left:0; top:0; width:7%; pointer-events:none; will-change:transform, opacity; }
.twk { width:2.6%; opacity:0; }
.fly svg, .twk svg { display:block; width:100%; height:auto; }
.boy, .pen { position:absolute; border:0; background:none; padding:0; cursor:pointer; min-width:52px; min-height:52px; }
.boy { left:60%; top:0; width:40%; height:100%; }
.bubble { position:absolute; left:41%; top:9%; padding:8px 16px; border-radius:20px; background:#fff; color:var(--ink); font-weight:800; font-size:clamp(1rem, 4.4vw, 1.6rem);
  box-shadow:0 6px 0 #00000012; opacity:0; transform:scale(.4); transform-origin:90% 100%; pointer-events:none; direction:rtl; }
.bubble::after { content:""; position:absolute; right:10px; bottom:-9px; border:9px solid transparent; border-top-color:#fff; border-bottom:0; }
/* the greeting, and the grown-ups' corner: a small gear that opens only when held for a second (a child's quick tap does nothing) */
.hi { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:52px; margin-bottom:14px; }
.hi h1 { margin:0; text-align:start; font-size:1.5rem; }
.hi small { display:block; font-family:Vazirmatn, Tahoma, sans-serif; font-weight:600; font-size:.85rem; color:var(--muted); }
.grown { position:relative; }
.gear { position:relative; display:grid; place-items:center; width:52px; height:52px; border:0; border-radius:14px; background:#ffffff99; color:var(--muted); cursor:pointer;
  touch-action:none; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.gear svg { width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.gear .hold { position:absolute; inset:3px; width:auto; height:auto; transform:rotate(-90deg); pointer-events:none; }
.gear .hold circle { fill:none; stroke:var(--blue); stroke-width:4; stroke-dasharray:100; stroke-dashoffset:100; opacity:0; } /* opacity: the round cap of an empty dash is still a dot */
.gear.holding .hold circle { opacity:1; stroke-dashoffset:0; transition:stroke-dashoffset 1s linear; }
.tip, .menu { position:absolute; inset-inline-end:0; top:60px; z-index:10; background:var(--card); color:var(--ink); box-shadow:0 18px 40px -16px #00507a88; }
.tip { font-size:.85rem; font-weight:600; padding:6px 12px; border-radius:14px; white-space:nowrap; opacity:0; transition:opacity .2s; pointer-events:none; }
.tip.on { opacity:1; }
.menu { border-radius:20px; padding:8px; min-width:190px; display:grid; gap:4px; }
.menu form { margin:0; }
.menu a, .menu button { display:flex; align-items:center; width:100%; min-height:52px; padding:0 14px; border:0; border-radius:14px; background:none;
  font:inherit; font-weight:700; text-align:start; color:var(--blue); text-decoration:none; cursor:pointer; }
.menu a:hover, .menu button:hover { background:var(--sky-pale); }
.menu .out { color:var(--err); }
/* the two big cards: stacked and full width on phones, side by side from 600px; the picture keeps its own shape */
.choose { --goo:var(--sun); position:relative; display:grid; grid-template-columns:1fr; gap:18px; }
@media (min-width:600px) { .choose { grid-template-columns:1fr 1fr; } }
.choose .go-letters { --goo:#e282d5; } /* the jelly's colour: each picture's own (change it with the picture) */
.choose .go-game { --goo:#6dd4e5; }
.choose a { position:relative; z-index:1; display:block; border-radius:24px; overflow:hidden; border:6px solid #fff;
  box-shadow:0 8px 0 var(--line), 0 20px 30px -20px #00507a66; transition:transform .12s, box-shadow .12s; }
.choose a:active { transform:translateY(6px); box-shadow:0 2px 0 var(--line), 0 4px 8px -4px #00507a33; }
.choose img { display:block; width:100%; height:auto; }
.choose a::after { content:""; position:absolute; inset:0; border-radius:18px; border:6px solid var(--sun); opacity:0; pointer-events:none; }
.choose.wait a { opacity:0; }
.ground { position:absolute; z-index:0; height:16px; border-radius:50%; background:radial-gradient(closest-side, #00507a4d, transparent); pointer-events:none; }
.goo { position:fixed; z-index:0; border-radius:50%; pointer-events:none; }
/* the living ground: grass, flowers and a few animals from the book; tap one and it jumps and makes its sound */
.meadow { position:relative; height:130px; margin:auto -16px -24px; }
.meadow canvas { position:absolute; inset:0; width:100%; height:100%; display:block; cursor:pointer; }
@media (prefers-reduced-motion:reduce) { .choose a { transition:none; } }
/* player page */
.player-page { width:100%; max-width:760px; align-self:flex-start; }
.top { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:14px; color:var(--muted); font-size:.9rem; font-weight:600; }
.top a, .top button { color:var(--blue); text-decoration:none; font:inherit; }
.top button { border:0; background:var(--card); padding:8px 16px; border-radius:999px; cursor:pointer; box-shadow:0 3px 0 var(--line), 0 9px 14px -8px #00507a40; }
/* swipeable cover: RTL strip, next letter comes in from the left */
.cover { position:relative; overflow:hidden; border-radius:24px; background:#fff; border:6px solid #fff;
  box-shadow:0 8px 0 var(--line), 0 20px 30px -20px #00507a66; aspect-ratio:1299 / 1594; touch-action:pan-y; cursor:grab; user-select:none; -webkit-user-select:none; }
.cover.dragging { cursor:grabbing; }
.strip { display:flex; direction:rtl; height:100%; transition:transform .42s cubic-bezier(.22,1,.36,1); will-change:transform; }
.cover.dragging .strip { transition:none; }
.strip img { flex:0 0 100%; width:100%; height:100%; object-fit:contain; pointer-events:none; -webkit-user-drag:none;
  transform-origin:50% 90%; transition:transform .38s cubic-bezier(.2,.8,.2,1), opacity .38s; }
.cover.dragging .strip img { transition:none; }
.counter { position:absolute; top:10px; left:12px; background:#ffffffe6; color:var(--ink); font-size:.85rem; font-weight:700;
  padding:3px 12px; border-radius:999px; pointer-events:none; font-variant-numeric:tabular-nums; }
@media (prefers-reduced-motion:reduce) { .strip, .strip img { transition:none; } }
/* living picture over the cover (same ratio as the card picture); the player fits itself inside */
/* it fades in over the still picture once drawn: the same picture, so only the mouths and effects seem to appear */
.anim-frame { position:absolute; inset:0; width:100%; height:100%; border:0; background:#fff; opacity:0; pointer-events:none;
  transform-origin:50% 90%; transition:opacity .35s ease-out, transform .38s cubic-bezier(.2,.8,.2,1); } /* slides back like the strip when a swipe is let go */
.cover.dragging .anim-frame { transition:opacity .35s ease-out; }
.anim-frame.shown { opacity:1; pointer-events:auto; }
/* the poem on the card while it is sung (lyrics.js): the half-line being sung lifts out of the card bigger (a copy of
   its strip of the picture), a sun light sweeping over it right to left (multiplied, so the print stays crisp), and the
   other three fade. Over a living picture too (the same picture). The overlay covers the picture itself: the cards
   (700×876) are a touch narrower than the cover (1299×1594), so they leave thin margins at the sides. */
.lyr { position:absolute; inset:0 .97%; z-index:2; pointer-events:none; transition:opacity .2s; }
.cover.dragging .lyr { opacity:0; }
.lyr i { position:absolute; border-radius:10px; transition:transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, background-color .35s; }
.lyr i b { position:absolute; inset:0; border-radius:inherit; background:#fff var(--img) no-repeat; opacity:0; transition:opacity .25s; }
.lyr i::before { content:''; position:absolute; inset:0; z-index:1; border-radius:inherit; mix-blend-mode:multiply; opacity:0; transition:opacity .25s;
  background:linear-gradient(to left, #ffcb05b0 calc(var(--p, 0%) - 4%), #ffcb0530 var(--p, 0%)); }
.lyr.singing i:not(.on) { background-color:#ffffffa6; } /* the other half-lines fade */
.lyr i.on { z-index:3; transform:scale(1.22); box-shadow:0 0 0 1px var(--sun), 0 10px 18px -6px #00507a66; }
.lyr i.on b, .lyr i.on::before { opacity:1; }
@media (prefers-reduced-motion:reduce) { .lyr i, .lyr i b, .lyr i::before { transition:none; } .lyr i::before { background:#ffcb0560; } }
.anim-frame:not(.cur) { display:none; } /* a neighbour loading ahead: not drawn until it is the current letter */
/* thumbnail picker */
.thumbs { display:flex; gap:10px; overflow-x:auto; padding:14px 8px 10px; scroll-snap-type:x proximity; scrollbar-width:thin; }
.thumb { flex:0 0 84px; position:relative; aspect-ratio:1299 / 1594; padding:0; border:3px solid #fff; border-radius:16px; overflow:hidden; background:#fff;
  cursor:pointer; opacity:.7; scroll-snap-align:center; box-shadow:0 4px 0 var(--line), 0 10px 14px -8px #00507a40; transition:opacity .15s, border-color .15s, transform .15s; }
@media (hover:hover) { .thumb:hover { opacity:1; transform:translateY(-3px); } }
.thumb.on { opacity:1; border-color:var(--blue); transform:translateY(-3px); box-shadow:0 5px 0 var(--blue-deep), 0 11px 14px -8px #00507a40; }
.thumb img { width:100%; height:100%; object-fit:cover; display:block; pointer-events:none; }
.thumb b { position:absolute; inset:auto 0 0; background:#00395fcc; color:#fff; font-size:.95rem; padding:4px 0 2px; }
/* round letter icons: a circle in a white ring, no name band (the icon is the letter) */
.thumb.icon { flex-basis:83px; aspect-ratio:1; border-radius:50%; background:transparent; }
.thumb.icon img { object-fit:contain; }
.thumb.icon b { display:none; }
/* player: a chunky toy in the cards' colours; the letter in its ring "sings" (player.js scales it with the song's loudness) */
.sc { position:relative; margin-top:16px; padding:26px 16px 10px; border-radius:28px; /* room for the name's highest hop */ background:var(--sun); color:var(--ink);
  box-shadow:0 10px 24px -10px #b07a0066, inset 0 -6px 0 #0000000d; }
.sc button { font:inherit; cursor:pointer; }
.sc button:focus-visible, .sc .wave:focus-visible { outline:3px solid var(--blue); outline-offset:4px; }
.sc svg { display:block; }
.sc-stage { display:flex; align-items:center; justify-content:center; gap:clamp(14px, 3vw, 22px); }
.sc-meta { min-width:0; flex:0 1 auto; display:flex; flex-direction:column; align-items:center; gap:8px; }
.sc-title { margin:0; font-family:Rubik, Vazirmatn, sans-serif; font-weight:800; font-size:clamp(2rem, 8vw, 3rem); line-height:1.25;
  color:var(--blue-deep); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; transform-origin:50% 85%; }
.write-btn { display:inline-flex; align-items:center; gap:8px; min-height:48px; padding:8px 18px 8px 16px; border:0; border-radius:999px;
  background:#fff; color:var(--blue); font-weight:700; font-size:1.05rem; box-shadow:0 4px 0 -1px var(--sun-deep), 0 6px 12px -6px #0004;
  transition:transform .12s, box-shadow .12s; }
.write-btn svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
/* the child's two activities beside the song: writing practice and the games, side by side */
.sc-acts { display:flex; justify-content:center; gap:10px; margin-top:20px; }
.sc-acts .write-btn { flex:1 1 0; max-width:230px; justify-content:center; text-decoration:none; white-space:nowrap; font-weight:700; font-size:1.05rem; }
/* on the pale sky ground, not the yellow panel: the sky-line edge (DESIGN.md: an edge in a deeper tone of the ground) */
.sc-acts .write-btn { box-shadow:0 5px 0 var(--line), 0 11px 14px -8px #00507a40; }
.sc-acts .write-btn:active { box-shadow:0 1px 0 var(--line), 0 2px 4px -2px #00507a33; }
.write-btn:active { transform:translateY(3px); box-shadow:0 1px 0 -1px var(--sun-deep), 0 2px 6px -4px #0004; }
.sc-controls { display:flex; justify-content:center; align-items:center; gap:clamp(14px, 5vw, 24px); margin:16px 0 10px; }
.sc-play, .skip { border:0; border-radius:50%; display:grid; place-items:center; transition:transform .12s cubic-bezier(.2,.8,.2,1), box-shadow .12s; }
.sc-play { width:92px; aspect-ratio:1; background:var(--blue); color:#fff;
  box-shadow:0 8px 0 var(--blue-deep), 0 14px 20px -8px #003a5e88; }
.sc-play svg { width:48%; height:48%; fill:currentColor; }
.skip { width:60px; aspect-ratio:1; background:#fff; color:var(--blue); box-shadow:0 6px 0 var(--sun-deep), 0 10px 16px -8px #0005; }
.skip svg { width:46%; height:46%; fill:none; stroke:currentColor; stroke-width:3.6; stroke-linecap:round; stroke-linejoin:round; }
@media (hover:hover) { .sc-play:hover, .skip:hover { transform:translateY(-2px); } }
.sc-play:active { transform:translateY(6px); box-shadow:0 2px 0 var(--blue-deep), 0 4px 8px -6px #003a5e88; }
.skip:active { transform:translateY(5px); box-shadow:0 1px 0 var(--sun-deep), 0 3px 6px -5px #0005; }
.wave { position:relative; height:56px; cursor:pointer; touch-action:none; border-radius:18px; }
.wave canvas { width:100%; height:100%; display:block; transform:scaleX(-1); } /* right-to-left progress */
.sc-times { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:8px; margin-top:4px; font-size:.8rem; font-weight:600;
  font-variant-numeric:tabular-nums; color:#6b5200; }
.status { text-align:center; color:var(--ink); font-size:.9rem; }
.sc-grown { display:flex; justify-content:center; gap:10px; margin-top:4px; padding-top:8px; border-top:2px dashed #0000001a; }
.sc-grown button { min-width:44px; height:44px; padding:0 10px; border:0; border-radius:14px; background:#ffffff66; color:#7a5d00;
  display:grid; place-items:center; transition:background .15s, color .15s; }
.sc-grown svg { width:22px; height:22px; fill:currentColor; }
.sc-grown button.on { background:#fff; color:var(--blue); }
.sc-grown .speed { font-weight:800; font-size:1rem; }
@media (prefers-reduced-motion:reduce) { .sc-play, .skip, .write-btn { transition:none; } }
/* letter grid */
.letters-head { display:flex; justify-content:space-between; align-items:baseline; margin:26px 4px 8px; }
.letters-head h2 { font-size:1.5rem; margin:0; }
.letters-head span { font-size:.85rem; color:var(--muted); font-weight:600; }
.letters { display:grid; grid-template-columns:repeat(7, 1fr); gap:10px; }
@media (max-width:560px) { .letters { grid-template-columns:repeat(4, 1fr); } }
.letter { position:relative; aspect-ratio:1 / 1.1; border:0; background:var(--card); border-radius:20px; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:0; font:inherit; color:var(--blue-deep);
  box-shadow:0 5px 0 var(--line), 0 11px 14px -8px #00507a40; transition:transform .12s, box-shadow .12s; }
@media (hover:hover) { .letter:hover { transform:translateY(-3px); box-shadow:0 8px 0 var(--line), 0 14px 14px -8px #00507a40; } }
.letter:active { transform:translateY(4px); box-shadow:0 1px 0 var(--line), 0 2px 4px -2px #00507a33; }
.letter .g { font-family:Rubik, Vazirmatn, sans-serif; font-size:2.6rem; font-weight:800; line-height:1.1; }
.letter .n { font-size:.9rem; color:var(--muted); font-weight:600; }
.letter .num { position:absolute; top:6px; right:9px; font-size:.7rem; color:var(--muted); font-weight:600; }
.letter.done::after { content:''; position:absolute; top:5px; left:6px; width:18px; height:18px; background:var(--star) center / contain no-repeat; }
.letter.on { background:var(--sun); box-shadow:0 5px 0 var(--sun-deep), 0 11px 14px -8px #00507a40; color:var(--blue-deep); }
.letter.on.done::after { background:var(--star) center / 14px no-repeat, #fff; border-radius:50%; width:22px; height:22px; top:4px; left:4px; }
.letter.on .n, .letter.on .num { color:#6b5200; }
.eq { display:none; position:absolute; bottom:7px; gap:2px; height:10px; align-items:flex-end; color:var(--blue); }
.letter.on .eq { display:flex; }
.eq i { width:3px; height:100%; background:currentColor; border-radius:2px; transform:scaleY(.3); transform-origin:bottom; }
.playing .letter.on .eq i { animation:eq .8s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay:-.3s !important; } .eq i:nth-child(3) { animation-delay:-.55s !important; }
@keyframes eq { from { transform:scaleY(.2); } to { transform:none; } } /* transform, not height: no layout each frame */
@media (prefers-reduced-motion:reduce) { .letter, .playing .letter.on .eq i { transition:none; animation:none; } }
/* writing stars on a tile: drawn, not typed */
.letter .w { position:absolute; top:22px; right:7px; display:flex; flex-direction:column; gap:1px; }
.letter.on .w i { filter:drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.letter .w i { width:10px; height:10px; background:var(--star) center / contain no-repeat; }
/* rewards: a star per letter, a medal per 7 letters, a certificate at the end */
.rewards { display:flex; justify-content:space-between; align-items:center; margin:0 4px 12px; min-height:2.6rem; }
#medals { display:flex; gap:6px; }
#medals span { width:30px; height:38px; display:block; filter:grayscale(1); opacity:.3; }
#medals span.on { filter:none; opacity:1; }
#medals svg { width:100%; height:100%; display:block; }
#cert { display:inline-flex; align-items:center; gap:6px; background:var(--sun); color:var(--blue-deep); font-weight:800; padding:8px 16px; border-radius:999px;
  text-decoration:none; box-shadow:0 4px 0 var(--sun-deep), 0 10px 14px -8px #00507a40; }
#cert svg { width:22px; height:22px; fill:var(--blue-deep); }
.toast { position:fixed; top:16px; left:50%; transform:translate(-50%, -20px); display:flex; align-items:center; gap:10px; background:var(--blue); color:#fff;
  padding:12px 22px 12px 18px; border-radius:999px; font-size:1.1rem; font-weight:700; box-shadow:0 6px 0 var(--blue-deep), 0 16px 24px -12px #003a5e88;
  opacity:0; pointer-events:none; transition:opacity .25s, transform .25s; z-index:30; max-width:calc(100vw - 32px); }
.toast::before { content:''; flex:none; width:26px; height:26px; background:var(--star) center / contain no-repeat; }
.toast.on { opacity:1; transform:translate(-50%, 0); }
/* celebration layer (party.js) */
.fx { position:fixed; inset:0; pointer-events:none; z-index:40; overflow:hidden; }
.fx .bit { position:absolute; display:block; border-radius:3px; will-change:transform, opacity; }
.fx .bit svg { width:100%; height:100%; display:block; }
.ring { position:absolute; display:block; border:4px solid #0070b2; border-radius:50%; pointer-events:none; z-index:40; }
/* while a song plays (party.js): notes from the letter, and soft shapes drifting behind the page */
.note { position:absolute; display:block; pointer-events:none; z-index:20; filter:drop-shadow(0 2px 2px #00395f33); }
.note svg, .float svg { width:100%; height:100%; display:block; }
.ambient { position:fixed; inset:0; z-index:-1; overflow:hidden; pointer-events:none; }
.float { position:absolute; display:block; opacity:0; will-change:transform, opacity; }
.float.bubble { border:3px solid var(--sky); border-radius:50%; background:#ffffff66; }
/* writing practice overlay */
.writing { position:fixed; inset:0; width:100%; height:100%; max-width:none; max-height:none; margin:0; border:0; padding:12px 16px;
  background:var(--sky-pale); color:var(--ink); }
.writing[open] { display:flex; flex-direction:column; align-items:center; gap:12px; }
.writing::backdrop { background:var(--sky-pale); }
.w-head { width:100%; max-width:520px; display:flex; justify-content:space-between; align-items:center; }
.w-head h2 { margin:0; font-size:1.6rem; }
.w-close { width:52px; height:52px; border:0; border-radius:50%; background:var(--card); cursor:pointer; color:var(--blue); display:grid; place-items:center;
  box-shadow:0 4px 0 var(--line), 0 10px 14px -8px #00507a40; }
.w-close svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:3; stroke-linecap:round; }
.w-pad { display:block; width:min(100%, 520px, calc(100vh - 240px)); width:min(100%, 520px, calc(100dvh - 240px)); aspect-ratio:1;
  background:#fff; border-radius:28px; touch-action:none; box-shadow:0 8px 0 var(--line), 0 20px 30px -20px #00507a55; }
.w-msg { margin:0; min-height:2.4em; font-size:1.3rem; font-weight:700; text-align:center; color:var(--blue-deep); }
.w-msg .stars { display:inline-flex; gap:6px; }
.w-msg .stars b { display:block; width:44px; height:44px; }
.w-msg .stars svg { width:100%; height:100%; display:block; }
.w-btns { width:100%; max-width:520px; display:flex; gap:10px; }
.w-btns .btn { flex:1; margin:0; padding:10px 6px 9px; font-size:.9rem; white-space:nowrap; display:flex; flex-direction:column; align-items:center; gap:4px; }
.w-btns svg { width:30px; height:30px; fill:none; stroke:currentColor; stroke-width:2.6; stroke-linecap:round; stroke-linejoin:round; }
.btn.alt { background:var(--card); color:var(--blue); box-shadow:0 5px 0 var(--line), 0 11px 14px -8px #00507a40; }
.btn.alt:active { box-shadow:0 1px 0 var(--line), 0 2px 4px -2px #00507a33; }
/* «دنياي السعيدة» (game.php): the card pictures in round frames; the child's controls are big discs and pills */
.game-page { width:100%; max-width:760px; }
.game-page svg, .g-award svg { fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.game-page .btn { display:flex; align-items:center; justify-content:center; gap:10px; text-decoration:none; }
.game-page .btn svg { width:24px; height:24px; }
.btn:disabled { opacity:.45; cursor:default; }
.g-top { display:flex; align-items:center; gap:12px; margin-bottom:16px; min-height:52px; }
.g-title { margin:0; font-size:1.5rem; }
.g-round { flex:none; width:52px; height:52px; border:0; padding:0; border-radius:50%; background:var(--card); color:var(--blue); display:grid; place-items:center;
  cursor:pointer; box-shadow:0 4px 0 var(--line), 0 10px 14px -8px #00507a40; transition:transform .12s, box-shadow .12s; }
.g-round svg { width:26px; height:26px; }
.g-round:active, .g-me:active { transform:translateY(3px); box-shadow:0 1px 0 var(--line), 0 2px 4px -2px #00507a33; }
.g-top > .g-round:last-child:not(:first-child) { margin-inline-start:auto; }
.g-top .g-round[data-act="treasure"] { margin-inline-start:auto; }
.g-top .g-round[data-act="treasure"] + .g-round { margin-inline-start:0; }
.g-me { display:flex; align-items:center; gap:8px; border:0; padding:4px 4px 4px 16px; border-radius:999px; background:var(--card); color:var(--blue-deep); font:inherit;
  font-weight:700; cursor:pointer; flex:0 1 auto; min-width:0; box-shadow:0 4px 0 var(--line), 0 10px 14px -8px #00507a40; transition:transform .12s, box-shadow .12s; }
.g-me img { width:44px; height:44px; border-radius:50%; }
.g-me b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:400px) { .g-me { padding:4px; } .g-me b { display:none; } } /* a narrow phone: the child's picture is enough */
.g-count { display:flex; align-items:center; gap:4px; font-weight:800; color:var(--blue-deep); font-family:Rubik, Vazirmatn, sans-serif; font-size:1.2rem; }
.g-dots { display:flex; gap:6px; flex-wrap:wrap; justify-content:center; flex:1; }
.g-dots i { width:14px; height:14px; border-radius:50%; background:var(--line); }
.g-dots i.on { background:var(--blue); }
.g-dots i.now { background:var(--sun); box-shadow:0 0 0 3px #fff, 0 0 0 5px var(--sun-deep); }
.g-panel { background:var(--card); border-radius:28px; padding:22px 14px 28px; text-align:center; min-height:420px;
  box-shadow:0 8px 0 var(--line), 0 18px 30px -18px #00507a55; }
.g-panel h2 { font-size:1.6rem; margin:8px 0; }
.g-panel h3 { font-family:Rubik, Vazirmatn, sans-serif; font-weight:800; color:var(--blue-deep); font-size:1.15rem; margin:24px 0 10px; }
.g-hint { margin:0 0 18px; color:var(--muted); font-size:.95rem; font-weight:600; line-height:1.8; }
.g-center { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; }
.g-big { width:96px; height:96px; color:var(--sun-deep); fill:var(--sun); }
.game-page .g-big { fill:var(--sun); }
.g-points { font-family:Rubik, Vazirmatn, sans-serif; font-weight:800; font-size:1.4rem; color:var(--blue); margin:0; }
.g-end { display:flex; flex-direction:column; gap:4px; width:100%; max-width:360px; margin:10px auto 0; }
/* stars: drawn, filled when earned */
.g-stars { display:inline-flex; gap:2px; vertical-align:middle; }
.g-stars i { width:22px; height:22px; background:var(--star) center / contain no-repeat; filter:grayscale(1); opacity:.3; }
.g-stars i.on { filter:none; opacity:1; }
.g-center > .g-stars i { width:64px; height:64px; }
.g-center > .g-stars i.on { animation:g-in .5s cubic-bezier(.2,.8,.2,1) backwards; }
/* profiles */
.g-kids { display:flex; flex-wrap:wrap; justify-content:center; gap:18px; margin-top:18px; }
.g-kid { display:flex; flex-direction:column; align-items:center; gap:8px; border:0; background:none; font:inherit; font-weight:700; color:var(--blue-deep); cursor:pointer; width:120px; }
.g-kid img, .g-kid svg { width:110px; height:110px; border-radius:50%; box-shadow:0 5px 0 var(--line), 0 11px 14px -8px #00507a40; }
.g-kid.add svg { padding:30px; background:var(--sky-pale); color:var(--blue); border:3px dashed var(--sky); box-shadow:none; }
.g-form { text-align:start; }
.g-form h2, .g-form .g-hint, .g-form h3 { text-align:center; }
.g-opts.small .g-opt { width:72px; }
.g-ages { display:grid; grid-template-columns:repeat(2, 1fr); gap:12px; }
.g-age { display:flex; flex-direction:column; align-items:center; gap:4px; border:3px solid var(--line); background:var(--card); border-radius:20px; padding:10px 6px; font:inherit;
  font-weight:700; color:var(--blue-deep); cursor:pointer; box-shadow:0 5px 0 var(--line), 0 11px 14px -8px #00507a40; }
.g-age img { width:84px; height:84px; object-fit:contain; }
.g-age.on { background:var(--sun); border-color:var(--sun-deep); box-shadow:0 5px 0 var(--sun-deep), 0 11px 14px -8px #00507a40; }
/* the map: five stations along a dashed path */
.g-map { position:relative; height:960px; margin-bottom:80px; }
.g-path { position:absolute; inset:0; width:100%; height:100%; }
.g-path path { fill:none; stroke:var(--sky); stroke-width:3; stroke-dasharray:3 9; vector-effect:non-scaling-stroke; }
.g-station { position:absolute; transform:translateX(-50%); width:150px; display:flex; flex-direction:column; align-items:center; gap:2px; border:0; background:none; font:inherit;
  color:var(--blue-deep); cursor:pointer; padding:0; }
.g-station.s0 { left:72%; top:calc(8% - 48px); } .g-station.s1 { left:28%; top:calc(28% - 48px); } .g-station.s2 { left:72%; top:calc(52% - 48px); }
.g-station.s3 { left:28%; top:calc(72% - 48px); } .g-station.s4 { left:50%; top:calc(92% - 60px); }
.g-disc { width:96px; height:96px; border-radius:50%; background:var(--card); color:var(--blue); display:grid; place-items:center;
  box-shadow:0 0 0 6px var(--sky), 0 6px 0 6px var(--line), 0 16px 20px -6px #00507a55; transition:transform .12s; }
.g-disc svg { width:48px; height:48px; }
.g-station b { margin-top:12px; font-family:Rubik, Vazirmatn, sans-serif; font-weight:800; font-size:1.05rem; }
.g-station small { color:var(--muted); font-weight:600; font-size:.85rem; }
.g-station:active .g-disc { transform:translateY(4px); }
.g-station.won .g-disc { background:var(--sun); color:var(--blue-deep); box-shadow:0 0 0 6px #fff, 0 6px 0 6px var(--sun-deep), 0 16px 20px -6px #00507a55; }
.g-go { font-size:1.2rem; }
/* picture choices */
.g-opts { display:flex; flex-wrap:wrap; justify-content:center; gap:14px; }
.g-opt { position:relative; width:clamp(96px, 27vw, 160px); aspect-ratio:1; padding:0; border:0; border-radius:50%; background:var(--card); cursor:pointer;
  box-shadow:0 5px 0 var(--line), 0 11px 14px -8px #00507a40; transition:transform .12s, box-shadow .12s; animation:g-in .4s cubic-bezier(.2,.8,.2,1) backwards; }
.g-opt img { display:block; width:100%; height:100%; border-radius:50%; pointer-events:none; }
.g-opt:active { transform:translateY(4px); box-shadow:0 1px 0 var(--line), 0 2px 4px -2px #00507a33; }
.g-opt:nth-child(2) { animation-delay:70ms; } .g-opt:nth-child(3) { animation-delay:140ms; } .g-opt:nth-child(4) { animation-delay:210ms; }
.g-opt:nth-child(5) { animation-delay:280ms; } .g-opt:nth-child(n+6) { animation-delay:350ms; }
.g-opt.pair, .g-opt.right { box-shadow:0 0 0 6px var(--sun), 0 0 0 10px #fff, 0 12px 18px -6px #00507a55; }
.g-opt.right { transform:scale(1.1); transition:transform .4s cubic-bezier(.2,.8,.2,1); }
.g-opt.wrong { animation:g-shake .4s; }
.g-opt.hint, .g-slot.hint { box-shadow:0 0 0 6px var(--sky), 0 0 0 10px #fff, 0 12px 18px -6px #00507a55; animation:g-pulse 1.4s ease-in-out infinite; }
/* the word card, or a letter in card red: what the pictures below answer */
.g-word { display:block; width:min(200px, 48vw); aspect-ratio:1; margin:0 auto 22px; animation:g-in .4s cubic-bezier(.2,.8,.2,1); }
.g-letter { display:grid; place-items:center; width:min(170px, 42vw); aspect-ratio:1; margin:6px auto 30px; border-radius:50%; background:var(--card);
  color:var(--berry); font:800 clamp(4rem, 18vw, 6rem) / 1 Rubik, Vazirmatn, sans-serif; box-shadow:0 0 0 9px var(--sky), 0 0 0 14px #fff, 0 14px 22px -6px #00507a55; }
/* memory: face-down cards are blue discs with a white star; a shadow card is the picture in black on white */
.g-mem { gap:12px; }
/* the looking time before the cards turn over: a sun bar that empties, then fades away */
.g-peek { height:12px; max-width:320px; margin:0 auto 20px; border-radius:999px; background:var(--sky-pale); overflow:hidden; transition:opacity .3s; }
.g-peek i { display:block; height:100%; border-radius:inherit; background:var(--sun); transform-origin:right; }
.g-peek.done { opacity:0; }
.g-mem .g-opt { width:clamp(76px, 22vw, 130px); }
.g-opt.back { background:var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.6l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5L12 17.4l-5.8 3.1 1.1-6.5L2.6 9.4l6.5-.9z' fill='%23fff' stroke='%23fff' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") center / 42% no-repeat;
  box-shadow:0 5px 0 var(--blue-deep), 0 11px 14px -8px #00507a40; }
.g-opt.back img { visibility:hidden; }
.g-sil { filter:brightness(0); opacity:.8; }
.g-opt .g-sil { padding:12%; }
/* places to drop on, and the pictures to drag */
.g-slots, .g-tray { display:flex; flex-wrap:wrap; justify-content:center; gap:14px; }
.g-tray { margin-top:26px; padding-top:22px; border-top:2px dashed var(--line); }
.g-slot, .g-piece { position:relative; width:clamp(88px, 26vw, 150px); aspect-ratio:1; border-radius:50%; }
.g-slot { background:var(--sky-pale); transition:transform .15s, box-shadow .15s; }
.g-slot img, .g-piece img { display:block; width:100%; height:100%; pointer-events:none; }
.g-slot .g-sil { padding:8%; }
.g-slot.open { cursor:pointer; outline:4px dashed var(--sky); outline-offset:-4px; }
.g-slot.over { transform:scale(1.08); box-shadow:0 0 0 6px var(--sun), 0 0 0 10px #fff; }
.g-slot.done { background:var(--card); }
.g-slot.done img { padding:4%; animation:g-in .45s cubic-bezier(.2,.8,.2,1); }
.g-slot.pic { background:var(--card); }
.g-slot.pic img, .g-piece.pic img { border-radius:50%; padding:0; }
.g-slot.pic.open { background:var(--sky-pale); }
.g-piece { border:0; padding:0; background:none; cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none; animation:g-in .4s cubic-bezier(.2,.8,.2,1) backwards; }
.g-piece img { filter:drop-shadow(0 6px 6px #00507a40); }
.g-piece.pic img { box-shadow:0 5px 0 var(--line), 0 11px 14px -8px #00507a40; filter:none; }
.g-piece.picked { transform:translateY(-6px); }
.g-piece.picked img { outline:5px solid var(--sun); outline-offset:2px; border-radius:50%; }
.g-piece.lifted { opacity:.25; }
.g-piece.wrong { animation:g-shake .4s; }
.g-ghost { position:fixed; z-index:50; margin:0; pointer-events:none; animation:none; }
.g-timer { height:12px; border-radius:999px; background:var(--sky-pale); overflow:hidden; margin:0 auto 18px; max-width:320px; }
.g-timer i { display:block; height:100%; background:var(--sky); border-radius:inherit; animation:g-time linear forwards; transform-origin:right; }
/* badges */
.g-badges { display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:14px; }
.g-badge-card { display:flex; flex-direction:column; align-items:center; gap:6px; background:var(--sky-pale); border-radius:20px; padding:14px 8px; color:var(--blue-deep); }
.g-badge-card b { font-weight:800; }
.g-badge-card small { color:var(--muted); font-size:.8rem; line-height:1.6; }
.g-badge { width:76px; height:76px; border-radius:50%; display:grid; place-items:center; background:#dfe8ee; color:#9aaab6; }
.g-badge svg { width:40px; height:40px; }
.g-badge.on { background:var(--sun); color:var(--blue-deep); box-shadow:0 0 0 5px #fff, 0 0 0 8px var(--sun-deep); }
.g-award { position:fixed; z-index:45; top:16px; left:50%; translate:-50% 0; display:flex; align-items:center; gap:12px; background:var(--card); color:var(--blue-deep);
  padding:10px 22px 10px 12px; border-radius:999px; font-weight:800; box-shadow:0 6px 0 var(--line), 0 18px 30px -12px #00507a77; animation:g-drop .5s cubic-bezier(.2,.8,.2,1); }
.g-award .g-badge { width:56px; height:56px; }
.g-award .g-badge svg { width:30px; height:30px; }
/* the child's page */
.g-who { display:flex; align-items:center; gap:16px; text-align:start; }
.g-who img { width:96px; height:96px; border-radius:50%; flex:none; }
.g-who div { display:flex; flex-direction:column; gap:4px; color:var(--muted); font-weight:600; }
.g-who b { font-family:Rubik, Vazirmatn, sans-serif; font-size:1.5rem; color:var(--blue-deep); }
.g-games { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:8px; }
.g-games li { display:grid; grid-template-columns:32px 1fr auto; grid-template-rows:auto auto; column-gap:10px; align-items:center; text-align:start;
  background:var(--sky-pale); border-radius:16px; padding:10px 14px; }
.g-games svg { width:28px; height:28px; color:var(--blue); grid-row:span 2; }
.g-games small { grid-column:2 / 4; color:var(--muted); font-weight:600; }
.g-words { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; }
.g-word-mini { position:relative; width:76px; height:76px; }
.g-word-mini img { display:block; }
.g-word-mini img { width:100%; height:100%; }
.g-word-mini i { position:absolute; bottom:-2px; left:-2px; min-width:24px; height:24px; border-radius:999px; background:var(--blue); color:#fff; font-style:normal;
  font-size:.8rem; font-weight:700; display:grid; place-items:center; padding:0 6px; }
@keyframes g-in { from { transform:scale(.6); opacity:0; } }
@keyframes g-shake { 25% { transform:translateX(6px); } 75% { transform:translateX(-6px); } }
@keyframes g-pulse { 50% { transform:scale(1.06); } }
@keyframes g-time { to { transform:scaleX(0); } }
@keyframes g-drop { from { transform:translateY(-40px); opacity:0; } }
/* a board whose pictures are still coming: three sun dots hop in turn. A picture outside the games: a breathing pale disc with a star */
.g-wait { display:flex; justify-content:center; gap:12px; padding:64px 0; }
.g-wait i { width:18px; height:18px; border-radius:50%; background:var(--sun); box-shadow:0 4px 0 var(--sun-deep); animation:g-hop .9s cubic-bezier(.2,.8,.2,1) infinite; }
.g-wait i:nth-child(2) { animation-delay:.15s; } .g-wait i:nth-child(3) { animation-delay:.3s; }
.media-view img, .media-view canvas { -webkit-user-drag:none; -webkit-touch-callout:none; }
img.g-pend { background:var(--star) center / 40% no-repeat, var(--sky-pale); border-radius:50%; animation:g-breathe 1.2s ease-in-out infinite alternate; }
@keyframes g-hop { 0%, 60%, 100% { transform:none; } 30% { transform:translateY(-14px); } }
@keyframes g-breathe { to { opacity:.45; } }
@media (prefers-reduced-motion:reduce) { .g-wait i { animation:g-breathe .9s ease-in-out infinite alternate; } }
@media (prefers-reduced-motion:reduce) {
  .g-opt, .g-piece, .g-round, .g-me, .g-slot, .g-disc, .g-opt.wrong, .g-piece.wrong, .g-opt.hint, .g-slot.hint, .g-slot.done img,
  .g-center > .g-stars i.on, .g-award { animation:none; transition:none; }
}

/* full-screen toggle (fullscreen.js): only on a touch screen, upright or sideways */
.fs-btn { display:none; position:fixed; top:max(8px, env(safe-area-inset-top)); left:max(8px, env(safe-area-inset-left)); z-index:35; width:44px; height:44px;
  place-items:center; padding:0; border:0; border-radius:14px; background:#ffffffb3; color:var(--muted); box-shadow:0 6px 16px -8px #00507a66; cursor:pointer; }
.fs-btn svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
@media (pointer:coarse) { .fs-btn { display:grid; } }
/* Short landscape: fit the useful screen without scaling the document or changing portrait. */
@media (orientation:landscape) and (max-height:500px) {
  body { padding:8px 12px; padding:max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .player-page, .game-page { min-width:0; }
  .banner { width:auto; max-width:100%; height:auto; max-height:clamp(52px, 16vh, 74px); max-height:clamp(52px, 16dvh, 74px); aspect-ratio:1600 / 600; object-fit:contain; margin:0 auto 8px; }
  .home { min-height:calc(100vh - 16px); min-height:calc(100dvh - 16px); }
  .home .hero { width:min(100%, 520px); margin:0 auto 8px; border-radius:16px; }
  .home .hero .banner { width:100%; max-height:none; }
  .hi { min-height:48px; margin-bottom:8px; }
  .hi h1 { font-size:1.1rem; line-height:1.3; }
  .hi small { font-size:.75rem; }
  .gear { width:48px; height:48px; }
  .choose { width:100%; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; align-items:start; }
  .choose a { border-width:4px; border-radius:18px; min-height:48px; }
  .choose img { width:100%; height:auto; max-height:clamp(120px, 48vh, 210px); max-height:clamp(120px, 48dvh, 210px); aspect-ratio:776 / 691; object-fit:contain; }
  .meadow { height:52px; min-height:52px; margin:8px -12px -8px; }
  .card { max-width:680px; padding:12px 18px; }
  .card .banner { margin:0 auto 8px; }
  .card h1 { font-size:1.3rem; margin-bottom:8px; }
  .tabs { margin-bottom:8px; }
  .card label { margin:8px 0 4px; }
  .card input { min-height:44px; padding:8px 12px; }
  .card .btn { min-height:48px; margin-top:10px; }
  .top { min-height:44px; margin-bottom:8px; }
  .top button { min-height:44px; }
}
/* Landscape player: keep the picture and controls together, then scroll to the full letter grid. */
@media (orientation:landscape) and (max-height:500px) {
  .player-page:not(.home) { max-width:900px; display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); gap:8px 16px; align-items:start; }
  .player-page:not(.home) > .banner, .player-page:not(.home) > .top, .player-page:not(.home) > .thumbs,
  .player-page:not(.home) > .sc-acts, .player-page:not(.home) > .letters-head,
  .player-page:not(.home) > .rewards, .player-page:not(.home) > .letters { grid-column:1 / -1; }
  .player-page:not(.home) > .banner { display:none; }
  .player-page:not(.home) > .top { padding-left:48px; }
  .player-page:not(.home) > .cover { grid-column:1; grid-row:2; }
  .player-page:not(.home) > .sc { grid-column:2; grid-row:2; align-self:center; }
  .cover { width:min(100%, 55vh); width:min(100%, 55dvh); max-width:260px; max-block-size:clamp(150px, 72vh, 320px); max-block-size:clamp(150px, 72dvh, 320px); aspect-ratio:1299 / 1594; justify-self:center; }
  .sc { min-width:0; margin:0; padding:8px 12px; border-radius:20px; }
  .sc-title { font-size:clamp(1.25rem, 5vh, 2rem); }
  .sc-meta { gap:0; }
  .sc-controls { margin:2px 0 4px; gap:12px; }
  .sc-play { width:clamp(52px, 15vh, 68px); width:clamp(52px, 15dvh, 68px); }
  .skip { width:48px; }
  .wave { height:44px; }
  .sc-times { margin:0; }
  .sc-grown { margin:2px 0 0; padding-top:4px; }
  .sc-grown button { min-width:44px; min-height:44px; }
  .thumbs { gap:8px; padding:6px 4px 8px; }
  .thumb { flex-basis:54px; border-radius:12px; }
  .thumb.icon { flex-basis:54px; }
  .sc-acts { margin-top:4px; }
  .sc-acts .write-btn { min-height:48px; }
  .letters-head { margin:12px 4px 4px; }
  .letters { grid-template-columns:repeat(auto-fit, minmax(64px, 1fr)); gap:8px; }
  .letter { min-height:64px; }
  .letter .g { font-size:2rem; }
  .writing { padding:max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); overflow-y:auto; }
  .writing[open] { gap:6px; }
  .w-head { max-width:none; }
  .w-head h2 { font-size:1.25rem; }
  .w-close { width:48px; height:48px; }
  .w-pad { width:min(58vw, 280px, calc(100vh - 140px)); width:min(58vw, 280px, calc(100dvh - 140px)); flex:none; }
  .w-msg { min-height:1.4em; font-size:1rem; }
  .w-btns .btn { min-height:48px; }
}
/* Game boards remain scrollable when browser chrome reduces the usable height. */
@media (orientation:landscape) and (max-height:500px) {
  .game-page { max-width:900px; }
  .g-top { min-height:48px; gap:8px; margin-bottom:8px; }
  .g-title { font-size:1.15rem; }
  .g-round { width:48px; height:48px; }
  .g-me { min-height:48px; }
  .g-me img { width:40px; height:40px; object-fit:contain; }
  .g-panel { min-height:0; padding:12px; border-radius:20px; }
  .g-panel h2 { font-size:1.25rem; margin:4px 0; }
  .g-panel h3 { margin:10px 0 6px; }
  .g-hint { margin-bottom:8px; line-height:1.45; }
  .g-opts, .g-slots, .g-tray { gap:8px; }
  .g-opt, .g-mem .g-opt, .g-slot, .g-piece { width:clamp(68px, 22vh, 108px); width:clamp(68px, 22dvh, 108px); }
  .g-opt img, .g-slot img, .g-piece img { object-fit:contain; }
  .g-word { width:clamp(76px, 26vh, 126px); width:clamp(76px, 26dvh, 126px); max-width:35vw; height:auto; object-fit:contain; margin-bottom:8px; }
  .g-letter { width:clamp(76px, 26vh, 126px); width:clamp(76px, 26dvh, 126px); max-width:35vw; font-size:clamp(3rem, 15vh, 4.5rem); margin:8px auto 16px; }
  .g-tray { margin-top:10px; padding-top:10px; }
  .g-peek, .g-timer { margin-bottom:8px; }
  .g-kids { gap:10px; margin-top:8px; }
  .g-kid { width:88px; min-height:48px; }
  .g-kid img, .g-kid svg { width:76px; height:76px; object-fit:contain; }
  .g-kid.add svg { padding:20px; }
  .g-age img { width:clamp(48px, 15vh, 68px); height:clamp(48px, 15vh, 68px); }
  .g-ages { gap:8px; }
  .g-age { padding:6px; min-height:48px; }
  .g-who img { width:64px; height:64px; object-fit:contain; }
  .g-who b { font-size:1.2rem; }
  /* The portrait path cannot fit five 150px stations in 70vh. Use reachable tiles instead. */
  .g-map { height:auto; margin:8px 0 12px; display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); gap:8px; }
  .g-path { display:none; }
  .g-station, .g-station.s0, .g-station.s1, .g-station.s2, .g-station.s3, .g-station.s4 { position:relative; left:auto; top:auto; transform:none; width:100%; min-width:0; min-height:90px; gap:2px; }
  .g-disc { width:clamp(48px, 14vh, 64px); height:clamp(48px, 14vh, 64px); }
  .g-disc svg { width:50%; height:50%; }
  .g-station b { margin-top:4px; font-size:.9rem; }
  .g-station small { font-size:.75rem; }
  .g-go { min-height:48px; margin-top:8px; }
}
@media (orientation:landscape) and (max-height:500px) and (max-width:650px) {
  .g-map { grid-template-columns:repeat(3, minmax(0, 1fr)); }
}
