/* ════════════════════════════════════════════════════════
   Catch — underwater number-tap arcade
   ════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100vh;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-family: 'Fredoka', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  color: #fff;
}

body {
  position: relative;
  background: transparent;
}

/* ─── Ocean backdrop ───────────────────────────────────── */
.ocean {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    180deg,
    #5cc1e8 0%,
    #2998c8 18%,
    #1875a8 38%,
    #0f5586 60%,
    #08385e 82%,
    #04253d 100%
  );
  overflow: hidden;
  z-index: -2;
}

/* Surface shimmer at top */
.surface {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 12%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  animation: surfaceShimmer 8s ease-in-out infinite;
}
@keyframes surfaceShimmer {
  0%, 100% { opacity: 0.7; transform: translateY(0); }
  50%      { opacity: 1.0; transform: translateY(-2px); }
}

/* God rays from the surface */
.sun-rays {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: screen;
}
.ray {
  position: absolute;
  top: -10%;
  width: 14%;
  height: 130%;
  background: linear-gradient(180deg, rgba(255, 240, 180, 0.45) 0%, rgba(255, 240, 180, 0) 75%);
  transform-origin: top center;
  transform: skewX(-8deg);
  filter: blur(8px);
  animation: raySway 10s ease-in-out infinite;
}
.ray-1 { left: 8%;  animation-delay: 0s;     transform: skewX(-12deg); }
.ray-2 { left: 32%; animation-delay: -2.5s;  width: 10%; transform: skewX(-4deg); }
.ray-3 { left: 56%; animation-delay: -5s;    width: 16%; transform: skewX(2deg); }
.ray-4 { left: 78%; animation-delay: -7.5s;  width: 12%; transform: skewX(10deg); }
@keyframes raySway {
  0%, 100% { opacity: 0.55; transform: skewX(-8deg) translateX(0); }
  50%      { opacity: 0.30; transform: skewX(-4deg) translateX(8px); }
}

/* Background bubbles drifting up */
.bg-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.18) 0 4px, transparent 5px),
    radial-gradient(circle at 22% 70%, rgba(255,255,255,0.14) 0 3px, transparent 4px),
    radial-gradient(circle at 40% 95%, rgba(255,255,255,0.20) 0 5px, transparent 6px),
    radial-gradient(circle at 60% 80%, rgba(255,255,255,0.14) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 88%, rgba(255,255,255,0.18) 0 4px, transparent 5px),
    radial-gradient(circle at 88% 60%, rgba(255,255,255,0.12) 0 3px, transparent 4px);
  background-size: 100% 200%;
  animation: bgBubblesUp 18s linear infinite;
}
@keyframes bgBubblesUp {
  from { background-position: 0 0; }
  to   { background-position: 0 -200%; }
}

/* Seabed */
.seabed {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 18%;
  pointer-events: none;
}
.sand {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(180deg, #c8a96a 0%, #a07f4a 60%, #6e5430 100%);
  border-top: 4px solid #d4b67a;
  box-shadow: inset 0 8px 16px rgba(255, 230, 180, 0.4);
  border-radius: 50% 50% 0 0 / 14px 14px 0 0;
}
/* Decoration sprites — clay-sculpted props arranged along the seabed.
   Each layer lives in its own absolute container so we can z-order
   relative to the fish (back behind, mid roughly with, front ahead). */
.decor-layer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 100%;
  pointer-events: none;
}
.decor-back  { z-index: 0; opacity: 0.85; }
.decor-mid   { z-index: 1; }
.decor-front { z-index: 2; }
.decor-item {
  position: absolute;
  bottom: var(--decor-bottom, 8%);
  left: var(--decor-left, 50%);
  width: var(--decor-w);
  height: var(--decor-h);
  transform: translateX(-50%);
}
.decor-sprite {
  position: absolute;
  inset: 0;
  background-image: var(--decor-sheet);
  background-repeat: no-repeat;
  background-size: var(--decor-sheet-w) 100%;
  animation: fishSpriteSwim calc(var(--decor-frames) * 180ms) steps(var(--decor-frames)) infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 28, 48, 0.35));
}

/* ─── HUD ──────────────────────────────────────────────── */
.hud {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px env(safe-area-inset-top, 12px);
  z-index: 10;
}

.hud-side {
  flex: 0 0 auto;
  min-width: 110px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hud-side--right { justify-content: flex-end; }

/* Profile chip container — the .nn-chip button rendered into it picks
   up its own white-pill styling from src/profiles.css. */
.profile-chip { display: inline-flex; align-items: center; }

.hud-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.lives {
  display: inline-flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 14px;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  font-size: 18px;
}
.heart {
  display: inline-block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
}
.heart--lost {
  filter: grayscale(100%) brightness(0.45);
  opacity: 0.4;
  animation: heartBreak 0.5s ease-out;
}
@keyframes heartBreak {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.6) rotate(8deg); filter: brightness(1.5) drop-shadow(0 0 8px #ff5560); }
  60%  { transform: scale(0.7) rotate(-12deg); }
  100% { transform: scale(1) rotate(0); }
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 16px;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  font-size: 22px;
  font-weight: 700;
  color: #1a3a52;
  font-variant-numeric: tabular-nums;
  min-width: 84px;
  justify-content: center;
}
.score-icon { font-size: 20px; }
.score-num--bump {
  animation: scoreBump 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scoreBump {
  0%   { transform: scale(1); color: #1a3a52; }
  40%  { transform: scale(1.6); color: #f5a700; }
  100% { transform: scale(1); color: #1a3a52; }
}

.mode-tabs {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.mode-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  color: #5a7a8a;
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
  white-space: nowrap;
}
.mode-btn:active { transform: scale(0.94); }
.mode-btn--active {
  background: linear-gradient(180deg, #ffb04a, #f59100);
  color: #fff;
  box-shadow: 0 2px 6px rgba(245, 145, 0, 0.55), inset 0 -2px 0 rgba(0,0,0,0.1);
  text-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

/* ─── Problem banner ───────────────────────────────────── */
.problem-banner {
  position: relative;
  margin: 6px auto 8px;
  padding: 12px 28px 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 4px solid #ffd96e;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 -4px 0 rgba(0,0,0,0.06);
  text-align: center;
  z-index: 5;
  width: fit-content;
  max-width: 90vw;
  animation: bannerPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.problem-banner::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 8px solid transparent;
  border-top-color: #ffd96e;
}
@keyframes bannerPop {
  from { transform: scale(0.6) translateY(-10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.problem-label {
  font-size: 13px;
  font-weight: 600;
  color: #5a7a8a;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}
.problem-math {
  font-size: 36px;
  font-weight: 700;
  color: #1a3a52;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  line-height: 1.1;
}
.problem-math--changing {
  animation: problemFlip 0.32s ease;
}
@keyframes problemFlip {
  0%   { transform: rotateX(0); opacity: 1; }
  50%  { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0); opacity: 1; }
}

.streak-pill {
  position: absolute;
  top: -14px;
  right: -14px;
  background: linear-gradient(180deg, #ff7e5f, #d63031);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(214, 48, 49, 0.5);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: streakPulse 0.8s ease-in-out infinite;
}
.streak-pill[hidden] { display: none; }
@keyframes streakPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}
.flame { font-size: 14px; }

/* ─── Scene ────────────────────────────────────────────── */
.scene {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
}
.fish-layer, .particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ─── Fish ─────────────────────────────────────────────── */
/* Fish are GPU-promoted via will-change + translate3d in JS so the
   compositor handles their motion. With these hints, 20-40 simultaneous
   fish render fluidly even on tablet GPUs.
   Note: deliberately no `contain: paint` — that would clip the number
   badge that hangs below the fish's bounding box. */
.fish {
  will-change: transform;
  position: absolute;
  top: 0;
  left: 0;
  width: var(--fish-w, 124px);
  height: var(--fish-h, 92px);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
  filter: drop-shadow(0 4px 8px rgba(0, 30, 60, 0.4));
  overflow: visible;
}

.fish-sprite-wrap {
  width: 100%;
  height: 100%;
  display: block;
  transform: scaleX(var(--fish-facing, 1));
  transform-origin: center;
}

.fish-sprite {
  width: 100%;
  height: 100%;
  display: block;
  background-image: var(--fish-sheet);
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: var(--fish-sheet-w) var(--fish-h);
  animation: fishSpriteSwim var(--fish-duration, 735ms) steps(var(--fish-frames, 7)) infinite;
}

@keyframes fishSpriteSwim {
  from { background-position-x: 0; }
  to   { background-position-x: calc(var(--fish-sheet-w) * -1); }
}

.fish-number-badge {
  /* Hangs off the bottom of the fish, centered horizontally, slightly
     overlapping the lower body. Keeps the fish art readable while the
     number stays prominent and predictable across all sprites. */
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 3px solid #fff5d6;
  background: linear-gradient(180deg, #fffdf4 0%, #ffe59f 100%);
  box-shadow:
    0 3px 0 rgba(138, 93, 28, 0.4),
    0 5px 12px rgba(0, 29, 56, 0.32),
    inset 0 -2px 0 rgba(217, 156, 45, 0.28);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: #16354e;
  font-size: 19px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255,255,255,0.75);
  pointer-events: none;
  z-index: 2;
}

.fish--correct {
  animation: fishCorrect 0.45s ease-out forwards;
}
@keyframes fishCorrect {
  0%   { transform: scale(1); filter: brightness(1) drop-shadow(0 4px 8px rgba(0,30,60,0.4)); }
  40%  { transform: scale(1.4); filter: brightness(1.6) drop-shadow(0 0 16px gold); }
  100% { transform: scale(0); opacity: 0; }
}
.fish--wrong {
  animation: fishWrong 0.55s ease-out forwards;
}
@keyframes fishWrong {
  0%   { transform: scale(1) rotate(0); }
  20%  { transform: scale(1.05) rotate(-12deg); filter: brightness(0.6) saturate(0); }
  40%  { transform: scale(0.95) rotate(12deg); }
  60%  { transform: scale(1) rotate(-6deg); }
  100% { transform: scale(0.9) rotate(0); opacity: 0; }
}

/* ─── Particles ────────────────────────────────────────── */
.bubble {
  position: absolute;
  width: var(--size, 14px);
  height: var(--size, 14px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.4) 35%, rgba(255,255,255,0.1) 70%);
  border: 1.5px solid rgba(255,255,255,0.6);
  pointer-events: none;
  animation: bubbleRise var(--dur, 1.1s) ease-out forwards;
}
@keyframes bubbleRise {
  0%   { transform: translate(0, 0) scale(0.4); opacity: 1; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, -200px)) scale(1); opacity: 0; }
}

.splash {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  pointer-events: none;
  animation: splashRing 0.5s ease-out forwards;
}
@keyframes splashRing {
  0%   { transform: scale(0.2); opacity: 1; border-width: 4px; }
  100% { transform: scale(2.4); opacity: 0; border-width: 1px; }
}

.x-mark {
  position: absolute;
  font-size: 48px;
  pointer-events: none;
  font-weight: 900;
  color: #ff4040;
  text-shadow: 0 2px 0 #fff, 0 4px 12px rgba(0,0,0,0.6);
  animation: xMark 0.7s ease-out forwards;
}
@keyframes xMark {
  0%   { transform: scale(0.2) rotate(-30deg); opacity: 1; }
  30%  { transform: scale(1.3) rotate(0); }
  100% { transform: scale(1) rotate(8deg); opacity: 0; }
}

.spark {
  position: absolute;
  font-size: 22px;
  pointer-events: none;
  animation: sparkRise var(--dur, 1.1s) ease-out forwards;
}
@keyframes sparkRise {
  0%   { transform: translate(0, 0) scale(0.3) rotate(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, -180px)) scale(1.2) rotate(var(--rot, 360deg)); opacity: 0; }
}

/* ─── Floating text (combo / messages) ─────────────────── */
.float-text-layer {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 8;
}
.float-text {
  position: absolute;
  font-weight: 700;
  font-size: 28px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.6);
  pointer-events: none;
  white-space: nowrap;
  animation: floatRise 1.1s ease-out forwards;
}
.float-text--good { color: #ffe066; }
.float-text--combo { color: #ff7eb3; font-size: 32px; }
.float-text--big { color: #6dffe0; font-size: 40px; }
@keyframes floatRise {
  0%   { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  15%  { transform: translate(-50%, -20px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -120px) scale(1); opacity: 0; }
}

/* ─── Overlays (game over / paused) ────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 30, 50, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: overlayFade 0.3s ease;
}
@keyframes overlayFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.overlay[hidden] { display: none; }

.overlay-card {
  background: linear-gradient(180deg, #fff 0%, #fff8e0 100%);
  color: #1a3a52;
  border: 4px solid #ffd96e;
  border-radius: 28px;
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  max-width: 90vw;
  min-width: 280px;
  animation: cardPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cardPop {
  from { transform: scale(0.5) translateY(40px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.overlay-emoji {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.overlay-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 18px;
  color: #1a3a52;
}
.overlay-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 16px;
}
.stat {
  background: #f0f7fa;
  border: 3px solid #c8e1ec;
  border-radius: 16px;
  padding: 10px 18px;
  min-width: 96px;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #5a7a8a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-num {
  font-size: 36px;
  font-weight: 700;
  color: #1a3a52;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.overlay-msg {
  font-size: 16px;
  color: #5a7a8a;
  margin-bottom: 18px;
  min-height: 1.5em;
}
.overlay-msg--new-best {
  color: #f59100;
  font-weight: 700;
  font-size: 18px;
  animation: msgPulse 1s ease-in-out infinite;
}
@keyframes msgPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* ── End-of-session scorecard ──────────────────────── */
.overlay-card--scorecard {
  max-width: 400px;
  text-align: center;
}

/* Silhouette of the next-locked special, sitting next to the unlock
   progress bar with an explicit "unlocks at X points!" header. */
.hs-sprite {
  position: absolute; inset: 0;
  background-image: var(--hero-sheet);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: var(--hero-sheet-w) 100%;
  /* Solid black silhouette via filter — works on any sprite */
  filter: brightness(0) opacity(0.78);
  animation: fishSpriteSwim calc(var(--hero-frames, 8) * 110ms) steps(var(--hero-frames, 8)) infinite;
}
.hs-tease {
  position: absolute; right: -4px; top: -6px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700; font-size: 26px;
  color: #ffe59f;
  text-shadow:
    0 0 4px rgba(0,0,0,0.4),
    0 2px 0 rgba(0,0,0,0.4);
  line-height: 1;
}

.scorecard-headline {
  font-family: 'Fredoka', sans-serif;
  margin: 6px 0 14px;
  color: #2a3658;
}
.scorecard-headline .sh-num {
  font-size: 56px; font-weight: 700; color: #2ecc71;
}
.scorecard-headline .sh-sep,
.scorecard-headline .sh-den {
  font-size: 30px; font-weight: 600; color: #6b7290;
}
.scorecard-headline .sh-label {
  display: block; font-size: 13px; font-weight: 500; color: #6b7290;
  letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px;
}
.scorecard-breakdown {
  display: flex; flex-direction: column; gap: 4px;
  margin: 10px auto 14px; max-width: 280px;
  font-family: 'Fredoka', sans-serif;
}
.sb-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 14px;
  background: rgba(244, 246, 252, 0.7);
  border-radius: 12px;
  font-size: 14px;
}
.sb-name { color: #4a5378; font-weight: 500; }
.sb-val  { color: #2a3658; font-weight: 700; }
.sb-row--total {
  background: #fffaf0;
  border: 2px solid #ffcc66;
  margin-top: 4px;
  font-size: 16px;
}
.sb-row--total .sb-val { color: #d68f00; }

.unlock-progress {
  margin: 14px auto 18px;
  max-width: 320px;
  padding: 12px 14px 14px;
  background: linear-gradient(180deg, #f6f3ff, #ecfff1);
  border: 2px dashed rgba(108, 92, 231, 0.3);
  border-radius: var(--r-md, 16px);
  font-family: 'Fredoka', sans-serif;
}
.up-header {
  font-size: 13px; font-weight: 600;
  color: #4a5378;
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.3;
}
.up-header strong { color: #d68f00; font-weight: 700; }
.up-row {
  display: flex; align-items: center; gap: 12px;
}
.up-silhouette {
  position: relative;
  flex: 0 0 auto;
  width: 76px; height: 56px;
}
.up-bar-wrap { flex: 1; }
.up-bar {
  position: relative;
  height: 18px;
  background: #e9edf5;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid #d4dae5;
}
.up-bar-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #6c5ce7, #a29bfe);
  border-radius: 999px;
}
.up-numbers {
  font-size: 12px; color: #6b7290;
  text-align: right; margin-top: 4px;
}
.up-numbers #upCurrent { color: #2a3658; font-weight: 700; }

/* Brief "tick up" animation on the breakdown row values */
@keyframes sbValTick {
  0% { transform: scale(1); color: #d68f00; }
  40% { transform: scale(1.15); color: #d68f00; }
  100% { transform: scale(1); }
}
.sb-val--ticking { animation: sbValTick 0.18s ease-out; }

/* ── Special-creature unlock celebration ───────────── */
.overlay--unlock {
  background: radial-gradient(circle at center, rgba(50, 90, 200, 0.45), rgba(8, 22, 60, 0.78));
  animation: cardPop 0.35s cubic-bezier(.34,1.56,.64,1);
}
.overlay--unlock.overlay--leaving { animation: cardPop 0.2s reverse; opacity: 0; }
.unlock-card {
  text-align: center;
  padding: 24px 28px 20px;
  background: linear-gradient(180deg, #fffaf0, #ffe9c8);
  border: 4px solid #ffcc66;
  box-shadow: 0 18px 60px rgba(255, 200, 60, 0.45), 0 6px 18px rgba(0,0,0,.25);
  max-width: 400px;
}
.unlock-banner {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #d68f00;
  letter-spacing: 0.18em;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
  margin-bottom: 10px;
}
.unlock-sprite-stage {
  width: var(--us-w);
  height: var(--us-h);
  margin: 6px auto 12px;
  position: relative;
  overflow: hidden;
}
.unlock-sprite {
  position: absolute;
  inset: 0;
  background-image: var(--unlock-sheet);
  background-repeat: no-repeat;
  background-size: var(--unlock-sheet-w) var(--unlock-h);
  animation: fishSpriteSwim calc(var(--unlock-frames) * 105ms) steps(var(--unlock-frames)) infinite;
}
.unlock-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: #2a3658;
  margin: 4px 0 4px;
}
.unlock-flavor {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: #6b7290;
  margin: 0 0 16px;
}
.unlock-btn {
  background: linear-gradient(180deg, #ffce4d, #ff9c2c);
  box-shadow: 0 6px 0 #c47010;
}

.big-btn {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(180deg, #4cd964, #2ecc71);
  border: none;
  padding: 14px 36px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,0.18), 0 8px 16px rgba(46, 204, 113, 0.5);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  text-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.18), 0 4px 8px rgba(46, 204, 113, 0.5);
}

/* ─── Screen shake on lost life ────────────────────────── */
.scene--shake {
  animation: shake 0.4s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
  .hud { padding: 10px 10px env(safe-area-inset-top, 8px); gap: 8px; }
  .hud-side { min-width: 0; }
  .lives { padding: 6px 10px; font-size: 16px; gap: 2px; }
  .score-pill { padding: 6px 12px; font-size: 18px; min-width: 64px; }
  .score-icon { font-size: 16px; }
  .mode-btn { font-size: 12px; padding: 5px 9px; }
  .problem-math { font-size: 30px; }
  .problem-banner { padding: 8px 18px; }
  .problem-label { font-size: 11px; }
  .fish-number-badge {
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    border-width: 2px;
    font-size: 16px;
    bottom: -12px;
  }
  .float-text { font-size: 24px; }
  .float-text--combo { font-size: 26px; }
  .float-text--big { font-size: 32px; }
  .overlay-card { padding: 22px 24px; min-width: 240px; }
  .overlay-emoji { font-size: 52px; }
  .overlay-title { font-size: 22px; }
  .stat-num { font-size: 28px; }
  .stat { padding: 8px 14px; min-width: 80px; }
  .big-btn { font-size: 18px; padding: 12px 28px; }
}

@media (max-width: 360px) {
  .fish-number-badge {
    min-width: 30px;
    height: 26px;
    font-size: 15px;
    bottom: -10px;
  }
  .mode-btn { font-size: 11px; padding: 4px 7px; }
}
