:root {
  --depth: 0;
  --surface: #36c2c8;
  --shelf: #137196;
  --mid: #0a2a45;
  --abyss: #041426;
  --trench: #01060e;
  --ink: #eaf7f6;
  --ink-soft: #a9cdd2;
  --ink-faint: #6f97a1;
  --glass: rgba(3, 22, 40, 0.5);
  --glass-strong: rgba(2, 14, 28, 0.82);
  --line: rgba(190, 235, 240, 0.18);
  --phosphor: #7cf3e6;
  --krill: #ff7aa2;
  --danger: #ff9c7a;
  --t-p: #a7ecb1;
  --t-c: #cdbbff;
  --t-s: #69d8e4;
  --t-r: #5aa6ff;
  --t-d: #b38bff;
  --t-k: #ff7aa2;
  --display: 'Bricolage Grotesque', 'Avenir Next', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(180deg, var(--abyss) 0%, var(--trench) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 3px; border-radius: 6px; }

/* ---------- the sea ---------- */
.sea { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.sea-layer { position: absolute; inset: 0; }
.sea-surface {
  background: linear-gradient(180deg, var(--surface) 0%, var(--shelf) 38%, var(--mid) 78%, var(--abyss) 100%);
  opacity: calc(1 - var(--depth) * 1.15);
}
.sea-rays {
  background:
    repeating-linear-gradient(100deg, rgba(255,255,255,0) 0 60px, rgba(255,255,255,.07) 60px 90px, rgba(255,255,255,0) 90px 170px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 65%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 65%);
  opacity: calc(0.9 - var(--depth) * 2.2);
  animation: sway 14s ease-in-out infinite alternate;
}
@keyframes sway { from { transform: translateX(-30px) skewX(-2deg); } to { transform: translateX(30px) skewX(2deg); } }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; }
/* dancing light from the surface, gone by a few hundred metres */
.sea-caustics {
  background:
    radial-gradient(ellipse 90px 40px at 20% 30%, rgba(255,255,255,.16), transparent 70%),
    radial-gradient(ellipse 70px 30px at 70% 20%, rgba(255,255,255,.13), transparent 70%),
    radial-gradient(ellipse 120px 50px at 45% 60%, rgba(255,255,255,.10), transparent 70%),
    radial-gradient(ellipse 60px 26px at 85% 70%, rgba(255,255,255,.12), transparent 70%);
  background-size: 340px 260px, 280px 220px, 420px 300px, 300px 240px;
  mix-blend-mode: soft-light;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 55%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 55%);
  opacity: calc(1 - var(--depth) * 3.5);
  animation: caustic 11s linear infinite;
}
@keyframes caustic {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 340px 130px, -280px 110px, 420px -150px, -300px 240px; }
}
/* the light closes in as you go deeper */
.sea-vignette {
  background: radial-gradient(ellipse 75% 70% at 50% 42%, transparent 35%, rgba(0, 3, 8, .85) 100%);
  opacity: calc(var(--depth) * 1.1);
}

/* ---------- sounding line ---------- */
.sounding {
  position: fixed; left: 0; top: 76px; bottom: 28px; width: 56px; z-index: 1; pointer-events: none;
}
.sounding-track { position: absolute; left: 22px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tick { position: absolute; left: -3px; width: 7px; height: 1px; background: var(--line); }
.tick.major { left: -6px; width: 13px; background: rgba(190,235,240,.35); }
.tick.major::after {
  content: attr(data-m); position: absolute; left: 18px; top: -8px; white-space: nowrap;
  font: 600 11px/1 var(--display); color: var(--ink-faint); letter-spacing: .02em;
}
.sounding-marker {
  position: absolute; left: 14px; top: 0; transform: translateY(-50%);
  transition: top 1.1s cubic-bezier(.2,.8,.2,1);
}
.sounding-marker::before {
  content: ''; position: absolute; left: -6px; top: 50%; width: 30px; height: 30px; margin-top: -15px;
  border-radius: 50%; background: radial-gradient(circle, rgba(124,243,230,.28), transparent 70%);
}
.sounding-marker span {
  position: absolute; left: 36px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  font: 800 13px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--phosphor);
  background: var(--glass-strong); padding: 5px 8px; border-radius: 999px;
}
@media (max-width: 720px) {
  .sounding { width: 14px; left: 0; }
  .sounding-track { left: 6px; }
  .tick, .tick.major::after { display: none; }
  .sounding-marker { left: -1px; }
  .sounding-marker span { display: none; }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--gutter); padding-top: max(12px, env(safe-area-inset-top));
  max-width: 760px; margin: 0 auto;
}
.wordmark {
  display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 2px;
  font: 800 22px/1 var(--display); letter-spacing: -.02em;
}
.krill-glyph { width: 34px; height: 24px; color: var(--krill); filter: drop-shadow(0 0 6px rgba(255,122,162,.45)); }
.topnav { display: flex; gap: 4px; }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 50%; color: var(--ink);
  transition: background .2s;
}
.icon-btn:hover { background: rgba(255,255,255,.08); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
main { max-width: 640px; margin: 0 auto; padding: 8px var(--gutter) 64px; outline: none; }
@media (min-width: 721px) { main { padding-left: 48px; } }
.screen { animation: enter .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px; border-radius: 999px; border: 0;
  font: 700 18px/1 var(--display); letter-spacing: -.01em;
  background: var(--ink); color: #062038;
  transition: transform .15s, box-shadow .2s, background .2s;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.krill { background: var(--krill); color: #2b0614; box-shadow: 0 0 0 0 rgba(255,122,162,.5), 0 10px 40px rgba(255,122,162,.35); }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.linkish { background: none; border: 0; padding: 0; color: var(--phosphor); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }

/* ---------- home ---------- */
.home-hero { padding: 36px 0 28px; }
.dive-no { font: 600 17px/1.2 var(--display); color: var(--ink-soft); }
.home-title {
  font-size: clamp(46px, 12vw, 84px); font-weight: 800; letter-spacing: -.045em; line-height: .92;
  margin: 14px 0 18px; text-wrap: balance;
}
.home-title .sink { display: block; color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.home-lede { font-size: 19px; color: var(--ink-soft); max-width: 30ch; margin-bottom: 28px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.reset-note { font-size: 14px; color: var(--ink-soft); margin-top: 16px; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 34px 0; }
.mode {
  text-align: left; padding: 18px 18px 20px; border-radius: 20px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(6px);
  transition: border-color .2s, transform .2s;
}
.mode:hover { border-color: rgba(124,243,230,.5); transform: translateY(-2px); }
.mode h3 { font-size: 21px; margin-bottom: 6px; }
.mode p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.4; }
.mode .best { margin-top: 10px; font: 700 14px/1 var(--display); color: var(--phosphor); }

.panel { background: var(--glass); border: 1px solid var(--line); border-radius: 22px; padding: 18px; backdrop-filter: blur(6px); }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.panel-head h3 { font-size: 20px; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat b { display: block; font: 800 26px/1 var(--display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-soft); }

/* ---------- leaderboard rows ---------- */
.board { list-style: none; margin: 0; padding: 0; }
.board li {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid rgba(190,235,240,.08);
}
.board li:last-child { border-bottom: 0; }
.board .rk { font: 800 16px/1 var(--display); color: var(--ink-faint); text-align: center; font-variant-numeric: tabular-nums; }
.board li:nth-child(1) .rk { color: #ffd27a; }
.board li:nth-child(2) .rk { color: #d6e4ea; }
.board li:nth-child(3) .rk { color: #e7a77a; }
.board .who { min-width: 0; }
.board .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.board .who small { font-size: 13px; letter-spacing: 1px; }
.board .sc { font: 800 17px/1 var(--display); font-variant-numeric: tabular-nums; text-align: right; }
.board .sc small { display: block; font: 400 12px/1.4 var(--body); color: var(--ink-soft); }
.board li.me { background: rgba(124,243,230,.09); border-radius: 12px; }
.board li.me .who b::after { content: ' (you)'; font-weight: 400; color: var(--phosphor); }
.empty { padding: 18px 4px; color: var(--ink-soft); }

/* ---------- game ---------- */
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 26px; }
.pips { display: flex; gap: 6px; }
.pip {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px;
  border: 1.5px solid var(--line); background: rgba(0,0,0,.12);
  transition: transform .3s, border-color .3s;
}
.pip.now { border-color: var(--ink); transform: scale(1.08); }
.score-now { font: 800 18px/1 var(--display); font-variant-numeric: tabular-nums; }
.score-now small { font: 400 13px var(--body); color: var(--ink-soft); }

.prompt-cat { font: 600 16px/1 var(--display); color: var(--ink-soft); margin-bottom: 10px; }
.prompt-q {
  font-size: clamp(36px, 9vw, 60px); font-weight: 800; letter-spacing: -.035em; line-height: .98;
  text-wrap: balance; margin-bottom: 28px; min-height: 2em;
}

.tank { position: relative; height: 14px; border-radius: 999px; background: rgba(0,0,0,.28); overflow: hidden; border: 1px solid var(--line); }
.tank-fill {
  position: absolute; inset: 0; transform-origin: left; border-radius: inherit;
  background: linear-gradient(90deg, var(--phosphor), #b5fff6);
  box-shadow: 0 0 18px rgba(124,243,230,.5);
}
.tank.low .tank-fill { background: linear-gradient(90deg, var(--danger), #ffd0b8); box-shadow: 0 0 18px rgba(255,156,122,.6); }
.tank-label { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--ink-soft); }
.tank-label > :last-child { position: relative; }
.tank-label b { font: 800 16px/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.penalty { position: absolute; right: 0; top: -24px; font: 800 18px var(--display); color: var(--danger); animation: floatUp .9s forwards; }
@keyframes floatUp { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-18px); } }

.guess { margin-top: 26px; display: flex; gap: 10px; }
.guess input {
  flex: 1; min-width: 0; height: 60px; padding: 0 20px; border-radius: 18px;
  border: 1.5px solid rgba(190,235,240,.35); background: rgba(2, 14, 28, .55);
  font: 600 22px/1 var(--display); letter-spacing: -.01em;
  transition: border-color .2s, box-shadow .2s;
}
.guess input::placeholder { color: var(--ink-faint); font-weight: 400; }
.guess input:focus { outline: none; border-color: var(--phosphor); box-shadow: 0 0 0 4px rgba(124,243,230,.15); }
.guess .btn { height: 60px; border-radius: 18px; padding: 0 22px; }
.guess.shake { animation: shake .38s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.tried { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; min-height: 30px; }
.tried span { font-size: 14px; padding: 4px 10px; border-radius: 999px; background: rgba(255,156,122,.12); color: #ffc4ae; text-decoration: line-through; text-decoration-color: rgba(255,196,174,.6); }
.hint-line { margin-top: 10px; font-size: 14px; color: var(--ink-faint); }

/* reveal */
.reveal { margin-top: 8px; }
.tier-badge {
  display: inline-flex; align-items: center; gap: 12px; padding: 10px 18px 10px 12px; border-radius: 999px;
  background: rgba(0,0,0,.28); border: 1.5px solid var(--tc, var(--line));
  font: 800 20px/1 var(--display); color: var(--tc, var(--ink));
  animation: pop .55s cubic-bezier(.2,1.6,.4,1) both;
}
.tier-badge .em { font-size: 28px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.reveal-answer { font-size: clamp(34px, 8vw, 52px); font-weight: 800; letter-spacing: -.03em; margin: 18px 0 6px; line-height: 1; }
.reveal-pts { font: 800 22px/1 var(--display); color: var(--tc); }
.reveal-blurb { margin-top: 8px; color: var(--ink-soft); }
.reveal .tc-k .reveal-answer, .tc-k .reveal-answer { color: var(--krill); text-shadow: 0 0 24px rgba(255,122,162,.55); }
.reveal-extra { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.reveal-extra h4 { margin: 0 0 6px; font: 700 16px/1.2 var(--display); color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 14.5px; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.chip i { font-style: normal; margin-right: 4px; }
.reveal-actions { margin-top: 26px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crowd-bar { height: 8px; border-radius: 999px; background: rgba(0,0,0,.3); overflow: hidden; margin-top: 6px; }
.crowd-bar i { display: block; height: 100%; background: var(--tc, var(--phosphor)); border-radius: inherit; width: 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }

/* ---------- summary ---------- */
.sum-hero { padding: 26px 0 10px; }
.sum-depth { font-size: clamp(64px, 18vw, 120px); font-weight: 800; letter-spacing: -.05em; line-height: .9; font-variant-numeric: tabular-nums; }
.sum-depth small { font-size: .38em; letter-spacing: -.02em; color: var(--ink-soft); margin-left: 6px; }
.sum-band { font: 700 24px/1.1 var(--display); margin-top: 10px; }
.sum-band span { color: var(--phosphor); }
.sum-emoji { font-size: 30px; letter-spacing: 4px; margin: 18px 0 6px; }
.sum-rank { color: var(--ink-soft); min-height: 1.5em; }
.sum-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 28px; }
.rounds { list-style: none; padding: 0; margin: 0; }
.rounds li { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; padding: 13px 0; border-bottom: 1px solid rgba(190,235,240,.08); }
.rounds li:last-child { border-bottom: 0; }
.rounds .em { font-size: 24px; line-height: 1.1; }
.rounds .q { font-size: 14px; color: var(--ink-soft); }
.rounds .a { font: 700 18px/1.25 var(--display); }
.rounds .a.miss { color: var(--ink-faint); font-weight: 600; }
.rounds .k { font-size: 13.5px; color: var(--ink-faint); margin-top: 3px; }
.rounds .k b { color: var(--krill); font-weight: 700; }
.rounds .pts { font: 800 17px/1 var(--display); font-variant-numeric: tabular-nums; padding-top: 18px; }

/* ---------- packs ---------- */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 20px; }
.pack { text-align: left; padding: 16px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); }
.pack:hover { border-color: rgba(124,243,230,.5); }
.pack b { display: block; font: 700 18px/1.15 var(--display); }
.pack span { font-size: 13.5px; color: var(--ink-soft); }

/* ---------- modal ---------- */
dialog {
  width: min(560px, calc(100vw - 24px)); max-height: min(86vh, 820px); padding: 0;
  border: 1px solid var(--line); border-radius: 26px; color: var(--ink);
  background: linear-gradient(180deg, #0b2b47, #051629); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(1, 8, 18, .6); backdrop-filter: blur(3px); }
dialog[open] { animation: rise .35s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-inner { display: flex; flex-direction: column; max-height: inherit; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 14px 6px 22px; }
.modal-head h2 { font-size: 26px; }
#modalBody { padding: 6px 22px 24px; overflow-y: auto; }

.tabs { display: flex; gap: 6px; margin: 6px 0 14px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 15px; }
.tab[aria-selected="true"] { background: var(--ink); color: #062038; border-color: var(--ink); font-weight: 700; }
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.day-nav b { font-family: var(--display); }
.day-nav .icon-btn svg { width: 20px; height: 20px; }

.tier-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.tier-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; }
.tier-list .em { font-size: 24px; }
.tier-list b { font-family: var(--display); }
.tier-list small { display: block; color: var(--ink-soft); font-size: 13.5px; line-height: 1.3; }
.tier-list .pts { font: 800 16px var(--display); font-variant-numeric: tabular-nums; }
.help p + p { margin-top: 10px; }
.help h3 { font-size: 19px; margin: 20px 0 6px; }

.dist { display: grid; gap: 6px; margin-top: 6px; }
.dist-row { display: grid; grid-template-columns: 26px 1fr 34px; gap: 8px; align-items: center; font-size: 14px; }
.dist-row .bar { height: 12px; border-radius: 999px; background: rgba(0,0,0,.3); overflow: hidden; }
.dist-row .bar i { display: block; height: 100%; border-radius: inherit; }
.cal { display: grid; grid-template-columns: repeat(7, 26px); gap: 5px; margin-top: 8px; }
.cal span { width: 26px; height: 26px; border-radius: 6px; background: rgba(255,255,255,.05); position: relative; }
.cal span[data-b] { cursor: pointer; }
.cal span.today { outline: 1.5px solid var(--ink-soft); outline-offset: 1px; }
.cal-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }
.cal-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.past { list-style: none; padding: 0; margin: 8px 0 0; }
.past li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(190,235,240,.08); }
.past li button { all: unset; cursor: pointer; display: flex; justify-content: space-between; width: 100%; gap: 10px; }
.past .e { letter-spacing: 2px; font-size: 15px; }

.field { display: grid; gap: 6px; margin: 12px 0; }
.field label { font-weight: 700; }
.field input[type=text] { height: 50px; padding: 0 16px; border-radius: 14px; border: 1.5px solid rgba(190,235,240,.35); background: rgba(2,14,28,.55); font-size: 18px; }
.field input[type=text]:focus { outline: none; border-color: var(--phosphor); }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(190,235,240,.08); }
.switch small { display: block; color: var(--ink-soft); }
.switch input { width: 46px; height: 26px; appearance: none; border-radius: 999px; background: rgba(255,255,255,.15); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.switch input:checked { background: var(--phosphor); }
.switch input:checked::after { transform: translateX(20px); background: #062038; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 30; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: #062038; padding: 12px 18px; border-radius: 16px; font-weight: 700; box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: rise .3s both; text-align: center; }

/* tier colours */
.tc-p { --tc: var(--t-p); } .tc-c { --tc: var(--t-c); } .tc-s { --tc: var(--t-s); }
.tc-r { --tc: var(--t-r); } .tc-d { --tc: var(--t-d); } .tc-k { --tc: var(--t-k); }
.tc-x { --tc: var(--ink-faint); }

.endless-air { display: flex; align-items: baseline; gap: 10px; }
.flash-gain { font: 800 20px var(--display); color: var(--phosphor); margin-left: 8px; animation: floatUp 1s forwards; }

@media (max-width: 420px) {
  .modes { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
  .guess .btn { padding: 0 16px; }
  .pip { width: 26px; height: 26px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- reveal flourishes ---------- */
.reveal-answer .ch { display: inline-block; animation: chRise .55s cubic-bezier(.2,1.4,.4,1) both; white-space: pre; }
@keyframes chRise { from { opacity: 0; transform: translateY(.45em) scale(.9); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.tc-r .tier-badge, .tc-d .tier-badge, .tc-k .tier-badge { position: relative; overflow: hidden; }
.tc-r .tier-badge::after, .tc-d .tier-badge::after, .tc-k .tier-badge::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  animation: sheen 1.4s .35s ease-out both;
}
@keyframes sheen { to { transform: translateX(120%); } }
.tc-k .tier-badge { box-shadow: 0 0 0 0 rgba(255,122,162,.6); animation: pop .55s cubic-bezier(.2,1.6,.4,1) both, krillPulse 2.2s .6s ease-in-out infinite; }
@keyframes krillPulse { 50% { box-shadow: 0 0 34px 6px rgba(255,122,162,.45); } }
.prompt-q .w { display: inline-block; animation: wordIn .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes wordIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.prompt-q { text-shadow: 0 0 calc(var(--depth) * 30px) rgba(124,243,230,calc(var(--depth) * .35)); }
.guess input:focus { box-shadow: 0 0 0 4px rgba(124,243,230,.15), 0 0 30px rgba(124,243,230,calc(.1 + var(--depth) * .25)); }
.pip.hit { animation: pipPop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pipPop { 40% { transform: scale(1.35); } }
.sum-depth { text-shadow: 0 0 40px rgba(124,243,230,calc(var(--depth) * .5)); }

/* ================= v3: modes, badges, zones ================= */
.section-title { font-size: 26px; margin: 38px 0 14px; letter-spacing: -.02em; }
.modes { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin: 0 0 30px; }
.mode { position: relative; overflow: hidden; display: flex; flex-direction: column; animation: modeIn .6s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 60ms); }
@keyframes modeIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.mode::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(300px 140px at 80% 0%, rgba(124,243,230,.16), transparent 70%); }
.mode:hover::before { opacity: 1; }
.mode-art { width: 54px; height: 54px; margin-bottom: 12px; display: block; }
.mode-art svg { width: 100%; height: 100%; fill: none; stroke: var(--phosphor); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(124,243,230,.45)); }
.mode-art .dot, .mode-art .dot2 { fill: var(--krill); stroke: none; }
.mode-art .beam { stroke: #b5fff6; transform-origin: 32px 32px; animation: beam 3s linear infinite; }
@keyframes beam { to { transform: rotate(360deg); } }
.mode-art .glass { fill: rgba(124,243,230,.12); }
.mode-art .crack { stroke: var(--krill); }
.mode-art .bolt { fill: rgba(255,210,122,.2); stroke: #ffd27a; }
.mode-art .tip { fill: var(--phosphor); }
.mode-abyss .mode-art svg { stroke: var(--t-d); filter: drop-shadow(0 0 6px rgba(179,139,255,.5)); }
.mode-blitz .mode-art svg { filter: drop-shadow(0 0 6px rgba(255,210,122,.5)); }
.mode-party .mode-art svg { stroke: var(--t-p); }
.mode-challenge .mode-art svg { stroke: var(--krill); filter: drop-shadow(0 0 6px rgba(255,122,162,.5)); }
.mode .best { margin-top: auto; padding-top: 12px; }

.badge-pop {
  position: fixed; z-index: 40; left: 50%; top: 84px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 12px 22px 12px 14px; border-radius: 999px;
  background: linear-gradient(120deg, #2b1030, #0b2b47); border: 1.5px solid rgba(255,122,162,.6);
  box-shadow: 0 0 40px rgba(255,122,162,.35), 0 18px 40px rgba(0,0,0,.5);
  animation: badgeIn .7s cubic-bezier(.2,1.5,.4,1) both;
}
.badge-pop.out { animation: badgeOut .5s ease-in both; }
.badge-pop .bp-icon { font-size: 34px; animation: wobble 1.2s .4s ease-in-out; }
.badge-pop small { display: block; color: var(--krill); font: 700 13px var(--display); }
.badge-pop b { font: 800 19px var(--display); }
@keyframes badgeIn { from { opacity: 0; transform: translate(-50%, -30px) scale(.7); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes badgeOut { to { opacity: 0; transform: translate(-50%, -20px) scale(.9); } }
@keyframes wobble { 25% { transform: rotate(-14deg) scale(1.2); } 60% { transform: rotate(10deg); } }
.badge-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -10px 0 26px; padding: 10px 14px; background: transparent; border: 1px dashed var(--line); border-radius: 16px; width: 100%; font-size: 22px; }
.badge-strip small { margin-left: auto; font-size: 14px; color: var(--ink-soft); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.badge { padding: 12px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid var(--line); opacity: .45; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; border-color: rgba(255,122,162,.45); background: rgba(255,122,162,.07); }
.badge span { font-size: 24px; display: block; }
.badge b { font: 700 15px/1.2 var(--display); display: block; margin-top: 4px; }
.badge small { font-size: 12.5px; color: var(--ink-soft); line-height: 1.3; display: block; margin-top: 3px; }

.zone-card { position: fixed; inset: 0; z-index: 35; pointer-events: none; display: grid; place-content: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse 60% 26% at 50% 50%, rgba(0,4,10,.55), transparent 75%); animation: zoneFade 2.4s ease both; }
.zone-card small { font: 700 16px var(--display); color: var(--phosphor); letter-spacing: .02em; }
.zone-card b { font: 800 clamp(54px, 15vw, 120px)/.9 var(--display); letter-spacing: -.05em; margin: 8px 0 12px; text-shadow: 0 0 40px rgba(124,243,230,.45);
  animation: zoneTitle 2.4s cubic-bezier(.2,.8,.2,1) both; }
.zone-card span { color: var(--ink-soft); max-width: 34ch; margin: 0 auto; font-size: 17px; }
@keyframes zoneFade { 0% { opacity: 0; } 14% { opacity: 1; } 62% { opacity: 1; } 100% { opacity: 0; } }
@keyframes zoneTitle { 0% { letter-spacing: .1em; filter: blur(10px); } 25% { letter-spacing: -.05em; filter: none; } 100% { transform: scale(1.06); } }

body.shaking { animation: shake .6s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%, 90% { transform: translate(calc(-1px * var(--shake)), 0); } 20%, 80% { transform: translate(calc(3px * var(--shake)), calc(1px * var(--shake))); }
  30%, 50%, 70% { transform: translate(calc(-5px * var(--shake)), calc(-1px * var(--shake))); } 40%, 60% { transform: translate(calc(5px * var(--shake)), calc(1px * var(--shake))); } }
.sonar-ripple { position: fixed; z-index: 20; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--phosphor); animation: ripple .85s ease-out forwards; }
@keyframes ripple { to { transform: scale(18); opacity: 0; border-width: .5px; } }

/* air tank with bubbles inside */
.tank-fill { overflow: hidden; }
.tank-fill::after { content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 10% 60%, rgba(255,255,255,.7) 1.5px, transparent 2.5px) 0 0 / 34px 14px,
              radial-gradient(circle at 60% 30%, rgba(255,255,255,.5) 1px, transparent 2px) 0 0 / 22px 14px;
  animation: tankBubbles 2.4s linear infinite; opacity: .7; }
@keyframes tankBubbles { to { background-position: 34px -14px, 22px -14px; } }
.tank { height: 16px; }

/* dive profile */
.profile { width: 100%; height: auto; display: block; overflow: visible; }
.pf-line { fill: none; stroke: var(--phosphor); stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(124,243,230,.6)); }
.profile.anim .pf-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s .2s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pf-surface { stroke: rgba(255,255,255,.35); stroke-dasharray: 4 6; }
.pf-lab { fill: var(--ink-faint); font: 600 12px var(--display); }
.pf-dot { fill: var(--tc); stroke: #041426; stroke-width: 2; }
.pf-em { font-size: 15px; }
.profile.anim .pf-mark { opacity: 0; animation: markIn .4s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes markIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.challenge-banner { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 18px; margin-top: 8px; border-radius: 22px;
  background: linear-gradient(120deg, rgba(255,122,162,.18), rgba(124,243,230,.08)); border: 1.5px solid rgba(255,122,162,.5); animation: rise .5s both; }
.challenge-banner .cb-icon { font-size: 38px; }
.challenge-banner b { font: 800 20px var(--display); }
.challenge-banner p { color: var(--ink-soft); font-size: 15px; }
.cb-actions { grid-column: 1 / -1; display: flex; gap: 8px; }

/* countdown */
.countdown { min-height: 60vh; display: grid; place-content: center; text-align: center; }
.countdown .dive-no { max-width: 28ch; margin: 0 auto 10px; }
.countdown b { font: 800 clamp(120px, 40vw, 220px)/1 var(--display); letter-spacing: -.06em; color: var(--phosphor); text-shadow: 0 0 50px rgba(124,243,230,.6);
  animation: cd .75s cubic-bezier(.2,1.4,.4,1); }
@keyframes cd { from { transform: scale(1.8); opacity: 0; filter: blur(8px); } to { transform: none; opacity: 1; } }

/* sonar */
.sonar-wrap { position: relative; width: min(100%, 380px); margin: 0 auto 6px; aspect-ratio: 1; }
.sonar-wrap canvas { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 0 0 1px rgba(124,243,230,.25), 0 0 60px rgba(124,243,230,.15), inset 0 0 40px rgba(0,0,0,.4); }
.sonar-time { position: absolute; right: -4px; top: -4px; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 18px; padding: 8px 12px; text-align: center; }
.sonar-time b { font: 800 28px/1 var(--display); display: block; font-variant-numeric: tabular-nums; }
.sonar-time small { font-size: 12px; color: var(--ink-soft); }
.chain b { font: 800 22px var(--display); color: #ffd27a; text-shadow: 0 0 14px rgba(255,210,122,.6); }
.chain { color: var(--ink-soft); font-size: 14px; animation: pop .4s both; }
.found-chips { margin-top: 14px; max-height: 180px; overflow: auto; }
.chip.pop { animation: pop .45s cubic-bezier(.2,1.6,.4,1) both; }
.chip b { color: var(--tc, var(--phosphor)); margin-left: 4px; }

/* blitz */
.blitz-stage { min-height: 150px; margin: 18px 0 6px; position: relative; }
.blitz-card { animation: blitzIn .32s cubic-bezier(.2,.9,.3,1.1) both; }
.blitz-card .prompt-q { margin-bottom: 0; min-height: 0; font-size: clamp(32px, 8vw, 52px); }
.blitz-card.out-hit { animation: blitzOutHit .2s ease-in forwards; }
.blitz-card.out-skip { animation: blitzOutSkip .2s ease-in forwards; }
@keyframes blitzIn { from { opacity: 0; transform: translateX(60px) rotate(2deg); } to { opacity: 1; transform: none; } }
@keyframes blitzOutHit { to { opacity: 0; transform: translateY(70px) scale(.9); } }
@keyframes blitzOutSkip { to { opacity: 0; transform: translateX(-80px) rotate(-3deg); } }
.blitz-log { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.mult { color: #ffd27a; font-family: var(--display); }

/* abyss */
.hull { display: flex; gap: 6px; }
.porthole { width: 34px; height: 34px; }
.porthole circle { fill: none; stroke: #c9b37a; stroke-width: 3; }
.porthole .glass { fill: rgba(124,243,230,.2); stroke: rgba(201,179,122,.5); stroke-width: 1.5; }
.porthole .crack { fill: none; stroke: #ff9c7a; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 60; stroke-dashoffset: 60; }
.porthole.cracked .crack { animation: crackDraw .5s ease-out forwards; }
.porthole.cracked .glass { fill: rgba(255,80,60,.15); }
@keyframes crackDraw { to { stroke-dashoffset: 0; } }
body.abyss-mode .sea-vignette { opacity: 1; }
body.crack-flash::after { content: ''; position: fixed; inset: 0; z-index: 30; pointer-events: none; background: radial-gradient(circle, transparent 30%, rgba(255,60,40,.45)); animation: flashOut .7s ease-out forwards; }
@keyframes flashOut { to { opacity: 0; } }
.tried .shallow { background: rgba(255,156,122,.18); text-decoration: none; }

/* pass & play */
.party-form { display: grid; gap: 6px; }
.name-row > div { display: flex; gap: 6px; align-items: center; }
.name-row input { flex: 1; }
.seg { display: flex; gap: 6px; }
.pass-screen { min-height: 62vh; display: grid; align-content: center; gap: 16px; text-align: left; }
.pass-screen .home-title { margin: 0; }
.party-scores { display: flex; flex-wrap: wrap; gap: 12px; color: var(--ink-soft); margin-top: 12px; }
.party-scores b { color: var(--ink); }
.locked { margin-top: 26px; padding: 22px; border-radius: 18px; text-align: center; font: 700 20px var(--display); background: rgba(124,243,230,.1); border: 1.5px solid var(--phosphor); animation: pop .4s both; }
.party-reveal { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.party-reveal li { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 18px;
  background: var(--glass); border: 1.5px solid var(--tc, var(--line)); animation: cardFlip .6s cubic-bezier(.2,1.2,.4,1) both; }
.party-reveal .em { font-size: 28px; }
.party-reveal b { display: block; font: 800 19px var(--display); }
.party-reveal span { color: var(--ink-soft); }
.party-reveal .pts { font: 800 22px var(--display); color: var(--tc, var(--ink)); }
.party-reveal li.washed { border-style: dashed; }
@keyframes cardFlip { from { opacity: 0; transform: perspective(600px) rotateX(-80deg); } to { opacity: 1; transform: none; } }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 26px 0 4px; }
.pod { position: relative; width: 31%; max-width: 160px; border-radius: 16px 16px 6px 6px; padding: 14px 8px; text-align: center;
  background: linear-gradient(180deg, rgba(124,243,230,.22), rgba(124,243,230,.04)); border: 1px solid var(--line); animation: podUp .8s cubic-bezier(.2,1.2,.4,1) both; }
.pod b { display: block; font: 800 18px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod span { font-size: 14px; color: var(--ink-soft); }
.pod i { display: block; font: 800 40px var(--display); font-style: normal; margin-top: 8px; opacity: .8; }
.pod-1 { order: 2; height: 190px; background: linear-gradient(180deg, rgba(255,122,162,.35), rgba(255,122,162,.05)); border-color: rgba(255,122,162,.5); animation-delay: .5s; }
.pod-2 { order: 1; height: 150px; animation-delay: .25s; }
.pod-3 { order: 3; height: 120px; }
@keyframes podUp { from { transform: translateY(40px) scaleY(.4); opacity: 0; transform-origin: bottom; } to { transform: none; opacity: 1; } }
.help-modes { padding-left: 18px; margin: 6px 0 0; }
.help-modes li { margin-bottom: 6px; }

/* top bar gets a frosted backdrop so content can scroll beneath it */
.topbar { max-width: none; padding-left: max(16px, calc((100vw - 760px) / 2 + 16px)); padding-right: max(16px, calc((100vw - 760px) / 2 + 16px));
  background: linear-gradient(180deg, rgba(3, 20, 36, .72), rgba(3, 20, 36, .35)); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid rgba(190, 235, 240, .08); }
@media (max-width: 520px) {
  .modes { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mode { padding: 14px 14px 16px; }
  .mode-art { width: 40px; height: 40px; margin-bottom: 8px; }
  .mode h3 { font-size: 18px; }
  .mode p { font-size: 13.5px; }
}
