/* ════════════════════════════════════════════════════════
   Ten Frame Fable — night meadow, lantern rack, fireflies
   ════════════════════════════════════════════════════════
   All art is CSS (gradients, shadows, glyphs) — no image assets.
   Layout is fluid (clamp/vmin) so it holds in both iPad orientations.
*/

:root {
  --jar: clamp(52px, 9.2vmin, 92px);
  --answer: clamp(46px, 7vmin, 66px);
  --gold: #ffd166;
  --gold-deep: #f5a623;
  --blue: #7cc4ff;
  --lavender: #c9b8ff;
  --ink: #f4f1e8;
  --panel: rgba(16, 20, 44, 0.62);
  --panel-line: rgba(255, 255, 255, 0.14);
  --dim-ms: 550ms;
}

* { box-sizing: border-box; }

/* Several flex/grid display rules below would silently beat the UA's
   [hidden] { display: none } — keep the attribute authoritative. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #0b0e22 0%, #141831 38%, #1d2447 72%, #232a52 100%);
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ─── Night backdrop ──────────────────────────────────── */
.night { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.stars {
  position: absolute; inset: 0;
  width: 2px; height: 2px; border-radius: 50%;
  background: transparent;
}
.stars-a {
  box-shadow:
    8vw 12vh 0 0 #fff8, 22vw 6vh 0 1px #fff6, 31vw 18vh 0 0 #fff7,
    44vw 9vh 0 0 #fff5, 57vw 14vh 0 1px #fff8, 66vw 5vh 0 0 #fff6,
    74vw 19vh 0 0 #fff7, 83vw 8vh 0 0 #fff5, 91vw 16vh 0 1px #fff7,
    13vw 26vh 0 0 #fff5, 38vw 24vh 0 0 #fff6, 52vw 28vh 0 0 #fff4,
    71vw 27vh 0 0 #fff6, 88vw 30vh 0 0 #fff5, 5vw 34vh 0 0 #fff4;
  animation: twinkle-a 5.5s ease-in-out infinite;
}
.stars-b {
  box-shadow:
    16vw 9vh 0 0 #fff5, 27vw 13vh 0 0 #fff4, 41vw 17vh 0 0 #fff6,
    49vw 4vh 0 0 #fff5, 62vw 22vh 0 0 #fff4, 79vw 12vh 0 0 #fff6,
    94vw 7vh 0 0 #fff5, 9vw 21vh 0 0 #fff4, 35vw 31vh 0 0 #fff5,
    59vw 33vh 0 0 #fff4, 81vw 24vh 0 0 #fff5;
  animation: twinkle-a 7s ease-in-out infinite reverse;
}
@keyframes twinkle-a {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.45; }
}

.moon {
  position: absolute;
  top: 7vh; right: 9vw;
  width: clamp(40px, 6vmin, 64px); height: clamp(40px, 6vmin, 64px);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fffbe9 0%, #f2ecd0 55%, #d8d2b4 100%);
  box-shadow: 0 0 36px 8px rgba(255, 250, 224, 0.18);
  opacity: 0.9;
}

.meadow {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22vh;
  background:
    radial-gradient(120% 100% at 50% 110%, rgba(46, 84, 56, 0.55) 0%, rgba(30, 56, 42, 0.35) 55%, transparent 100%);
}

/* Ambient drifting fireflies (pure decoration) */
.drifter {
  position: absolute;
  color: var(--gold);
  font-size: 13px;
  text-shadow: 0 0 8px var(--gold), 0 0 18px rgba(255, 209, 102, 0.6);
  opacity: 0;
  animation: drift 16s ease-in-out infinite;
}
.d-1 { left: 12vw; top: 58vh; animation-delay: 0s; }
.d-2 { left: 78vw; top: 48vh; animation-delay: 5.4s; animation-duration: 19s; }
.d-3 { left: 46vw; top: 70vh; animation-delay: 10s; animation-duration: 14s; }
@keyframes drift {
  0%   { transform: translate(0, 0); opacity: 0; }
  12%  { opacity: 0.85; }
  35%  { transform: translate(6vw, -8vh); opacity: 0.3; }
  55%  { transform: translate(11vw, -3vh); opacity: 0.8; }
  80%  { transform: translate(16vw, -10vh); opacity: 0.25; }
  100% { transform: translate(20vw, -13vh); opacity: 0; }
}

/* ─── HUD ─────────────────────────────────────────────── */
.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  padding: clamp(8px, 1.6vmin, 16px) clamp(10px, 2vmin, 20px) 0;
}

.hud-btn {
  display: flex; align-items: center; justify-content: center;
  width: clamp(40px, 5.4vmin, 52px); height: clamp(40px, 5.4vmin, 52px);
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  color: var(--ink);
  font-size: clamp(18px, 2.6vmin, 24px);
  text-decoration: none;
  cursor: pointer;
}
.hud-btn:active { transform: scale(0.94); }

/* ─── Lantern string + catch readout ─────────────────── */
.string-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: clamp(64px, 9vmin, 92px);
}

.catch-readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.catch-total {
  font-size: clamp(22px, 3.4vmin, 32px);
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.35);
}
.catch-total.is-bumped { animation: bump 0.5s ease; }
.catch-decomp {
  font-size: clamp(12px, 1.8vmin, 15px);
  color: rgba(244, 241, 232, 0.66);
}
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.lantern-string {
  position: relative;
  display: flex;
  gap: clamp(6px, 1.1vmin, 12px);
  padding: 6px 14px 2px;
  transition: transform 1.2s ease-in, opacity 1.2s ease-in;
}
.lantern-string.is-ascending {
  transform: translateY(-90px) scale(0.88);
  opacity: 0;
}
.lantern-string.is-returning {
  transition: none;
  animation: string-return 0.5s ease-out;
}
@keyframes string-return {
  from { transform: translateY(26px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.string-rope {
  position: absolute;
  left: 4px; right: 4px; top: 10px;
  height: 14px;
  border-top: 2px solid rgba(214, 192, 148, 0.4);
  border-radius: 50% / 100% 100% 0 0;
  transform: scaleY(-1);
}

.lantern {
  position: relative;
  width: clamp(18px, 2.8vmin, 28px);
  height: clamp(22px, 3.4vmin, 34px);
  border-radius: 28% 28% 38% 38%;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  margin-top: 8px;
}
.lantern::before { /* cap + hanger */
  content: '';
  position: absolute;
  top: -7px; left: 50%;
  width: 45%; height: 5px;
  transform: translateX(-50%);
  border-radius: 3px 3px 0 0;
  background: rgba(214, 192, 148, 0.45);
}
.lantern.is-lit {
  background: radial-gradient(circle at 50% 42%, #fff3c4 0%, var(--gold) 52%, var(--gold-deep) 100%);
  border-color: rgba(255, 226, 150, 0.85);
  box-shadow: 0 0 14px 3px rgba(255, 209, 102, 0.5);
}
.lantern.is-popping { animation: lantern-pop 0.5s ease; }
@keyframes lantern-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

.constellation { position: absolute; inset: 0; pointer-events: none; }
.c-star {
  position: absolute;
  top: 30%;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 0 10px #fff8;
  opacity: 0;
  animation: c-twinkle 1.3s ease-out forwards;
}
@keyframes c-twinkle {
  0%   { opacity: 0; transform: translateY(8px) scale(0.5); }
  35%  { opacity: 1; transform: translateY(-10px) scale(1.25); }
  100% { opacity: 0; transform: translateY(-26px) scale(0.7); }
}

/* ─── User panel / level pill (house pattern, night dress) ── */
.user-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.level-display {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
}
.level-label {
  font-size: clamp(11px, 1.6vmin, 13px);
  font-weight: 600;
  color: rgba(244, 241, 232, 0.6);
}
.level-num {
  font-size: clamp(16px, 2.4vmin, 20px);
  font-weight: 700;
  color: var(--gold);
}
.level-num.is-bumped { animation: bump 0.6s ease; }
.level-heat { display: flex; gap: 4px; }
.heat-pip {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.25s ease;
}
.heat-pip.is-lit {
  background: var(--gold);
  box-shadow: 0 0 8px 1px rgba(255, 209, 102, 0.55);
}
.heat-pip.is-just-lit { animation: pip-pop 0.45s ease; }
@keyframes pip-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.8); }
  100% { transform: scale(1); }
}

/* ─── Play column ─────────────────────────────────────── */
.play {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vmin, 26px);
  padding: 0 16px clamp(10px, 2vmin, 20px);
  min-height: 0;
}

/* ─── Prompt card ─────────────────────────────────────── */
.prompt-wrap { display: flex; justify-content: center; }
.prompt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: clamp(8px, 1.6vmin, 14px) clamp(20px, 3.4vmin, 34px);
  border-radius: 22px;
  background: var(--panel);
  border: 1.5px solid var(--panel-line);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.prompt-card[data-kind="count"] { --accent: var(--gold); }
.prompt-card[data-kind="more"]  { --accent: var(--blue); }
.prompt-card[data-kind="teen"]  { --accent: var(--lavender); }
.prompt-card.is-solved {
  border-color: rgba(159, 208, 122, 0.7);
  box-shadow: 0 0 22px rgba(159, 208, 122, 0.25);
}

.prompt-row {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.6vmin, 16px);
  min-height: clamp(40px, 6vmin, 58px);
}
.prompt-row > span { transition: opacity 0.18s ease, transform 0.18s ease; }

.p-op {
  font-size: clamp(20px, 3.4vmin, 32px);
  font-weight: 600;
  color: rgba(244, 241, 232, 0.65);
}
.p-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(38px, 5.6vmin, 54px);
  height: clamp(38px, 5.6vmin, 54px);
  padding: 0 10px;
  border-radius: 14px;
  font-size: clamp(20px, 3.4vmin, 32px);
  font-weight: 700;
}
.p-seen {
  color: var(--gold);
  background: rgba(255, 209, 102, 0.12);
  border: 1.5px solid rgba(255, 209, 102, 0.45);
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.7);
}
.p-target, .p-ten {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.p-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(44px, 6.4vmin, 62px);
  height: clamp(44px, 6.4vmin, 62px);
  border-radius: 16px;
  font-size: clamp(24px, 4.2vmin, 40px);
  font-weight: 700;
  color: var(--accent, var(--gold));
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed var(--accent, var(--gold));
  animation: blank-breathe 2.2s ease-in-out infinite;
}
.is-solved .p-blank {
  border-style: solid;
  border-color: #9fd07a;
  color: #c9efa9;
  animation: none;
}
@keyframes blank-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 0 14px 2px color-mix(in srgb, var(--accent, #ffd166) 35%, transparent); }
}

.is-flipping { opacity: 0; transform: translateY(8px) scale(0.8); }
.is-flipped-in { animation: flip-in 0.26s ease; }
@keyframes flip-in {
  from { opacity: 0; transform: translateY(-10px) scale(1.25); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Teen merge: "10 + 4" pulls together, then the teen numeral pops in */
.prompt-row.is-merging > span {
  transition: transform 0.45s ease-in, opacity 0.45s ease-in;
}
.prompt-row.is-merging > span:first-child { transform: translateX(26px); }
.prompt-row.is-merging > .p-op { opacity: 0; transform: scale(0.4); }
.prompt-row.is-merging > [data-role="blank"] { transform: translateX(-26px); }
.p-teen-result {
  font-size: clamp(34px, 5.6vmin, 54px);
  font-weight: 700;
  color: var(--lavender);
  text-shadow: 0 0 16px rgba(201, 184, 255, 0.5);
  animation: flip-in 0.32s ease;
}

.prompt-caption {
  font-size: clamp(13px, 2vmin, 17px);
  font-weight: 500;
  color: rgba(244, 241, 232, 0.7);
}

/* ─── The caught ten (teen rounds) ────────────────────── */
.caught-ten {
  display: flex;
  gap: clamp(4px, 0.8vmin, 8px);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.07);
  border: 1px solid rgba(255, 209, 102, 0.28);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.12);
}
.mini-lantern {
  width: clamp(10px, 1.8vmin, 16px);
  height: clamp(12px, 2.2vmin, 20px);
  border-radius: 30% 30% 40% 40%;
  background: radial-gradient(circle at 50% 42%, #fff3c4 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 0 8px 1px rgba(255, 209, 102, 0.45);
}

/* ─── The rack (ten-frame of jars) ────────────────────── */
.rack-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.rack {
  display: grid;
  grid-template-columns: repeat(5, var(--jar));
  grid-template-rows: repeat(2, var(--jar));
  gap: clamp(8px, 1.4vmin, 14px);
  padding: clamp(12px, 2vmin, 20px);
  border-radius: 26px;
  background:
    linear-gradient(180deg, #6a543c 0%, #57432f 55%, #483626 100%);
  border: 2px solid rgba(35, 25, 14, 0.7);
  box-shadow:
    inset 0 2px 0 rgba(255, 240, 210, 0.14),
    inset 0 -3px 8px rgba(0, 0, 0, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.45);
  touch-action: none;
}

.jar {
  position: relative;
  border-radius: 30% 30% 38% 38% / 24% 24% 42% 42%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.06) 60%, rgba(255, 255, 255, 0.11) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.25);
}
.jar::before { /* glass highlight */
  content: '';
  position: absolute;
  top: 9%; left: 14%;
  width: 18%; height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent);
}
.jar::after { /* cork lid */
  content: '';
  position: absolute;
  top: -6px; left: 50%;
  width: 44%; height: 7px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: linear-gradient(180deg, #b08d5e, #8a6a42);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.firefly {
  position: absolute;
  left: 50%; top: 54%;
  width: 42%; height: 42%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #fffceb 0%, #ffe9a3 38%, var(--gold) 68%, rgba(245, 166, 35, 0.0) 100%);
  box-shadow:
    0 0 12px 4px rgba(255, 217, 120, 0.65),
    0 0 30px 10px rgba(255, 209, 102, 0.28);
  opacity: 1;
  transition: opacity var(--dim-ms) ease;
}
.firefly.is-glowing { animation: flicker var(--flicker-dur, 3.4s) ease-in-out infinite; }
@keyframes flicker {
  0%, 100% { filter: brightness(1); transform: translate(-50%, -50%) scale(1); }
  45% { filter: brightness(0.82); transform: translate(-50%, -50%) scale(0.94); }
  60% { filter: brightness(1.12); transform: translate(-50%, -50%) scale(1.04); }
}
.firefly.is-arriving { animation: swirl-in 0.48s ease-out; }
@keyframes swirl-in {
  0% {
    transform: translate(calc(-50% + var(--fx, 60px)), calc(-50% + var(--fy, -80px))) scale(0.35);
    opacity: 0;
  }
  55% {
    transform: translate(calc(-50% + var(--fx, 60px) * 0.22), calc(-50% + var(--fy, -80px) * 0.3 - 12px)) scale(0.8);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}
/* Newcomers (the MORE answer flying in) glow cooler so the operand split
   n + (10−n) stays visible in the completed frame. */
.firefly.is-newcomer {
  background: radial-gradient(circle at 45% 40%, #f2fbff 0%, #c9e9ff 38%, var(--blue) 68%, rgba(60, 140, 220, 0) 100%);
  box-shadow:
    0 0 12px 4px rgba(150, 208, 255, 0.6),
    0 0 30px 10px rgba(124, 196, 255, 0.26);
}

/* The flash: glow dims to dark. Peeks/mercy/celebration bring it back. */
.rack.is-dim .firefly { opacity: 0; }
.rack.is-dim.is-peeking .firefly,
.rack.is-dim.is-mercy .firefly,
.rack.is-dim.is-celebrating .firefly { opacity: 1; }

.rack.is-dim { cursor: pointer; }

.peek-hint {
  font-size: clamp(11px, 1.7vmin, 14px);
  color: rgba(244, 241, 232, 0.42);
  letter-spacing: 0.04em;
}

/* ─── Answers ─────────────────────────────────────────── */
.answers-wrap { display: flex; justify-content: center; width: 100%; }
.answers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(6px, 1.2vmin, 12px);
  transition: opacity 0.25s ease;
}
.answers.is-locked { opacity: 0.45; pointer-events: none; }

.answer-btn {
  width: var(--answer);
  height: var(--answer);
  border-radius: 18px;
  border: 1.5px solid var(--panel-line);
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(20px, 3.2vmin, 30px);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
}
.answer-btn:active { transform: scale(0.92); }
.answer-btn.is-wrong {
  animation: shake 0.4s ease;
  opacity: 0.35;
  border-color: rgba(255, 120, 120, 0.5);
}
.answer-btn.is-correct {
  background: radial-gradient(circle at 50% 38%, #fff3c4 0%, var(--gold) 70%);
  border-color: rgba(255, 226, 150, 0.9);
  color: #4a3206;
  box-shadow: 0 0 18px 4px rgba(255, 209, 102, 0.45);
}
.answer-btn.is-coach { animation: coach-pulse 1.1s ease-in-out infinite; }
@keyframes coach-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); transform: scale(1); }
  50% { box-shadow: 0 0 16px 4px rgba(255, 209, 102, 0.55); transform: scale(1.08); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* ─── Glints (fireflies streaming to the lantern) ─────── */
.glint {
  position: fixed;
  z-index: 30;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffceb 0%, var(--gold) 70%);
  box-shadow: 0 0 10px 3px rgba(255, 209, 102, 0.6);
  pointer-events: none;
  animation: glint-fly 0.6s cubic-bezier(0.3, 0, 0.7, 1) forwards;
}
@keyframes glint-fly {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.5); opacity: 0.15; }
}

/* ─── Level-up overlay (house pattern, night dress) ───── */
.level-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 26, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: overlay-in 0.25s ease;
}
.level-up-overlay.is-leaving { animation: overlay-out 0.32s ease forwards; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-out { from { opacity: 1; } to { opacity: 0; } }

.lvl-up-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 56px;
  border-radius: 28px;
  background: linear-gradient(180deg, #232a52 0%, #1a2042 100%);
  border: 2px solid rgba(255, 209, 102, 0.5);
  box-shadow: 0 0 50px rgba(255, 209, 102, 0.25);
  animation: card-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes card-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.lvl-up-banner {
  font-size: clamp(16px, 2.6vmin, 22px);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.06em;
}
.lvl-up-number {
  font-size: clamp(56px, 10vmin, 92px);
  font-weight: 700;
  color: var(--ink);
  text-shadow: 0 0 26px rgba(255, 209, 102, 0.55);
  animation: bump 0.7s ease 0.2s;
}
.lvl-up-sparkles { position: absolute; inset: -18px; pointer-events: none; }
.lus {
  position: absolute;
  font-size: 20px;
  animation: lus-float 1.8s ease-in-out infinite;
}
.lus-1 { left: 6%; top: 12%; }
.lus-2 { right: 8%; top: 8%; animation-delay: 0.3s; }
.lus-3 { left: 12%; bottom: 10%; animation-delay: 0.6s; }
.lus-4 { right: 14%; bottom: 16%; animation-delay: 0.9s; }
.lus-5 { left: 48%; top: -4%; animation-delay: 0.45s; }
.lus-6 { left: 50%; bottom: -6%; animation-delay: 0.75s; }
@keyframes lus-float {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.9; }
  50% { transform: translateY(-8px) scale(1.2); opacity: 0.5; }
}

/* ─── Portrait & small screens ────────────────────────── */
@media (orientation: portrait) {
  :root {
    --jar: clamp(48px, 13vw, 84px);
    /* Sized so all 11 numerals hold one row — a strip that wraps reads
       as a mistake and breaks the fixed spatial layout kids learn. */
    --answer: clamp(38px, 6.6vw, 56px);
  }
  .answers { gap: clamp(4px, 1vw, 8px); }
}

@media (max-height: 560px) {
  :root { --jar: clamp(40px, 8vmin, 64px); --answer: clamp(38px, 6vmin, 52px); }
  .play { gap: 8px; }
}

/* ─── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .drifter, .stars-a, .stars-b { animation: none; }
  .firefly.is-glowing { animation: none; }
  .p-blank { animation: none; }
  .lantern-string,
  .lantern-string.is-ascending { transition: none; }
}
