/* ============================================================
   Little Light: "lantern at night"
   Same system underneath (tokens, 4px spacing, pressable lip,
   outlined flat art), its own skin on top: ink-outlined sticker
   UI, pill controls, night-sky story path.
   ============================================================ */
:root {
  /* ground and ink */
  --paper: #ffffff;   /* white canvas (Open Design) */
  --surface: #fbf7ef; --line: #ddd8e4;  --paper-2: #fdecd2;  --ink: #2b2250;  --ink-soft: #5d5680;
  --night: #221a48;  --night-2: #322a6b;  --night-3: #463d8a;  --cream: #fff3d6;
  /* accents */
  --coral: #ff7a45;  --coral-wash: #ffe1d3;
  --gold: #ffc94a;   --gold-wash: #fff1c7;
  --teal: #3bb3a6;   --teal-wash: #d4f3ee;  --teal-ink: #17675f;
  --sky: #8fd3ff;    --sky-wash: #e3f4ff;
  --rose: #ffb3c7;   --lilac: #b9a6ff;
  --retry-ink: #b8431b;
  /* system */
  --stroke: 3px;  --lip: 5px;  --r-card: 22px;  --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --display: "Fredoka", "Arial Rounded MT Bold", system-ui, sans-serif;
  --text: "Lexend", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Safari 26 colours its bars from the page itself, so the root never stays transparent */
html { background: var(--paper); }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--text); font-weight: 400;
  font-size: 18px; line-height: 1.55; overflow-x: clip; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.08; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px dashed var(--coral); outline-offset: 4px; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 var(--s5); }
.mark { background: linear-gradient(transparent 62%, var(--gold) 62%, var(--gold) 92%, transparent 92%); padding: 0 .08em; }

/* ---------- Pressable: ink outline + ink lip (the sticker) ---------- */
.btn { --fill: var(--coral); --fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 56px; padding: 0 var(--s6);
  background: var(--fill); color: var(--fg); border: var(--stroke) solid var(--ink); border-radius: var(--r-pill);
  box-shadow: 0 var(--lip) 0 var(--ink); cursor: pointer; text-decoration: none;
  font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: 0;
  transition: transform .08s, box-shadow .08s, background-color .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 calc(var(--lip) + 1px) 0 var(--ink); }
.btn:active { transform: translateY(var(--lip)); box-shadow: 0 0 0 var(--ink); }
.btn svg { width: 22px; height: 22px; }
.btn.paper { --fill: var(--paper); }
.btn.teal { --fill: var(--teal); }
.btn.gold { --fill: var(--gold); }
.btn:disabled { --fill: var(--paper-2); --fg: #a99f8a; border-color: #d9c9ab; box-shadow: 0 var(--lip) 0 #d9c9ab; cursor: default; transform: none; }

/* ---------- Top bar ---------- */
/* The bar sits at the very top and fills the notch / status-bar area with its own background,
   so nothing scrolls visibly behind it (Safari draws the page under the status bar). */
.top { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: var(--stroke) solid var(--ink);
  padding-top: env(safe-area-inset-top, 0px); }
.wrap { padding-left: max(var(--s5), env(safe-area-inset-left, 0px)); padding-right: max(var(--s5), env(safe-area-inset-right, 0px)); }
.top > .wrap { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo { display: flex; align-items: center; gap: var(--s2); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 28px; text-decoration: none; letter-spacing: -0.01em; }
.logo svg { width: 40px; height: 40px; }
.logo em { font-style: normal; color: #d4501a; }
.stats { display: flex; gap: var(--s3); align-items: center; }
.stat { display: flex; align-items: center; gap: 6px; padding: 4px 14px 4px 8px; border: var(--stroke) solid var(--ink); border-radius: var(--r-pill);
  font-family: var(--display); font-weight: 600; font-size: 18px; background: var(--gold-wash); }
.stat.sun { background: var(--coral-wash); }
.stat svg { width: 26px; height: 26px; }
.mute { width: 44px; height: 44px; flex: none; border: var(--stroke) solid var(--ink); border-radius: 50%; background: var(--sky-wash); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink); padding: 0; }
.mute:active { transform: translateY(3px); box-shadow: none; }
.mute svg { width: 24px; height: 24px; }
.mute .off { display: none; } .mute[aria-pressed="false"] .on { display: none; } .mute[aria-pressed="false"] .off { display: block; }
.mute[aria-pressed="false"] { background: var(--paper-2); }
/* Phone bar: the wordmark and one control. The rest opens in a panel under the bar
   (never at the bottom, where Safari 26 floats its toolbar over the page). */
.me { display: none; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 10px; border: var(--stroke) solid var(--ink);
  border-radius: var(--r-pill); background: var(--gold-wash); box-shadow: 0 3px 0 var(--ink); cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 17px; }
.me:active { transform: translateY(3px); box-shadow: none; }
.me svg { width: 24px; height: 24px; }
.me-label { margin-left: 4px; }
.me[aria-expanded="true"] { background: var(--coral-wash); }
.menu { border-top: 2px dashed #d9c9ab; background: var(--paper); }
.menu-in { display: grid; gap: var(--s3); padding-block: var(--s4) var(--s5); }
.menu-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.menu-stats p { display: flex; align-items: center; gap: 8px; margin: 0; border: var(--stroke) solid var(--ink); border-radius: var(--r-card);
  padding: 10px 12px; background: var(--gold-wash); font-family: var(--display); font-weight: 500; font-size: 16px; line-height: 1.2; }
.menu-stats p + p { background: var(--coral-wash); }
.menu-stats b { font-size: 24px; font-weight: 600; }
.menu-stats svg { width: 26px; height: 26px; flex: none; }
.row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 56px; padding: 0 var(--s4); border: var(--stroke) solid var(--ink);
  border-radius: var(--r-card); background: #fff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; text-align: left;
  font-family: var(--display); font-weight: 600; font-size: 18px; }
.row:active { transform: translateY(4px); box-shadow: none; }
.row svg { width: 26px; height: 26px; flex: none; }
.mute.row { display: flex; align-items: center; justify-content: flex-start; height: auto; border-radius: var(--r-card); }
.row-state { margin-left: auto; color: var(--ink-soft); font-weight: 500; }
.mute.row[aria-pressed="false"] { background: var(--paper-2); }

/* Sound check */
.hear { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + var(--toolbar, 0px) + 16px);
  background: rgba(34, 26, 72, .6); }
.hear-card { width: 100%; max-width: 420px; display: grid; gap: var(--s3); justify-items: center; text-align: center; padding: var(--s5);
  background: var(--paper); border: var(--stroke) solid var(--ink); border-radius: 28px; box-shadow: 0 8px 0 var(--ink); }
.hear-pip { width: 110px; }
.hear-card h2 { font-size: 30px; }
.hear-card p { color: var(--ink-soft); font-size: 17px; }
.hear-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); width: 100%; text-align: left; }
.hear-tips li { display: flex; gap: var(--s3); align-items: flex-start; background: #fff; border: 2px solid var(--ink); border-radius: 18px; padding: 10px 14px; font-size: 16px; line-height: 1.4; }
.hear-tips svg { width: 28px; height: 28px; flex: none; }
.hear .ios-only { display: none; }
.is-ios .hear .ios-only { display: flex; }
.hear.listening .hear-tips li { background: var(--gold-wash); }
#hear-yes { width: 100%; }
.hear-skip { min-height: 44px; background: none; border: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; font-size: 16px; cursor: pointer; }
.debug { position: fixed; left: 8px; right: 8px; top: calc(env(safe-area-inset-top, 0px) + 84px); z-index: 90; margin: 0; padding: 10px; border-radius: 10px;
  background: rgba(0, 0, 0, .82); color: #b7ffb0; font: 12px/1.45 ui-monospace, monospace; white-space: pre-wrap; pointer-events: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Hero ---------- */
.hero { padding: var(--s8) 0 0; position: relative; }
.hero .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s7); align-items: center; }
.hero h1 { font-size: clamp(42px, 6vw, 76px); max-width: 11ch; }
.hero p { color: var(--ink-soft); margin-top: var(--s5); max-width: 27em; font-size: 19px; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s6); }
.hero-art svg { width: 100%; height: auto; overflow: visible; display: block; }
.scallop { display: block; width: 100%; height: 48px; margin-top: var(--s7); }

.bob { animation: bob 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes bob { 50% { transform: translateY(-7px) rotate(-1.5deg); } }
.glow { animation: glow 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes glow { 50% { transform: scale(1.12); opacity: .7; } }
.twinkle { animation: twinkle 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.twinkle:nth-of-type(2n) { animation-delay: .9s; } .twinkle:nth-of-type(3n) { animation-delay: 1.7s; }
@keyframes twinkle { 50% { transform: scale(.55); opacity: .45; } }

/* ---------- Night-sky story path ---------- */
.sky { background: var(--night); color: var(--cream); padding: var(--s9) 0 var(--s9); position: relative; overflow: hidden; scroll-margin-top: 70px; }
.dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sky-head { text-align: center; position: relative; }
.sky-head h2 { font-size: clamp(36px, 4.6vw, 56px); color: var(--cream); }
.sky-head p { color: var(--lilac); margin-top: var(--s3); }
.constellation { position: relative; max-width: 560px; margin: var(--s7) auto 0; }
.week { margin-top: var(--s8); }
.week-head { text-align: center; display: grid; gap: 2px; }
.week-head h3 { font-size: clamp(24px, 3vw, 30px); color: var(--cream); }
.week-head p { color: var(--lilac); font-size: 16px; }
.week-sky { position: relative; margin-top: var(--s8); }   /* room for the "Start here" tag above the first star */
.week.closed .week-head h3 { color: #8c83c4; }
.dim-stars { display: flex; justify-content: center; gap: var(--s3); margin-top: var(--s4); opacity: .35; }
.dim-stars svg { width: 30px; height: 30px; }
.week-lock { text-align: center; color: #8c83c4; font-size: 15px; margin-top: var(--s3); }
.constellation svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.star-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; width: 180px; }
.node { width: 88px; height: 88px; border-radius: 50%; border: var(--stroke) solid var(--ink); background: var(--coral); cursor: pointer;
  box-shadow: 0 var(--lip) 0 var(--ink); display: grid; place-items: center; transition: transform .08s, box-shadow .08s; position: relative; }
.node:active { transform: translateY(var(--lip)); box-shadow: 0 0 0 var(--ink); }
.node svg { width: 48px; height: 48px; }
.node.done { background: var(--gold); box-shadow: 0 var(--lip) 0 var(--ink), 0 0 0 12px rgba(255, 201, 74, .18), 0 0 0 26px rgba(255, 201, 74, .08); }
.node.locked { background: var(--night-2); border: var(--stroke) dashed var(--night-3); box-shadow: none; cursor: not-allowed; }
.node.current::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: var(--stroke) solid var(--coral); animation: ripple 1.8s ease-out infinite; }
@keyframes ripple { from { transform: scale(.85); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.node-label { margin-top: var(--s3); font-family: var(--display); font-weight: 600; font-size: 17px; text-align: center; color: var(--cream); line-height: 1.2; }
.star-node.locked .node-label { color: #8c83c4; }
.tag { position: absolute; top: -48px; background: var(--cream); color: var(--ink); border: var(--stroke) solid var(--ink); border-radius: var(--r-pill);
  padding: 2px 14px; font-family: var(--display); font-weight: 600; font-size: 16px; white-space: nowrap; animation: hop 1.6s ease-in-out infinite; }
@keyframes hop { 50% { transform: translateY(-5px); } }

/* ---------- Sticker panels ---------- */
.panels { padding: var(--s9) 0; }
.panels .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); }
.panel { border: var(--stroke) solid var(--ink); border-radius: 28px; box-shadow: 0 8px 0 var(--ink); padding: var(--s6); display: flex; flex-direction: column; gap: var(--s4); }
.panel:nth-child(1) { background: var(--gold-wash); transform: rotate(-1deg); }
.panel:nth-child(2) { background: var(--teal-wash); transform: rotate(1deg); margin-top: var(--s7); }
.panel h2 { font-size: clamp(30px, 3.2vw, 40px); }
.panel p { color: var(--ink-soft); }
.panel svg { width: 100%; height: auto; margin-top: auto; }

/* ---------- Footer ---------- */
footer { background: var(--night); color: var(--cream); padding: var(--s9) 0 var(--s8); position: relative; overflow: hidden; }
footer .wrap { position: relative; display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--s7); align-items: end; }
footer blockquote { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(34px, 4.4vw, 56px); line-height: 1.1; }
footer cite { display: block; font-style: normal; font-family: var(--text); font-size: 17px; color: var(--lilac); margin-top: var(--s4); }
footer p { color: var(--lilac); font-size: 16px; margin-top: var(--s5); }

/* ---------- Lesson ---------- */
.lesson { position: fixed; inset: 0; z-index: 50; background: var(--paper); display: none; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); overscroll-behavior: contain; }
.lesson.open { display: flex; }
.l-top { max-width: 1000px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: var(--s4); padding: var(--s5) var(--s5) 0; }
.close { width: 48px; height: 48px; flex: none; border: var(--stroke) solid var(--ink); border-radius: 50%; background: var(--paper); cursor: pointer; display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink); }
.close:active { transform: translateY(3px); box-shadow: none; }
.close svg { width: 18px; height: 18px; }
.trail { flex: 1; display: flex; justify-content: center; gap: var(--s2); }
.trail svg { width: 36px; height: 36px; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.trail svg.lit { transform: scale(1.15) rotate(8deg); }
.trail svg path { fill: var(--paper-2); stroke: #d9c9ab; transition: fill .3s, stroke .3s; }
.trail svg.lit path { fill: var(--gold); stroke: var(--ink); }
.l-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.l-inner { max-width: 660px; margin: 0 auto; padding: var(--s6) var(--s5) var(--s6); }
.l-head { display: flex; align-items: center; gap: var(--s3); }
.qplay { width: 44px; height: 44px; flex: none; border: var(--stroke) solid var(--ink); border-radius: 50%; background: var(--sky-wash); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink); padding: 0; }
.qplay:active { transform: translateY(3px); box-shadow: none; }
.qplay svg { width: 24px; height: 24px; }
.l-kind { display: inline-flex; align-items: center; gap: 6px; background: var(--sky-wash); border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 2px 12px 2px 6px; font-size: 15px; font-weight: 500; }
.l-kind svg { width: 20px; height: 20px; }
.l-q { font-size: clamp(28px, 3.8vw, 38px); margin: var(--s4) 0 var(--s6); }
.speaker { display: flex; align-items: flex-end; gap: var(--s3); margin-bottom: var(--s6); }
.speaker svg { width: 104px; flex: none; }
.bubble { position: relative; background: #fff; border: var(--stroke) solid var(--ink); border-radius: var(--r-card); padding: var(--s3) var(--s4); font-size: 19px; margin-bottom: 34px; font-family: var(--display); font-weight: 500; }
.bubble::before { content: ""; position: absolute; left: -11px; bottom: 16px; width: 16px; height: 16px; background: #fff; border-left: var(--stroke) solid var(--ink); border-bottom: var(--stroke) solid var(--ink); transform: rotate(45deg); }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s4); }
.choices:not(:has(svg)) { grid-template-columns: 1fr; max-width: 460px; }
.choice { border: var(--stroke) solid var(--ink); border-radius: var(--r-card); background: #fff; padding: var(--s4); cursor: pointer;
  box-shadow: 0 var(--lip) 0 var(--ink); display: flex; flex-direction: column; align-items: center; gap: var(--s3);
  font-family: var(--display); font-weight: 600; font-size: 20px; text-align: center; transition: transform .08s, box-shadow .08s, background-color .15s; }
.choice svg { width: 90px; height: 90px; }
.choice:nth-child(1) svg { transform: rotate(-4deg); } .choice:nth-child(3) svg { transform: rotate(4deg); }
.choice:active { transform: translateY(var(--lip)); box-shadow: 0 0 0 var(--ink); }
.choice.sel { background: var(--gold-wash); transform: translateY(2px); box-shadow: 0 3px 0 var(--ink); }
.choice.text-only { flex-direction: row; justify-content: flex-start; text-align: left; padding: var(--s4) var(--s5); }
.choice .dot { flex: none; width: 26px; height: 26px; border: var(--stroke) solid var(--ink); border-radius: 50%; background: var(--paper); }
.choice.sel .dot { background: var(--coral); box-shadow: inset 0 0 0 4px var(--paper); }

.lines { position: relative; margin-bottom: var(--s6); }
.answer-line { min-height: 124px; display: flex; flex-wrap: wrap; gap: var(--s2); align-content: flex-start; padding: var(--s2) 0;
  background: repeating-linear-gradient(transparent 0 58px, #d9c9ab 58px 61px); }
.bank { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; }
.tile { border: var(--stroke) solid var(--ink); border-radius: var(--r-pill); background: #fff; padding: 6px 18px; font-family: var(--display); font-weight: 600; font-size: 20px; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.tile:active { transform: translateY(4px); box-shadow: none; }
.answer-line .tile { background: var(--sky-wash); }
.tile.ghost { background: var(--paper-2); border-color: #d9c9ab; color: transparent; box-shadow: none; cursor: default; }
.tile.pop { animation: pop .2s cubic-bezier(.3, 1.6, .5, 1); }
/* build the verse: words already in place, empty slots (the glowing one is next), a wrong tap, Pip's hint */
.answer-line span.tile { cursor: default; box-shadow: 0 3px 0 var(--ink); }
.answer-line .tile.given { background: var(--surface); border-color: var(--line); box-shadow: 0 3px 0 var(--line); color: var(--ink-soft); }
.slot { min-width: 58px; height: 46px; border: var(--stroke) dashed #d9c9ab; border-radius: var(--r-pill); }
.slot.next { border-color: var(--coral); background: var(--coral-wash); animation: slot-glow 1.4s ease-in-out infinite; }
@keyframes slot-glow { 50% { box-shadow: 0 0 0 5px var(--coral-wash); } }
.tile.bad { background: var(--coral-wash); animation: wobble .4s; }
.tile.hint { background: var(--gold); animation: hint-glow 1s ease-in-out infinite; }
@keyframes hint-glow { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 7px var(--gold-wash); } }
.verse-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin: -16px 0 var(--s4); }
.verse-ref { margin: 0; color: var(--ink-soft); }
.hear-verse { min-height: 44px; }
.build-hint { min-height: 1.5em; margin: calc(-1 * var(--s4)) 0 var(--s4); text-align: center; font-family: var(--display); font-weight: 500; font-size: 18px; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .slot.next, .tile.hint, .tile.bad { animation: none; } }
@keyframes pop { from { transform: scale(.7); } to { transform: scale(1); } }

.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.pairs .col { display: grid; gap: var(--s4); }
.pair { border: var(--stroke) solid var(--ink); border-radius: var(--r-card); background: #fff; padding: var(--s4); font-family: var(--display); font-weight: 600; font-size: 20px; cursor: pointer;
  box-shadow: 0 var(--lip) 0 var(--ink); min-height: 68px; transition: background-color .15s, opacity .3s, transform .08s; }
.pair.sel { background: var(--gold-wash); }
.pair.ok { background: var(--teal-wash); }
.pair.gone { opacity: .3; cursor: default; box-shadow: 0 2px 0 var(--ink); transform: translateY(3px); }
.pair.bad { background: var(--coral-wash); animation: wobble .4s; }
@keyframes wobble { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }

.l-foot { padding: 0 var(--s5) calc(max(env(safe-area-inset-bottom, 0px), var(--obscured, 0px)) + var(--toolbar, 0px) + var(--s4)); }
.l-foot .in { max-width: 960px; margin: 0 auto; border: var(--stroke) solid transparent; border-radius: 28px; padding: var(--s4) var(--s5);
  display: flex; align-items: center; gap: var(--s4); min-height: 104px; transition: background-color .2s, border-color .2s; }
.l-foot .msg { display: none; align-items: center; gap: var(--s4); }
.l-foot .msg svg { width: 72px; flex: none; }
.l-foot .msg h3 { font-size: 26px; }
.l-foot .msg p { font-size: 17px; }
.l-foot.right .in { background: var(--teal-wash); border-color: var(--ink); color: var(--teal-ink); }
.l-foot.retry .in { background: var(--coral-wash); border-color: var(--ink); color: var(--retry-ink); }
.l-foot.right .in, .l-foot.retry .in { animation: slideup .3s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } }
.l-foot.right .msg, .l-foot.retry .msg { display: flex; }
.l-foot.right .skip, .l-foot.retry .skip, .l-foot.done .skip { display: none; }
.l-foot #check { min-width: 180px; margin-left: auto; }

/* Story time */
.story { display: grid; gap: var(--s4); justify-items: center; text-align: center; }
.story-art { width: 100%; display: flex; gap: var(--s4); justify-content: center; align-items: flex-end; padding: var(--s5) var(--s4);
  border: var(--stroke) solid var(--ink); border-radius: 28px; box-shadow: 0 var(--lip) 0 var(--ink); }
.story-art.a0 { background: var(--gold-wash); } .story-art.a1 { background: var(--teal-wash); } .story-art.a2 { background: var(--sky-wash); } .story-art.a3 { background: var(--coral-wash); }
.story-art svg { width: 160px; height: 160px; max-width: 45%; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.story-art svg + svg { width: 120px; height: 120px; }
.tell { font-family: var(--display); font-weight: 500; font-size: clamp(22px, 3vw, 28px); line-height: 1.35; max-width: 28ch; text-wrap: balance; }
.niv { margin: 0; background: #fff; border: 2px solid var(--ink); border-radius: var(--r-card); padding: var(--s3) var(--s4); font-size: 18px; max-width: 34em; text-wrap: balance; }
.niv cite { display: block; font-style: normal; color: var(--ink-soft); font-size: 15px; margin-top: 4px; }
.ref { color: var(--ink-soft); font-size: 15px; }
.read { min-height: 48px; font-size: 18px; padding: 0 var(--s5); }
.read[aria-pressed="true"] { --fill: var(--gold-wash); }
.dots { display: flex; gap: var(--s2); justify-content: center; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--paper-2); border: 2px solid #d9c9ab; }
.dots i.on { background: var(--coral); border-color: var(--ink); }
.sabbath { display: none; align-items: center; gap: var(--s2); margin-bottom: var(--s4); background: var(--coral-wash); border: var(--stroke) solid var(--ink);
  border-radius: var(--r-pill); padding: 4px 16px 4px 8px; font-family: var(--display); font-weight: 600; font-size: 18px; }
.sabbath.show { display: inline-flex; }
.sabbath svg { width: 30px; height: 30px; }
.niv-note { font-size: 13px !important; max-width: 60em; }

.done-screen { text-align: center; padding-top: var(--s3); }
.done-screen .big-star { width: 200px; margin: 0 auto; display: block; overflow: visible; }
.done-screen h2 { font-size: 44px; margin-top: var(--s4); }
.done-screen .verse { font-family: var(--display); font-weight: 500; font-size: 22px; margin: var(--s4) auto 0; max-width: 24em; }
.done-screen .verse small { display: block; font-family: var(--text); font-size: 16px; color: var(--ink-soft); margin-top: 6px; }
.chips { display: flex; gap: var(--s3); justify-content: center; margin-top: var(--s6); flex-wrap: wrap; }
.chips span { display: flex; align-items: center; gap: var(--s2); border: var(--stroke) solid var(--ink); border-radius: var(--r-pill); padding: 6px 18px 6px 10px;
  font-family: var(--display); font-weight: 600; font-size: 20px; box-shadow: 0 4px 0 var(--ink); }
.chips svg { width: 28px; height: 28px; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* Phone: one row, wordmark and one control (taste-skill layout §6/§8) */
@media (max-width: 640px) {
  .stats { display: none; }
  .me { display: inline-flex; }
  .top > .wrap { height: 60px; }
}
@media (min-width: 641px) { .menu { display: none !important; } }
@media (max-width: 860px) {
  .hero { padding-top: var(--s6); }
  .hero .wrap, .panels .wrap, footer .wrap { grid-template-columns: 1fr; }
  .hero-art { max-width: 440px; margin: 0 auto; width: 100%; }
  .panel:nth-child(2) { margin-top: 0; }
  .logo { font-size: 23px; } .logo svg { width: 32px; height: 32px; }
  .stat { padding: 2px 10px 2px 6px; font-size: 16px; } .stat svg { width: 22px; height: 22px; }
  .star-node { width: 130px; } .node { width: 74px; height: 74px; } .node svg { width: 40px; height: 40px; } .node-label { font-size: 15px; }
  .l-foot .in { flex-direction: column; align-items: stretch; }
  .l-foot #check { width: 100%; margin-left: 0; }
  .l-foot .skip { display: none; }
  .l-foot .msg svg { width: 56px; }
  .trail svg { width: 28px; height: 28px; }
  .speaker svg { width: 84px; }
  .story-art { padding: var(--s3); } .story-art svg { width: 110px; height: 110px; } .story-art svg + svg { width: 90px; height: 90px; }
  .l-q { margin-bottom: var(--s4); }
  .l-foot.story .in { flex-direction: row; } .l-foot.story .skip { display: inline-flex; padding: 0 var(--s4); } .l-foot.story #check { flex: 1; width: auto; }
  .choices { grid-template-columns: 1fr; }
  .choices:has(svg) { grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
  .choices:has(svg) .choice { padding: var(--s3) var(--s1); font-size: 16px; }
  .choices:has(svg) .choice svg { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
/* The lantern journey: a warm welcome becomes a quiet night sky. */
.motion-tools { margin-top: 16px; }
.motion-toggle { justify-self: end; min-height: 44px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: var(--r-pill); background: var(--paper); color: var(--ink); font: 500 14px var(--text); cursor: pointer; }
.motion-toggle:hover { background: var(--gold-wash); }
.hero-art { --nightfall: 0; }
.hero-art > svg { overflow: hidden; }
.scene-sun { transform: translateY(calc(var(--nightfall) * 140px)); opacity: calc(1 - var(--nightfall)); }
.scene-moon { opacity: var(--nightfall); }
.fireflies { opacity: var(--nightfall); }
.fireflies circle { animation: firefly-drift 5s ease-in-out infinite alternate; }
.fireflies circle:nth-child(2n) { animation-delay: -2s; animation-duration: 6s; }
.hero-pip .pip-eyes { transform-origin: 112px 102px; animation: pip-blink 6s infinite; }
.hero-pip .pip-lantern { transform-origin: 186px 116px; animation: lantern-swing 3.8s ease-in-out infinite; }
.motion-ready .pip-arrival { animation: pip-arrive 800ms cubic-bezier(.16,1,.3,1) both; }
.motion-ready .hero-pip .pip-leg { transform-box: fill-box; transform-origin: top; animation: pip-step 200ms ease-in-out 4 alternate; }
.motion-ready .hero-pip .pip-leg:nth-child(2) { animation-direction: alternate-reverse; }
.motion-off *, .motion-sleep *, .motion-outside * { animation-play-state: paused !important; }
.motion-off { scroll-behavior: auto; }
@keyframes pip-arrive { from { transform: translateX(-65px); } to { transform: translateX(0); } }
@keyframes pip-step { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@keyframes lantern-swing { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes pip-blink { 0%,43%,47%,100% { transform: scaleY(1); } 45% { transform: scaleY(.08); } }
@keyframes firefly-drift { from { transform: translate(0,0); } to { transform: translate(10px,-16px); } }
::selection { background: var(--gold); color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  .scene-sun { transform: none; }
}


/* ============================================================
   Open Design reader + sound check (2026-10-16)
   White canvas, cream surfaces, thin borders; gold for the one main action.
   ============================================================ */
.btn.soft { --fill: #fff; border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.soft:hover { box-shadow: 0 4px 0 var(--line); }
.btn.soft:active { box-shadow: 0 0 0 var(--line); }
.btn:disabled { opacity: .55; }

/* Story time reads like a book: page label in the bar, quiet art, plain text, thin quote card */
.reading-label { display: none; margin: 0; flex: 1; text-align: center; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.close-label { display: none; }
.lesson.reading .trail { display: none; }
.lesson.reading .reading-label { display: block; }
.lesson.reading .l-top { border-bottom: 1px solid var(--line); padding-bottom: var(--s3); }
.lesson.reading .close { width: auto; padding: 0 14px; gap: 8px; border-radius: var(--r-card); border: 2px solid var(--line); box-shadow: none; display: flex; align-items: center; font-family: var(--display); font-weight: 600; font-size: 15px; }
.lesson.reading .close-label { display: inline; }
.lesson.reading .l-top .mute { border: 2px solid var(--line); box-shadow: none; background: #fff; }
.lesson.reading .reader-title { text-align: center; margin: var(--s2) 0 var(--s5); font-size: clamp(28px, 4vw, 38px); }
.lesson.reading .story-art { background: var(--surface); border: 0; box-shadow: none; border-radius: 24px; padding: var(--s5); min-height: 160px; align-items: center; }
.lesson.reading .tell { font-family: var(--text); font-weight: 400; font-size: clamp(19px, 2.5vw, 24px); line-height: 1.6; max-width: 42ch; }
.lesson.reading .niv { border: 1px solid var(--line); border-radius: 16px; padding: 16px 22px; font-size: 16px; line-height: 1.7; max-width: 52ch; }
.lesson.reading .niv cite { font-size: 13px; }
.read-hint { margin: 0; font-size: 13px; color: var(--ink-soft); }
.dots i { width: 9px; height: 9px; border: 1px solid var(--line); background: var(--surface); }
.dots i.on { background: var(--line); border-color: var(--line); }
.dots i.current { background: var(--ink); border-color: var(--ink); }
.lesson.reading .l-foot { border-top: 1px solid var(--line); padding-top: var(--s3); }
.lesson.reading .l-foot .skip { --fill: #fff; border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.lesson.reading #check { --fill: var(--gold); }

/* Sound check */
.hear-card { position: relative; border: 2px solid var(--line); box-shadow: 0 20px 70px rgba(43, 34, 80, .2); padding: 30px 24px 22px; gap: var(--s2); background: #fff; }
.hear-close { position: absolute; right: 14px; top: 14px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; }
.hear-close svg { width: 16px; height: 16px; }
.hear-pip { width: 100px; }
.hear-card h2 { font-size: 32px; margin-top: var(--s2); }
.hear-card > p { color: var(--ink); font-size: 16px; }
.hear-card .btn { width: 100%; min-height: 52px; font-size: 18px; }
.hear-hint { margin: 2px 0 6px; font-size: 14px; color: var(--ink-soft) !important; min-height: 2.6em; }
.hear-ios { display: none; gap: 10px; align-items: flex-start; text-align: left; margin: 0 0 6px; padding: 10px 14px; border-radius: 16px; background: var(--surface); font-size: 14px !important; line-height: 1.45; }
.is-ios .hear-ios { display: flex; }
.hear-ios svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.hear-note { margin: 0; font-size: 13px !important; color: var(--ink-soft) !important; }
.hear-skip { color: var(--ink); }
@media (max-width: 640px) {
  .lesson.reading .close { padding: 0 10px; font-size: 14px; }
  .lesson.reading .story-art { min-height: 120px; padding: var(--s3); }
  .lesson.reading .tell { font-size: 19px; }
  .lesson.reading .niv { padding: 14px; font-size: 15px; }
}
@media (max-width: 640px) {
  /* Open Design's phone footer: a narrow secondary button and a wide main one */
  .lesson.reading .l-foot.story .in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s3); }
  .lesson.reading .l-foot .btn { width: 100%; min-height: 52px; padding: 0 var(--s3); font-size: 17px; line-height: 1.2; white-space: normal; text-align: center; }
}

/* The game page only ever shows a story (the map is the journey on the landing page), so the old
   night-sky page behind the sound check and the reader stays hidden. Tests still use its markup. */
body.story-only > header, body.story-only > main, body.story-only > footer { display: none; }
body.story-only { background: #fff; min-height: 100svh; }
/* The sound check sits over the story's first page: dim it and soften it, keep it recognisable */
.hear { background: rgba(34, 26, 72, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
/* "Keep Little Light on your phone" on the finish screen */
.keep-app { margin-top: var(--s5); min-height: 50px; font-size: 17px; }
.keep-app svg { width: 22px; height: 22px; }
/* "Welcome back! We saved your place." Sits under the top bar, in the flow, until the child's first tap */
.resume-note { align-self: center; margin: var(--s3) var(--s4) 0; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; max-width: calc(100% - 32px);
  background: var(--gold-wash); border: 2px solid var(--ink); border-radius: var(--r-pill); box-shadow: 0 3px 0 var(--ink);
  font-family: var(--display); font-weight: 500; font-size: 16px; animation: slideup .3s cubic-bezier(.3, 1.4, .5, 1); }
.resume-note svg { width: 20px; height: 20px; flex: none; color: var(--coral); }
.resume-note button { min-height: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: var(--r-pill); background: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
@media (max-width: 640px) { .resume-note { font-size: 14px; } }
