:root {
  --deep: #04152e;
  --mid: #08305a;
  --shallow: #0e5c84;
  --glow: #7fe0ff;
  --ink: #e8f6ff;
  --ink-soft: #9cc4dd;
  --betta: #3d66f0;
  --sand: #c9a46a;
  --glass: rgba(170, 225, 255, 0.10);
  --glass-edge: rgba(170, 225, 255, 0.35);
  --live: #ff5f7a;
  --radius: 22px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Baloo 2", ui-rounded, system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--shallow) 0%, var(--mid) 38%, var(--deep) 100%) fixed;
  background-color: var(--deep);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── the sea ─────────────────────────────────────────────── */
.ocean { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.rays {
  position: absolute; inset: -20% -10% 30% -10%;
  background:
    repeating-linear-gradient(100deg, transparent 0 60px, rgba(160, 230, 255, .06) 60px 90px, transparent 90px 170px);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  animation: sway 14s ease-in-out infinite alternate;
  transform-origin: 50% 0;
}
@keyframes sway { from { transform: skewX(-6deg) translateX(-2%); } to { transform: skewX(6deg) translateX(2%); } }

.bubble {
  position: absolute; bottom: -30px; left: var(--x);
  width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), rgba(160,230,255,.12) 60%, rgba(160,230,255,.04));
  border: 1px solid rgba(200, 240, 255, .25);
  animation: rise var(--d) linear var(--delay) infinite;
}
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .9; }
  50% { transform: translate(14px, -55vh); }
  100% { transform: translate(-8px, -110vh); opacity: 0; }
}

.floor { position: absolute; left: 0; right: 0; bottom: 0; height: 150px; }
.floor svg { width: 100%; height: 100%; display: block; }
.weed { transform-box: fill-box; transform-origin: 50% 100%; animation: weed 6s ease-in-out infinite alternate; }
.weed:nth-child(2n) { animation-duration: 7.5s; animation-delay: -2s; }
.weed:nth-child(3n) { animation-duration: 5s; animation-delay: -1s; }
@keyframes weed { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }

/* a tiny Vincent that crosses the sea now and then */
.swimmer {
  position: absolute; top: var(--y, 30%); left: -80px; width: 54px;
  animation: cross 38s linear 4s infinite;
  opacity: .9;
}
@keyframes cross {
  0% { transform: translate(0, 0); }
  25% { transform: translate(30vw, -18px); }
  50% { transform: translate(60vw, 10px); }
  75% { transform: translate(90vw, -12px); }
  100% { transform: translate(calc(100vw + 160px), 0); }
}

/* betta fins */
.betta { display: block; overflow: visible; }
.betta .tail { transform-box: fill-box; transform-origin: 100% 50%; animation: tail 1.6s ease-in-out infinite alternate; }
.betta .dorsal { transform-box: fill-box; transform-origin: 20% 100%; animation: fin 2.2s ease-in-out infinite alternate; }
.betta .anal { transform-box: fill-box; transform-origin: 20% 0%; animation: fin 2.4s ease-in-out infinite alternate-reverse; }
.betta .pectoral { transform-box: fill-box; transform-origin: 100% 50%; animation: pec .7s ease-in-out infinite alternate; }
@keyframes tail { from { transform: skewY(-7deg) scaleX(.94); } to { transform: skewY(7deg) scaleX(1.04); } }
@keyframes fin { from { transform: skewX(-6deg); } to { transform: skewX(6deg); } }
@keyframes pec { from { transform: scaleX(.7); } to { transform: scaleX(1.1); } }
.bob { animation: bob 3.2s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-3px) rotate(-2deg); } to { transform: translateY(3px) rotate(2deg); } }

/* ── layout ──────────────────────────────────────────────── */
.page {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto;
  padding: 28px 16px 170px;
  display: flex; flex-direction: column; gap: 22px;
}

header { display: flex; align-items: center; gap: 14px; }
header .betta { width: 64px; flex: none; filter: drop-shadow(0 4px 12px rgba(61, 102, 240, .55)); }
h1 { margin: 0; font-family: "Chewy", "Baloo 2", ui-rounded, cursive; font-weight: 400; font-size: clamp(38px, 7vw, 56px); letter-spacing: 1px; line-height: 1; color: #f2fbff; text-shadow: 0 3px 0 #2f4fe0, 0 6px 18px rgba(47, 79, 224, .55); }
.sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 16px; }

/* ── the tank window ─────────────────────────────────────── */
.tank {
  position: relative; margin: 0;
  border-radius: var(--radius);
  padding: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: 0 0 0 6px rgba(127, 224, 255, .05), 0 24px 60px rgba(0, 10, 30, .55), inset 0 1px 0 rgba(255,255,255,.15);
  backdrop-filter: blur(6px);
}
.screen {
  position: relative; overflow: hidden;
  border-radius: calc(var(--radius) - 8px);
  aspect-ratio: 16 / 9;
  background: radial-gradient(ellipse at 50% 40%, #0c3b63, #031024);
}
.screen video, .screen img.snap {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.screen::after { /* glass sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.10) 0%, transparent 28%, transparent 70%, rgba(255,255,255,.05) 100%);
}

.hud {
  position: absolute; left: 12px; right: 12px; top: 12px; z-index: 2;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .8px;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(3, 16, 36, .55); border: 1px solid rgba(170, 225, 255, .25);
  backdrop-filter: blur(4px);
}
.pill.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); }
.state-live .pill.live .dot { background: var(--live); box-shadow: 0 0 0 0 rgba(255,95,122,.7); animation: ping 1.6s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(255,95,122,0); } 100% { box-shadow: 0 0 0 0 rgba(255,95,122,0); } }
.hud .spacer { flex: 1; }
.hud button {
  pointer-events: auto; cursor: pointer; color: var(--ink);
  font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(3, 16, 36, .55); border: 1px solid rgba(170, 225, 255, .25);
}
.hud button:hover { border-color: var(--glow); }

.status {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  text-align: center; color: var(--ink-soft); font-size: 16px;
  transition: opacity .6s ease;
}
.status .betta { width: 96px; }
.state-live .status { opacity: 0; pointer-events: none; }

.note { margin: 0; text-align: center; color: var(--ink-soft); font-size: 15px; }
.note a { color: var(--ink-soft); }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .swimmer, .bubble { display: none; }
}
