:root {
  /* Typography compliance tokens from DESIGN.md: Inter** Lora** Space Mono** rare poetic inside bottles behind convex */
  --river-midnight: #07141A;
  --deep-blue: #12354A;
  --aero-blue: #8ED8FF;
  --chrome: #D9E4EC;
  --pebble: #5E6A66;
  --moss: #314D3C;
  --bubble: #F6FBFF;
  --coral: #FF6F61;
  --cyan: #23F0D2;
  --silt: #B9975B;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: var(--river-midnight);
  color: var(--bubble);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.design-tokens { display: none; }

button { font: inherit; }

.stream-tank {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 12%, rgba(142, 216, 255, .35), transparent 26%),
    radial-gradient(circle at 72% 88%, rgba(49, 77, 60, .75), transparent 36%),
    linear-gradient(142deg, #07141A 0%, #12354A 48%, #07141A 100%);
  isolation: isolate;
}

.stream-tank::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    repeating-linear-gradient(112deg, transparent 0 28px, rgba(246, 251, 255, .045) 30px 33px, transparent 35px 80px),
    radial-gradient(circle, rgba(217, 228, 236, .12) 1px, transparent 2px);
  background-size: auto, 92px 92px;
  opacity: .8;
  animation: waterDrift 18s linear infinite;
  z-index: 0;
}

.water-ribbon {
  position: absolute;
  left: -18vw;
  top: -8vh;
  width: 150vw;
  height: 38vh;
  transform: rotate(-18deg);
  background: linear-gradient(90deg, transparent, rgba(142, 216, 255, .14), rgba(246, 251, 255, .32), rgba(35, 240, 210, .14), transparent);
  filter: blur(6px);
  border-top: 1px solid rgba(246, 251, 255, .35);
  border-bottom: 1px solid rgba(246, 251, 255, .18);
  animation: ribbonPulse 7s ease-in-out infinite alternate;
  z-index: 1;
}

.chrome-streaks {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(217, 228, 236, .16) 25%, transparent 31%, transparent 62%, rgba(246, 251, 255, .12) 66%, transparent 72%);
  transform: translateX(-20%);
  animation: chromeSlide 9s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}

.depth-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .9s ease, transform 1.2s ease;
  pointer-events: none;
  z-index: 5;
}

.depth-panel.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.surface { background: radial-gradient(circle at 50% 28%, rgba(142, 216, 255, .18), transparent 38%); }
.glass { background: linear-gradient(160deg, rgba(18, 53, 74, .12), rgba(217, 228, 236, .08), rgba(7, 20, 26, .5)); }
.pebble { background: radial-gradient(circle at 30% 90%, rgba(185, 151, 91, .26), transparent 32%), linear-gradient(180deg, transparent, rgba(49, 77, 60, .38)); }
.night { background: radial-gradient(circle at 70% 45%, rgba(35, 240, 210, .1), transparent 26%), linear-gradient(180deg, rgba(7, 20, 26, .2), rgba(7, 20, 26, .86)); }

.dock-label,
.caption-strip,
.coded-fragments,
.stream-status,
.aqua-button,
.scrubber,
.ring-reader {
  font-family: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.dock-label {
  position: absolute;
  padding: 10px 16px;
  border: 1px solid rgba(217, 228, 236, .38);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(246, 251, 255, .22), rgba(94, 106, 102, .13));
  box-shadow: inset 0 1px 0 rgba(246, 251, 255, .55), 0 14px 40px rgba(0, 0, 0, .28);
  color: var(--chrome);
  font-size: 11px;
}
.top-left { left: 4vw; top: 4vh; }
.top-right { right: 5vw; top: 5vh; }
.mid-right { right: 4vw; top: 34vh; }
.bottom-left { left: 5vw; bottom: 18vh; }

.player-shell {
  position: absolute;
  left: 11vw;
  top: 15vh;
  width: min(760px, 76vw);
  min-height: 48vh;
  border-radius: 44px;
  border: 1px solid rgba(246, 251, 255, .48);
  background:
    linear-gradient(180deg, rgba(246, 251, 255, .28), rgba(142, 216, 255, .08) 42%, rgba(7, 20, 26, .38)),
    linear-gradient(110deg, rgba(217, 228, 236, .5), rgba(18, 53, 74, .28));
  box-shadow: inset 0 2px 4px rgba(246, 251, 255, .7), inset 0 -24px 60px rgba(7, 20, 26, .34), 0 34px 90px rgba(0, 0, 0, .42);
  backdrop-filter: blur(18px) saturate(145%);
  overflow: hidden;
}

.player-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border-bottom: 1px solid rgba(246, 251, 255, .32);
  background: linear-gradient(180deg, rgba(246, 251, 255, .42), rgba(217, 228, 236, .12));
}

.aqua-light {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--silt);
  box-shadow: inset 0 2px 4px rgba(246, 251, 255, .75), 0 0 16px rgba(185, 151, 91, .7);
}
.aqua-light.cyan { background: var(--cyan); box-shadow: inset 0 2px 4px rgba(246, 251, 255, .75), 0 0 18px rgba(35, 240, 210, .8); }
.aqua-light.coral { background: var(--coral); box-shadow: inset 0 2px 4px rgba(246, 251, 255, .75), 0 0 18px rgba(255, 111, 97, .8); }
.stream-status { margin-left: auto; color: var(--deep-blue); font-size: 11px; }

.bubble-lens {
  position: relative;
  margin: 7vh auto 4vh;
  width: min(560px, 82%);
  aspect-ratio: 1.9 / 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  background: radial-gradient(circle at 30% 18%, rgba(246, 251, 255, .86), rgba(142, 216, 255, .24) 34%, rgba(18, 53, 74, .34) 72%, rgba(7, 20, 26, .45));
  box-shadow: inset -18px -24px 48px rgba(7, 20, 26, .34), inset 14px 12px 28px rgba(246, 251, 255, .58), 0 0 70px rgba(142, 216, 255, .33);
}

.wordmark {
  margin: 0;
  color: var(--bubble);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: clamp(2.1rem, 6vw, 5.7rem);
  letter-spacing: -.06em;
  text-shadow: 0 3px 0 rgba(18, 53, 74, .9), 0 0 28px rgba(35, 240, 210, .45);
}

.fragment {
  position: absolute;
  bottom: 18%;
  width: 70%;
  margin: 0;
  color: var(--river-midnight);
  font-size: clamp(.82rem, 1.5vw, 1.05rem);
}

.lora { font-family: Lora, Georgia, serif; font-style: italic; }

.underline-ripple {
  position: relative;
  display: inline-block;
}
.underline-ripple::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -.16em;
  height: .25em;
  border-bottom: 2px solid var(--cyan);
  border-radius: 50%;
  transform: scaleX(0);
  transform-origin: left;
  filter: drop-shadow(0 0 8px rgba(35, 240, 210, .75));
  animation: underlineDraw 2.4s ease forwards, rippleBob 2.2s ease-in-out infinite alternate 2.4s;
}

.player-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 0 24px 32px;
}

.aqua-button {
  border: 1px solid rgba(246, 251, 255, .55);
  color: var(--deep-blue);
  background: linear-gradient(180deg, #F6FBFF, #D9E4EC 48%, #8ED8FF);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 11px;
  box-shadow: inset 0 2px 3px rgba(246, 251, 255, .9), inset 0 -7px 18px rgba(18, 53, 74, .18), 0 10px 22px rgba(0, 0, 0, .25);
  cursor: pointer;
}
.aqua-button:hover { transform: translateY(-2px); color: var(--moss); }

.edge-copy {
  position: absolute;
  right: 5vw;
  bottom: 24vh;
  max-width: 280px;
  color: rgba(246, 251, 255, .72);
  line-height: 1.55;
}

.message-buoy,
.finale-panel {
  position: absolute;
  border: 1px solid rgba(217, 228, 236, .42);
  border-radius: 34px;
  padding: clamp(24px, 4vw, 48px);
  background: linear-gradient(145deg, rgba(246, 251, 255, .2), rgba(142, 216, 255, .08), rgba(49, 77, 60, .18));
  box-shadow: inset 0 1px 2px rgba(246, 251, 255, .62), 0 28px 80px rgba(0, 0, 0, .36);
  backdrop-filter: blur(16px);
}
.message-buoy h2,
.finale-panel h2 {
  margin: 0 0 18px;
  font-family: "Space Mono", monospace;
  font-size: clamp(1.8rem, 4.5vw, 4.3rem);
  letter-spacing: -.05em;
}
.message-buoy p,
.finale-panel p {
  margin: 0;
  max-width: 520px;
  color: rgba(246, 251, 255, .78);
  line-height: 1.65;
}
.left-buoy { left: 8vw; top: 20vh; width: min(610px, 58vw); }
.pebble-buoy { right: 8vw; top: 23vh; width: min(560px, 50vw); }
.finale-panel { left: 15vw; top: 24vh; width: min(680px, 68vw); }

.caption-strip {
  position: absolute;
  right: 8vw;
  bottom: 26vh;
  transform: rotate(-8deg);
  border-radius: 999px;
  padding: 14px 24px;
  color: var(--river-midnight);
  background: linear-gradient(180deg, rgba(246, 251, 255, .9), rgba(142, 216, 255, .55));
  box-shadow: inset 0 2px 4px rgba(246, 251, 255, .85), 0 18px 50px rgba(0,0,0,.28);
  font-size: 12px;
}

.coded-fragments {
  position: absolute;
  left: 46vw;
  top: 14vh;
  display: grid;
  gap: 18px;
  color: var(--cyan);
  font-size: 12px;
  opacity: .82;
}
.coded-fragments span { text-shadow: 0 0 16px rgba(35, 240, 210, .5); }

.message-bottle {
  position: absolute;
  left: 12vw;
  top: 28vh;
  width: 310px;
  height: 104px;
  border-radius: 55px 34px 34px 55px;
  border: 1px solid rgba(246, 251, 255, .45);
  background: linear-gradient(100deg, rgba(246, 251, 255, .15), rgba(217, 228, 236, .32), rgba(142, 216, 255, .12));
  box-shadow: inset 0 2px 8px rgba(246, 251, 255, .55), 0 28px 80px rgba(0,0,0,.34);
  transform: rotate(-14deg);
  animation: bottleFloat 7s ease-in-out infinite;
}
.message-bottle p { margin: 32px 34px; color: var(--bubble); font-size: 15px; }
.bottle-neck {
  position: absolute;
  right: -58px;
  top: 30px;
  width: 74px;
  height: 42px;
  border: 1px solid rgba(246, 251, 255, .4);
  border-radius: 16px 24px 24px 16px;
  background: rgba(217, 228, 236, .18);
}

.pebble-bed {
  position: absolute;
  inset: auto 0 0;
  height: 24vh;
  background: linear-gradient(180deg, transparent, rgba(185, 151, 91, .25));
}
.pebble-bed span {
  position: absolute;
  bottom: 4vh;
  width: 16vw;
  height: 7vh;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, rgba(246, 251, 255, .18), rgba(94, 106, 102, .55));
  filter: blur(.2px);
}
.pebble-bed span:nth-child(1) { left: 2vw; }
.pebble-bed span:nth-child(2) { left: 18vw; bottom: 1vh; width: 22vw; }
.pebble-bed span:nth-child(3) { left: 40vw; width: 12vw; }
.pebble-bed span:nth-child(4) { left: 55vw; bottom: 2vh; width: 18vw; }
.pebble-bed span:nth-child(5) { left: 70vw; width: 24vw; }
.pebble-bed span:nth-child(6) { left: 88vw; bottom: 0; width: 14vw; }

.ring-reader {
  margin-top: 28px;
  display: inline-grid;
  gap: 4px;
  padding: 16px 22px;
  border-radius: 26px;
  color: var(--river-midnight);
  background: radial-gradient(circle at 25% 20%, #F6FBFF, #8ED8FF 72%);
  box-shadow: inset 0 2px 4px rgba(246, 251, 255, .9), 0 0 34px rgba(35, 240, 210, .28);
}
.ring-reader span { font-size: 10px; color: var(--deep-blue); }
.ring-reader strong { font-size: 16px; color: var(--moss); }

.bubble {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(246, 251, 255, .45);
  background: radial-gradient(circle at 30% 24%, rgba(246, 251, 255, .86), rgba(142, 216, 255, .17) 42%, rgba(246, 251, 255, .05));
  box-shadow: inset -6px -8px 18px rgba(7, 20, 26, .18), 0 0 18px rgba(142, 216, 255, .22);
  z-index: 4;
  cursor: pointer;
}
.bubble::after {
  content: attr(data-phrase);
  position: absolute;
  left: 50%;
  top: 50%;
  width: max-content;
  max-width: 180px;
  transform: translate(-50%, -50%) scale(.72);
  opacity: 0;
  color: var(--river-midnight);
  font: italic 12px Lora, Georgia, serif;
  text-align: center;
  transition: opacity .3s ease, transform .3s ease;
}
.bubble:hover::after,
.bubble.revealed::after { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.fish {
  position: absolute;
  z-index: 3;
  transform: translate3d(0,0,0);
  filter: drop-shadow(0 0 10px currentColor);
}
.tetra { width: 54px; height: 8px; border-radius: 99px; background: var(--cyan); color: var(--cyan); }
.guppy { width: 28px; height: 16px; border-radius: 50% 10% 50% 10%; background: var(--coral); color: var(--coral); }
.angel { width: 0; height: 0; border-top: 24px solid transparent; border-bottom: 24px solid transparent; border-left: 38px solid rgba(246, 251, 255, .35); color: var(--aero-blue); }
.shadow { width: 92px; height: 22px; border-radius: 50%; background: rgba(7, 20, 26, .55); color: var(--river-midnight); }
.f1 { top: 20vh; left: -10vw; animation: swimRight 16s linear infinite; }
.f2 { top: 62vh; left: -8vw; animation: swimRight 20s linear infinite 2s; }
.f3 { top: 42vh; right: -8vw; animation: swimLeft 22s linear infinite; }
.f4 { top: 72vh; right: -12vw; animation: swimLeft 26s linear infinite 4s; }
.f5 { top: 10vh; left: -12vw; animation: swimRight 24s linear infinite 6s; }
.f6 { top: 34vh; right: -9vw; animation: swimLeft 18s linear infinite 5s; }

.scrubber {
  position: fixed;
  left: 5vw;
  right: 5vw;
  bottom: 24px;
  z-index: 30;
  height: 58px;
}
.scrub-track {
  position: relative;
  height: 18px;
  margin-top: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(7, 20, 26, .74), rgba(217, 228, 236, .18));
  border: 1px solid rgba(246, 251, 255, .28);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.45), 0 12px 38px rgba(0,0,0,.28);
}
.scrub-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--aero-blue), var(--cyan), var(--coral));
  transition: width .55s ease;
}
.playhead {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(246, 251, 255, .85);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 30% 20%, #F6FBFF, #8ED8FF 58%, #12354A);
  box-shadow: inset 0 2px 4px rgba(246, 251, 255, .9), 0 0 24px rgba(35, 240, 210, .55);
  cursor: grab;
  transition: left .55s ease;
  z-index: 3;
}
.playhead:active { cursor: grabbing; }
.tick {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  padding: 0;
  border: 1px solid rgba(246, 251, 255, .7);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--pebble);
  cursor: pointer;
}
.tick:nth-of-type(1) { left: 0%; }
.tick:nth-of-type(2) { left: 33.333%; }
.tick:nth-of-type(3) { left: 66.666%; }
.tick:nth-of-type(4) { left: 100%; }
.tick.active { background: var(--bubble); box-shadow: 0 0 20px var(--cyan); }
.tick span {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  color: rgba(246, 251, 255, .72);
  font-size: 10px;
}

@keyframes waterDrift { to { transform: translate3d(-80px, 80px, 0); } }
@keyframes ribbonPulse { from { opacity: .52; } to { opacity: .9; transform: rotate(-18deg) translateY(6vh); } }
@keyframes chromeSlide { 50% { transform: translateX(20%); opacity: .75; } }
@keyframes underlineDraw { to { transform: scaleX(1); } }
@keyframes rippleBob { from { border-radius: 42% 58% 52% 48%; } to { border-radius: 60% 40% 46% 54%; transform: scaleX(1) translateY(3px); } }
@keyframes bottleFloat { 50% { transform: rotate(-8deg) translate(18px, -18px); } }
@keyframes swimRight { from { transform: translateX(0); } to { transform: translateX(120vw); } }
@keyframes swimLeft { from { transform: translateX(0) scaleX(-1); } to { transform: translateX(-120vw) scaleX(-1); } }

@media (max-width: 760px) {
  .player-shell { left: 5vw; width: 90vw; top: 12vh; }
  .player-controls { flex-wrap: wrap; }
  .edge-copy, .coded-fragments { display: none; }
  .left-buoy, .pebble-buoy, .finale-panel { left: 6vw; right: auto; width: 88vw; top: 20vh; }
  .message-bottle { left: 12vw; top: 52vh; transform: scale(.82) rotate(-14deg); }
  .tick span { display: none; }
}
