/* ═══════════════════════════════════════════════════════
   OCEAN STARS — a warm, bright reef for a 4-year-old.
   Big tap targets, high contrast, no scary pure-black.
═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Nunito:wght@600;700;800&display=swap');

:root {
  --sun:    #59c7f0;   /* sunlit shallow */
  --aqua:   #1d8fc4;
  --deep:   #0a4f78;   /* deep water (never pure black) */
  --deepest:#073b5c;
  --sand:   #f6dca0;
  --coral:  #ff7a59;   /* warm accent */
  --coral-d:#e85d3c;
  --gold:   #ffd75e;   /* sea stars */
  --mint:   #6ee7b7;
  --ink:    #093048;
  --paper:  #f7fcff;
  --round: 'Baloo 2', system-ui, sans-serif;
  --body:  'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; touch-action: manipulation; cursor: pointer; }
img { -webkit-user-drag: none; user-drag: none; }
html, body { height: 100%; }
body {
  font-family: var(--body);
  color: var(--paper);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;   /* no double-tap zoom; single-finger scroll still works */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;   /* no long-press "Save Image / Copy" popup */
  background:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(120,225,255,0.55), transparent 60%),
    linear-gradient(180deg, var(--sun) 0%, var(--aqua) 32%, var(--deep) 72%, var(--deepest) 100%);
}
/* sandy seabed glow */
body::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 16%;
  background: radial-gradient(ellipse 80% 130% at 50% 100%, rgba(246,220,160,0.5), transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ── rising bubbles ── */
.bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bubbles span {
  position: absolute; bottom: -40px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.8), rgba(255,255,255,0.12) 60%, transparent);
  animation: rise linear infinite;
}
.bubbles span:nth-child(1){ left: 8%;  width: 16px; height: 16px; animation-duration: 9s;  animation-delay: 0s; }
.bubbles span:nth-child(2){ left: 20%; width: 10px; height: 10px; animation-duration: 7s;  animation-delay: 2s; }
.bubbles span:nth-child(3){ left: 33%; width: 22px; height: 22px; animation-duration: 11s; animation-delay: 1s; }
.bubbles span:nth-child(4){ left: 47%; width: 8px;  height: 8px;  animation-duration: 6s;  animation-delay: 3s; }
.bubbles span:nth-child(5){ left: 58%; width: 14px; height: 14px; animation-duration: 9.5s;animation-delay: 0.5s; }
.bubbles span:nth-child(6){ left: 67%; width: 19px; height: 19px; animation-duration: 12s; animation-delay: 2.5s; }
.bubbles span:nth-child(7){ left: 78%; width: 11px; height: 11px; animation-duration: 8s;  animation-delay: 1.5s; }
.bubbles span:nth-child(8){ left: 88%; width: 15px; height: 15px; animation-duration: 10s; animation-delay: 4s; }
.bubbles span:nth-child(9){ left: 95%; width: 9px;  height: 9px;  animation-duration: 7.5s;animation-delay: 0.8s; }
.bubbles span:nth-child(10){left: 14%; width: 13px; height: 13px; animation-duration: 10.5s;animation-delay: 3.5s; }
@keyframes rise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.8; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-104vh) translateX(18px); opacity: 0; }
}

/* ── screens ── */
.screen {
  display: none;
  position: fixed; inset: 0; z-index: 2;
  flex-direction: column; align-items: center;
  padding:
    max(0.8rem, env(safe-area-inset-top))
    1rem
    max(0.8rem, env(safe-area-inset-bottom));
}
.screen.active { display: flex; }

/* ═══════════ DEEP DIG — rock mining ═══════════ */
#screen-mine { width: 100%; max-width: 640px; margin: 0 auto; gap: 0.55rem; }
.dig-hud { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.dig-haul { display: flex; gap: 0.55rem; flex-wrap: wrap; }
.dig-gem {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: rgba(255,255,255,0.14); border: 2px solid rgba(255,255,255,0.25);
  border-radius: 16px; padding: 0.2rem 0.6rem; font-family: var(--round); font-weight: 800;
  color: #fff; font-size: clamp(1.1rem, 5vw, 1.5rem);
}
.dig-gem-e { font-size: 1.15em; }
.dig-gem.bump { animation: dig-bump 0.4s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes dig-bump { 0%,100%{transform:scale(1);} 45%{transform:scale(1.28);} }
/* the little arrow between tiers in the haul (pebble › copper › silver › gold) */
.dig-haul-arrow { align-self: center; color: rgba(255,255,255,0.4); font-weight: 800; }
/* a tier that can be refined glows + shows the smelt (⏫) button */
.dig-gem.canrefine { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,215,94,0.35); animation: dig-glow 1.3s ease-in-out infinite; }
@keyframes dig-glow { 0%,100%{box-shadow:0 0 0 2px rgba(255,215,94,0.3);} 50%{box-shadow:0 0 10px 3px rgba(255,215,94,0.6);} }
.dig-smelt {
  margin-left: 0.2rem; border: none; cursor: pointer; border-radius: 12px;
  background: linear-gradient(180deg, var(--gold), #f59e0b); color: var(--ink);
  font-size: 0.95em; line-height: 1; padding: 0.5rem 0.85rem; font-weight: 800;
  min-height: 48px; box-shadow: 0 3px 0 #d89b1e; animation: dig-glow 1.3s ease-in-out infinite;
}
.dig-smelt:active { transform: translateY(2px); box-shadow: 0 1px 0 #d89b1e; }

/* ═══════════ THE FORGE — cauldron model (Ivy-style) ═══════════ */
/* Full-field overlay: one cauldron he drags ores into. Put REFINE ores in,
   hit Forge. Tally shows count; recipe shows target. Fizzle on wrong count. */
.dig-forge {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: clamp(0.5rem, 2.5vw, 1rem);
  background: radial-gradient(circle at 50% 35%, rgba(255,140,40,0.22), rgba(8,40,64,0.96));
  border-radius: 18px; text-align: center; padding: 0.7rem; overflow-y: auto;
}
.dig-forge-x {
  position: absolute; top: 8px; right: 10px; z-index: 2; border: none; cursor: pointer;
  background: #fff; color: #0a4f78; font-weight: 900; font-size: 1.5rem;
  width: 54px; height: 54px; border-radius: 50%; box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}
.dig-forge-title {
  font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(1.1rem, 5.5vw, 1.6rem);
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.dig-forge-title b { color: var(--gold); }
/* Cauldron: one big pot he drags ores into. */
.dig-forge-cauldron {
  background: rgba(255,255,255,0.08); border: 3px solid rgba(255,215,94,0.4);
  border-radius: 50%; width: clamp(110px, 36vw, 150px); height: clamp(110px, 36vw, 150px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.15rem; transition: border-color 0.25s, background 0.25s;
}
.dig-forge-cauldron-pot { font-size: clamp(2rem, 11vw, 3rem); line-height: 1; }
.dig-forge-drops {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1px;
  max-width: 85%; max-height: 2.2em; overflow: hidden;
}
.dig-forge-drop {
  font-size: clamp(0.85rem, 4vw, 1.1rem); cursor: pointer; user-select: none;
  animation: pip-pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.dig-forge-drop img { width: 1em; height: 1em; object-fit: contain; }
.dig-forge-tally {
  font-family: var(--round); font-weight: 800; color: var(--gold);
  font-size: clamp(0.85rem, 4.5vw, 1.15rem); text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.dig-forge-pile {
  display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; max-width: 92%;
  min-height: 1em;
}
.dig-forge-ore {
  border: none; cursor: grab; background: rgba(255,255,255,0.14); border-radius: 12px;
  font-size: clamp(1.5rem, 7vw, 2.2rem); width: clamp(46px, 12vw, 58px); height: clamp(46px, 12vw, 58px);
  box-shadow: 0 3px 0 rgba(0,0,0,0.2); display: grid; place-items: center;
  touch-action: none; user-select: none;   /* drag the ore into the trays without scrolling the page */
}
.dig-forge-ore:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.2); }
.dig-forge-ghost { display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,0.22); box-shadow: 0 6px 12px rgba(0,0,0,0.4); transform: scale(1.12); }
/* End-of-zone fun rating overlay (mining game). */
.dig-rate { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; padding: 1.2rem; background: rgba(5,34,56,0.84); }
.dig-rate-q { font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(1.2rem, 5.5vw, 1.7rem); text-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.dig-rate-faces { display: flex; gap: 0.7rem; }
.dig-face { font-size: clamp(2.2rem, 11vw, 3.2rem); line-height: 1; cursor: pointer; background: rgba(255,255,255,0.12); border: 3px solid transparent; border-radius: 18px; padding: 0.2rem 0.5rem; transition: transform .15s, border-color .15s, background .15s; }
.dig-face:active { transform: scale(0.9); }
.dig-face.picked { border-color: var(--gold); background: rgba(255,215,94,0.25); transform: scale(1.12); }
.dig-note { width: 100%; max-width: 340px; font-family: var(--round); }
.dig-note summary { list-style: none; text-align: center; cursor: pointer; font-weight: 700; color: rgba(255,255,255,0.85); font-size: 0.85rem; padding: 0.2rem; }
.dig-note summary::-webkit-details-marker { display: none; }
.dig-note textarea { width: 100%; margin-top: 0.3rem; border-radius: 12px; border: 2px solid rgba(255,255,255,0.35); padding: 0.45rem; font-family: var(--body); font-size: 0.95rem; resize: vertical; }
.dig-rate-go { max-width: 340px; }
.dig-forge-ore:disabled { opacity: 0; pointer-events: none; }
.dig-forge-ore.spent { opacity: 0.15; pointer-events: none; }
.dig-forge-ore img { width: 1.1em; height: 1.1em; object-fit: contain; }
.dig-forge-hint { font-family: var(--round); font-weight: 700; color: #fff; font-size: clamp(0.95rem, 4.6vw, 1.25rem); min-height: 1.4em; }
.dig-forge-hint.flash { animation: dig-bump 0.45s cubic-bezier(0.34,1.56,0.64,1); color: var(--gold); }
.dig-forge-go.dim { opacity: 0.55; filter: grayscale(0.4); }
.dig-forge.shake { animation: dig-shake 0.45s; }
.dig-forge.forging .dig-forge-cauldron { background: rgba(255,200,50,0.28); border-color: var(--gold); animation: dig-glow 0.8s ease-in-out; }
.dig-forge.done .dig-forge-pile, .dig-forge.done .dig-forge-go { opacity: 0; transform: scale(0.7); transition: all 0.4s; }
.dig-forge.done .dig-forge-cauldron { transform: scale(1.3); transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1); }

/* ═══════════ PLAYABLE SUB — a reward playground (no math) ═══════════ */
.dig-enter-sub {
  margin-top: 0.35rem; border: none; cursor: pointer; border-radius: 999px;
  font-family: var(--round); font-weight: 800; color: var(--ink);
  background: linear-gradient(180deg, #7fe3ff, #34c0e6);
  font-size: clamp(0.95rem, 4.4vw, 1.2rem); padding: 0.5rem 1.2rem; min-height: 48px;
  box-shadow: 0 4px 0 #2a9cbd, 0 8px 18px rgba(0,0,0,0.25); animation: dig-glow 1.6s ease-in-out infinite;
}
.dig-enter-sub:active { transform: translateY(3px); box-shadow: 0 1px 0 #2a9cbd; }
.dig-room {
  position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: clamp(0.5rem, 2.5vw, 1rem);
  padding: 3rem 0.8rem 1rem; text-align: center; overflow-y: auto;
  background: linear-gradient(180deg, #0b4566, #07304a);
}
.dig-room-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background:
    radial-gradient(circle at 20% 18%, rgba(127,227,255,0.25), transparent 40%),
    radial-gradient(circle at 82% 30%, rgba(255,215,94,0.18), transparent 38%);
}
.dig-room > :not(.dig-room-bg) { position: relative; z-index: 1; }
.dig-room-x {
  position: absolute; top: 8px; left: 10px; z-index: 3; border: none; cursor: pointer;
  background: rgba(255,255,255,0.18); color: #fff; font-family: var(--round); font-weight: 800;
  font-size: 1rem; padding: 0.45rem 0.9rem; border-radius: 999px; min-height: 44px;
}
.dig-room-name {
  font-family: var(--round); font-weight: 800; color: var(--gold);
  font-size: clamp(1.2rem, 6vw, 1.8rem); text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.dig-porthole {
  position: relative; border: none; cursor: pointer; padding: 0;
  width: clamp(150px, 50vw, 230px); height: clamp(150px, 50vw, 230px); border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #1b6fa0, #052238 75%);
  box-shadow: 0 0 0 10px #c8932e, 0 0 0 16px #8a6320, inset 0 8px 24px rgba(0,0,0,0.5);
  overflow: hidden;
}
.dig-porthole:active { transform: scale(0.98); }
.dig-porthole-glass { position: absolute; inset: 0; display: block; overflow: hidden; border-radius: 50%; }
.dig-porthole-tip {
  position: absolute; bottom: 8%; left: 0; right: 0; z-index: 2;
  font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(0.85rem, 4vw, 1.05rem);
  text-shadow: 0 2px 5px rgba(0,0,0,0.7);
}
.dig-swimby {
  position: absolute; left: -20%; font-size: clamp(2rem, 11vw, 3.4rem);
  animation: dig-swim 2.5s linear forwards;
}
@keyframes dig-swim { 0% { left: -20%; } 100% { left: 110%; } }
.dig-room-parts { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; }
.dig-room-parts .dig-sub-base { width: clamp(3rem, 15vw, 4.4rem); height: clamp(3rem, 15vw, 4.4rem); }
.dig-room-part { border: none; background: none; cursor: pointer; padding: 0.2rem; }
.dig-room-part-e { font-size: clamp(2.4rem, 12vw, 3.6rem); filter: drop-shadow(0 3px 7px rgba(0,0,0,0.4)); display: inline-block; }
.dig-room-part-e img { width: 1.4em; height: 1.4em; object-fit: contain; vertical-align: middle; }
.dig-room-crew { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 0.5rem 0.9rem; }
.dig-room-friend {
  border: none; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
}
.dig-room-friend-e { font-size: clamp(2.6rem, 13vw, 3.8rem); display: inline-block; animation: dig-reveal-bob 1.8s ease-in-out infinite; filter: drop-shadow(0 3px 7px rgba(0,0,0,0.4)); }
.dig-room-friend-e img { width: 1.3em; height: 1.3em; object-fit: contain; }
.dig-room-fname { font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(0.75rem, 3.6vw, 0.95rem); text-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.dig-room-part.hop, .dig-room-friend.hop { animation: dig-bump 0.45s cubic-bezier(0.34,1.56,0.64,1); }
.dig-room-say {
  min-height: 1.6em; font-family: var(--round); font-weight: 800; color: var(--gold);
  font-size: clamp(1rem, 5vw, 1.4rem); text-shadow: 0 2px 6px rgba(0,0,0,0.5); padding: 0 0.5rem;
}
.dig-room-say.pop { animation: pip-pop 0.45s cubic-bezier(0.34,1.56,0.64,1); }

.dig-goal {
  width: 100%; text-align: center; background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,215,94,0.4); border-radius: 20px; padding: 0.55rem 0.7rem;
}
.dig-goal-label { font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(1.05rem, 5vw, 1.45rem); }
.dig-need-row { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 0.25rem; }
.dig-need {
  font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(1.2rem, 6vw, 1.7rem);
  background: rgba(0,0,0,0.18); border-radius: 12px; padding: 0.1rem 0.5rem;
}
.dig-need.ok { color: var(--ink); background: linear-gradient(180deg, var(--mint), #34d399); }
.dig-need-plus { color: var(--gold); font-weight: 800; font-size: 1.4rem; }
.dig-build { margin-top: 0.5rem; animation: glow 0.8s ease-in-out infinite alternate; }
.dig-goal-done, .dig-built-pop { font-family: var(--round); font-weight: 800; color: var(--gold); font-size: clamp(1.2rem, 6vw, 1.7rem); padding: 0.3rem; }
.dig-built-pop { animation: pip-pop 0.5s cubic-bezier(0.34,1.56,0.64,1); }

.dig-field { flex: 1; width: 100%; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }
.dig-rockwrap { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; position: relative; }
.dig-count {
  height: 1.2em; font-family: var(--round); font-weight: 800; color: var(--gold);
  font-size: clamp(2.4rem, 13vw, 4rem); line-height: 1; text-shadow: 0 3px 10px rgba(0,0,0,0.4);
  opacity: 0;
}
.dig-count.pop { animation: dig-countpop 0.45s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes dig-countpop { 0%{opacity:0;transform:translateY(12px) scale(0.6);} 35%{opacity:1;transform:translateY(0) scale(1.25);} 100%{opacity:1;transform:scale(1);} }
.dig-rock {
  position: relative; border: none; cursor: pointer; background: none; padding: 0;
  width: clamp(150px, 52vw, 230px); height: clamp(150px, 52vw, 230px);
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.45));
  transition: transform 0.08s;
}
.dig-rock-e { font-size: clamp(8rem, 40vw, 13rem); line-height: 1; }
.dig-rock.hit { animation: dig-shake 0.18s; }
@keyframes dig-shake { 0%,100%{transform:translate(0,0) rotate(0);} 25%{transform:translate(-5px,2px) rotate(-3deg);} 75%{transform:translate(5px,-2px) rotate(3deg);} }
.dig-rock.crack2 .dig-rock-e { filter: brightness(1.05); }
.dig-rock.crack3 .dig-rock-e { filter: brightness(1.1) saturate(1.1); }
.dig-rock.crack4 .dig-rock-e { filter: brightness(1.18) saturate(1.2); }
.dig-rock.burst { animation: dig-burst 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards; }
@keyframes dig-burst { 0%{transform:scale(1);} 35%{transform:scale(1.3) rotate(6deg);} 100%{transform:scale(0.2) rotate(-10deg); opacity:0;} }
.dig-rock-badge {
  position: absolute; top: 0; right: 0; z-index: 6;
  background: var(--gold); color: var(--ink); font-family: var(--round); font-weight: 800;
  border-radius: 14px; padding: 0.2rem 0.6rem; font-size: clamp(1.2rem, 6vw, 1.7rem);
  box-shadow: 0 3px 8px rgba(0,0,0,0.35); border: 2px solid #fff;
}
.dig-rock-gem { font-size: 1.05em; }
.dig-prompt { font-family: var(--round); font-weight: 700; color: #fff; text-align: center; font-size: clamp(1rem, 4.8vw, 1.35rem); text-shadow: 0 2px 5px rgba(0,0,0,0.4); }
.dig-prompt b { color: var(--gold); }

.dig-sub { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem; min-height: 3.6em; }
.dig-sub-row { display: flex; align-items: center; justify-content: center; gap: 0.35rem; flex-wrap: wrap; }
.dig-sub-part { font-size: clamp(3.2rem, 16vw, 4.8rem); filter: drop-shadow(0 4px 9px rgba(0,0,0,0.4)); }
.dig-sub-name { font-family: var(--round); font-weight: 800; color: var(--gold); font-size: clamp(0.95rem, 4.4vw, 1.3rem); text-shadow: 0 2px 5px rgba(0,0,0,0.4); }

/* HIS sub: base art + his face composited over the porthole (render-time overlay
   — the porthole sits on the left of sub-0.png). */
.dig-sub-base { position: relative; display: inline-block; width: clamp(3.6rem, 18vw, 5.4rem); height: clamp(3.6rem, 18vw, 5.4rem); filter: drop-shadow(0 4px 9px rgba(0,0,0,0.4)); }
.dig-sub-base-img { width: 100%; height: 100%; object-fit: contain; }
.dig-sub-face {
  position: absolute; left: 9%; top: 33%; width: 30%; height: 30%;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85) inset;
}

/* First-run name-the-sub overlay */
.dig-namesub { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(6,40,64,0.82); padding: 1rem; }
.dig-namesub-box { text-align: center; max-width: 460px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.dig-namesub-sub .dig-sub-base { width: clamp(6rem, 32vw, 9rem); height: clamp(6rem, 32vw, 9rem); }
.dig-namesub-title { font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(1.4rem, 7vw, 2rem); text-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.dig-namesub-hint { font-family: var(--round); font-weight: 700; color: var(--gold); font-size: clamp(1rem, 4.8vw, 1.3rem); }
.dig-namesub-choices { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; max-width: 320px; }
.dig-namesub-pick {
  font-family: var(--round); font-weight: 800; color: var(--ink);
  font-size: clamp(1.1rem, 5.5vw, 1.5rem); background: linear-gradient(180deg, #fff, #e9f6ff);
  border: none; border-radius: 16px; min-height: 56px; padding: 0.5rem 1rem;
  box-shadow: 0 5px 0 #9fc4d8, 0 8px 16px rgba(0,0,0,0.22); transition: transform 0.1s, box-shadow 0.1s;
}
.dig-namesub-pick:active { transform: translateY(3px); box-shadow: 0 2px 0 #9fc4d8; }

/* Outcome-surprise: a silly critter pops out of a cracked rock */
.dig-critter { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.dig-critter-e { font-size: clamp(4rem, 22vw, 7rem); filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)); animation: dig-critter-pop 1.5s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes dig-critter-pop {
  0% { transform: translateY(40px) scale(0.2) rotate(-20deg); opacity: 0; }
  25% { transform: translateY(-10px) scale(1.15) rotate(8deg); opacity: 1; }
  45% { transform: translateY(0) scale(1) rotate(-6deg); }
  65% { transform: translateY(-6px) scale(1.05) rotate(6deg); }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
/* Varied reward shower: themed emoji float up on a zone-clear */
.dig-shower { position: fixed; bottom: -2rem; z-index: 9; pointer-events: none; animation: dig-shower-up 2.3s ease-out forwards; }
@keyframes dig-shower-up { 0% { transform: translateY(0) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-95vh) rotate(160deg); opacity: 0; } }

.dig-fly { position: absolute; font-size: clamp(1.4rem, 7vw, 2.2rem); pointer-events: none; transition: all 0.7s cubic-bezier(0.4,0,0.2,1); z-index: 5; }
.dig-confetti { position: fixed; top: -12px; width: 11px; height: 16px; border-radius: 2px; z-index: 9; animation: confetti-fall 2s linear forwards; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(540deg); opacity: 0.2; } }

/* ── Deep Dig: real art (emoji shows until the PNG loads) ── */
.dig-rock-e img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0,0,0,0.4)); }
.dig-gem-e img, .dig-need-e img, .dig-rock-gem img, .dig-fly-e img { width: 1.15em; height: 1.15em; object-fit: contain; vertical-align: -0.18em; }
.dig-sub-part img { width: 1.5em; height: 1.5em; object-fit: contain; vertical-align: middle; }
.dig-need-e { display: inline-block; }
/* the hammer swings in from the LOWER-LEFT so it never hides the badge (which
   shows the ore + how many hits are needed, top-right). */
.dig-hammer {
  position: absolute; bottom: -2%; left: -14%; width: 46%; height: 46%;
  pointer-events: none; transform-origin: 34% 82%; transform: rotate(-16deg);
  font-size: clamp(3rem, 16vw, 5rem); line-height: 1; z-index: 4;
}
.dig-hammer img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); }
.dig-rock.hit .dig-hammer { animation: dig-whack 0.18s ease-in-out; }
@keyframes dig-whack { 0%,100% { transform: rotate(-16deg); } 45% { transform: rotate(30deg); } }

/* Crack open: pop the geode and HOLD it (don't shrink away), so the treasure
   inside is clearly visible before it flies into the haul. */
.dig-rock.cracked { animation: dig-pop 0.5s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes dig-pop { 0% { transform: scale(1); } 40% { transform: scale(1.22) rotate(-3deg); } 100% { transform: scale(1.06); } }
/* the stage holds the rock, then the loot panel after it falls away */
.dig-stage { width: 100%; min-height: clamp(150px, 42vw, 230px); display: flex; align-items: center; justify-content: center; position: relative; }
.dig-rock.falling { animation: dig-fall 0.4s ease-in forwards; pointer-events: none; }
@keyframes dig-fall { 0% { transform: scale(1.05); opacity: 1; } 100% { transform: translateY(60px) scale(0.55) rotate(10deg); opacity: 0; } }

/* the loot: BIG, well-spaced, on a clear panel so it's easy to count */
.dig-reveal {
  position: relative;
  display: flex; flex-wrap: wrap; gap: clamp(0.4rem, 2.5vw, 0.9rem); justify-content: center; align-items: center;
  background: rgba(255,255,255,0.16); border: 3px solid rgba(255,255,255,0.34); border-radius: 26px;
  padding: clamp(0.7rem, 3.5vw, 1.3rem); max-width: 96%; min-height: clamp(120px, 32vw, 180px);
  box-shadow: inset 0 2px 16px rgba(0,0,0,0.18); animation: dig-reveal-in 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes dig-reveal-in { 0% { opacity: 0; transform: scale(0.5); } 100% { opacity: 1; transform: scale(1); } }
.dig-reveal-e { font-size: clamp(2.6rem, 13vw, 4rem); animation: dig-reveal-bob 1.1s ease-in-out infinite; }
.dig-reveal-e img { width: 1.5em; height: 1.5em; object-fit: contain; filter: drop-shadow(0 3px 7px rgba(0,0,0,0.4)); }
@keyframes dig-reveal-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.dig-reveal-e { position: relative; }
.dig-reveal-e.lit { animation: pip-pop 0.35s cubic-bezier(0.34,1.56,0.64,1); }
.dig-cnum { position: absolute; top: -0.5em; right: -0.4em; font-family: var(--round); font-weight: 800; font-size: 0.6em; color: var(--ink); background: var(--gold); border: 2px solid #fff; border-radius: 50%; min-width: 1.5em; height: 1.5em; display: flex; align-items: center; justify-content: center; }
/* reveal modes: count (ten-frame), add/sub (groups + operator) */
.dig-reveal.asrow { flex-direction: row; flex-wrap: wrap; gap: 0.4rem 0.7rem; }
.dig-grp { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; align-items: center; max-width: 40vw; }
.dig-op { font-family: var(--round); font-weight: 800; font-size: clamp(2rem, 10vw, 3rem); color: var(--gold); }
.dig-tf { background: none; border: none; padding: 0; }
.dig-tf .tf-cell { width: clamp(36px, 11vw, 54px); height: clamp(36px, 11vw, 54px); }
.dig-tf .dig-reveal-e, .dig-grp .dig-reveal-e { font-size: clamp(1.3rem, 6.5vw, 2rem); animation: none; }
.dig-tf .dig-reveal-e img, .dig-grp .dig-reveal-e img { width: 1.3em; height: 1.3em; }
.dig-reveal-e.gone { opacity: 0.28; filter: grayscale(0.7); }

/* Loot luck: a lucky higher-tier crack sparkles + announces itself */
.dig-reveal.lucky { animation: dig-lucky-glow 0.6s ease-in-out 2 alternate; box-shadow: inset 0 2px 16px rgba(0,0,0,0.18), 0 0 26px rgba(255,215,94,0.85); }
@keyframes dig-lucky-glow { from { background: rgba(255,255,255,0.16); } to { background: rgba(255,215,94,0.34); } }
.dig-lucky {
  position: absolute; top: -1.4em; left: 50%; transform: translateX(-50%);
  font-family: var(--round); font-weight: 800; color: var(--gold); white-space: nowrap;
  font-size: clamp(1.1rem, 5.5vw, 1.6rem); text-shadow: 0 2px 6px rgba(0,0,0,0.5);
  animation: pip-pop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.dig-sparkle { position: absolute; font-size: 1.4rem; pointer-events: none; animation: dig-sparkle-pop 1s ease-out forwards; }
@keyframes dig-sparkle-pop { 0% { opacity: 0; transform: scale(0.3) rotate(0); } 40% { opacity: 1; transform: scale(1.2) rotate(40deg); } 100% { opacity: 0; transform: scale(0.6) rotate(120deg); } }

/* "How many did you find?" number pad (and the build "how many in all?") */
.dig-q { font-family: var(--round); font-weight: 800; padding-left: 0.1em; }
.dig-choices, #dig-total-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; align-items: center; margin-top: 0.4rem; }
.dig-choice {
  font-family: var(--round); font-weight: 800; color: var(--ink);
  font-size: clamp(1.7rem, 9vw, 2.5rem); background: linear-gradient(180deg, #fff, #e9f6ff);
  border: none; border-radius: 18px; min-width: 66px; min-height: 66px; padding: 0.3rem 0.7rem;
  box-shadow: 0 5px 0 #9fc4d8, 0 8px 16px rgba(0,0,0,0.22); transition: transform 0.1s, box-shadow 0.1s;
}
.dig-choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #9fc4d8; }
.dig-choice:disabled { cursor: default; }
.dig-choice.correct { background: linear-gradient(180deg, var(--mint), #34d399); color: #053b2b; box-shadow: 0 5px 0 #18a06f, 0 0 22px rgba(110,231,183,0.7); animation: correct-pop 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.dig-choice.wrong { background: linear-gradient(180deg, #ffd9cf, #ffb6a3); color: #7a2c19; opacity: 0.85; }

/* ═══════════ WELCOME / INTRO ═══════════ */
.welcome-box, .intro-box {
  margin: auto; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  max-width: 560px; width: 100%;
}
.eyebrow {
  font-family: var(--body); font-weight: 800; font-size: 0.72rem;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: rgba(255,255,255,0.85); text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.title {
  font-family: var(--round); font-weight: 800;
  font-size: clamp(3rem, 16vw, 5.5rem); line-height: 0.95;
  margin: 0.4rem 0; color: #fff;
  text-shadow: 0 3px 0 var(--aqua), 0 6px 16px rgba(0,0,0,0.35);
}
.title .accent { color: var(--gold); }
.buddy { font-size: clamp(4rem, 22vw, 7rem); filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3)); animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%,100%{ transform: translateY(0) rotate(-3deg);} 50%{ transform: translateY(-12px) rotate(3deg);} }
.subtitle {
  font-family: var(--round); font-weight: 600;
  font-size: clamp(1.1rem, 4.6vw, 1.5rem); color: #fff;
  margin: 0.6rem 0 1.4rem; max-width: 22ch;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.welcome-stars {
  margin-top: 1rem; font-family: var(--round); font-weight: 700;
  font-size: 1.05rem; color: var(--gold); text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* big primary button */
.btn-big {
  font-family: var(--round); font-weight: 800;
  font-size: clamp(1.3rem, 5.5vw, 1.8rem);
  color: var(--ink); background: linear-gradient(180deg, var(--gold), #ffc73a);
  border: none; border-radius: 999px;
  padding: 1rem 2.4rem; min-height: 64px;
  box-shadow: 0 6px 0 #d89b1e, 0 12px 26px rgba(0,0,0,0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-big:active { transform: translateY(4px); box-shadow: 0 2px 0 #d89b1e, 0 6px 14px rgba(0,0,0,0.3); }
.btn-ghost {
  margin-top: 0.9rem; font-family: var(--round); font-weight: 700; font-size: 1.15rem;
  color: #fff; background: rgba(255,255,255,0.16);
  border: 2px solid rgba(255,255,255,0.7); border-radius: 999px;
  padding: 0.7rem 1.8rem; min-height: 52px; backdrop-filter: blur(6px);
}
.btn-ghost:active { transform: scale(0.97); }
.btn-tiny {
  margin-top: 1.6rem; font-family: var(--body); font-weight: 700;
  font-size: 0.78rem; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.6); background: none; border: none;
  text-decoration: underline; text-underline-offset: 3px;
}

.intro-art { font-size: clamp(3.5rem, 18vw, 6rem); filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3)); animation: bob 2.6s ease-in-out infinite; }
.intro-text {
  font-family: var(--round); font-weight: 700;
  font-size: clamp(1.4rem, 6vw, 2.1rem); color: #fff; line-height: 1.3;
  margin: 1.4rem 0 1.8rem; max-width: 18ch;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

/* ═══════════ PLAY ═══════════ */
#screen-play { justify-content: space-between; }

.hud { width: 100%; max-width: 640px; }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.zone-track { display: flex; gap: 0.4rem; align-items: center; }
.zone-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem;
  background: rgba(255,255,255,0.14); border: 2px solid rgba(255,255,255,0.25);
  filter: grayscale(0.8) brightness(0.8); opacity: 0.7;
  transition: all 0.3s;
}
.zone-dot.done, .zone-dot.lit { filter: none; opacity: 1; background: rgba(255,215,94,0.22); border-color: var(--gold); }
.zone-dot.current {
  filter: none; opacity: 1; transform: scale(1.2);
  background: rgba(255,255,255,0.28); border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25), 0 0 16px rgba(255,255,255,0.5);
}
.star-counter {
  display: flex; align-items: center; gap: 0.35rem;
  font-family: var(--round); font-weight: 800; font-size: 1.5rem; color: #fff;
  background: rgba(9,48,72,0.45); border: 2px solid rgba(255,255,255,0.35);
  border-radius: 999px; padding: 0.2rem 0.9rem 0.2rem 0.6rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.star-ico { font-size: 1.3rem; }
.hud-zone {
  text-align: center; font-family: var(--round); font-weight: 700;
  font-size: 1.1rem; color: #fff; margin-top: 0.5rem;
  letter-spacing: 0.02em; text-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.play-main {
  flex: 1; width: 100%; max-width: 640px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.6rem; min-height: 0;
}
.q-prompt {
  font-family: var(--round); font-weight: 800;
  font-size: clamp(1.5rem, 6.5vw, 2.2rem); color: #fff; text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* the things being counted */
.q-objects {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.3rem 0.5rem; width: 100%;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.22);
  border-radius: 26px; padding: 0.9rem 0.8rem; min-height: 96px;
  backdrop-filter: blur(4px);
}
.q-objects.recognize { background: none; border: none; min-height: 80px; }
.obj-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.2rem 0.35rem; }
.obj {
  font-size: clamp(2rem, 9vw, 3.1rem); line-height: 1;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.25));
  animation: pop 0.35s cubic-bezier(0.34,1.56,0.64,1) backwards;
  transition: transform 0.2s, filter 0.2s;
}
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.obj.gone { opacity: 0.28; filter: grayscale(0.7) drop-shadow(0 3px 5px rgba(0,0,0,0.2)); }
.obj.lit {
  transform: scale(1.35) translateY(-4px);
  filter: drop-shadow(0 0 14px var(--gold)) drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
/* Tap-to-count: each creature is a big tap target; tapping it pops a count
   number above it (1, 2, 3 …) and lights it so he sees what he's counted. */
.obj.tappable { cursor: pointer; position: relative; }
.obj.counted {
  transform: scale(1.12) translateY(-2px);
  filter: drop-shadow(0 0 10px var(--gold)) drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.count-num {
  position: absolute; top: -0.55em; right: -0.35em;
  min-width: 1.35em; height: 1.35em; padding: 0 0.18em;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--round); font-weight: 800; font-size: 0.92rem;
  color: #4a2c00; background: var(--gold);
  border-radius: 999px; border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
  animation: pop 0.3s cubic-bezier(0.34,1.56,0.64,1) backwards;
}
.op-chip {
  font-family: var(--round); font-weight: 800; font-size: 2.2rem; color: var(--gold);
  padding: 0 0.3rem;
  /* Dark outline so the light-yellow +/− stays readable on light backgrounds too. */
  text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.9), 0 2px 4px rgba(0,0,0,0.6);
}

/* ── Arithmetic (add / subtract): three representations ──────────────── */
/* All three lay out the same .obj spans (so tap-to-count works); they differ
   only in arrangement. Stack the optional equation strip above the creatures. */
.q-objects.arith { flex-direction: column; gap: 0.55rem; }
.arith-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.25rem 0.6rem; }
/* Counting-on: the first addend is ALREADY counted — a solid numeral badge he
   does NOT tap (so he holds it as a number and counts on the second group). */
.counton-badge {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 3.4rem; padding: 0.35rem 0.7rem 0.3rem;
  background: rgba(6, 30, 52, 0.82); border: 3px solid var(--gold);
  border-radius: 1rem; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.counton-badge .co-face { font-size: clamp(1.3rem, 5vw, 1.9rem); line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35)); }
.counton-badge .counton-num {
  font-family: var(--round); font-weight: 800; font-size: clamp(2.1rem, 9vw, 3rem);
  color: var(--gold); line-height: 1.05;
  text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 2px 4px rgba(0,0,0,0.6);
}
.counton-badge .co-tag {
  font-family: var(--round); font-weight: 800; font-size: 0.62rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: #cfe6ff; opacity: 0.9; margin-top: 0.05rem;
}
/* Symbolic: the written number sentence, e.g. 3 + 2 = ▢ */
.equation { display: flex; align-items: center; justify-content: center; gap: 0.3rem; font-family: var(--round); font-weight: 800; }
.equation .eq-n { font-size: clamp(1.9rem, 8.5vw, 2.9rem); color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.equation .eq-op { font-size: clamp(1.5rem, 6.5vw, 2.2rem); color: var(--gold); text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.9), 0 2px 4px rgba(0,0,0,0.6); }
.equation .eq-box {
  font-size: clamp(1.9rem, 8.5vw, 2.7rem); color: var(--gold);
  text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 2px 4px rgba(0,0,0,0.6);
  min-width: 1.25em; height: 1.25em; display: inline-flex; align-items: center; justify-content: center;
  border: 3px dashed var(--gold); border-radius: 12px;
}
/* Ten-frame arithmetic: shrink the creatures to fit the cells; tint addend #2. */
.arith-frame .tf-obj { font-size: clamp(1.05rem, 5.2vw, 1.6rem); filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25)); }
.tf-cell.tf-a2.filled { background: rgba(120,200,255,0.30); border-color: #6cc6e6; }

/* ── Other counting puzzle types ─────────────────────────────────── */
/* Count out N / ten-frame: the "build a quantity" layouts. */
.q-objects.countout { flex-direction: column; gap: 0.5rem; }
.q-objects.countout .big-numeral { margin-bottom: 0.1rem; }
/* The net: where he drops what he's counted out. */
.net {
  min-height: 56px; min-width: 70%; padding: 0.35rem 0.7rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.15rem 0.3rem;
  background: rgba(255,255,255,0.12); border: 3px dashed rgba(255,255,255,0.5); border-radius: 18px;
}
.net .caught { font-size: clamp(1.3rem, 6vw, 2rem); animation: pop 0.3s cubic-bezier(0.34,1.56,0.64,1); }
.school { opacity: 0.97; }
.school .obj.used { opacity: 0.18; transform: scale(0.8); pointer-events: none; }
/* Ten-frame: a 2×5 grid he fills cell by cell. */
.tenframe {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  padding: 6px; background: rgba(255,255,255,0.14); border-radius: 16px;
}
.tf-cell {
  width: clamp(34px, 11vw, 52px); height: clamp(34px, 11vw, 52px);
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(1.2rem, 6vw, 1.9rem); line-height: 1;
  background: rgba(0,0,0,0.18); border: 2px solid rgba(255,255,255,0.4); border-radius: 10px;
}
.tf-cell.filled { background: rgba(255,215,94,0.22); border-color: var(--gold); animation: pop 0.25s cubic-bezier(0.34,1.56,0.64,1); }

/* What's missing: a row of numbered chips with one hidden. */
.q-objects.seqrow { padding: 0.6rem; }
.seq { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; }
.seq-chip {
  min-width: 1.7em; padding: 0.2em 0.45em; text-align: center;
  font-family: var(--round); font-weight: 800; font-size: clamp(1.6rem, 8vw, 2.6rem);
  color: #fff; background: rgba(255,255,255,0.14); border-radius: 14px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.seq-chip.hidden {
  background: rgba(255,215,94,0.18); border: 3px dashed var(--gold);
  animation: bob 2.2s ease-in-out infinite;
}

/* More or fewer: two tappable reef cards. */
.q-objects.compare { flex-direction: row; gap: 0.8rem; align-items: stretch; }
.cmp-group {
  flex: 1; min-height: 110px; max-width: 46%; padding: 0.5rem;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 0.1rem 0.2rem;
  background: rgba(255,255,255,0.12); border: 3px solid rgba(255,255,255,0.35); border-radius: 20px;
  cursor: pointer; transition: transform 0.1s, box-shadow 0.15s;
}
.cmp-group:active:not(:disabled) { transform: scale(0.97); }
.cmp-group.correct { border-color: var(--mint); box-shadow: 0 0 22px rgba(110,231,183,0.7); }
.cmp-group.wrong { border-color: #ffb6a3; opacity: 0.65; }
.cmp-obj { font-size: clamp(1.1rem, 5vw, 1.7rem); line-height: 1; }

/* The "Done" commit button for the build puzzles. */
.q-choices.donebar { grid-template-columns: 1fr; }
.choice-done { background: linear-gradient(180deg, #ffe08a, var(--gold)); color: #4a2c00; box-shadow: 0 5px 0 #d4a017, 0 10px 20px rgba(0,0,0,0.25); }
.recognize-cue { font-size: clamp(3rem, 16vw, 5rem); animation: bob 2.4s ease-in-out infinite; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); }

/* "Meet the number" teaching turn: big coral numeral + creatures to count */
.q-objects.teaching { flex-direction: column; gap: 0.6rem; background: none; border: none; }
.q-objects.teaching .obj { font-size: clamp(1.5rem, 7vw, 2.3rem); }
.big-numeral {
  font-family: var(--round); font-weight: 800; color: #fff;
  font-size: clamp(3.6rem, 22vw, 6.5rem); line-height: 1;
  width: clamp(92px, 32vw, 150px); height: clamp(92px, 32vw, 150px);
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--coral), var(--coral-d));
  border-radius: 26px;
  box-shadow: 0 8px 0 #b8431f, 0 14px 30px rgba(0,0,0,0.35);
  text-shadow: 0 3px 0 rgba(0,0,0,0.18);
  animation: reveal 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.big-numeral.hint { animation: reveal 0.5s cubic-bezier(0.34,1.56,0.64,1), glow 0.7s ease-in-out infinite alternate; }

/* dive meter (streak pips) */
.dive-meter { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.dive-pip { font-size: 1.4rem; filter: grayscale(1) brightness(1.4); opacity: 0.45; transition: all 0.3s; }
.dive-pip.on { filter: none; opacity: 1; transform: scale(1.15); animation: pip-pop 0.4s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes pip-pop { 0%{ transform: scale(0.4);} 70%{ transform: scale(1.4);} 100%{ transform: scale(1.15);} }

/* recognition number line — the level's numbers, lighting gold as mastered */
.dive-meter.numberline { gap: 0.3rem; }
.num-chip {
  min-width: 1.7rem; height: 1.7rem; padding: 0 0.3rem;
  display: grid; place-items: center;
  font-family: var(--round); font-weight: 800; font-size: 1rem;
  border-radius: 8px; color: #fff;
  background: rgba(255,255,255,0.16); border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.3s;
}
.num-chip.got {
  color: var(--ink); background: linear-gradient(180deg, var(--gold), #ffc73a);
  border-color: var(--gold); box-shadow: 0 0 10px rgba(255,215,94,0.7);
  animation: pip-pop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.num-chip.locked { opacity: 0.35; }

/* answer choices — BIG tap targets */
.q-choices {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem; width: 100%; max-width: 440px; margin-top: 0.3rem;
}
.q-choices[data-count="1"] { grid-template-columns: 1fr; max-width: 240px; }
.q-choices[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.q-choices[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.q-choices[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.choice {
  font-family: var(--round); font-weight: 800;
  font-size: clamp(2.2rem, 10vw, 3rem); color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #e9f6ff);
  border: none; border-radius: 22px;
  min-height: 84px; padding: 0.4rem;
  box-shadow: 0 5px 0 #9fc4d8, 0 10px 20px rgba(0,0,0,0.25);
  transition: transform 0.1s, box-shadow 0.1s, background 0.2s;
}
.choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #9fc4d8, 0 5px 12px rgba(0,0,0,0.25); }
.choice:disabled { cursor: default; }
/* Number pad waiting for him to finish counting — dimmed, not interactive yet. */
.choice.await-count { opacity: 0.5; filter: saturate(0.7); }

/* "which way?" — two BIG number cards (the real number + its flip twin). */
.choice-bigcard {
  font-size: clamp(3.4rem, 19vw, 5.6rem); min-height: clamp(130px, 34vw, 190px);
  border-radius: 28px; line-height: 1;
  background: linear-gradient(180deg, #ffffff, #e9f6ff);
  box-shadow: 0 6px 0 #9fc4d8, 0 12px 24px rgba(0,0,0,0.28);
}
.choice-bigcard:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 3px 0 #9fc4d8, 0 6px 14px rgba(0,0,0,0.25); }
/* "find the number" — the number's name in words (audio-independent cue). */
.find-word { font-family: var(--round); font-weight: 800; text-transform: capitalize;
  font-size: clamp(1.5rem, 8vw, 2.4rem); color: #fff; margin-top: 0.25rem;
  text-shadow: 0 2px 6px rgba(0,0,0,0.45); letter-spacing: 0.02em; }
.choice.correct {
  background: linear-gradient(180deg, var(--mint), #34d399); color: #053b2b;
  box-shadow: 0 5px 0 #18a06f, 0 0 24px rgba(110,231,183,0.7);
  animation: correct-pop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes correct-pop { 0%{transform:scale(1);} 50%{transform:scale(1.12);} 100%{transform:scale(1);} }
.choice.wrong { background: linear-gradient(180deg, #ffd9cf, #ffb6a3); color: #7a2c19; opacity: 0.85; box-shadow: 0 4px 0 #d98a73; }
.choice.hint-glow {
  background: linear-gradient(180deg, #fff6d8, var(--gold)); color: var(--ink);
  animation: glow 0.7s ease-in-out infinite alternate;
}
@keyframes glow { from { box-shadow: 0 5px 0 #d89b1e, 0 0 10px rgba(255,215,94,0.6);} to { box-shadow: 0 5px 0 #d89b1e, 0 0 28px rgba(255,215,94,0.95);} }
.shake { animation: shake 0.45s ease-in-out; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }

/* quantity choices — tap the group with the right number of creatures */
.choice-qty { min-height: 92px; padding: 0.5rem 0.4rem; }
/* Five-frame layout: creatures flow in rows of up to 5 ("five and some more")
   so the quantity is SUBITIZABLE — the kid reads 5+2 as seven at a glance
   instead of counting a scattered blob. Makes pick-the-group a real numeral↔
   quantity test, not a counting-accuracy test. Shared with unicornmath. */
.qty-grp {
  display: grid; grid-template-columns: repeat(5, auto); gap: 3px 6px;
  align-items: center; justify-content: center; align-content: center; line-height: 1;
}
.qty-grp span { font-size: clamp(1.1rem, 4.6vw, 1.5rem); filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2)); }

/* ── controls ── */
.controls {
  width: 100%; max-width: 640px;
  display: flex; align-items: center; justify-content: center; gap: 0.9rem;
  padding-top: 0.4rem;
}
.ctrl {
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 1.4rem; display: grid; place-items: center;
  background: rgba(9,48,72,0.45); border: 2px solid rgba(255,255,255,0.4);
  color: #fff; backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25); transition: transform 0.1s, opacity 0.2s;
}
.ctrl:active { transform: scale(0.92); }
.ctrl-big { width: 66px; height: 66px; font-size: 1.8rem; border-color: var(--gold); background: rgba(255,215,94,0.22); }
.ctrl.muted { opacity: 0.4; }
.ctrl.speaking { border-color: var(--gold); animation: glow 0.8s ease-in-out infinite alternate; }

/* ═══════════ CELEBRATE ═══════════ */
#screen-celebrate.active { overflow-y: auto; }
.celebrate-box {
  margin: auto; text-align: center; max-width: 480px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  padding: 1rem;
}
.celebrate-bubbles { font-size: 1.8rem; letter-spacing: 0.3rem; animation: bob 2.2s ease-in-out infinite; }
.celebrate-emoji {
  font-size: clamp(4.5rem, 26vw, 8rem);
  filter: drop-shadow(0 0 30px rgba(255,215,94,0.8)) drop-shadow(0 8px 16px rgba(0,0,0,0.3));
  animation: reveal 0.7s cubic-bezier(0.34,1.56,0.64,1), bob 2.6s 0.7s ease-in-out infinite;
}
@keyframes reveal { 0%{transform:scale(0) rotate(-20deg);opacity:0;} 70%{transform:scale(1.15) rotate(6deg);} 100%{transform:scale(1) rotate(0);} }
.celebrate-title {
  font-family: var(--round); font-weight: 800;
  font-size: clamp(1.8rem, 8vw, 2.6rem); color: #fff;
  text-shadow: 0 3px 0 var(--coral-d), 0 6px 14px rgba(0,0,0,0.35);
}
.celebrate-text {
  font-family: var(--round); font-weight: 600;
  font-size: clamp(1.1rem, 4.6vw, 1.4rem); color: #fff; max-width: 20ch;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35); margin-bottom: 0.4rem;
}
/* The reward showcase: the submarine (with its new part) + the whole crew. */
.celebrate-sub {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 0.1rem; font-size: clamp(1.7rem, 7.5vw, 2.5rem); line-height: 1; margin: 0.2rem 0 0.3rem;
}
/* The hull is the vessel — make it clearly dominate the little parts so it
   reads as a submarine, not just another reef critter. */
.celebrate-sub .sub-hull, .crew-sub .sub-hull { font-size: 2.4em; }
.celebrate-sub .sub-part, .celebrate-sub .sub-hull { animation: pop 0.45s cubic-bezier(0.34,1.56,0.64,1) backwards; }
.celebrate-sub .sub-part.fresh { animation: partSnap 0.7s cubic-bezier(0.34,1.7,0.5,1) 0.5s backwards; }
@keyframes partSnap { 0%{transform:scale(0) translateY(-14px);opacity:0;} 60%{transform:scale(1.4) translateY(0);} 100%{transform:scale(1);opacity:1;} }
.celebrate-crew {
  display: flex; align-items: flex-end; justify-content: center; flex-wrap: wrap;
  gap: 0.25rem 0.35rem; font-size: clamp(1.5rem, 6.5vw, 2.1rem); line-height: 1;
  margin-bottom: 0.7rem; max-width: 22rem;
}
.celebrate-crew .crew-chip { animation: crewIn 0.5s cubic-bezier(0.34,1.56,0.64,1) backwards; }
.celebrate-crew .crew-chip.newbie { animation: crewJoin 0.9s cubic-bezier(0.34,1.6,0.5,1) backwards; }
@keyframes crewIn { from{transform:scale(0) translateY(8px);opacity:0;} to{transform:scale(1);opacity:1;} }
@keyframes crewJoin { 0%{transform:scale(0) translateX(60px) rotate(20deg);opacity:0;} 55%{transform:scale(1.35) rotate(-8deg);} 100%{transform:scale(1) translateX(0) rotate(0);opacity:1;} }
.celebrate-crew .crew-chip.bob { animation: crewIn 0.5s cubic-bezier(0.34,1.56,0.64,1) backwards, bob 2.4s 0.6s ease-in-out infinite; }

/* Confetti burst behind the celebrate card (JS injects the pieces). */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.confetti span {
  position: absolute; top: -8%; width: 0.7rem; height: 0.9rem; border-radius: 2px;
  opacity: 0; animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(-10vh) rotate(0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(108vh) rotate(720deg); opacity: 0.9; }
}
.celebrate-box { position: relative; z-index: 1; }

/* ═══════════ FINAL CHALLENGE (invite a grown-up) ═══════════ */
.finale-box {
  margin: auto; text-align: center; max-width: 460px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem; padding: 1.2rem;
}
.finale-badge {
  font-size: clamp(4rem, 22vw, 7rem);
  filter: drop-shadow(0 0 26px rgba(255,215,94,0.85)) drop-shadow(0 8px 16px rgba(0,0,0,0.3));
  animation: reveal 0.7s cubic-bezier(0.34,1.56,0.64,1), bob 2.4s 0.7s ease-in-out infinite;
}
.finale-title {
  font-family: var(--round); font-weight: 800; color: #fff;
  font-size: clamp(1.7rem, 7.5vw, 2.4rem);
  text-shadow: 0 3px 0 var(--coral-d), 0 6px 14px rgba(0,0,0,0.35);
}
.finale-text {
  font-family: var(--round); font-weight: 600; color: #fff; max-width: 18ch;
  font-size: clamp(1.15rem, 5vw, 1.5rem); text-shadow: 0 2px 8px rgba(0,0,0,0.35); margin-bottom: 0.5rem;
}

/* ═══════════ CREW & SUB GALLERY ═══════════ */
#screen-crew.active { display: flex; align-items: flex-start; overflow-y: auto; }
.crew-view { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.7rem; padding: 1rem 1rem 2rem; }
.crew-title { font-family: var(--round); font-weight: 800; color: #fff; text-align: center; font-size: clamp(1.5rem, 6vw, 2rem); text-shadow: 0 2px 8px rgba(0,0,0,0.35); margin-top: 0.3rem; }
.crew-sub {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.15rem;
  font-size: clamp(1.8rem, 8vw, 2.6rem); line-height: 1;
  background: rgba(9,48,72,0.5); border: 2px solid rgba(255,255,255,0.22); border-radius: 20px;
  padding: 0.7rem 0.9rem; width: 100%;
}
.crew-hint { font-family: var(--round); font-weight: 600; color: rgba(255,255,255,0.85); font-size: 1rem; }
.crew-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.6rem; width: 100%; }
.crew-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.25rem; cursor: pointer;
  background: rgba(9,48,72,0.5); border: 2px solid rgba(255,255,255,0.22); border-radius: 18px; padding: 0.6rem 0.3rem;
  transition: transform 0.15s, border-color 0.15s;
}
.crew-card:active { transform: scale(0.94); border-color: var(--gold); }
.crew-card.cheer { animation: crewJoin 0.7s cubic-bezier(0.34,1.6,0.5,1); }
.crew-card .crew-face { font-size: clamp(2.2rem, 11vw, 3.2rem); line-height: 1; }
.crew-card .crew-name { font-family: var(--round); font-weight: 700; color: #fff; font-size: 0.8rem; text-align: center; line-height: 1.15; }
/* Tap payoff — sub parts + crew cards pop big with their own word + emoji burst. */
.crew-card, .crew-sub .sub-part, .crew-sub .sub-hull { position: relative; }
.crew-sub .sub-part, .crew-sub .sub-hull { cursor: pointer; padding: 0.15rem; border-radius: 12px; }
.crew-card.pop, .crew-sub .sub-part.pop, .crew-sub .sub-hull.pop { animation: popBig 0.8s cubic-bezier(0.34,1.7,0.5,1); z-index: 5; }
/* Celebrate-screen showcase pieces are tap toys too (same payoff as the gallery). */
.celebrate-sub .sub-part, .celebrate-crew .crew-chip { position: relative; cursor: pointer; }
.celebrate-sub .sub-part.pop, .celebrate-crew .crew-chip.pop { animation: popBig 0.8s cubic-bezier(0.34,1.7,0.5,1); z-index: 5; }
@keyframes popBig {
  0%   { transform: scale(1) rotate(0); }
  30%  { transform: scale(1.7) rotate(-8deg); }
  55%  { transform: scale(1.45) rotate(6deg); }
  78%  { transform: scale(1.6) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}
.crew-bubble {
  position: absolute; top: -1.2rem; left: 50%; transform: translateX(-50%);
  font-family: var(--round); font-weight: 800; font-size: 0.8rem; color: var(--ink);
  background: #fff; padding: 0.12rem 0.5rem; border-radius: 10px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3); z-index: 10; pointer-events: none;
}
.cb-burst {
  position: absolute; left: 50%; top: 40%; z-index: 9; pointer-events: none;
  font-size: clamp(1.2rem, 6vw, 1.9rem); transform: translate(-50%, -50%);
  animation: cbBurst 1.2s ease-out forwards;
}
@keyframes cbBurst {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0) * 80px), -150%) scale(var(--sc, 1)); }
}

/* ═══════════ FRIEND CHEERS DURING PLAY ═══════════ */
.friend-cheer {
  position: fixed; left: 50%; top: 30%; transform: translateX(-50%);
  display: none; flex-direction: column; align-items: center; gap: 0.2rem; z-index: 60; pointer-events: none;
}
.friend-cheer.show { display: flex; animation: friendPop 1.6s ease-out forwards; }
.friend-cheer .fc-face { font-size: clamp(2.6rem, 13vw, 3.6rem); line-height: 1; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35)); }
.friend-cheer .fc-bubble {
  font-family: var(--round); font-weight: 800; color: var(--coral-d); background: #fff;
  padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 1rem; box-shadow: 0 3px 8px rgba(0,0,0,0.3); order: -1;
}
@keyframes friendPop {
  0% { transform: translateX(-50%) translateY(20px) scale(0.4); opacity: 0; }
  18% { transform: translateX(-50%) translateY(0) scale(1.15); opacity: 1; }
  30% { transform: translateX(-50%) translateY(0) scale(1); }
  78% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-16px) scale(0.85); opacity: 0; }
}

/* ═══════════ WELCOME-BACK STREAK BANNER ═══════════ */
/* A brief, celebratory greeting when a returning diver reaches the map — rewards
   coming back day after day (Success #2). Fixed overlay, non-interactive. */
.welcome-back {
  position: fixed; left: 50%; top: 16%; transform: translateX(-50%);
  display: none; flex-direction: column; align-items: center; gap: 0.25rem;
  z-index: 70; pointer-events: none; text-align: center; max-width: 88vw;
}
.welcome-back.show { display: flex; animation: wbPop 4.2s ease-out forwards; }
.welcome-back .wb-title {
  font-family: var(--round); font-weight: 800; color: #fff;
  font-size: clamp(1.3rem, 6.5vw, 2rem);
  background: linear-gradient(180deg, rgba(9,79,120,0.92), rgba(6,48,74,0.92));
  border: 2px solid var(--gold); border-radius: 999px;
  padding: 0.35rem 1.1rem; box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  text-shadow: 0 2px 6px rgba(0,0,0,0.45);
}
.welcome-back .wb-sub {
  font-family: var(--round); font-weight: 800; color: var(--gold);
  font-size: clamp(1rem, 5vw, 1.5rem);
  text-shadow: 0 2px 4px rgba(0,0,0,0.6), 0 0 2px rgba(0,0,0,0.8);
}
@keyframes wbPop {
  0% { transform: translateX(-50%) translateY(-18px) scale(0.5); opacity: 0; }
  10% { transform: translateX(-50%) translateY(0) scale(1.1); opacity: 1; }
  18% { transform: translateX(-50%) translateY(0) scale(1); }
  85% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-12px) scale(0.9); opacity: 0; }
}

/* ═══════════ GROWN-UP REPORT ═══════════ */
.welcome-foot { display: flex; gap: 1.2rem; align-items: center; margin-top: 1.4rem; }
.btn-tiny.danger { color: rgba(255,150,140,0.7); }
#screen-report.active { display: flex; align-items: flex-start; overflow-y: auto; }
.report {
  width: 100%; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 0.7rem; padding-bottom: 2rem;
}
.report-title {
  font-family: var(--round); font-weight: 800; color: #fff; text-align: center;
  font-size: clamp(1.5rem, 6vw, 2rem); margin: 0.5rem 0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.rep-card {
  background: rgba(9,48,72,0.5); border: 2px solid rgba(255,255,255,0.22);
  border-radius: 18px; padding: 0.9rem 1rem; backdrop-filter: blur(6px);
}
.rep-card h3 {
  font-family: var(--round); font-weight: 700; color: var(--gold);
  font-size: 0.95rem; margin-bottom: 0.6rem; letter-spacing: 0.02em;
}
.rep-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; font-family: var(--body); font-weight: 600; color: #fff; }
.rep-stats b { font-family: var(--round); color: var(--gold); font-size: 1.15rem; }
.rep-numline { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rep-num {
  min-width: 2rem; height: 2rem; padding: 0 0.35rem; border-radius: 8px;
  display: grid; place-items: center; font-family: var(--round); font-weight: 800; font-size: 1rem; color: #fff;
}
.rep-num.got { color: var(--ink); background: linear-gradient(180deg, var(--gold), #ffc73a); box-shadow: 0 0 8px rgba(255,215,94,0.6); }
.rep-num.learning { background: rgba(95,164,217,0.55); border: 1px solid rgba(255,255,255,0.4); }
.rep-num.new { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.5); }
.rep-legend { display: flex; gap: 1rem; margin-top: 0.6rem; font-size: 0.72rem; color: rgba(255,255,255,0.8); align-items: center; }
.rep-legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -1px; }
.rep-legend .dot.got { background: var(--gold); }
.rep-legend .dot.learning { background: rgba(95,164,217,0.8); }
.rep-legend .dot.new { background: rgba(255,255,255,0.25); }
.rep-skills { display: flex; flex-direction: column; gap: 0.4rem; }
.rep-skill { display: flex; justify-content: space-between; align-items: center; font-family: var(--body); font-weight: 600; color: #fff; }
.rep-status { font-size: 0.78rem; color: rgba(255,255,255,0.7); }
.rep-skill.done .rep-status { color: var(--mint); }
.rep-skill.inprogress .rep-status { color: var(--gold); }
.rep-week { display: flex; justify-content: space-between; align-items: flex-end; gap: 0.3rem; height: 92px; }
.wk-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.wk-bar { width: 70%; max-width: 26px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--gold), #ffc73a); }
.wk-bar.empty { background: rgba(255,255,255,0.15); }
.wk-lab { font-size: 0.7rem; color: rgba(255,255,255,0.6); font-weight: 700; }
.wk-val { font-size: 0.7rem; color: rgba(255,255,255,0.85); font-weight: 700; min-height: 0.9rem; }
.rep-reco {
  font-family: var(--round); font-weight: 600; color: #fff; text-align: center;
  background: rgba(255,122,89,0.22); border: 1px solid rgba(255,122,89,0.5);
  border-radius: 14px; padding: 0.7rem 0.9rem; font-size: 0.95rem;
}
.rep-btns { display: flex; flex-direction: column; gap: 0.6rem; align-items: center; margin-top: 0.3rem; }
.rep-btns .btn-ghost, .rep-btns .btn-big { width: 100%; max-width: 320px; }

/* flying star reward */
.fly-star {
  position: fixed; z-index: 50; font-size: 2.4rem; pointer-events: none;
  transform: translate(-50%, -50%);
  transition: left 0.7s cubic-bezier(0.5,0,0.3,1), top 0.7s cubic-bezier(0.5,0,0.3,1), transform 0.7s ease, opacity 0.7s ease;
  filter: drop-shadow(0 0 12px var(--gold));
}

/* art chips (crew, sub parts, rewards, celebration friend, welcome buddy):
   the transparent PNG swapped in for an emoji, sized to 1em so it matches. */
.sub-craft img, .sub-crew img, .dive-reward img, #celebrate-emoji img, .buddy img,
.celebrate-sub img, .celebrate-crew img, .crew-sub img, .crew-card .crew-face img, .friend-cheer .fc-face img {
  width: 1em; height: 1em; object-fit: contain; vertical-align: middle;
}
.celebrate-friend img { filter: drop-shadow(0 6px 12px rgba(0,0,0,0.3)); }

/* ── Oliver's sub, bobbing along through the puzzles ── */
.oliver-sub {
  position: fixed; left: 0.3rem; bottom: calc(env(safe-area-inset-bottom) + 0.3rem);
  width: clamp(104px, 28vw, 156px); height: auto; z-index: 6; pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.4));
  animation: subswim 3.8s ease-in-out infinite;
}
@keyframes subswim {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50%      { transform: translateY(-7px) rotate(1.5deg); }
}
/* Oliver's sub as the travelling map sprite */
.map-sub-img { width: 64px; height: auto; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.5)); }

/* ── number tracing (finger-write the numeral) ── */
.q-objects.trace-mode { background: none; border: none; min-height: 0; padding: 0; }
.trace-field {
  position: relative; width: clamp(170px, 54vw, 250px); aspect-ratio: 100 / 140;
  touch-action: none; -webkit-user-select: none; user-select: none;
  background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.24);
  border-radius: 22px; backdrop-filter: blur(4px);
}
.trace-ghost {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--round); font-weight: 800; font-size: 9rem; line-height: 1;
  color: rgba(255,255,255,0.13); pointer-events: none;
}
.trace-svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.trace-guide { fill: none; stroke: rgba(255,255,255,0.45); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 0.5 17; }
.trace-trail { fill: none; stroke: var(--gold); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(255,215,94,0.85)); pointer-events: none; }
.trace-start { fill: var(--mint); stroke: #fff; stroke-width: 2; }
.trace-dot { fill: rgba(255,255,255,0.22); transition: fill 0.15s; }
.trace-dot.on { fill: var(--gold); }
.trace-field.done { animation: correct-pop 0.5s cubic-bezier(0.34,1.56,0.64,1); border-color: var(--gold); box-shadow: 0 0 24px rgba(255,215,94,0.75); }

/* story slide art: generated image (emoji shows until it loads / if missing) */
.story-img {
  width: clamp(180px, 62vw, 320px); height: auto; max-height: 42vh;
  object-fit: contain; border-radius: 22px;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,0.35));
  animation: reveal 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

/* ═══════════ FULL-BLEED SCENE BACKGROUND ═══════════ */
#scene-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 0.6s ease;
}
#scene-bg.on { opacity: 1; }
/* legibility: soften the edges, darken the bottom where text + controls sit */
#scene-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 88% 78% at 50% 34%, transparent 42%, rgba(7,59,92,0.5) 100%),
    linear-gradient(180deg, rgba(7,59,92,0.45) 0%, transparent 22%, transparent 48%, rgba(7,59,92,0.92) 100%);
}
.bubbles { z-index: 1; }          /* float the bubbles over the scene image */
.subtitle { font-size: clamp(1.2rem, 5vw, 1.65rem); }

/* ═══════════ STORY (full-bleed) ═══════════ */
#screen-intro.active { justify-content: flex-end; }
.intro-box { margin-top: auto; margin-bottom: 0; }
.intro-text {
  font-size: clamp(1.55rem, 6.4vw, 2.4rem); line-height: 1.25;
  max-width: 20ch; margin: 0.6rem 0 1.6rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.55), 0 1px 2px rgba(0,0,0,0.6);
}

/* ═══════════ DIVE MAP (node-path descent) ═══════════ */
#screen-map.active { display: flex; align-items: center; justify-content: flex-start; overflow-y: auto; }
.map-head { width: 100%; max-width: 520px; text-align: center; padding-top: 0.2rem; }
.map-head .eyebrow { margin-bottom: 0.15rem; }
.map-title {
  font-family: var(--round); font-weight: 800; color: #fff;
  font-size: clamp(1.6rem, 7vw, 2.3rem); margin: 0.1rem 0 0.55rem;
  text-shadow: 0 3px 0 var(--aqua), 0 5px 16px rgba(0,0,0,0.4);
}

/* the submarine being built out + the crew (compact, in the head) */
.sub-build {
  width: 100%; max-width: 360px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  background: rgba(9,48,72,0.42); border: 2px solid rgba(255,255,255,0.22);
  border-radius: 16px; padding: 0.45rem 0.7rem; backdrop-filter: blur(6px);
}
.sub-craft { font-size: clamp(1.5rem, 6.5vw, 2.1rem); line-height: 1; display: flex; align-items: center; gap: 0.1rem; flex-wrap: wrap; justify-content: center; }
.sub-craft .sub-hull { font-size: 1.9em; }   /* the hull leads; parts ride on it */
.sub-craft .sub-part { animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1) backwards; }
.sub-crew { font-size: clamp(1.1rem, 5vw, 1.5rem); display: flex; gap: 0.2rem; flex-wrap: wrap; justify-content: center; opacity: 0.95; }

/* the descent canvas + flowing path */
.map-canvas { position: relative; width: 100%; max-width: 460px; flex: 0 0 auto; min-height: 58vh; margin: 0.4rem auto 0; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.map-node { position: absolute; transform: translate(-50%, -50%); width: 96px; text-align: center; pointer-events: none; }
.node-disc {
  width: 70px; height: 70px; border-radius: 50%; overflow: hidden; margin: 0 auto;
  border: 3px solid rgba(255,255,255,0.45); background: var(--deep); position: relative;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  transition: width 0.35s ease, height 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}
.node-disc img { width: 100%; height: 100%; object-fit: cover; }
.node-emoji { display: grid; place-items: center; width: 100%; height: 100%; font-size: 1.9rem; }
.map-node.locked .node-disc { border-style: dashed; border-color: rgba(255,255,255,0.28); box-shadow: none; }
.map-node.locked .node-disc img, .map-node.locked .node-emoji { filter: grayscale(0.8) brightness(0.6); opacity: 0.75; }
.map-node.complete .node-disc { border-color: var(--gold); }
.map-node.complete .node-disc::after {
  content: "✓"; position: absolute; top: -4px; right: -4px;
  width: 22px; height: 22px; background: var(--gold); color: var(--ink);
  border-radius: 50%; display: grid; place-items: center;
  font-family: var(--round); font-weight: 800; font-size: 0.8rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.map-node.current { pointer-events: auto; cursor: pointer; }
.map-node.current .node-disc {
  width: 84px; height: 84px; border-color: #fff;
  box-shadow: 0 0 26px rgba(255,255,255,0.55), 0 6px 18px rgba(0,0,0,0.45);
  animation: glow 1.4s ease-in-out infinite alternate;
}
.map-node.current:active .node-disc { transform: scale(0.96); }
.map-node.deeper .node-disc { border-style: dashed; opacity: 0.7; }
.node-label {
  margin-top: 0.35rem; font-family: var(--round); font-weight: 700;
  font-size: 0.92rem; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.map-node.locked .node-label, .map-node.deeper .node-label { opacity: 0.6; }

/* the submarine sprite, sailing to the current depth */
.map-sub {
  position: absolute; transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
  transition: left 1.2s cubic-bezier(0.4,0,0.2,1), top 1.2s cubic-bezier(0.4,0,0.2,1);
  animation: bob 1.8s ease-in-out infinite;
}
.map-sub-chip { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.5)); }
.map-sub-chip img { width: 1em; height: 1em; object-fit: contain; }

.map-foot {
  width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: center;
  gap: 0.4rem; padding: 0.3rem 0 max(0.4rem, env(safe-area-inset-bottom));
  position: sticky; bottom: 0; z-index: 6;   /* the dive CTA stays reachable while the map scrolls */
}
#map-dive.done { filter: grayscale(0.4); opacity: 0.85; }

/* ── bigger screens ── */
@media (min-width: 700px) {
  .ctrl { width: 60px; height: 60px; font-size: 1.6rem; }
  .ctrl-big { width: 78px; height: 78px; font-size: 2.1rem; }
  .zone-dot { width: 42px; height: 42px; font-size: 1.2rem; }
}
@media (max-height: 640px) {
  .q-objects { min-height: 72px; padding: 0.6rem; }
  .choice { min-height: 70px; }
  .buddy { font-size: 4.5rem; }
}

/* ═══════════ END-OF-ZONE FUN RATING ═══════════ */
.zone-rate { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin: 0.2rem 0 0.1rem; width: 100%; }
.zone-rate-q { font-family: var(--round); font-weight: 800; color: #fff; font-size: clamp(1rem, 4.6vw, 1.3rem); text-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.zone-rate-faces { display: flex; gap: 0.6rem; }
.zone-face {
  position: relative;
  font-size: clamp(2rem, 10vw, 3rem); line-height: 1; cursor: pointer;
  background: rgba(255,255,255,0.12); border: 3px solid transparent; border-radius: 18px;
  padding: 0.2rem 0.45rem; transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.zone-face:active { transform: scale(0.9); }
.zone-face.picked { border-color: var(--gold); background: rgba(255,215,94,0.25); transform: scale(1.12); }
/* Faces-first: the big continue button holds back for a beat (so a face tap
   captures the fun rating), then fades in as a no-stuck fallback. Stays in flow
   (opacity only) so the layout doesn't jump when it appears. */
#celebrate-btn { transition: opacity 0.45s ease, transform 0.45s ease; }
#screen-celebrate.awaiting-rate #celebrate-btn { opacity: 0; transform: translateY(8px); pointer-events: none; }
/* The faces invite a tap (they double as the "keep going" action) with a gentle
   staggered bob; tapping cheers with a bounce + sparkles. */
.zone-rate-faces .zone-face { animation: zf-invite 1.6s ease-in-out infinite; }
.zone-rate-faces .zone-face:nth-child(2) { animation-delay: 0.2s; }
.zone-rate-faces .zone-face:nth-child(3) { animation-delay: 0.4s; }
.zone-face.cheer { animation: zf-cheer 0.5s ease forwards; }
@keyframes zf-invite { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes zf-cheer { 0% { transform: scale(1); } 35% { transform: scale(1.35) rotate(-6deg); } 70% { transform: scale(1.15) rotate(4deg); } 100% { transform: scale(1.12); } }
.zf-spark {
  position: absolute; left: 50%; top: 30%; pointer-events: none;
  font-size: 0.9rem; opacity: 0;
  animation: zf-spark-fly 0.8s ease-out forwards;
}
@keyframes zf-spark-fly {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.4); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0) * 40px), -34px) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .zone-rate-faces .zone-face { animation: none; }
}
.zone-note { width: 100%; max-width: 340px; font-family: var(--round); }
.zone-note summary { list-style: none; text-align: center; cursor: pointer; font-weight: 700; color: rgba(255,255,255,0.8); font-size: 0.85rem; padding: 0.2rem; }
.zone-note summary::-webkit-details-marker { display: none; }
.zone-note textarea { width: 100%; margin-top: 0.3rem; border-radius: 12px; border: 2px solid rgba(255,255,255,0.35); padding: 0.45rem; font-family: var(--body); font-size: 0.95rem; resize: vertical; }

/* ═══════════ NAME YOUR SUB (first run) ═══════════ */
.name-box { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; max-width: 560px; width: 100%; padding: 1rem; }
.name-castle { font-size: clamp(4rem, 20vw, 6.5rem); filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3)); animation: bob 2.6s ease-in-out infinite; }
.name-title { font-family: var(--round); font-weight: 800; font-size: clamp(1.6rem, 7vw, 2.4rem); color: #fff; margin: 0.4rem 0; text-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.name-hint { font-family: var(--round); font-weight: 600; color: #fff; font-size: 1.05rem; margin-bottom: 1.1rem; text-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; width: 100%; max-width: 460px; margin-bottom: 1rem; }
.name-choice {
  font-family: var(--round); font-weight: 800; font-size: clamp(1.1rem, 4.8vw, 1.5rem);
  color: var(--ink); background: linear-gradient(180deg, #ffffff, #dff1fb);
  border: none; border-radius: 20px; min-height: 84px; padding: 0.6rem;
  box-shadow: 0 5px 0 #4f9ec4, 0 10px 20px rgba(0,0,0,0.25); transition: transform 0.1s, box-shadow 0.1s;
}
.name-choice:active { transform: translateY(3px); box-shadow: 0 2px 0 #4f9ec4, 0 5px 12px rgba(0,0,0,0.25); }
.name-chosen { grid-column: 1 / -1; font-family: var(--round); font-weight: 800; font-size: clamp(1.6rem, 7vw, 2.4rem); color: var(--gold); text-shadow: 0 2px 10px rgba(0,0,0,0.4); animation: crewJoin 0.7s cubic-bezier(0.34,1.6,0.5,1); padding: 1.4rem 0; }

/* ═══════════ THE DIG, FOLDED INTO PLAY (treasure rock) + THE FORGE ═══════════ */
/* Mirrors Ivy's geode + forge: crack a rock with the hammer, ore spills as the
   add/take-away groups, and the ore he cracks out feeds the forge. */
.map-action {
  flex: 1; min-height: 56px; font-family: var(--round); font-weight: 800;
  font-size: 1.05rem; color: #07344d; border: none; border-radius: 16px;
  padding: 0.6rem 0.4rem; box-shadow: 0 4px 0 rgba(0,0,0,0.18);
}
.map-action.forge { background: linear-gradient(180deg, #ffe08a, #ffc23d); }
.map-action.crew  { background: linear-gradient(180deg, #7fe6ff, #36c2ef); }
.map-action:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.18); }
.map-action.forge.ready { animation: forge-ready 1.4s ease-in-out infinite; }
.map-action.forge b { font-size: 1.15em; }
@keyframes forge-ready {
  0%,100% { box-shadow: 0 4px 0 rgba(0,0,0,0.18), 0 0 0 rgba(255,215,94,0); }
  50%     { box-shadow: 0 4px 0 rgba(0,0,0,0.18), 0 0 16px rgba(255,215,94,0.9); }
}

/* The treasure rock he whacks with the hammer, then counts the ore. */
.q-objects.minerock { background: rgba(255,255,255,0.1); }
.q-rock {
  position: relative; border: none; background: none; cursor: pointer; padding: 0;
  width: clamp(140px, 46vw, 210px); height: clamp(140px, 46vw, 210px);
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.4));
}
.q-rock-e { font-size: clamp(7rem, 36vw, 11rem); line-height: 1; filter: drop-shadow(0 0 14px rgba(120,200,255,0.7)); animation: q-glow 1.8s ease-in-out infinite; }
@keyframes q-glow { 0%,100% { filter: drop-shadow(0 0 12px rgba(120,200,255,0.6)); transform: scale(1); } 50% { filter: drop-shadow(0 0 22px rgba(255,215,94,0.8)); transform: scale(1.05); } }
.q-rock.hit { animation: q-shake 0.18s; }
.q-rock.hit .q-rock-e { animation: none; }
.q-rock.crack2 .q-rock-e { filter: brightness(1.1) drop-shadow(0 0 18px rgba(255,215,94,0.8)); }
.q-rock.crack3 .q-rock-e { filter: brightness(1.18) saturate(1.2) drop-shadow(0 0 26px rgba(255,215,94,0.95)); }
.q-rock.cracked { animation: q-pop 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.q-rock-spark { position: absolute; top: 10%; right: 12%; font-size: clamp(1.4rem, 7vw, 2.2rem); pointer-events: none; }
.q-rock.cracked .q-hammer, .q-rock.cracked .q-rock-spark { display: none; }
.q-hammer {
  position: absolute; bottom: -2%; left: -12%; width: 46%; height: 46%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(2.6rem, 14vw, 4.2rem); line-height: 1;
  transform-origin: 34% 82%; transform: rotate(-16deg); pointer-events: none;
}
.q-rock.hit .q-hammer { animation: q-whack 0.18s ease-in-out; }
@keyframes q-whack { 0%,100% { transform: rotate(-16deg); } 45% { transform: rotate(30deg); } }
@keyframes q-shake { 0%,100%{ transform: translate(0,0) rotate(0);} 25%{ transform: translate(-5px,2px) rotate(-3deg);} 75%{ transform: translate(5px,-2px) rotate(3deg);} }
@keyframes q-pop { 0%{ transform: scale(1);} 40%{ transform: scale(1.2) rotate(-3deg);} 100%{ transform: scale(1.05);} }
.q-rock.falling { animation: q-fall 0.4s ease-in forwards; pointer-events: none; }
@keyframes q-fall { 0%{ transform: scale(1.05); opacity: 1;} 100%{ transform: translateY(56px) scale(0.55) rotate(10deg); opacity: 0;} }
.q-objects.minereveal { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); box-shadow: inset 0 2px 16px rgba(0,0,0,0.16); animation: q-reveal-in 0.42s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes q-reveal-in { 0%{ opacity: 0; transform: scale(0.55);} 100%{ opacity: 1; transform: scale(1);} }
.q-objects.minereveal .obj { font-size: clamp(1.9rem, 9.5vw, 2.9rem); }
.q-objects.minereveal .tf-obj { font-size: clamp(1.1rem, 5.5vw, 1.8rem); }

/* The whole play area jolts when the rock finally cracks open. */
.reef-jolt { animation: reef-jolt 0.42s cubic-bezier(0.36,0.07,0.19,0.97); }
@keyframes reef-jolt {
  0%,100% { transform: translate(0,0); }
  15% { transform: translate(-6px,3px); } 30% { transform: translate(6px,-3px); }
  45% { transform: translate(-5px,-2px); } 60% { transform: translate(4px,3px); }
  75% { transform: translate(-3px,1px); } 90% { transform: translate(2px,-1px); }
}

/* Loot juice: chips/ore fly off the rock, and a banner on a lucky gem. */
.loot-banner { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; animation: crewJoin 0.5s cubic-bezier(0.34,1.6,0.5,1); }
.loot-big { font-size: clamp(3rem, 16vw, 5rem); filter: drop-shadow(0 4px 10px rgba(255,215,94,0.6)); }
.loot-word { font-family: var(--round); font-weight: 800; color: var(--gold); font-size: clamp(1.1rem, 5vw, 1.6rem); text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.loot-spark { position: fixed; z-index: 9999; font-size: 1.8rem; pointer-events: none; transition: transform 1s ease-out, opacity 1s ease-out; }

/* The forge — combine the ore he cracked out into one big sparkle gem. */
.forge-view { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.8rem; padding: 1rem; max-height: 100%; overflow-y: auto; }
.forge-title { font-family: var(--round); font-weight: 800; font-size: clamp(1.5rem, 6.5vw, 2.2rem); color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.4); }
.forge-recipe { font-family: var(--round); font-weight: 700; font-size: clamp(1rem, 4.6vw, 1.4rem); color: #fff; background: rgba(0,0,0,0.25); padding: 0.5rem 1rem; border-radius: 16px; text-align: center; }
.forge-recipe b { color: var(--gold); text-shadow: 0 1px 2px rgba(0,0,0,0.55); }
.forge-cauldron {
  position: relative; width: 100%; max-width: 360px; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 0.8rem; border-radius: 26px;
  background: rgba(20,90,140,0.30); border: 4px dashed rgba(255,215,94,0.7);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.forge-cauldron.ready { background: rgba(255,215,94,0.30); box-shadow: 0 0 26px rgba(255,215,94,0.7); }
.forge-cauldron.fused { border-style: solid; }
.forge-cauldron-pot { font-size: clamp(3rem, 16vw, 5rem); line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); }
.forge-tally { display: flex; gap: 0.8rem; font-family: var(--round); font-weight: 800; font-size: clamp(1.1rem, 5vw, 1.5rem); color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.6); }
.forge-drops { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.15rem; min-height: 1.2em; }
.forge-drop { font-size: clamp(1.5rem, 7vw, 2.2rem); animation: forgePop 0.35s ease both; cursor: pointer; }
@keyframes forgePop { 0%{ transform: scale(0); } 60%{ transform: scale(1.3); } 100%{ transform: scale(1); } }
.forge-tray { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; width: 100%; max-width: 460px; min-height: 70px; padding: 0.5rem; border-radius: 20px; background: rgba(0,0,0,0.18); }
.forge-gem {
  font-size: clamp(2.2rem, 11vw, 3.2rem); line-height: 1; cursor: grab;
  padding: 0.15rem; border-radius: 14px; touch-action: none; user-select: none;
  transition: opacity 0.2s; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}
.forge-gem.spent { display: none; }
.forge-ghost { font-size: clamp(2.2rem, 11vw, 3.2rem); line-height: 1; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5)); transform: scale(1.15); }
.forge-out { font-size: clamp(4rem, 22vw, 7rem); animation: crewJoin 0.7s cubic-bezier(0.34,1.6,0.5,1); filter: drop-shadow(0 0 16px var(--gold)); }
.forge-prompt { font-family: var(--round); font-weight: 800; font-size: clamp(1.2rem, 5.2vw, 1.6rem); color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.4); text-align: center; }
.forge-choices { display: grid; grid-template-columns: 1fr; gap: 0.6rem; width: 100%; max-width: 460px; }
.forge-choices .btn-big { grid-column: 1 / -1; }
/* Forge inventory — what he HAS across the chain (storage made visible). */
.forge-inv { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.forge-inv-item {
  font-family: var(--round); font-weight: 800; font-size: clamp(1rem, 4.6vw, 1.35rem);
  color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.28); padding: 0.3rem 0.7rem; border-radius: 14px;
}
/* The full chain shown when he has nothing to forge yet (recipe area). */
.forge-formula { display: block; margin: 0.1rem 0; }
/* Reveal-on-crack banner — names what he found + what it forges into. */
.crack-reveal {
  margin-top: 0.4rem; font-family: var(--round); font-weight: 800;
  font-size: clamp(1rem, 4.4vw, 1.3rem); color: #fff; text-align: center;
  background: rgba(20,90,140,0.55); padding: 0.4rem 0.8rem; border-radius: 16px;
  animation: forgePop 0.4s ease both;
}
.crack-reveal b { color: var(--gold); text-shadow: 0 1px 2px rgba(0,0,0,0.65); }

/* ── "Quick look" (subitizing): dice-pattern grid + the coral cover ── */
.flash-wrap { position: relative; display: inline-block; padding: 0.3rem; }
.flash-grid {
  display: grid;
  grid-template-columns: repeat(3, clamp(2.6rem, 12vw, 3.6rem));
  grid-template-rows: repeat(3, clamp(2.6rem, 12vw, 3.6rem));
  gap: 0.1rem; justify-content: center;
  transition: opacity 0.3s;
}
.flash-cell { display: flex; align-items: center; justify-content: center; }
.flash-cover {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.flash-coral { font-size: clamp(3.2rem, 16vw, 4.6rem); filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
.flash-q {
  font-family: var(--round); font-weight: 800; color: var(--gold);
  font-size: clamp(2.2rem, 11vw, 3.2rem); text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.flash-wrap.hidden .flash-grid { opacity: 0; }
.flash-wrap.hidden .flash-cover { opacity: 1; }

/* ── Number line (0–10): read the hidden number's position ── */
.numline {
  position: relative; display: flex; justify-content: space-between;
  width: 100%; max-width: 500px; margin: 0.8rem auto 0.2rem;
  padding: 0.85rem 0.3rem 0.2rem;
}
.numline::before {
  content: ''; position: absolute; left: 3%; right: 3%; top: 1.05rem;
  height: 4px; border-radius: 2px; background: rgba(247,252,255,0.55);
}
.nl-tick { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; flex: 1; }
.nl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--paper); margin-bottom: 0.3rem; }
.nl-num { font-family: var(--round); font-weight: 800; font-size: clamp(0.95rem, 4vw, 1.25rem); color: var(--paper); }
.nl-tick.nl-hidden .nl-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.nl-tick.nl-hidden .nl-num { font-size: clamp(1.2rem, 5vw, 1.5rem); }

/* ── Speed dive: node badge, HUD, result, and the friend's earned trick ── */
/* THE speed-round fix (Rose 2026-07-30: "where are the speed rounds?"):
   .map-node has pointer-events:none with only .current re-enabled, so real
   TAPS never reached cleared zones — speed dives were unreachable by finger
   since 07-24 (JS-driven verification bypassed pointer-events and missed it). */
.map-node.complete { cursor: pointer; pointer-events: auto; }
.map-node.complete::before { animation: speedPulse 2.2s ease-in-out infinite; }
@keyframes speedPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }
.map-node.complete::before {
  content: '⚡'; position: absolute; top: -0.5rem; right: -0.25rem; z-index: 2;
  font-size: 1.15rem; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.45));
}
.speed-hud {
  position: fixed; top: 4.7rem; right: 0.8rem; z-index: 40;
  background: rgba(7,59,92,0.78); border-radius: 14px; padding: 0.35rem 0.75rem;
  font-family: var(--round); font-weight: 800; font-size: 1.05rem; color: var(--gold);
}
.speed-result { text-align: center; padding: 1.2rem 0.6rem; }
.speed-time { font-family: var(--round); font-size: clamp(2rem, 9vw, 2.8rem); font-weight: 800; color: var(--paper); }
.speed-note { font-family: var(--round); font-size: clamp(1.1rem, 5vw, 1.5rem); font-weight: 800; color: var(--gold); margin-top: 0.45rem; }
.trick-fly { position: fixed; left: 0; top: 42%; z-index: 70; pointer-events: none; animation: trickLeap 2.5s ease-in-out forwards; }
.trick-face { font-size: 3.4rem; line-height: 1; display: block; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35)); }
.trick-face img { width: 4.5rem; height: 4.5rem; object-fit: contain; }
@keyframes trickLeap {
  0%   { transform: translateX(-16vw) translateY(0)      rotate(0deg); }
  25%  { transform: translateX(22vw)  translateY(-9vh)   rotate(180deg); }
  50%  { transform: translateX(55vw)  translateY(2vh)    rotate(360deg); }
  75%  { transform: translateX(86vw)  translateY(-7vh)   rotate(540deg); }
  100% { transform: translateX(116vw) translateY(0)      rotate(720deg); }
}
.crew-card.has-trick { position: relative; }
.crew-card.has-trick::after { content: '🌟'; position: absolute; top: 0.3rem; right: 0.4rem; font-size: 1.2rem; }

/* number-line tutorial: ticks light one by one as the voice counts along */
.nl-tick.nl-lit .nl-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); transform: scale(1.25); }
.nl-tick.nl-lit .nl-num { color: var(--gold); }

/* ════════════════════════════════════════════════════════════════
   CANDLE & INK — design pass 2026-07-28 (Rose's handoff, turn 4 + 3a)
   One calm system: candle primaries, ink glass panels, warm-gold
   wayfinding, bright gold for REWARDS ONLY. Shared with unicornmath —
   same layer, re-colored through the tokens below.
════════════════════════════════════════════════════════════════ */
:root {
  --candle: #fdf6e8;                 /* primary fill + headline text */
  --warm:   #f4b87a;                 /* wayfinding accent */
  --ink2:   #14293c;                 /* text on candle */
  --surf1:  #0d2236; --surf2: #071523;             /* surface gradient */
  --glassd: rgba(7,25,42,0.62);      /* question panel glass */
  --glassp: rgba(7,25,42,0.6);       /* pill glass */
  --glassb: rgba(7,21,35,0.7);       /* bottom-sheet glass */
  --hairline: rgba(253,246,232,0.3);
  --hairline-dim: rgba(253,246,232,0.2);
  /* retint the legacy tokens the old rules lean on */
  --deep: #0d2236; --deepest: #071523; --ink: #14293c; --paper: #fdf6e8;
}

/* ── surfaces ── */
body {
  background: linear-gradient(180deg, var(--surf1) 0%, var(--surf2) 100%);
}
body::after {              /* stardust replaces the sandy seabed glow */
  height: 100%;
  opacity: 0.55;
  background:
    radial-gradient(circle at 12% 12%, rgba(253,246,232,0.65) 0, transparent 1.3px),
    radial-gradient(circle at 86% 8%,  rgba(253,246,232,0.55) 0, transparent 1.4px),
    radial-gradient(circle at 8% 40%,  rgba(253,246,232,0.4)  0, transparent 1px),
    radial-gradient(circle at 92% 36%, rgba(244,184,122,0.5)  0, transparent 1.2px),
    radial-gradient(circle at 15% 88%, rgba(253,246,232,0.45) 0, transparent 1.1px),
    radial-gradient(circle at 55% 62%, rgba(253,246,232,0.35) 0, transparent 1px),
    radial-gradient(circle at 82% 90%, rgba(244,184,122,0.45) 0, transparent 1.2px);
}
#scene-bg::after {         /* scrim over scene art — critical for contrast */
  background: linear-gradient(180deg,
    rgba(7,25,42,0.78) 0%, rgba(7,25,42,0.3) 22%, transparent 45%,
    rgba(7,25,42,0.65) 72%, rgba(7,25,42,0.95) 100%);
}

/* ── type ── */
.eyebrow {
  font-family: var(--body); font-weight: 800; font-size: 12px;
  letter-spacing: 0.36em; text-transform: uppercase; color: var(--warm);
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
.title {
  font-family: var(--round); font-weight: 700;
  font-size: clamp(3rem, 13vw, 4rem); line-height: 0.95; color: var(--candle);
  text-shadow: 0 2px 2px rgba(0,0,0,0.5), 0 6px 22px rgba(0,0,0,0.45);
}
.title .accent { color: var(--warm); text-shadow: inherit; display: block; }

/* section ornament: hairline rule with a centered ✦ */
.rule-orn {
  width: 190px; display: flex; align-items: center; gap: 8px;
  color: var(--warm); font-size: 10px; margin: 0.9rem auto 0;
}
.rule-orn span { flex: 1; height: 1px; }
.rule-orn span:first-child { background: linear-gradient(90deg, transparent, var(--warm)); }
.rule-orn span:last-child  { background: linear-gradient(90deg, var(--warm), transparent); }

/* ── buttons ── */
.btn-big {
  font-family: var(--round); font-weight: 700;
  font-size: clamp(1.2rem, 5vw, 1.44rem); color: var(--ink2);
  background: var(--candle); border: none; border-radius: 999px;
  padding: 0.95rem 2.7rem; min-height: 60px;
  box-shadow: 0 8px 26px rgba(253,246,232,0.2);
  text-shadow: none; transition: transform 0.12s;
}
.btn-big:active { transform: scale(0.97); box-shadow: 0 6px 18px rgba(253,246,232,0.16); }
.btn-big.done { background: rgba(253,246,232,0.25); color: var(--candle); box-shadow: none; }
.btn-ghost, .map-action {
  font-family: var(--body); font-weight: 800; font-size: 0.85rem;
  color: var(--candle); background: var(--glassp);
  border: 1px solid rgba(253,246,232,0.5); border-radius: 999px;
  padding: 0.7rem 1.4rem; min-height: 46px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: none; text-shadow: none; transition: transform 0.12s;
}
.btn-ghost:active, .map-action:active { transform: scale(0.97); }
.btn-tiny {
  font-family: var(--body); font-weight: 700; font-size: 0.8rem;
  color: rgba(253,246,232,0.65); background: none; border: none;
  text-decoration: underline; text-underline-offset: 3px;
  box-shadow: none; padding: 0.5rem 0.8rem;
}
.btn-tiny.danger { color: rgba(255,160,140,0.85); }
.map-action.home { color: rgba(253,246,232,0.65); background: rgba(7,21,35,0.35); border-color: rgba(253,246,232,0.3); text-decoration: none; }

/* control circles */
.ctrl {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(253,246,232,0.45); background: rgba(7,25,42,0.55);
  color: var(--candle); font-size: 1.15rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: none; transition: transform 0.12s;
}
.ctrl:active { transform: scale(0.94); }
.ctrl-big {
  width: 64px; height: 64px; font-size: 1.5rem;
  border: 1.5px solid var(--warm); background: rgba(244,184,122,0.2);
}
.ctrl.off { opacity: 0.45; }

/* ── counters ── */
.star-counter, .gem-counter {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--glassp); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 7px 16px;
  font-family: var(--round); font-weight: 700; font-size: 1.05rem;
  color: var(--candle); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: none;
}

/* ── welcome ── */
.welcome-box { text-align: center; }
.welcome-box .buddy { filter: drop-shadow(0 10px 24px rgba(0,0,0,0.5)); }
.subtitle {
  font-family: var(--round); font-weight: 600; font-size: 1.3rem;
  color: var(--candle); text-shadow: 0 2px 8px rgba(0,0,0,0.6); max-width: 24ch;
  margin-left: auto; margin-right: auto;
}
.welcome-stars {
  font-family: var(--body); font-weight: 800; font-size: 0.9rem;
  color: var(--gold); text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* ── play HUD ── */
.hud-row { align-items: center; }
.zone-pill {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--glassp); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 7px 16px; max-width: 70%;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hud-zone {
  font-family: var(--body); font-weight: 800; font-size: 0.75rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--warm);
  text-shadow: none; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zone-track { display: inline-flex; gap: 4px; flex: none; }
.tier-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(253,246,232,0.3); }
.tier-dot.on { background: var(--warm); }
.q-prompt {
  font-family: var(--round); font-weight: 700;
  font-size: clamp(1.35rem, 6vw, 1.7rem); color: var(--candle);
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.q-objects {
  background: var(--glassd); border: 1px solid var(--hairline-dim);
  border-radius: 26px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.equation { color: var(--candle); }
.equation .eq-n { color: var(--candle); background: none; }
.equation .eq-op { color: var(--warm); background: none; }
.equation .eq-box {
  min-width: 46px; height: 46px; border: 2.5px dashed var(--warm);
  border-radius: 12px; color: var(--warm); background: none; box-shadow: none;
}
.dive-meter .dive-pip, .dive-meter .dive-pip.on { font-size: 17px; }
.dive-meter .dive-pip { filter: grayscale(1); opacity: 0.4; }
.dive-meter .dive-pip.on { filter: none; opacity: 1; }

/* answer cards */
.choice {
  font-family: var(--round); font-weight: 700; font-size: clamp(1.9rem, 9vw, 2.5rem);
  color: var(--ink2); background: var(--candle);
  border: none; border-radius: 22px; min-height: 88px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  text-shadow: none; transition: transform 0.12s;
}
.choice:active { transform: scale(0.97); }
.choice:disabled { opacity: 0.55; }
.choice.correct { background: #7fe6b0; color: var(--ink2); box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.choice.wrong { background: #f3a08c; color: var(--ink2); }
.choice.await-count { opacity: 0.35; }
.choice.hint-glow { box-shadow: 0 0 0 4px rgba(244,184,122,0.7), 0 8px 24px rgba(0,0,0,0.35); }
.choice-done { background: var(--candle); color: var(--ink2); }

/* ── map: postcard & chart (3a) ── */
#screen-map { padding-top: 0; }
.map-hero {
  position: absolute; left: 0; right: 0; top: 0; height: 250px; z-index: 0;
  overflow: hidden; pointer-events: none;
}
.map-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,21,35,0.55) 0%, transparent 35%,
    transparent 55%, rgba(13,34,54,0.85) 88%, var(--surf1) 100%);
}
.map-head { position: relative; z-index: 1; padding-top: max(1.2rem, env(safe-area-inset-top)); }
.map-head-row {
  width: 100%; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 0.6rem; text-align: left;
}
.map-head .eyebrow { font-size: 11px; letter-spacing: 0.32em; margin-bottom: 2px; }
.map-title {
  font-family: var(--round); font-weight: 700; font-size: clamp(1.5rem, 7vw, 1.9rem);
  color: var(--candle); text-shadow: 0 2px 8px rgba(0,0,0,0.7); line-height: 1.1;
}
.sub-build { display: none; }         /* the build showcase lives in crew/celebrate now */
.map-canvas { z-index: 1; margin-top: 140px; }   /* chart clears the postcard hero */
.map-svg path#map-path-done { stroke: var(--warm); }
.map-svg path#map-path-pending { stroke: rgba(253,246,232,0.55); stroke-dasharray: 2 10; }

/* nodes */
.map-node .node-label {
  font-family: var(--body); font-weight: 800; font-size: 12px;
  color: rgba(253,246,232,0.85); text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
.map-node.complete .node-disc {
  width: 62px; height: 62px; border: 2px solid var(--warm);
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}
.map-node.complete::after {          /* the ✓ badge (top-right of the disc) */
  content: "✓"; position: absolute; top: -4px; right: 12px; z-index: 2;
  width: 18px; height: 18px; background: var(--warm); color: var(--surf1);
  border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; font-family: var(--body);
}
.map-node.complete::before { right: auto; left: 8px; top: -8px; }   /* ⚡ speed badge moves top-left */
.map-node.current .node-disc {
  width: 92px; height: 92px; border: 3px solid var(--candle);
  box-shadow: 0 0 0 4px rgba(244,184,122,0.5), 0 0 34px rgba(244,184,122,0.55), 0 8px 20px rgba(0,0,0,0.5);
  animation: none;
}
.map-node.current .node-label {
  display: inline-block; background: var(--candle); color: var(--ink2);
  padding: 3px 14px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35); text-shadow: none;
}
.map-node.locked { opacity: 0.7; }
.map-node.locked .node-disc {
  width: 54px; height: 54px; border: 2px dashed rgba(253,246,232,0.5);
  background: rgba(253,246,232,0.06); box-shadow: none;
}
.map-node.locked .node-disc img { opacity: 0.6; }
.map-node.locked .node-disc::after {
  content: "🔒"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.map-node.locked .node-label { color: rgba(253,246,232,0.55); }
.map-node.deeper .node-disc { border: 2px dashed rgba(253,246,232,0.4); background: rgba(253,246,232,0.05); }
.map-sub { z-index: 3; margin-left: -58px; margin-top: -10px; }
.map-sub .map-sub-img, .map-sub img { width: 68px; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.6)); }

/* bottom sheet */
.map-foot { gap: 0.6rem; }
.map-sheet {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--glassb); border: 1px solid rgba(253,246,232,0.22);
  border-radius: 24px; padding: 13px 16px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.map-buddy { width: 54px; height: 54px; object-fit: contain; flex: none; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); }
.map-teaser {
  flex: 1; text-align: left; font-family: var(--round); font-weight: 700;
  font-size: 1.05rem; line-height: 1.15; color: var(--candle);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.map-sheet .btn-big { flex: none; padding: 0.8rem 1.7rem; min-height: 52px; font-size: 1.15rem; }
.map-foot-row { display: flex; justify-content: center; gap: 10px; }

/* ── celebrate ── */
.celebrate-box { background: none; border: none; box-shadow: none; }
.celebrate-title {
  font-family: var(--round); font-weight: 700; font-size: clamp(1.6rem, 8vw, 2rem);
  color: var(--candle); text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.celebrate-text { font-family: var(--round); font-weight: 600; color: rgba(253,246,232,0.9); text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.celebrate-emoji { filter: drop-shadow(0 0 34px rgba(255,215,94,0.7)) drop-shadow(0 10px 20px rgba(0,0,0,0.45)); }
.celebrate-sub, .celebrate-crew {
  background: var(--glassp); border: 1px solid var(--hairline-dim); border-radius: 999px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: none;
}
.zone-rate-q { font-family: var(--body); font-weight: 800; color: rgba(253,246,232,0.85); text-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.zone-face {
  font-size: 38px; background: rgba(7,21,35,0.55);
  border: 1.5px solid rgba(253,246,232,0.35); border-radius: 20px;
  padding: 8px 16px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: none; transition: transform 0.12s;
}
.zone-face:active { transform: scale(0.94); }
.zone-face.picked { border-color: var(--warm); background: rgba(244,184,122,0.2); }
.finale-box {
  background: var(--glassb); border: 1px solid var(--hairline-dim); border-radius: 26px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.finale-title { font-family: var(--round); font-weight: 700; color: var(--candle); }

/* ── forge ── */
#screen-forge {
  background: linear-gradient(180deg, var(--surf1) 0%, var(--surf2) 100%);
}
#screen-forge::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 30%, rgba(244,184,122,0.16), transparent 55%);
}
.forge-title {
  font-family: var(--round); font-weight: 700; font-size: clamp(1.5rem, 7vw, 1.9rem);
  color: var(--candle); text-shadow: none;
}
.forge-eyebrow { margin-bottom: 2px; }
.forge-inv span, .forge-inv .inv-chip {
  background: var(--glassp); border: 1px solid var(--hairline-dim);
  border-radius: 999px; color: var(--candle);
}
.forge-recipe {
  background: var(--glassp); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 0.6rem 1.3rem;
  font-family: var(--round); font-weight: 700; color: var(--candle);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.forge-recipe b { color: var(--gold); }
.forge-cauldron {
  width: clamp(170px, 52vw, 218px); height: clamp(170px, 52vw, 218px);
  border: 2.5px dashed rgba(244,184,122,0.75); border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(244,184,122,0.18), rgba(244,184,122,0.05) 70%);
  box-shadow: none;
}
.forge-cauldron.ready { border-color: var(--gold); }
.forge-tally { font-family: var(--body); font-weight: 800; font-size: 14px; color: var(--warm); }
.forge-tray {
  background: var(--glassd); border: 1px solid var(--hairline-dim);
  border-radius: 22px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#forge-back { background: none; border: 1px solid rgba(253,246,232,0.35); color: var(--candle); box-shadow: none; font-size: 1rem; min-height: 48px; padding: 0.7rem 1.6rem; }

/* ── glass panels everywhere else (name / intro / report / crew / banners) ── */
.name-box, .intro-box, .crew-view, .report .rep-card, .rep-reco {
  background: var(--glassb); border: 1px solid var(--hairline-dim);
  border-radius: 26px; box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.name-choice {
  background: var(--candle); color: var(--ink2); border: none; border-radius: 999px;
  font-family: var(--round); font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  text-shadow: none;
}
.name-choice:active { transform: scale(0.97); }
.crew-card {
  background: rgba(253,246,232,0.08); border: 1px solid var(--hairline-dim);
  border-radius: 22px; box-shadow: none;
}
.crew-title, .name-title, .report-title {
  font-family: var(--round); font-weight: 700; color: var(--candle); text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.welcome-back {
  background: var(--glassb); border: 1px solid var(--hairline);
  border-radius: 24px; box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.speed-hud {
  background: var(--glassp); border: 1px solid var(--hairline);
  color: var(--warm); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.speed-time { color: var(--candle); }
.speed-note { color: var(--gold); }

/* number line + flash retints (warm wayfinding; gold stays on reward moments) */
.numline::before { background: rgba(253,246,232,0.55); }
.nl-dot { background: var(--candle); }
.nl-num { color: var(--candle); }
.nl-tick.nl-hidden .nl-dot { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.nl-tick.nl-lit .nl-dot { background: var(--warm); box-shadow: 0 0 10px var(--warm); }
.nl-tick.nl-lit .nl-num { color: var(--warm); }
.flash-q { color: var(--warm); }

/* tenframes / column grid: ink glass + warm live-column glow */
.tenframe .tf-cell { background: rgba(253,246,232,0.07); border: 1.5px solid rgba(253,246,232,0.25); box-shadow: none; }
.tenframe .tf-cell.filled { background: rgba(253,246,232,0.14); }
.num-chip { background: rgba(253,246,232,0.1); border: 1px solid var(--hairline-dim); color: var(--candle); }
.num-chip.got { background: var(--gold); color: var(--ink2); border-color: var(--gold); }
.num-chip.locked { opacity: 0.35; }

@media (prefers-reduced-motion: reduce) {
  .btn-big, .choice, .ctrl, .btn-ghost, .map-action { transition: none; }
}

/* ghost pills win over the legacy colored map-action variants */
.map-action.forge, .map-action.crew, .map-action.forge.ready {
  background: var(--glassp); border: 1px solid rgba(253,246,232,0.5);
  color: var(--candle); box-shadow: none; white-space: nowrap;
}
.map-action.forge b { color: var(--gold); font-weight: 800; }
.map-action.forge.ready { border-color: var(--warm); background: rgba(244,184,122,0.16); }
.ctrl.speaking { border-color: var(--warm); box-shadow: 0 0 12px rgba(244,184,122,0.55); animation: none; }

/* teach card + narrow-screen polish (Candle & Ink) */
.big-numeral {
  background: var(--candle); color: var(--ink2); border: none;
  border-radius: 22px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); text-shadow: none;
}
.big-numeral.hint { background: var(--candle); color: var(--ink2); }
.map-actions { flex-wrap: wrap; }
@media (max-width: 430px) {
  .map-action { padding: 0.6rem 1rem; font-size: 0.8rem; }
  .map-sheet { padding: 11px 12px; gap: 9px; }
  .map-sheet .btn-big { padding: 0.7rem 1.3rem; font-size: 1.05rem; }
}
.map-foot-row .map-action { flex: none; }


/* map: the scene continues behind the chart, desaturated (Rose + kids 2026-07-31) */
.map-hero { display: none; }
body:has(#screen-map.active) #scene-bg { filter: saturate(0.4) brightness(0.55); }
