:root {
  --theme: #FF8A3D;
  --theme-light: #FFC07A;
  --theme-deep: #E86318;
  --aqua: #8FEBFF;
  --navy: #04263E;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #052C49;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #F4FCFF;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

.game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #052C49;
  touch-action: none;
  animation: gameIn .5s ease-out both;
}

/* ---------------- underwater scene ---------------- */
.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
}
.game.running .scene:active { cursor: grabbing; }

.sea {
  position: absolute;
  left: -1%;
  top: -1%;
  width: 102%;
  height: 102%;
  object-fit: cover;
  object-position: 50% 44%;
  filter: saturate(1.08) brightness(1.03);
  animation: seaDrift 28s ease-in-out infinite alternate;
  will-change: transform;
}

.sea-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 30, 54, .34) 0%, rgba(2, 38, 66, 0) 18%, rgba(2, 34, 60, 0) 58%, rgba(1, 20, 38, .34) 100%),
    radial-gradient(90% 58% at 50% 108%, rgba(255, 138, 61, .16), transparent 62%);
}

.surface-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(70% 34% at 50% -6%, rgba(207, 252, 255, .5), rgba(150, 240, 255, .12) 46%, transparent 72%),
    linear-gradient(180deg, rgba(160, 240, 255, .18), transparent 22%);
  mix-blend-mode: screen;
  opacity: .8;
}

.rays {
  position: absolute;
  left: -24%;
  right: -24%;
  top: -22%;
  height: 108%;
  pointer-events: none;
  background: repeating-linear-gradient(101deg,
    transparent 0 46px,
    rgba(186, 248, 255, .17) 64px,
    rgba(186, 248, 255, .05) 82px,
    transparent 104px 168px);
  filter: blur(10px);
  mix-blend-mode: screen;
  opacity: .7;
  transform-origin: 50% 0;
  animation: raysSway 14s ease-in-out infinite alternate;
}

.caustics {
  position: absolute;
  left: -14%;
  right: -14%;
  top: -8%;
  height: 48%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 4%, rgba(255, 255, 255, .3), transparent 44%),
    radial-gradient(ellipse at 74% -2%, rgba(180, 247, 255, .34), transparent 42%),
    radial-gradient(ellipse at 46% 30%, rgba(220, 255, 255, .16), transparent 52%);
  mix-blend-mode: screen;
  filter: blur(7px);
  opacity: .8;
  animation: causticShift 10s ease-in-out infinite alternate;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 82% at 50% 44%,
    transparent 38%,
    rgba(1, 17, 31, .16) 72%,
    rgba(1, 12, 24, .42) 100%);
}

/* ---------------- layers ---------------- */
.ambient, .pearl-layer, .trail-layer, .fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ambient { z-index: 4; overflow: hidden; }
.pearl-layer { z-index: 8; }
.trail-layer { z-index: 11; }
.fx-layer { z-index: 18; }

/* ---------------- HUD ---------------- */
.hud {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(9px + var(--safe-top));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

.score-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 5px 14px 5px 5px;
  border-radius: 25px;
  background: linear-gradient(180deg, rgba(12, 72, 110, .82), rgba(3, 38, 65, .78));
  border: 1px solid rgba(172, 236, 255, .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 7px 20px rgba(0, 16, 32, .3);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.score-badge {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 32%, #FFF7EA 0%, #FFD9AE 42%, #FF9E51 78%, #E06B1B 100%);
  border: 2px solid rgba(255, 243, 218, .9);
  box-shadow: 0 2px 8px rgba(0, 14, 28, .35), inset 0 0 9px rgba(255, 255, 255, .6);
}
.score-badge img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  transform: scale(1.18) translateY(1px);
  filter: drop-shadow(0 1px 2px rgba(90, 30, 0, .3));
}
.score-text {
  display: flex;
  align-items: baseline;
  gap: 3px;
  line-height: 1;
  padding-right: 1px;
}
.score-value {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(0, 20, 35, .33);
}
.score-text em {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: .06em;
  color: rgba(214, 245, 255, .7);
  white-space: nowrap;
}
.score-pill.bump { animation: scoreBump .32s ease-out; }

.hud-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 12px 4px 7px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(12, 72, 110, .8), rgba(3, 38, 65, .76));
  border: 1px solid rgba(172, 236, 255, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26), 0 7px 20px rgba(0, 16, 32, .28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.timer-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #FFE3B8, #FF9E51 62%, #E06B1B);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 2px 7px rgba(0, 12, 24, .3);
}
.timer-icon .mp-icon {
  width: 19px;
  height: 19px;
  color: #FFFDF6;
  filter: drop-shadow(0 1px 1px rgba(120, 45, 0, .4));
}
.timer-text {
  flex: 0 0 auto;
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  text-shadow: 0 2px 0 rgba(0, 20, 35, .3);
}
.timer-bar {
  position: absolute;
  left: 41px;
  right: 12px;
  bottom: 6px;
  height: 3px;
  border-radius: 99px;
  background: rgba(0, 18, 34, .55);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.timer-bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFD08A, #FF8A3D 58%, #F2661A);
  box-shadow: 0 0 8px rgba(255, 138, 61, .55);
  transition: width .16s linear;
}
.timer-pill.low { border-color: rgba(255, 160, 130, .65); }
.timer-pill.low .timer-bar i {
  background: linear-gradient(90deg, #FFB38C, #FF5A45);
  animation: lowPulse .85s ease-in-out infinite;
}
.timer-pill.low .timer-text { color: #FFD9CC; }

.pause-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #EAFBFF;
  border: 2px solid rgba(190, 242, 255, .5);
  background: radial-gradient(circle at 35% 28%, rgba(100, 208, 255, .5), rgba(5, 54, 88, .76) 72%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 7px 18px rgba(0, 15, 30, .32);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform .12s ease;
}
.pause-btn .mp-icon { width: 20px; height: 20px; }
.pause-btn:active { transform: scale(.9); }
.game.over .pause-btn, .game.paused .pause-btn { opacity: .32; pointer-events: none; }

/* ---------------- hint / toast ---------------- */
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(160px + var(--safe-bottom));
  z-index: 24;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 17px 10px 13px;
  border-radius: 999px;
  background: rgba(3, 38, 63, .62);
  border: 1px solid rgba(190, 240, 255, .32);
  box-shadow: 0 9px 26px rgba(0, 15, 30, .32), inset 0 1px 0 rgba(255, 255, 255, .2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 600;
  color: #F2FCFF;
  white-space: nowrap;
  pointer-events: none;
  animation: hintFloat 2.4s ease-in-out infinite;
  transition: opacity .4s ease, transform .4s ease;
}
.hint .mp-icon { width: 19px; height: 19px; color: #FFC487; }
.game.running .hint, .game.over .hint, .game.paused .hint {
  opacity: 0;
  transform: translate(-50%, 10px);
  animation: none;
  pointer-events: none;
}

.toast {
  position: absolute;
  left: 50%;
  top: calc(76px + var(--safe-top));
  z-index: 35;
  transform: translate(-50%, -8px);
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFB05F, #FF7A2B);
  box-shadow: 0 8px 20px rgba(0, 15, 30, .32), inset 0 1px 0 rgba(255, 255, 255, .45);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- player ---------------- */
.player {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 12;
  width: var(--pw, 172px);
  will-change: transform;
  pointer-events: none;
}
.diver {
  position: relative;
  transform-origin: 50% 52%;
  will-change: transform;
}
.diver img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 11px 15px rgba(0, 12, 26, .42)) saturate(1.06);
  animation: diverBob 3.6s ease-in-out infinite;
}
.diver-glow {
  position: absolute;
  left: 8%;
  right: -8%;
  top: 4%;
  bottom: -6%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 55% 50%, rgba(130, 238, 255, .3), transparent 68%);
  filter: blur(9px);
}

/* ---------------- collectible clams ---------------- */
.clam {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s, 84px);
  height: calc(var(--s, 84px) * .9);
  will-change: transform;
  pointer-events: none;
}
.clam-body {
  position: absolute;
  inset: 0;
  animation: clamSpawn .5s cubic-bezier(.18, 1.35, .4, 1) both;
  will-change: transform;
}
.clam-float {
  position: absolute;
  inset: 0;
  animation: clamBob 3.4s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.clam-glow {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 138%;
  height: 138%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 218, 170, .5), rgba(255, 154, 70, .16) 46%, transparent 70%);
  filter: blur(5px);
  animation: haloPulse 2.6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.clam-float img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 7px 11px rgba(0, 15, 30, .34)) saturate(1.08) brightness(1.03);
}
.clam-spark {
  position: absolute;
  left: 53%;
  top: 46%;
  width: 34%;
  height: 34%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255, 244, 224, .65) 34%, transparent 68%);
  mix-blend-mode: screen;
  opacity: .7;
  animation: pearlTwinkle 2.3s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.clam.grab .clam-body { animation: clamGrab .3s ease-out forwards; }
.clam.grab .clam-glow { animation: clamGrab .3s ease-out forwards; }

/* ---------------- bubbles / fx ---------------- */
.bubble {
  position: absolute;
  bottom: -24px;
  left: var(--x, 50%);
  width: var(--s, 8px);
  height: var(--s, 8px);
  border-radius: 50%;
  border: 1px solid rgba(205, 248, 255, .5);
  background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .65), rgba(170, 235, 255, .1) 55%, transparent 72%);
  opacity: 0;
  animation: bubbleRise var(--d, 12s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.trail-bubble {
  position: absolute;
  width: var(--s, 6px);
  height: var(--s, 6px);
  margin: calc(var(--s, 6px) / -2);
  border-radius: 50%;
  border: 1px solid rgba(220, 250, 255, .65);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .8), rgba(160, 232, 255, .06) 60%, transparent 75%);
  animation: trailRise 1.5s ease-out forwards;
}

.spark {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, #FFD39B 45%, rgba(255, 138, 61, 0) 72%);
  animation: sparkFly .68s ease-out forwards;
}
.burst-ring {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 211, 160, .9);
  box-shadow: 0 0 16px rgba(255, 138, 61, .5);
  animation: burstRing .58s ease-out forwards;
}
.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 900;
  color: #FFE7BE;
  text-shadow: 0 2px 0 rgba(110, 50, 0, .5), 0 0 16px rgba(255, 138, 61, .85);
  white-space: nowrap;
  animation: scorePop .85s ease-out forwards;
}
.fly-pearl {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px;
  background: url("images/gen/pearl.png") center / contain no-repeat;
  filter: drop-shadow(0 0 9px rgba(255, 180, 100, .95));
  will-change: transform, opacity;
  pointer-events: none;
}

/* ---------------- controls ---------------- */
.controls {
  position: absolute;
  inset: 0;
  z-index: 26;
  pointer-events: none;
}

.joystick {
  position: absolute;
  left: 16px;
  bottom: calc(19px + var(--safe-bottom));
  width: 118px;
  height: 118px;
  pointer-events: auto;
  touch-action: none;
}
.game.ready .joystick { animation: joyHint 2.6s ease-in-out infinite; }
.joystick.active { animation: none; }
.joy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(129, 224, 255, .16), rgba(4, 44, 74, .4) 68%, rgba(2, 27, 48, .26));
  border: 2px solid rgba(190, 242, 255, .42);
  box-shadow:
    inset 0 0 26px rgba(140, 230, 255, .16),
    inset 0 2px 0 rgba(255, 255, 255, .16),
    0 10px 26px rgba(0, 15, 30, .28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.joy-arrow {
  position: absolute;
  width: 15px;
  height: 15px;
  color: rgba(216, 248, 255, .48);
}
.joy-arrow.up { left: 50%; top: 6px; margin-left: -7.5px; }
.joy-arrow.down { left: 50%; bottom: 6px; margin-left: -7.5px; }
.joy-arrow.left { top: 50%; left: 6px; margin-top: -7.5px; }
.joy-arrow.right { top: 50%; right: 6px; margin-top: -7.5px; }
.joy-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #FFFFFF 0%, #EFFBFF 34%, #A9E5F8 64%, #5AA9CE 100%);
  box-shadow:
    0 6px 14px rgba(0, 20, 40, .35),
    inset 0 -3px 8px rgba(40, 120, 160, .38),
    inset 0 2px 3px rgba(255, 255, 255, .8),
    0 0 0 2px rgba(255, 255, 255, .5);
  will-change: transform;
  transition: transform .13s ease-out;
}
.joystick.active .joy-thumb { transition: none; }
.joy-shine {
  position: absolute;
  left: 18%;
  top: 13%;
  width: 42%;
  height: 32%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 255, 255, .95), transparent 70%);
  transform: rotate(-18deg);
}

.boost-btn {
  position: absolute;
  right: 17px;
  bottom: calc(25px + var(--safe-bottom));
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid rgba(214, 246, 255, .8);
  background: radial-gradient(circle at 38% 28%, #7FD8FF 0%, #34A6E2 46%, #0E639E 100%);
  color: #FFFFFF;
  box-shadow:
    0 8px 0 #063A5F,
    0 15px 28px rgba(0, 12, 26, .4),
    inset 0 2px 0 rgba(255, 255, 255, .55),
    inset 0 -4px 10px rgba(0, 60, 100, .32);
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
  transition: transform .1s ease, box-shadow .1s ease, filter .2s ease;
}
.boost-btn:active {
  transform: translateY(4px);
  box-shadow:
    0 4px 0 #063A5F,
    0 8px 16px rgba(0, 12, 26, .36),
    inset 0 2px 0 rgba(255, 255, 255, .5);
}
.boost-glow {
  position: absolute;
  inset: -25%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(150, 240, 255, .5), transparent 62%);
  animation: boostPulse 2.8s ease-in-out infinite;
}
.boost-icon {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 2;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 3px rgba(0, 40, 70, .42));
}
.boost-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  text-indent: .18em;
  color: rgba(240, 252, 255, .9);
  text-shadow: 0 1px 2px rgba(0, 40, 70, .55);
}
.boost-cool {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  background: conic-gradient(rgba(2, 28, 50, .72) calc(var(--cool, 0) * 1turn), transparent 0);
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.boost-btn.cooling .boost-cool { opacity: 1; }
.boost-btn.cooling { filter: saturate(.72); }
.boost-btn.cooldown-done { animation: boostReady .45s ease-out; }

/* ---------------- overlays ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: radial-gradient(100% 70% at 50% 35%, rgba(4, 40, 66, .4), rgba(1, 14, 28, .82));
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility .28s ease;
}
.overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.panel {
  position: relative;
  width: 100%;
  max-width: 334px;
  padding: 25px 22px 22px;
  border-radius: 30px;
  background: linear-gradient(165deg, rgba(14, 76, 114, .97), rgba(4, 33, 56, .98));
  border: 1px solid rgba(145, 228, 255, .32);
  box-shadow: 0 26px 70px rgba(0, 8, 18, .55), inset 0 1px 0 rgba(255, 255, 255, .24), 0 0 0 6px rgba(5, 42, 70, .2);
  text-align: center;
  transform: translateY(14px) scale(.97);
  transition: transform .34s cubic-bezier(.2, 1, .3, 1);
  overflow: hidden;
}
.overlay.show .panel { transform: none; }
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(82% 48% at 50% 0%, rgba(255, 138, 61, .3), transparent 72%);
  pointer-events: none;
}
.panel > * { position: relative; }

.panel-emblem {
  position: relative;
  width: 128px;
  height: 106px;
  margin: -4px auto 2px;
  display: grid;
  place-items: center;
}
.panel-emblem img {
  width: 124px;
  height: auto;
  filter: drop-shadow(0 12px 18px rgba(0, 10, 22, .45));
  animation: emblemFloat 3.6s ease-in-out infinite;
}
.emblem-glow {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 178, 100, .44), transparent 66%);
  filter: blur(8px);
}
.panel-emblem.small { width: 78px; height: 68px; margin: 0 auto 8px; }
.panel-emblem.small img { width: 78px; }

.eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .22em;
  color: #8EDBF5;
  opacity: .85;
}
.panel h2 {
  margin: 7px 0 4px;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: .01em;
  color: #FAFDFF;
  text-shadow: 0 3px 0 rgba(0, 20, 35, .35);
}
.panel-sub {
  margin: 7px 0 4px;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(210, 240, 255, .74);
}

.result-count {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  margin: 6px 0 7px;
}
.result-count span {
  font-size: 58px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.03em;
  background: linear-gradient(180deg, #FFF6E6, #FFC177 56%, #FF8A3D);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 rgba(120, 50, 0, .3)) drop-shadow(0 0 18px rgba(255, 138, 61, .36));
}
.result-count small { font-size: 13px; color: #CFEFFF; opacity: .82; }
.best-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(2, 26, 44, .46);
  border: 1px solid rgba(150, 230, 255, .2);
  font-size: 12px;
  color: rgba(208, 240, 255, .84);
}
.best-line .mp-icon { width: 15px; height: 15px; color: #FFC27B; }
.best-line b { color: #FFC27B; font-size: 14px; margin: 0 1px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 54px;
  margin-top: 12px;
  border: 0;
  border-radius: 18px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background .12s ease;
}
.btn .mp-icon { width: 22px; height: 22px; }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #FFB463, #FF8A3D 52%, #F06A19);
  box-shadow: 0 8px 0 #B94A0F, 0 16px 28px rgba(0, 10, 22, .38), inset 0 1px 0 rgba(255, 255, 255, .6);
  text-shadow: 0 1px 0 rgba(120, 50, 0, .35);
}
.btn.primary:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #B94A0F, 0 8px 16px rgba(0, 10, 22, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn.ghost {
  height: 46px;
  margin-top: 10px;
  background: rgba(126, 214, 255, .08);
  border: 1px solid rgba(160, 230, 255, .28);
  color: #DDF5FF;
  font-size: 14px;
  font-weight: 600;
}
.btn.ghost:active { transform: scale(.98); background: rgba(126, 214, 255, .16); }
.btn:focus-visible, .pause-btn:focus-visible, .boost-btn:focus-visible { outline: 2px solid #FFF1DF; outline-offset: 3px; }

/* ---------------- keyframes ---------------- */
@keyframes gameIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes seaDrift {
  0% { transform: scale(1.005) translate3d(0, 0, 0); }
  100% { transform: scale(1.045) translate3d(-1.1%, -.7%, 0); }
}
@keyframes raysSway {
  0% { transform: rotate(-1.4deg) translateX(-1.5%); opacity: .5; }
  100% { transform: rotate(1.2deg) translateX(1.5%); opacity: .8; }
}
@keyframes causticShift {
  0% { transform: translate3d(-1%, 0, 0) scale(1); opacity: .62; }
  100% { transform: translate3d(1.4%, 1%, 0) scale(1.05); opacity: .9; }
}
@keyframes scoreBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes lowPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
@keyframes hintFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}
@keyframes joyHint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes diverBob {
  0%, 100% { transform: translateY(0) rotate(-.8deg); }
  50% { transform: translateY(-4px) rotate(.8deg); }
}
@keyframes haloPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(.9); opacity: .72; }
  50% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
}
@keyframes pearlTwinkle {
  0%, 100% { opacity: .32; transform: translate(-50%, -50%) scale(.82); }
  50% { opacity: .82; transform: translate(-50%, -50%) scale(1.18); }
}
@keyframes clamBob {
  0%, 100% { transform: translateY(-3px) rotate(-2.2deg); }
  50% { transform: translateY(4px) rotate(2.2deg); }
}
@keyframes clamSpawn {
  0% { transform: scale(.28) translateY(8px); opacity: 0; }
  68% { transform: scale(1.08) translateY(0); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes clamGrab {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.42) rotate(7deg); opacity: 0; }
}
@keyframes bubbleRise {
  0% { transform: translate3d(0, 0, 0) scale(.7); opacity: 0; }
  12% { opacity: .55; }
  55% { transform: translate3d(16px, -48vh, 0) scale(1); }
  100% { transform: translate3d(-12px, -98vh, 0) scale(1.15); opacity: 0; }
}
@keyframes trailRise {
  0% { transform: translate3d(0, 0, 0) scale(.5); opacity: .85; }
  100% { transform: translate3d(var(--dx, 6px), -34px, 0) scale(1.15); opacity: 0; }
}
@keyframes sparkFly {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
  100% { transform: translate3d(var(--tx, 0), var(--ty, -20px), 0) scale(.15); opacity: 0; }
}
@keyframes burstRing {
  0% { transform: scale(.45); opacity: 1; }
  100% { transform: scale(3.4); opacity: 0; }
}
@keyframes scorePop {
  0% { transform: translate(-50%, -30%) scale(.55); opacity: 0; }
  22% { transform: translate(-50%, -55%) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -165%) scale(1); opacity: 0; }
}
@keyframes emblemFloat {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-5px) rotate(1.5deg); }
}
@keyframes boostPulse {
  0%, 100% { opacity: .5; transform: scale(.92); }
  50% { opacity: .9; transform: scale(1.08); }
}
@keyframes boostReady {
  0% { transform: scale(1); }
  45% { transform: scale(1.09); }
  100% { transform: scale(1); }
}

/* ---------------- responsive ---------------- */
@media (max-width: 360px) {
  .hud { padding: 0 11px; }
  .score-pill { height: 45px; padding-right: 11px; }
  .score-badge { width: 36px; height: 36px; }
  .score-badge img { width: 34px; height: 34px; }
  .score-value { font-size: 22px; }
  .timer-pill { height: 40px; padding-left: 6px; padding-right: 10px; }
  .timer-icon { width: 27px; height: 27px; }
  .timer-text { font-size: 15px; }
  .timer-bar { left: 37px; right: 10px; }
  .pause-btn { width: 40px; height: 40px; }
  .joystick { width: 106px; height: 106px; left: 13px; }
  .joy-thumb { width: 49px; height: 49px; margin: -24.5px 0 0 -24.5px; }
  .boost-btn { width: 76px; height: 76px; right: 14px; }
  .boost-icon { width: 35px; height: 35px; }
  .hint { bottom: calc(146px + var(--safe-bottom)); font-size: 12px; padding: 9px 14px 9px 11px; }
}

@media (max-height: 690px) {
  .panel { padding: 20px 20px 18px; border-radius: 26px; }
  .panel-emblem { width: 100px; height: 84px; margin-bottom: 0; }
  .panel-emblem img { width: 100px; }
  .panel h2 { font-size: 24px; }
  .result-count span { font-size: 48px; }
  .result-count { margin: 4px 0; }
  .btn { height: 48px; margin-top: 9px; }
  .btn.primary { box-shadow: 0 6px 0 #B94A0F, 0 12px 22px rgba(0, 10, 22, .34), inset 0 1px 0 rgba(255, 255, 255, .6); }
  .hint { bottom: calc(148px + var(--safe-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .sea, .rays, .caustics, .diver img, .clam-glow, .clam-float, .clam-spark,
  .panel-emblem img, .hint, .bubble, .boost-glow, .game.ready .joystick {
    animation-duration: .001s;
    animation-iteration-count: 1;
  }
}
