/* ================================================================
   FUNDA design system — "sunrise study"
   Warm, calm, grown-up-but-friendly. NOT cartoonish primary colours.
   Andika (SIL literacy font, single-storey a/g for early readers)
   for body + word display; Baloo 2 for warm display headings.
   Mobile-first, 56px+ touch targets, high contrast.
   ================================================================ */

:root {
  --paper:    #faf4e8;   /* warm paper */
  --paper-2:  #f3e9d6;
  --ink:      #2a2622;   /* near-black warm charcoal */
  --ink-soft: #6b6156;
  --teal:     #0f5c5a;   /* deep calm teal — primary */
  --teal-2:   #14807d;
  --ochre:    #e08a2b;   /* warm accent */
  --ochre-2:  #f0a94a;
  --coral:    #d9564b;   /* gentle wrong */
  --leaf:     #4a9d5b;   /* gentle right */
  --sky-1:    #ffd89b;
  --sky-2:    #f6b06a;
  --sky-3:    #e88a5a;
  --card:     #fffdf8;
  --shadow:   0 8px 24px rgba(60, 40, 20, .14);
  --shadow-lg:0 18px 48px rgba(60, 40, 20, .22);
  --radius:   22px;
  --tap: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Andika', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  user-select: none;
}

/* ---------- ambient sunrise ---------- */
.sky { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: linear-gradient(180deg, var(--sky-1) 0%, #fbe2bd 34%, var(--paper) 68%); }
.sun {
  position: absolute; top: 8%; left: 50%; transform: translateX(-50%);
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, #fff3d6 0%, var(--sky-2) 55%, rgba(246,176,106,0) 72%);
  filter: blur(2px); animation: sunPulse 7s ease-in-out infinite alternate;
}
@keyframes sunPulse { from { opacity:.75; transform: translateX(-50%) scale(.98);} to { opacity:1; transform: translateX(-50%) scale(1.04);} }
.hills {
  position: absolute; left: -5%; right: -5%; bottom: 0; height: 34vh;
  background:
    radial-gradient(120% 90% at 20% 100%, #d9b98a 0 40%, transparent 41%),
    radial-gradient(120% 80% at 78% 100%, #cdaa78 0 40%, transparent 41%),
    linear-gradient(180deg, transparent, rgba(180,150,110,.25));
  opacity: .5;
}
@media (prefers-reduced-motion: reduce) { .sun { animation: none; } }

/* ---------- header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(250, 244, 232, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(120, 90, 60, .12);
}
.brand { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(150deg, var(--teal-2), var(--teal));
  color: #fff; font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.3rem;
  box-shadow: var(--shadow);
}
.brand-mark.xl { width: auto; height: auto; background: none; box-shadow: none;
  color: var(--teal); display: inline; font-size: inherit; }
.brand-name { font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 1.35rem; color: var(--teal); }
.header-right { display: flex; align-items: center; gap: 8px; }
.chip {
  min-width: 46px; height: 46px; padding: 0 12px;
  border: none; border-radius: 14px; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 1.2rem; font-family: 'Baloo 2', cursive; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .12s ease;
}
.chip:active { transform: scale(.93); }
.stars-chip { color: var(--ochre); font-size: 1.05rem; }
.lang-switch { gap: 3px; }
.lang-code { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: .95rem; color: var(--teal); }
.reset-chip { font-size: 1.1rem; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; top: 72px; z-index: 40;
  transform: translateX(-50%) translateY(-14px);
  background: var(--ink); color: #fff;
  font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 1.05rem;
  padding: 10px 22px; border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- modal (reset confirm) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; padding: 22px;
  background: rgba(42, 38, 34, .5); backdrop-filter: blur(4px);
}
.modal-backdrop.show { display: flex; animation: fadeUp .2s ease; }
.modal {
  background: var(--card); border-radius: var(--radius); padding: 30px 26px;
  max-width: 380px; width: 100%; text-align: center; box-shadow: var(--shadow-lg);
  animation: popIn .32s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from { transform: scale(.85); opacity: 0; } }
.modal-emoji { font-size: 3rem; }
.modal-title { font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 1.5rem; color: var(--ink); margin-top: 8px; }
.modal-body { color: var(--ink-soft); margin: 8px 0 22px; font-size: 1rem; line-height: 1.4; }
.modal-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- current-language marker in picker ---------- */
.lang-choice.current { border-color: var(--leaf); background: linear-gradient(160deg, #fff, #eefaf0); }
.lc-check { position: absolute; top: 16px; right: 20px; color: var(--leaf); font-weight: 800; font-size: 1.4rem; }
.lang-choice { position: relative; }

/* ---------- screens ---------- */
main { position: relative; z-index: 1; flex: 1; display: flex; }
.screen { display: none; width: 100%; }
.screen.active { display: block; animation: fadeUp .32s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }

/* ---------- language picker ---------- */
.lang-hero { max-width: 620px; margin: 0 auto; padding: 8vh 22px 40px; text-align: center; }
.big-logo { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: clamp(3.4rem, 14vw, 5.5rem);
  color: var(--teal); letter-spacing: -.02em; line-height: 1; }
.hero-tag { margin-top: 18px; font-family: 'Baloo 2', cursive; font-weight: 600;
  font-size: clamp(1.3rem, 5vw, 1.9rem); color: var(--ink); }
.hero-sub { margin-top: 4px; color: var(--ink-soft); font-size: 1.05rem; }
.lang-choices { margin-top: 34px; display: grid; gap: 16px; }
.lang-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 20px 24px; border: 3px solid transparent; border-radius: var(--radius); cursor: pointer;
  background: var(--card); box-shadow: var(--shadow); text-align: left;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.lang-choice:hover { transform: translateY(-4px); border-color: var(--ochre-2); box-shadow: var(--shadow-lg); }
.lang-choice:active { transform: scale(.98); }
.lc-hi { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.9rem; color: var(--teal); }
.lc-name { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.lc-note { margin-top: 6px; font-size: .82rem; color: var(--ink-soft);
  background: rgba(224,138,43,.12); padding: 3px 10px; border-radius: 999px; }

/* ---------- home / skill map ---------- */
.home-inner { max-width: 940px; margin: 0 auto; padding: 20px 18px 40px; }
.mission-cta {
  display: block; width: 100%; max-width: 560px; margin: 6px auto 8px;
  padding: 22px 28px; border: none; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(150deg, var(--ochre-2), var(--ochre));
  color: #fff; font-family: 'Baloo 2', cursive; font-weight: 800;
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  box-shadow: 0 12px 30px rgba(224,138,43,.4);
  transition: transform .14s ease;
}
.mission-cta:hover { transform: translateY(-3px) scale(1.01); }
.mission-cta:active { transform: scale(.97); }
.practice-label { text-align: center; color: var(--ink-soft); margin: 20px 0 12px; font-size: 1.05rem; }

.track { margin-bottom: 26px; }
.track-title { font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 1.35rem;
  color: var(--teal); margin-bottom: 12px; padding-left: 4px; }
.skill-nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.skill-node {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px 14px; border: none; border-radius: 18px; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow); min-height: 128px;
  transition: transform .14s ease, box-shadow .14s ease;
}
.skill-node:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.skill-node:active { transform: scale(.97); }
.skill-node.locked { opacity: .55; filter: grayscale(.4); cursor: default; }
.sn-icon { font-size: 2.5rem; line-height: 1; }
.sn-name { font-weight: 700; font-size: 1rem; text-align: center; color: var(--ink); }
.sn-bar { width: 78%; height: 8px; border-radius: 99px; background: rgba(120,90,60,.16); overflow: hidden; margin-top: auto; }
.sn-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--leaf), var(--teal-2)); transition: width .5s ease; }
.sn-badge { position: absolute; top: 8px; right: 10px; font-size: 1.1rem; }

/* ---------- mission ---------- */
.mission-top { max-width: 780px; margin: 0 auto; padding: 14px 18px 4px; text-align: center; }
.mission-label { font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 1.2rem; color: var(--teal); }
.q-progress { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.q-dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(120,90,60,.2); }
.q-dot.done { background: var(--leaf); }
.q-dot.now { background: var(--ochre); box-shadow: 0 0 0 4px rgba(224,138,43,.22); }

.question-stage {
  max-width: 780px; margin: 8px auto; padding: 20px 18px 8px;
  min-height: 46vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 22px; text-align: center;
  border-radius: 26px; transition: background .2s ease;
}
.question-stage.flash-ok { animation: flashOk .7s ease; }
.question-stage.flash-no { animation: flashNo .5s ease; }
@keyframes flashOk { 0%,100%{background:transparent;} 30%{background:rgba(74,157,91,.16);} }
@keyframes flashNo { 0%,100%{background:transparent;} 25%,75%{background:rgba(217,86,75,.12);} }

/* ---------- prompts / stage content ---------- */
.counters { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 560px; }
.counters.small { gap: 7px; }
.counter {
  font-size: clamp(2.2rem, 9vw, 3.2rem); line-height: 1; cursor: pointer; border: none; background: none;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.15)); transition: transform .12s ease;
  position: relative;
}
.counters.small .counter { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.counter:active { transform: scale(.9); }
.counter.counted::after {
  content: attr(data-n); position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; border-radius: 50%; background: var(--teal); color: #fff;
  font-family: 'Baloo 2', cursive; font-size: .85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.counter.counted { transform: translateY(-4px); }
.counter.hl { animation: pop .4s ease; }
.counter.static { cursor: default; }
.counter.fade { opacity: .18; transform: scale(.8); transition: all .5s ease; }
.counter.hiddenbox { filter: none; }
@keyframes pop { 50% { transform: scale(1.3); } }

/* ten-frame */
.tenframe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px;
  background: #fff; padding: 8px; border-radius: 14px; box-shadow: var(--shadow); }
.tenframe.mini { transform: scale(.6); margin: -8px; }
.tf-cell { width: 40px; height: 40px; border: 2px solid rgba(120,90,60,.25); border-radius: 8px; }
.tf-cell.full { background: radial-gradient(circle at 40% 35%, var(--ochre-2), var(--ochre)); border-color: transparent; }
.tf-cell.gap { border-style: dashed; border-color: var(--coral); }

/* dot card (subitizing) */
.dotcard { position: relative; width: min(58vw, 260px); aspect-ratio: 1; background: #fff;
  border-radius: 20px; box-shadow: var(--shadow); transition: opacity .18s ease; }
.dotcard.hidden { opacity: 0; }
.dotcard .dot { position: absolute; width: 17%; aspect-ratio: 1; transform: translate(-50%,-50%);
  border-radius: 50%; background: radial-gradient(circle at 38% 32%, var(--teal-2), var(--teal)); }
.dotcard .dot.hl { animation: pop .4s ease; }

/* option buttons */
.options { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.options.big .option { min-width: 92px; }
.option {
  min-width: 76px; min-height: var(--tap); padding: 14px 20px; cursor: pointer;
  border: 3px solid transparent; border-radius: 18px; background: var(--card); box-shadow: var(--shadow);
  font-family: 'Baloo 2', cursive; font-weight: 800; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.opt-label { font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.05; }
.options.pics .opt-label { font-size: clamp(2.6rem, 11vw, 3.6rem); }
.options.glyphs .opt-label { font-family: 'Andika', sans-serif; font-size: clamp(2.4rem, 10vw, 3.4rem); }
.opt-sub { font-size: .8rem; color: var(--ink-soft); }
.option:hover { transform: translateY(-4px); border-color: var(--ochre-2); box-shadow: var(--shadow-lg); }
.option:active { transform: scale(.95); }
.option.gone { opacity: 0; pointer-events: none; transform: scale(.6); }
.option.reveal { border-color: var(--leaf); background: rgba(74,157,91,.14);
  animation: revealPulse 1s ease infinite; }
.option.hl { border-color: var(--ochre); }
@keyframes revealPulse { 50% { box-shadow: 0 0 0 6px rgba(74,157,91,.2); } }

/* compare */
.compare { display: flex; gap: 16px; align-items: stretch; }
.compare-side { flex: 1; padding: 18px 12px; border: 3px solid transparent; border-radius: 20px;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; min-height: 130px;
  display: flex; align-items: center; justify-content: center; transition: transform .12s ease, border-color .12s ease; }
.compare-side:hover { transform: translateY(-4px); border-color: var(--ochre-2); }
.compare-side:active { transform: scale(.97); }
.compare-side.reveal { border-color: var(--leaf); background: rgba(74,157,91,.14); }
.compare.lined .counters { flex-direction: column; gap: 4px; }

/* bonds */
.bonds { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bonds-total { width: 74px; height: 74px; border-radius: 50%;
  background: linear-gradient(150deg, var(--teal-2), var(--teal)); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.bonds-num { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 2.2rem; }
.hiddenbox.hl { animation: pop .4s ease; }

/* story */
.story-scene { display: flex; flex-direction: column; gap: 16px; align-items: center; }

/* reading tiles / words */
.tiles { display: flex; gap: 10px; }
.tile {
  min-width: 62px; min-height: 74px; padding: 8px 16px; cursor: pointer;
  border: 3px solid rgba(120,90,60,.18); border-radius: 16px; background: #fff; box-shadow: var(--shadow);
  font-family: 'Andika', sans-serif; font-weight: 700; font-size: clamp(2rem, 8vw, 2.8rem); color: var(--teal);
  transition: transform .12s ease, border-color .12s ease;
}
.tile.hl { border-color: var(--ochre); background: rgba(240,169,74,.16); transform: translateY(-4px) scale(1.06); color: var(--ochre); }
.word-display {
  display: inline-flex; gap: 2px; padding: 16px 26px; cursor: pointer;
  border: none; border-radius: 18px; background: #fff; box-shadow: var(--shadow);
  font-family: 'Andika', sans-serif; font-weight: 700; font-size: clamp(2.6rem, 11vw, 4rem); color: var(--ink); letter-spacing: .02em;
}
.wd-part { padding: 0 2px; border-radius: 6px; transition: background .15s ease, color .15s ease; }
.wd-part.hl { background: var(--ochre); color: #fff; }
.glyph-intro { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: fadeUp .3s ease; }
.glyph-big { font-family: 'Andika', sans-serif; font-weight: 700; font-size: clamp(5rem, 22vw, 8rem);
  color: var(--teal); line-height: 1; }
.glyph-word { font-size: 1.4rem; color: var(--ink-soft); font-weight: 700; }

/* ---------- shapes ---------- */
.shape-svg { display: block; }
.options.shapes .option { padding: 14px; min-width: 96px; }
.options.shapes .opt-label { font-size: 0; }               /* only the svg shows */
.shape-intro { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: fadeUp .3s ease; }
.shape-name { font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 1.4rem; color: var(--ink); }

/* ---------- patterns ---------- */
.pattern-strip {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center;
  background: #fff; padding: 12px 14px; border-radius: 18px; box-shadow: var(--shadow); max-width: 92%;
}
.pattern-cell {
  width: 62px; height: 62px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; transition: background .2s ease;
}
.pattern-cell.hl { background: rgba(240,169,74,.24); }
.pattern-cell.u0 { background: rgba(15,92,90,.08); }
.pattern-cell.u1 { background: rgba(224,138,43,.12); }
.pattern-cell.slot { border: 3px dashed var(--ochre); }
.pattern-q { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 2rem; color: var(--ochre); }

/* ---------- add / subtract ---------- */
.sum {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: #fff; padding: 14px 22px; border-radius: 18px; box-shadow: var(--shadow); flex-wrap: wrap;
}
.sum-n, .sum-op, .sum-q {
  font-family: 'Baloo 2', cursive; font-weight: 800; line-height: 1;
}
.sum-n { font-size: clamp(2.4rem, 9vw, 3.4rem); color: var(--teal); }
.sum-op { font-size: clamp(1.8rem, 7vw, 2.6rem); color: var(--ink-soft); }
.sum-q { font-size: clamp(2.4rem, 9vw, 3.4rem); color: var(--ochre); }
.sum-frames { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.sum-frames-op { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.8rem; color: var(--ink-soft); }
.sum-total { margin-top: 2px; }

/* ---------- build a word ---------- */
.build-pic { font-size: clamp(3.6rem, 15vw, 5.5rem); filter: drop-shadow(0 4px 8px rgba(0,0,0,.18)); }
.build-slots { display: flex; gap: 8px; }
.build-slot {
  min-width: 58px; height: 70px; padding: 0 12px; border-radius: 14px;
  border: 3px dashed rgba(120,90,60,.35); background: rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Andika', sans-serif; font-weight: 700; font-size: clamp(1.8rem, 7vw, 2.6rem); color: var(--teal);
}
.build-slot.filled { border-style: solid; border-color: var(--leaf); background: #fff; animation: chipPop .35s ease; }
.build-tray { flex-wrap: wrap; justify-content: center; }
.build-tray .tile.used { opacity: .28; pointer-events: none; transform: scale(.92); }
.tile.wrong { animation: wobble .5s ease; border-color: var(--coral); }

/* ---------- answer dock (help + repeat) ---------- */
.answer-dock {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(250,244,232,0), rgba(250,244,232,.9) 40%);
}
.repeat-btn {
  width: var(--tap); height: var(--tap); flex: none; border: none; border-radius: 18px; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow); font-size: 1.6rem; transition: transform .12s ease;
}
.repeat-btn:active { transform: scale(.92); }
.help-btn {
  display: flex; align-items: center; gap: 12px; padding: 0 30px; height: 68px; cursor: pointer;
  border: none; border-radius: 20px;
  background: linear-gradient(150deg, var(--teal-2), var(--teal)); color: #fff;
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.4rem;
  box-shadow: 0 12px 28px rgba(15,92,90,.4); transition: transform .14s ease;
}
.help-btn:hover { transform: translateY(-3px); }
.help-btn:active { transform: scale(.96); }
.help-hand { font-size: 1.7rem; }
.help-btn.nudge { animation: nudge .5s ease 2; }
@keyframes nudge { 0%,100%{transform:translateY(0);} 25%{transform:translateY(-8px) rotate(-4deg);} 75%{transform:translateY(-8px) rotate(4deg);} }
.help-dots { display: flex; gap: 4px; }
.help-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.35); }
.help-dot.lit { background: var(--ochre-2); }

/* ---------- finish ---------- */
.finish { display: flex; flex-direction: column; align-items: center; gap: 14px; animation: fadeUp .4s ease; }
.finish-emoji { font-size: clamp(4rem, 16vw, 6.5rem); animation: pop .6s cubic-bezier(.34,1.56,.64,1); }
.finish-title { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: clamp(1.7rem, 6vw, 2.6rem); color: var(--teal); }
.finish-stars { font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.5rem; color: var(--ochre); }
.finish-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.btn-primary, .btn-ghost {
  padding: 16px 28px; border: none; border-radius: 18px; cursor: pointer;
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1.2rem; transition: transform .14s ease;
}
.btn-primary { background: linear-gradient(150deg, var(--ochre-2), var(--ochre)); color: #fff; box-shadow: 0 10px 24px rgba(224,138,43,.4); }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.btn-primary:active, .btn-ghost:active { transform: scale(.95); }

/* ---------- confetti ---------- */
#confettiLayer { position: fixed; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.confetto { position: absolute; top: -6vh; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(114vh) rotate(680deg); opacity: .7; } }

/* ---------- footer ---------- */
.app-footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; font-size: .74rem; color: var(--ink-soft); }
.app-footer a { color: var(--teal); text-decoration: none; font-weight: 700; }
.sandz-logo { width: 16px; height: 16px; border-radius: 4px; background: linear-gradient(135deg, var(--teal-2), var(--teal));
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-family: 'Baloo 2', cursive; font-size: .6rem; font-weight: 800; }

/* ---------- desktop niceties ---------- */
@media (min-width: 720px) {
  .tf-cell { width: 46px; height: 46px; }
}
/* keep the header on one row on small phones */
@media (max-width: 480px) {
  .app-header { gap: 6px; padding: 9px 10px; }
  .brand-name { display: none; }
  .chip { min-width: 40px; height: 40px; padding: 0 8px; font-size: 1.02rem; }
  .stars-chip, .lang-code { font-size: .92rem; }
}
@media (max-width: 340px) {
  .app-header { gap: 4px; padding: 8px 7px; }
  .chip { min-width: 36px; height: 38px; padding: 0 6px; font-size: .95rem; }
  .home-chip { min-width: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.active, .finish, .glyph-intro, .modal { animation: none; }
}
