/* ==========================================================================
   rexzii — Frutiger Aero profile
   1. Font & tokens      5. Tiles (presence, music)   9. Effects (bubbles, fish fx)
   2. Base               6. Buttons                   10. Intro
   3. Scene              7. Dock                      11. Motion & entrance
   4. Card               8. Toast                     12. Responsive
   ========================================================================== */

/* 1. Font & tokens -------------------------------------------------------- */
@font-face {
  font-family: Unbounded;
  src: url("../assets/unbounded.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* scene (colours fade between themes; see @property below) */
  --px: 0;
  --py: 0;
  --sun-x: 80%;
  --sun-y: 15%;
  --moon-x: 80%;
  --moon-y: 15%;
  --sky-top: #0a74d4;
  --sky-mid: #43b1ef;
  --sky-low: #c4efff;
  --sky-sun: rgba(255, 255, 238, 0.6);
  --glow: rgba(255, 255, 255, 0.75);
  --sun-a: #fff4c2;
  --sun-b: #ffd45e;
  --sun-bloom: rgba(255, 246, 205, 0.55);
  --cloud-a: #ffffff;
  --cloud-b: #f0f8fd;
  --cloud-c: #c6dcee;
  --cloud-shadow: rgba(0, 70, 130, 0.14);
  --far-a: #b4e3f2;
  --far-b: #86c9df;
  --mid-a: #c4f47e;
  --mid-b: #3dba5e;
  --near-a: #93e45e;
  --near-b: #1f9a4c;
  --tree-a: #d2ff92;
  --tree-b: #2a9f4a;
  --trunk: #8b6a3e;
  --water-a: #74f2e2;
  --water-b: #18bcd3;
  --water-c: #0a76a0;
  --reed-a: #a4f58a;
  --reed-b: #1b9658;

  /* type */
  --font-display: Unbounded, "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", "Frutiger", "Myriad Pro", system-ui, -apple-system, sans-serif;
  --text: #073450;
  --text-2: #2a6683;
  --text-3: #5b8ea6;

  /* glass */
  --glass-a: rgba(255, 255, 255, 0.66);
  --glass-b: rgba(226, 248, 255, 0.36);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-shine: rgba(255, 255, 255, 0.75);
  --tile: rgba(255, 255, 255, 0.5);
  --tile-edge: rgba(255, 255, 255, 0.85);
  --tile-inset: rgba(0, 90, 140, 0.08);
  --shadow: 0 2px 6px rgba(0, 70, 110, 0.12), 0 30px 70px -24px rgba(0, 60, 110, 0.55);

  /* accents */
  --aqua-1: #8ae4ff;
  --aqua-2: #1aa3e8;
  --aqua-3: #0573c2;
  --green-1: #b6f58e;
  --green-2: #3cc65e;
  --green-3: #13893c;

  --radius-card: 30px;
  --radius-tile: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --sky-top: #01081c;
  --sky-mid: #082452;
  --sky-low: #124f78;
  --sky-sun: rgba(0, 0, 0, 0);
  --glow: rgba(60, 170, 220, 0.28);
  --cloud-a: #6d8cb6;
  --cloud-b: #3a5682;
  --cloud-c: #1c3456;
  --cloud-shadow: rgba(0, 0, 0, 0.2);
  --far-a: #1b4566;
  --far-b: #10304b;
  --mid-a: #23735e;
  --mid-b: #0d3e36;
  --near-a: #1d5f48;
  --near-b: #0a3329;
  --tree-a: #3fa57a;
  --tree-b: #0e4a36;
  --trunk: #3b3226;
  --water-a: #157c92;
  --water-b: #0b4d6e;
  --water-c: #031f38;
  --reed-a: #3fc07c;
  --reed-b: #0b4a33;

  --text: #ecf9ff;
  --text-2: #a8d8ec;
  --text-3: #74a9c2;

  --glass-a: rgba(70, 150, 200, 0.34);
  --glass-b: rgba(6, 34, 66, 0.62);
  --glass-edge: rgba(150, 225, 255, 0.38);
  --glass-shine: rgba(190, 240, 255, 0.22);
  --tile: rgba(140, 215, 255, 0.08);
  --tile-edge: rgba(150, 225, 255, 0.2);
  --tile-inset: rgba(0, 0, 0, 0.18);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}

/* Scene colours are registered so they can transition smoothly. */
@property --sky-top { syntax: "<color>"; inherits: true; initial-value: #0a74d4; }
@property --sky-mid { syntax: "<color>"; inherits: true; initial-value: #43b1ef; }
@property --sky-low { syntax: "<color>"; inherits: true; initial-value: #c4efff; }
@property --sky-sun { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 238, 0.6); }
@property --glow { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.75); }
@property --sun-a { syntax: "<color>"; inherits: true; initial-value: #fff4c2; }
@property --sun-b { syntax: "<color>"; inherits: true; initial-value: #ffd45e; }
@property --sun-bloom { syntax: "<color>"; inherits: true; initial-value: rgba(255, 246, 205, 0.55); }
@property --cloud-a { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --cloud-b { syntax: "<color>"; inherits: true; initial-value: #f0f8fd; }
@property --cloud-c { syntax: "<color>"; inherits: true; initial-value: #c6dcee; }
@property --cloud-shadow { syntax: "<color>"; inherits: true; initial-value: rgba(0, 70, 130, 0.14); }
@property --far-a { syntax: "<color>"; inherits: true; initial-value: #b4e3f2; }
@property --far-b { syntax: "<color>"; inherits: true; initial-value: #86c9df; }
@property --mid-a { syntax: "<color>"; inherits: true; initial-value: #c4f47e; }
@property --mid-b { syntax: "<color>"; inherits: true; initial-value: #3dba5e; }
@property --near-a { syntax: "<color>"; inherits: true; initial-value: #93e45e; }
@property --near-b { syntax: "<color>"; inherits: true; initial-value: #1f9a4c; }
@property --tree-a { syntax: "<color>"; inherits: true; initial-value: #d2ff92; }
@property --tree-b { syntax: "<color>"; inherits: true; initial-value: #2a9f4a; }
@property --water-a { syntax: "<color>"; inherits: true; initial-value: #74f2e2; }
@property --water-b { syntax: "<color>"; inherits: true; initial-value: #18bcd3; }
@property --water-c { syntax: "<color>"; inherits: true; initial-value: #0a76a0; }
@property --reed-a { syntax: "<color>"; inherits: true; initial-value: #a4f58a; }
@property --reed-b { syntax: "<color>"; inherits: true; initial-value: #1b9658; }

:root {
  transition:
    --sky-top 1.4s ease,
    --sky-mid 1.4s ease,
    --sky-low 1.4s ease,
    --sky-sun 1.4s ease,
    --glow 1.4s ease,
    --sun-a 1.4s ease,
    --sun-b 1.4s ease,
    --sun-bloom 1.4s ease,
    --cloud-a 1.4s ease,
    --cloud-b 1.4s ease,
    --cloud-c 1.4s ease,
    --cloud-shadow 1.4s ease,
    --far-a 1.4s ease,
    --far-b 1.4s ease,
    --mid-a 1.4s ease,
    --mid-b 1.4s ease,
    --near-a 1.4s ease,
    --near-b 1.4s ease,
    --tree-a 1.4s ease,
    --tree-b 1.4s ease,
    --water-a 1.4s ease,
    --water-b 1.4s ease,
    --water-c 1.4s ease,
    --reed-a 1.4s ease,
    --reed-b 1.4s ease;
}

/* Dawn and dusk re-colour the daytime sky (night has its own palette). */
:root[data-tod="dawn"]:not([data-theme="dark"]) {
  --sun-x: 18%;
  --sun-y: 30%;
  --sky-top: #3b7fd4;
  --sky-mid: #f2b4ae;
  --sky-low: #ffe1c0;
  --sky-sun: rgba(255, 210, 170, 0.75);
  --glow: rgba(255, 228, 200, 0.85);
  --sun-a: #ffe2b8;
  --sun-b: #ffa968;
  --sun-bloom: rgba(255, 200, 150, 0.5);
  --cloud-b: #fff0ea;
  --cloud-c: #f2c2bc;
  --far-a: #d9d3ec;
  --far-b: #a9bfdc;
}
:root[data-tod="dusk"]:not([data-theme="dark"]) {
  --sun-x: 82%;
  --sun-y: 32%;
  --sky-top: #2a4ca8;
  --sky-mid: #e488ad;
  --sky-low: #ffbd80;
  --sky-sun: rgba(255, 165, 110, 0.75);
  --glow: rgba(255, 200, 150, 0.8);
  --sun-a: #ffd0a0;
  --sun-b: #ff8a45;
  --sun-bloom: rgba(255, 160, 100, 0.5);
  --cloud-b: #ffe2d4;
  --cloud-c: #e29aa6;
  --far-a: #c9b3d9;
  --far-b: #9a9ccb;
}

/* 2. Base ----------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 15px/1.45 var(--font-body);
  color: var(--text);
  background: var(--sky-top);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

p, h1, h2 { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(26, 163, 232, 0.55);
}

/* 3. Scene ---------------------------------------------------------------- */
/* Everything around the card. Colours come from the tokens above and fade
   smoothly between day, dawn, dusk and night (they're registered below). */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.scene > * { position: absolute; }
.defs { width: 0; height: 0; overflow: hidden; }

.sky {
  inset: 0;
  background:
    radial-gradient(60% 50% at var(--sun-x) var(--sun-y), var(--sky-sun) 0%, transparent 70%),
    radial-gradient(150% 60% at 50% 100%, var(--sky-low) 15%, transparent 75%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 52%, var(--sky-low) 100%);
}

/* Soft bright band sitting behind the hills */
.horizon-glow {
  left: 0;
  right: 0;
  top: calc(var(--water-top, 55vh) - 30vh);
  height: 32vh;
  background: radial-gradient(75% 100% at 50% 100%, var(--glow) 0%, transparent 72%);
}

/* Stars (box-shadows from js/scene.js) */
.stars {
  inset: 0;
  opacity: 0;
  translate: calc(var(--px) * -4px) calc(var(--py) * -3px);
  transition: opacity 1.4s ease, translate 0.9s var(--ease-out);
}
.stars i { position: absolute; left: 0; top: 0; border-radius: 50%; }
.stars .s1 { width: 1px; height: 1px; animation: twinkle 3.4s ease-in-out infinite alternate; }
.stars .s2 { width: 1.6px; height: 1.6px; animation: twinkle 4.8s ease-in-out -1.6s infinite alternate; }
.stars .s3 { width: 2.4px; height: 2.4px; filter: drop-shadow(0 0 3px #bfe6ff); animation: twinkle 2.6s ease-in-out -0.8s infinite alternate; }
.stars .shooting {
  left: var(--sx, 20vw);
  top: var(--sy, 10vh);
  width: 140px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 85%, rgba(255, 255, 255, 0.4));
  filter: drop-shadow(0 0 4px rgba(190, 230, 255, 0.9));
  rotate: 22deg;
  opacity: 0;
}
.stars .shooting.go { animation: shoot 1.1s ease-out forwards; }

/* Aurora ribbons (night) */
.aurora {
  left: -10%;
  right: -10%;
  top: 0;
  height: 58%;
  opacity: 0;
  mix-blend-mode: screen;
  translate: calc(var(--px) * -10px) 0;
  transition: opacity 1.6s ease, translate 0.9s var(--ease-out);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 62%, transparent 100%);
}
.aurora i {
  position: absolute;
  left: 0;
  right: 0;
  height: 34%;
  border-radius: 50%;
  filter: blur(30px);
  background: linear-gradient(90deg, transparent 4%, rgba(70, 255, 190, 0.7) 26%, rgba(60, 200, 255, 0.55) 52%, rgba(150, 110, 255, 0.45) 74%, transparent 96%);
  animation: aurora 24s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) { top: 12%; rotate: -5deg; }
.aurora i:nth-child(2) { top: 30%; height: 24%; rotate: 4deg; opacity: 0.7; animation-duration: 32s; animation-delay: -10s; }

/* Sun: slow ray fan, bloom and a glossy core */
.sun {
  left: var(--sun-x);
  top: var(--sun-y);
  width: 0;
  height: 0;
  translate: calc(var(--px) * -6px) calc(var(--py) * -4px);
  transition: opacity 1.2s ease, translate 1.2s var(--ease-out);
}
.sun > * { position: absolute; left: 0; top: 0; border-radius: 50%; translate: -50% -50%; }
.sun-rays {
  width: 130vmax;
  height: 130vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.15) 0deg 3deg, rgba(255, 255, 255, 0) 3deg 13deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 42%);
  mask-image: radial-gradient(circle, #000 0%, transparent 42%);
  animation: turn 200s linear infinite;
}
.sun-bloom {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--sun-bloom) 0%, transparent 65%);
}
.sun-core {
  width: 104px;
  height: 104px;
  background: radial-gradient(circle at 50% 44%, #fff 0 36%, var(--sun-a) 64%, var(--sun-b) 100%);
  box-shadow: 0 0 30px 8px rgba(255, 252, 228, 0.95), 0 0 100px 34px var(--sun-bloom);
}
.sun-core::after {
  content: "";
  position: absolute;
  inset: 8% 20% 54%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
}

/* Lens flares on the line from the sun towards the middle of the screen */
.flares {
  inset: 0;
  mix-blend-mode: screen;
  translate: calc(var(--px) * 10px) calc(var(--py) * 7px);
  transition: opacity 1.2s ease, translate 0.9s var(--ease-out);
}
.flares i {
  position: absolute;
  left: calc(var(--sun-x) + (50% - var(--sun-x)) * var(--k));
  top: calc(var(--sun-y) + (62% - var(--sun-y)) * var(--k));
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  translate: -50% -50%;
}
.flares i:nth-child(1) { --k: 0.32; --s: 72px; background: radial-gradient(circle, transparent 48%, rgba(140, 230, 255, 0.4) 64%, transparent 71%); }
.flares i:nth-child(2) { --k: 0.5; --s: 24px; background: radial-gradient(circle, rgba(170, 255, 190, 0.55), transparent 70%); }
.flares i:nth-child(3) { --k: 0.78; --s: 140px; background: radial-gradient(circle, rgba(200, 170, 255, 0.16) 0 42%, transparent 70%); }
.flares i:nth-child(4) { --k: 1.18; --s: 46px; background: radial-gradient(circle, transparent 44%, rgba(255, 220, 150, 0.4) 62%, transparent 70%); }

/* Moon: pearl with soft craters, halo and glow */
.moon {
  left: var(--moon-x);
  top: var(--moon-y);
  width: 0;
  height: 0;
  opacity: 0;
  translate: calc(var(--px) * -6px) calc(36px + var(--py) * -4px);
  transition: opacity 1.2s ease, translate 1.2s var(--ease-out);
}
.moon > * { position: absolute; left: 0; top: 0; border-radius: 50%; translate: -50% -50%; }
.moon-glow { width: 340px; height: 340px; background: radial-gradient(circle, rgba(170, 210, 255, 0.32), transparent 65%); }
.moon-ring { width: 160px; height: 160px; background: radial-gradient(circle, transparent 56%, rgba(200, 225, 255, 0.24) 60%, transparent 68%); }
.moon-body {
  width: 74px;
  height: 74px;
  background:
    radial-gradient(circle at 63% 58%, rgba(110, 140, 195, 0.32) 0 9%, transparent 10.5%),
    radial-gradient(circle at 38% 68%, rgba(110, 140, 195, 0.24) 0 6%, transparent 7.5%),
    radial-gradient(circle at 58% 30%, rgba(110, 140, 195, 0.2) 0 5%, transparent 6.5%),
    radial-gradient(circle at 36% 32%, #ffffff, #e9f2ff 45%, #a3bde6 100%);
  box-shadow: 0 0 26px 4px rgba(210, 230, 255, 0.7), inset -9px -11px 18px rgba(55, 85, 145, 0.35);
}
.moon-body::after {
  content: "";
  position: absolute;
  inset: 7% 22% 56%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
}

/* Clouds: puffy shaded lobes, two depths drifting at different speeds */
.cloud-layer { inset: 0; transition: opacity 1.2s ease, translate 0.9s var(--ease-out); }
.cloud-layer.far { opacity: 0.72; translate: calc(var(--px) * -8px) calc(var(--py) * -4px); }
.cloud-layer.near { translate: calc(var(--px) * -18px) calc(var(--py) * -8px); }
.cloud {
  position: absolute;
  left: 0;
  top: var(--y);
  width: var(--w);
  aspect-ratio: 260 / 120;
  overflow: visible;
  filter: drop-shadow(0 10px 14px var(--cloud-shadow));
  animation: drift var(--d) linear var(--delay) infinite;
}
.cloud.b { aspect-ratio: 2 / 1; }

/* Landscape */
.landscape { inset: 0; width: 100%; height: 100%; }
.landscape .gloss { opacity: 0.55; transition: opacity 1.2s ease; }
.landscape .near-gloss { opacity: 0.45; transition: opacity 1.2s ease; }
.landscape .trunk { fill: var(--trunk); transition: fill 1.2s ease; }
.landscape .trees { filter: drop-shadow(0 3px 3px rgba(0, 60, 40, 0.25)); }

/* Night */
:root[data-theme="dark"] .stars { opacity: 1; }
:root[data-theme="dark"] .aurora { opacity: 0.6; }
:root[data-theme="dark"] .sun { opacity: 0; translate: calc(var(--px) * -6px) calc(46px + var(--py) * -4px); }
:root[data-theme="dark"] .flares { opacity: 0; }
:root[data-theme="dark"] .moon { opacity: 1; translate: calc(var(--px) * -6px) calc(var(--py) * -4px); }
:root[data-theme="dark"] .cloud-layer.far { opacity: 0.4; }
:root[data-theme="dark"] .cloud-layer.near { opacity: 0.6; }
:root[data-theme="dark"] .landscape .gloss,
:root[data-theme="dark"] .landscape .near-gloss { opacity: 0.12; }

/* Dawn & dusk: softer flares */
:root[data-tod="dawn"]:not([data-theme="dark"]) .flares,
:root[data-tod="dusk"]:not([data-theme="dark"]) .flares { opacity: 0.55; }

/* Water effects canvas (wave ribbons, swooshes, orbs, surface): js/water.js */
.water-fx { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Aquarium layer. Fish, pellets and bubbles are positioned by aquarium.js. */
/* Clipped at the waterline so nothing (bubbles, droplets) pokes into the sky. */
.aquarium { inset: 0; clip-path: inset(var(--water-top, 0px) 0 0 0); }
.aquarium > * { position: absolute; left: 0; top: 0; will-change: transform, translate; }

/* Fish */
.fish {
  pointer-events: auto;
  cursor: pointer;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 6px 6px rgba(0, 70, 100, 0.22));
}
.fish.parade { pointer-events: none; }
.fish svg { display: block; width: 100%; height: 100%; overflow: visible; transform-origin: 50% 55%; }
.fish .tail {
  transform-box: view-box;
  transform-origin: 31px 32px;
  animation: wag var(--wag, 0.9s) ease-in-out infinite alternate;
}
.fish .fin {
  transform-box: view-box;
  transform-origin: 76px 37px;
  animation: flap calc(var(--wag, 0.9s) * 1.4) ease-in-out infinite alternate;
}
.fish[data-pace="idle"] { --wag: 1.1s; }
.fish[data-pace="swim"] { --wag: 0.5s; }
.fish[data-pace="fast"] { --wag: 0.16s; }
.fish.wiggle svg { animation: fish-wiggle 0.55s var(--ease-out); }
.fish.gulp svg { animation: fish-gulp 0.4s var(--ease-spring); }
.fish.startled svg { animation: fish-startle 0.6s var(--ease-out); }
:root[data-theme="dark"] .fish { filter: drop-shadow(0 0 10px rgba(120, 230, 255, 0.3)) brightness(0.9) saturate(1.1); }

/* Food pellets */
.pellet {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 45% 55% 50% 40%;
  background: radial-gradient(circle at 35% 30%, #fff8d2 0 18%, #ffc54d 46%, #de7614 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 2px 3px rgba(120, 60, 0, 0.35);
  filter: hue-rotate(var(--hue, 0deg));
  pointer-events: none;
  transition: opacity 0.22s ease, scale 0.22s ease;
}
.pellet.eaten { opacity: 0; scale: 0.2; }
.pellet.dissolve { opacity: 0; scale: 0.4; transition-duration: 0.6s; }
:root[data-theme="dark"] .pellet { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 0 8px rgba(255, 190, 80, 0.6); }

/* Bubbles: glassy body, bright highlight, faint soap-film rim */
.bubble {
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  background:
    radial-gradient(circle at 30% 27%, rgba(255, 255, 255, 0.95) 0 7%, rgba(255, 255, 255, 0) 15%),
    radial-gradient(circle at 68% 76%, rgba(255, 255, 255, 0.45) 0 4%, rgba(255, 255, 255, 0) 10%),
    radial-gradient(circle, rgba(255, 255, 255, 0) 56%, rgba(190, 245, 255, 0.22) 70%, rgba(255, 255, 255, 0.8) 100%);
  box-shadow: inset 0 -2px 5px rgba(110, 215, 255, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 200deg, rgba(255, 140, 210, 0.5), rgba(130, 220, 255, 0.5), rgba(150, 255, 190, 0.45), rgba(255, 235, 140, 0.45), rgba(255, 140, 210, 0.5));
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 76%, transparent 100%);
  mask: radial-gradient(circle, transparent 60%, #000 76%, transparent 100%);
  mix-blend-mode: screen;
  opacity: 0.75;
  animation: sheen 7s linear infinite;
}
.bubble.small { pointer-events: none; cursor: default; }
.bubble.small::before { display: none; }
/* Pop: the film vanishes instantly, leaving a bright ring that bursts outward
   from the bubble's own centre (plus droplets from JS). */
.bubble.popping { pointer-events: none; background: none; box-shadow: none; }
.bubble.popping::before { display: none; }
.bubble.popping::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 10px rgba(200, 245, 255, 0.9), inset 0 0 8px rgba(255, 255, 255, 0.7);
  animation: pop-ring 0.26s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
.bubble.surfacing { pointer-events: none; animation: bubble-surface 0.3s ease-out forwards; }

/* Fire-and-forget motes: cursor trail, bursts, pop droplets */
.mote {
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0 14%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.75) 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
  animation: mote var(--dur) ease-out forwards;
}
.mote.droplet {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 5px rgba(200, 245, 255, 0.9);
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* Sparkle for taps on the sky */
.glint {
  position: fixed;
  z-index: 5;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  translate: var(--x) var(--y);
  background: radial-gradient(circle, #fff 0 12%, rgba(255, 255, 255, 0) 40%);
  animation: glint 0.6s var(--ease-out) forwards;
}
.glint::before,
.glint::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0 44%, #fff 50%, transparent 56% 100%) center / 100% 2px no-repeat,
    linear-gradient(0deg, transparent 0 44%, #fff 50%, transparent 56% 100%) center / 2px 100% no-repeat;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
}
.glint::after { rotate: 45deg; scale: 0.6; opacity: 0.7; }

/* Ring on the water where you tap */
.ripple {
  width: 96px;
  height: 26px;
  margin: -13px 0 0 -48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.45), inset 0 0 6px rgba(255, 255, 255, 0.35);
  pointer-events: none;
  translate: var(--x) var(--y);
  animation: ripple 0.9s var(--ease-out) forwards;
}

/* 4. Card ----------------------------------------------------------------- */
.stage {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: max(28px, env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom));
  /* Let clicks outside the card reach the fish, bubbles and water below. */
  pointer-events: none;
}
.stage > * { pointer-events: auto; }

.card {
  position: relative;
  width: min(440px, 100%);
  padding: 30px 22px 22px;
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.25),
    var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  isolation: isolate;
  transition: background 1.2s ease, border-color 1.2s ease, box-shadow 1.2s ease;
}

/* Classic Aero top gloss */
.card::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto;
  height: 132px;
  border-radius: calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 60% 60% / calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 26px 26px;
  background: linear-gradient(180deg, var(--glass-shine), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: -1;
}

/* Hero */
.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  margin-bottom: 20px;
}

.avatar-ring {
  position: relative;
  width: 116px;
  height: 116px;
  padding: 5px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, #ffffff 0%, var(--aqua-1) 35%, var(--aqua-2) 70%, var(--green-2) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.7),
    0 10px 24px -6px rgba(0, 110, 170, 0.55),
    0 0 40px rgba(120, 230, 255, 0.35);
}

.avatar-ring::after {
  content: "";
  position: absolute;
  inset: 5px 5px 50%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.avatar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #bfefff;
}

.status-dot {
  position: absolute;
  right: 4px;
  bottom: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #8a97a6;
  box-shadow: 0 2px 6px rgba(0, 40, 70, 0.35);
  z-index: 1;
}
:root[data-theme="dark"] .status-dot { border-color: #0c2f4c; }
.status-dot[data-status="online"] { background: radial-gradient(circle at 35% 30%, #a9ffb8, #23c552 60%); }
.status-dot[data-status="idle"] { background: radial-gradient(circle at 35% 30%, #ffe7a0, #f0b232 60%); }
.status-dot[data-status="dnd"] { background: radial-gradient(circle at 35% 30%, #ffb3b3, #f23f43 60%); }
.status-dot[data-status="offline"] { background: radial-gradient(circle at 35% 30%, #d9e2ea, #80848e 60%); }

.name {
  font: 700 clamp(28px, 7vw, 34px) / 1.05 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
:root[data-theme="dark"] .name { text-shadow: 0 0 24px rgba(120, 220, 255, 0.45); }

.bio {
  color: var(--text-2);
  font-size: 15px;
}

.location {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 4px 12px 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--tile);
  border: 1px solid var(--tile-edge);
}
.location svg { width: 14px; height: 14px; fill: var(--green-2); }

/* 5. Tiles ---------------------------------------------------------------- */
.tile {
  position: relative;
  padding: 14px;
  border-radius: var(--radius-tile);
  background: var(--tile);
  border: 1px solid var(--tile-edge);
  box-shadow: inset 0 1px 2px var(--tile-inset), inset 0 -1px 0 rgba(255, 255, 255, 0.35);
}
.tile + .tile { margin-top: 12px; }

/* Presence */
.presence {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.tile-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  overflow: hidden;
}
.tile-icon svg { width: 24px; height: 24px; fill: #fff; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.tile-icon::after {
  content: "";
  position: absolute;
  inset: 1px 1px 50%;
  border-radius: 12px 12px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.05));
}
.discord-icon {
  background: linear-gradient(180deg, #8f9cff, #5865f2 55%, #3f49c9);
  box-shadow: 0 4px 10px -2px rgba(70, 80, 220, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.tile-body { min-width: 0; }

.presence-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
}
.badge { width: 16px; height: 16px; flex: none; }
.guild-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 4px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--tile);
  border: 1px solid var(--tile-edge);
}
.guild-tag img { width: 14px; height: 14px; display: block; }

.presence-status {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-3);
}

.activity {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--tile-edge);
  font-size: 13px;
  color: var(--text-2);
}
.activity p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity p:first-child { font-weight: 600; color: var(--text); }

/* Music */
.tile-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.spotify-glyph { width: 18px; height: 18px; fill: #1ed760; flex: none; filter: drop-shadow(0 1px 1px rgba(0, 60, 20, 0.25)); }
.listening-label { flex: 1; min-width: 0; }

.eq { display: none; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; height: 100%; border-radius: 2px; background: #1ed760; transform-origin: bottom; animation: eq 0.9s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
.music[data-state="active"] .eq { display: inline-flex; }

.spotify { margin-top: 12px; }
.spotify iframe {
  display: block;
  width: 100%;
  height: 80px;
  border: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.music-empty {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-3);
}
.music:not([data-state="none"]) .music-empty { display: none; }

/* Live now-playing card (from Lanyard): art, title, artist, progress */
.now-playing {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.np-art {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--aqua-1), var(--aqua-3));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65), 0 8px 16px -8px rgba(0, 50, 90, 0.7);
}
.np-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.np-art::after {
  content: "";
  position: absolute;
  inset: 0 0 52%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.np-info { min-width: 0; display: grid; gap: 1px; }
.np-title,
.np-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-title { font-size: 15px; font-weight: 700; color: var(--text); text-decoration: none; }
.np-title:hover { text-decoration: underline; }
.np-artist { font-size: 13px; color: var(--text-2); }
.np-progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.np-time { font-size: 11.5px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.np-bar {
  position: relative;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(0, 60, 100, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 50, 90, 0.3), 0 1px 0 rgba(255, 255, 255, 0.6);
}
:root[data-theme="dark"] .np-bar { background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4); }
.np-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #b4ffd2, #1ed760 55%, #10a148);
  box-shadow: 0 0 8px rgba(30, 215, 96, 0.55);
  transition: width 0.25s linear;
}
.np-bar i.jump { transition: none; }
.np-bar i::after {
  content: "";
  position: absolute;
  inset: 1px 3px 50%;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.1));
}

/* 6. Buttons -------------------------------------------------------------- */
.links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.aqua-btn {
  --b1: var(--aqua-1);
  --b2: var(--aqua-2);
  --b3: var(--aqua-3);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(0, 70, 130, 0.35);
  border-radius: 999px;
  overflow: hidden;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(0, 50, 100, 0.55);
  background: linear-gradient(180deg, var(--b1) 0%, var(--b2) 55%, var(--b3) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -6px 10px rgba(255, 255, 255, 0.25),
    0 6px 14px -6px rgba(0, 90, 160, 0.7);
  transition: transform 0.2s var(--ease-spring), filter 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.aqua-btn::before {
  content: "";
  position: absolute;
  inset: 1px 8px 52%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.1));
  pointer-events: none;
}
.aqua-btn > * { position: relative; }
.aqua-btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; filter: drop-shadow(0 1px 1px rgba(0, 50, 100, 0.45)); }
.aqua-btn:hover { filter: brightness(1.08) saturate(1.1); transform: translateY(-1px); }
.aqua-btn:active { transform: translateY(1px) scale(0.98); filter: brightness(0.96); }
#copy-discord { --b1: var(--green-1); --b2: var(--green-2); --b3: var(--green-3); border-color: rgba(10, 100, 40, 0.35); text-shadow: 0 1px 1px rgba(0, 70, 20, 0.55); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -6px 10px rgba(255, 255, 255, 0.25), 0 6px 14px -6px rgba(20, 120, 50, 0.7); }

.guestbook { display: grid; gap: 12px; justify-items: center; padding: 20px; }
.guestbook h2 { font: 600 16px var(--font-display); }
.guestbook .giscus { width: 100%; }

/* 7. Dock ----------------------------------------------------------------- */
/* A small glass card with the same recipe as the profile card: glass body,
   top shine, tile-style buttons. "On" controls become glossy icon tiles,
   like the Discord tile on the card. */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
  translate: -50% 0;
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.25),
    var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  isolation: isolate;
  transition: background 1.2s ease, border-color 1.2s ease, box-shadow 1.2s ease;
}
.dock::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto;
  height: 52%;
  border-radius: 21px 21px 50% 50% / 21px 21px 12px 12px;
  background: linear-gradient(180deg, var(--glass-shine), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: -1;
}

.dock-btn {
  --g1: var(--aqua-1);
  --g2: var(--aqua-2);
  --g3: var(--aqua-3);
  --gs: rgba(0, 110, 190, 0.5);
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid var(--tile-edge);
  background: var(--tile);
  box-shadow: inset 0 1px 2px var(--tile-inset), inset 0 -1px 0 rgba(255, 255, 255, 0.35);
  color: var(--text-2);
  transition: transform 0.2s var(--ease-spring), filter 0.2s ease, background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.dock-btn svg { position: relative; z-index: 1; width: 22px; height: 22px; fill: currentColor; }
.dock-btn::after {
  content: "";
  position: absolute;
  inset: 1px 1px 50%;
  border-radius: 12px 12px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.dock-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.dock-btn:active { transform: translateY(1px) scale(0.94); }

/* Glossy "lit" tiles */
#theme-toggle,
#sound-toggle[aria-pressed="true"],
#feed-toggle[aria-pressed="true"] {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  background: linear-gradient(180deg, var(--g1), var(--g2) 55%, var(--g3));
  box-shadow: 0 4px 10px -2px var(--gs), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}
#theme-toggle::after,
#sound-toggle[aria-pressed="true"]::after,
#feed-toggle[aria-pressed="true"]::after { opacity: 1; }
#theme-toggle svg,
#sound-toggle[aria-pressed="true"] svg,
#feed-toggle[aria-pressed="true"] svg { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28)); }

/* Theme: a sun tile by day, a moon tile at night */
#theme-toggle { --g1: #ffe98c; --g2: #ffbb1c; --g3: #ee8600; --gs: rgba(235, 135, 0, 0.5); }
:root[data-theme="dark"] #theme-toggle { --g1: #93a2ff; --g2: #4b5cd8; --g3: #2a3290; --gs: rgba(60, 70, 200, 0.55); }
#theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] #theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .i-moon { display: block; }

/* Sound: tile + slider grouped in one inset tile */
.dock-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 14px 3px 3px;
  border-radius: 15px;
  background: var(--tile);
  border: 1px solid var(--tile-edge);
  box-shadow: inset 0 1px 2px var(--tile-inset), inset 0 -1px 0 rgba(255, 255, 255, 0.35);
}
.dock-volume .dock-btn { width: 36px; height: 36px; border-radius: 11px; }
.dock-volume .dock-btn:not([aria-pressed="true"]) { background: transparent; border-color: transparent; box-shadow: none; }
#sound-toggle .wave { display: none; }
#sound-toggle[aria-pressed="true"] .wave { display: block; }
#sound-toggle[aria-pressed="true"] .mute { display: none; }

/* Food: amber tile while feeding is on */
#feed-toggle { --g1: #ffe2a0; --g2: #ffad33; --g3: #e27a0e; --gs: rgba(225, 120, 10, 0.5); }
#feed-toggle .flakes { fill: #ffd76a; }
#feed-toggle[aria-pressed="true"] .flakes { fill: #fff6cf; }
#feed-toggle[aria-pressed="false"] .flakes { opacity: 0; }

/* Volume: the same glossy groove as the song progress bar */
.volume {
  --fill: 50%;
  --groove: rgba(0, 60, 100, 0.12);
  width: 96px;
  height: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
:root[data-theme="dark"] .volume { --groove: rgba(255, 255, 255, 0.1); }
.volume:disabled { opacity: 0.45; cursor: default; }
.volume::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 99px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.05) 50%, transparent 50%) 0 0 / var(--fill) 100% no-repeat,
    linear-gradient(180deg, var(--aqua-1), var(--aqua-2) 55%, var(--aqua-3)) 0 0 / var(--fill) 100% no-repeat,
    var(--groove);
  box-shadow: inset 0 1px 2px rgba(0, 50, 90, 0.3), 0 1px 0 rgba(255, 255, 255, 0.5);
}
.volume::-moz-range-track {
  height: 8px;
  border-radius: 99px;
  background: var(--groove);
  box-shadow: inset 0 1px 2px rgba(0, 50, 90, 0.3), 0 1px 0 rgba(255, 255, 255, 0.5);
}
.volume::-moz-range-progress {
  height: 8px;
  border-radius: 99px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.05) 50%, transparent 50%),
    linear-gradient(180deg, var(--aqua-1), var(--aqua-2) 55%, var(--aqua-3));
}
.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -5px;
  border-radius: 50%;
  border: 1px solid rgba(0, 80, 140, 0.35);
  background: radial-gradient(circle at 40% 30%, #fff 0 30%, #d4f3ff 60%, #79d3f6);
  box-shadow: 0 2px 5px rgba(0, 60, 110, 0.4), inset 0 -2px 3px rgba(0, 120, 200, 0.25);
}
.volume::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 80, 140, 0.35);
  background: radial-gradient(circle at 40% 30%, #fff 0 30%, #d4f3ff 60%, #79d3f6);
  box-shadow: 0 2px 5px rgba(0, 60, 110, 0.4), inset 0 -2px 3px rgba(0, 120, 200, 0.25);
}

/* 8. Toast ---------------------------------------------------------------- */
/* Pop-ups are mini glass cards: glossy icon tile, title, detail, optional
   progress (easter eggs found). */
.toast {
  --g1: var(--aqua-1);
  --g2: var(--aqua-2);
  --g3: var(--aqua-3);
  --gs: rgba(0, 110, 190, 0.5);
  position: fixed;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 72px);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 18px 10px 10px;
  border-radius: 20px;
  color: var(--text);
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.25),
    var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  isolation: isolate;
  opacity: 0;
  translate: -50% 12px;
  scale: 0.94;
  pointer-events: none;
  transition: opacity 0.25s ease, translate 0.4s var(--ease-spring), scale 0.4s var(--ease-spring);
}
.toast::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto;
  height: 52%;
  border-radius: 19px 19px 50% 50% / 19px 19px 12px 12px;
  background: linear-gradient(180deg, var(--glass-shine), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: -1;
}
.toast.show { opacity: 1; translate: -50% 0; scale: 1; }

.toast-icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  overflow: hidden;
  font-size: 21px;
  line-height: 1;
  background: linear-gradient(180deg, var(--g1), var(--g2) 55%, var(--g3));
  box-shadow: 0 4px 10px -2px var(--gs), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.toast-icon::after {
  content: "";
  position: absolute;
  inset: 1px 1px 50%;
  border-radius: 12px 12px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.05));
}
.toast-body { display: grid; gap: 1px; min-width: 0; }
.toast-title { font-size: 14px; font-weight: 700; line-height: 1.25; }
.toast-text { font-size: 12.5px; color: var(--text-2); }
.toast-progress {
  position: relative;
  height: 6px;
  margin-top: 5px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(0, 60, 100, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 50, 90, 0.3), 0 1px 0 rgba(255, 255, 255, 0.5);
}
:root[data-theme="dark"] .toast-progress { background: rgba(255, 255, 255, 0.1); }
.toast-progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 0%);
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.05) 50%, transparent 50%),
    linear-gradient(180deg, #b4ffd2, #1ed760 55%, #10a148);
  transition: width 0.6s var(--ease-out) 0.15s;
}

/* Icon tile colour per kind */
.toast[data-kind="done"] { --g1: var(--green-1); --g2: var(--green-2); --g3: var(--green-3); --gs: rgba(20, 130, 50, 0.5); }
.toast[data-kind="hint"] { --g1: #ffe2a0; --g2: #ffad33; --g3: #e27a0e; --gs: rgba(225, 120, 10, 0.5); }
.toast[data-kind="error"] { --g1: #ffc0c8; --g2: #f2596b; --g3: #c42c45; --gs: rgba(200, 40, 70, 0.5); }

/* 9. Effects -------------------------------------------------------------- */
/* Little glass speech pill when you poke a fish */
.fish-say {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 70;
  padding: 4px 11px;
  border-radius: 999px;
  font: 700 13px var(--font-body);
  color: #073450;
  white-space: nowrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(214, 246, 255, 0.8));
  border: 1px solid #fff;
  box-shadow: inset 0 -2px 4px rgba(120, 210, 255, 0.3), 0 6px 14px -4px rgba(0, 70, 120, 0.45);
  pointer-events: none;
  translate: calc(var(--x) - 50%) calc(var(--y) - 100%);
  transform-origin: 50% 100%;
  animation: say 1.5s forwards;
}

.cute-float {
  position: fixed;
  z-index: 150;
  left: 0;
  top: 0;
  font-size: 18px;
  pointer-events: none;
  animation: cute-float var(--dur, 1s) var(--ease-out) forwards;
}

.avatar-ring.hop { animation: hop 0.6s var(--ease-out); }
.avatar.egg-spin { animation: egg-spin 1s var(--ease-spring); }
.dock-btn.boop { animation: boop 0.45s var(--ease-spring); }
.dock-btn.spin svg { animation: spin-once 0.6s var(--ease-spring); }
html.egg-hue { animation: egg-hue 5s linear; }

/* 10. Intro --------------------------------------------------------------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(10, 70, 120, 0.35), rgba(3, 20, 45, 0.7));
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  transition: opacity 0.7s ease, visibility 0.7s;
}
.intro.hide { opacity: 0; visibility: hidden; }
.intro-inner { display: grid; justify-items: center; gap: 14px; }
.intro-btn {
  position: relative;
  min-width: 168px;
  padding: 14px 40px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  overflow: hidden;
  font: 600 18px var(--font-display);
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 50, 100, 0.6);
  background: linear-gradient(180deg, var(--aqua-1), var(--aqua-2) 55%, var(--aqua-3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 0 0 6px rgba(255, 255, 255, 0.08), 0 14px 40px -8px rgba(0, 150, 230, 0.8);
  animation: intro-breathe 3s ease-in-out infinite;
  transition: transform 0.2s var(--ease-spring);
}
.intro-btn::before {
  content: "";
  position: absolute;
  inset: 1px 12px 50%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.08));
}
.intro-btn:hover { transform: scale(1.04); }
.intro-sub { font-size: 13px; color: rgba(230, 248, 255, 0.85); }

/* 11. Motion & entrance --------------------------------------------------- */
html.anim-ready .card > *,
html.anim-ready .dock { opacity: 0; }
html.entered .card > * { animation: rise-in 0.7s var(--ease-out) both; }
html.entered .card > :nth-child(2) { animation-delay: 0.08s; }
html.entered .card > :nth-child(3) { animation-delay: 0.16s; }
html.entered .card > :nth-child(4) { animation-delay: 0.24s; }
html.entered .dock { animation: dock-in 0.7s var(--ease-out) 0.3s both; }

@keyframes rise-in { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
@keyframes dock-in { from { opacity: 0; translate: -50% 20px; } to { opacity: 1; translate: -50% 0; } }
@keyframes intro-breathe { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 0 0 12px rgba(255, 255, 255, 0.04), 0 14px 50px -6px rgba(0, 170, 255, 0.95); } }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes shoot {
  0% { opacity: 0; translate: 0 0; }
  12% { opacity: 1; }
  100% { opacity: 0; translate: 360px 146px; }
}
@keyframes aurora {
  0% { transform: translateX(-6%) scaleY(0.75); }
  50% { transform: translateX(3%) scaleY(1.15); }
  100% { transform: translateX(7%) scaleY(0.9); }
}
@keyframes turn { to { rotate: 360deg; } }
@keyframes drift { from { transform: translateX(-35vw); } to { transform: translateX(115vw); } }
@keyframes glint { 0% { scale: 0.2; opacity: 0; } 30% { scale: 1.1; opacity: 1; } 100% { scale: 0.6; opacity: 0; rotate: 45deg; } }
@keyframes eq { from { transform: scaleY(0.25); } to { transform: scaleY(1); } }

@keyframes wag { from { transform: rotate(-13deg); } to { transform: rotate(13deg); } }
@keyframes flap { from { transform: rotate(-12deg); } to { transform: rotate(20deg); } }
@keyframes fish-wiggle { 25% { transform: rotate(-8deg) scale(1.05); } 55% { transform: rotate(6deg); } 80% { transform: rotate(-2deg); } }
@keyframes fish-gulp { 40% { transform: scale(1.16, 0.88); } 70% { transform: scale(0.96, 1.06); } }
@keyframes fish-startle { 15% { transform: scale(1.25, 0.78); } 45% { transform: scale(0.9, 1.12) rotate(-6deg); } }
@keyframes sheen { to { rotate: 360deg; } }
@keyframes pop-ring { from { inset: 0; opacity: 1; border-width: 2.5px; } to { inset: -12px; opacity: 0; border-width: 0.5px; } }
@keyframes bubble-surface { to { scale: 1.3 0.35; opacity: 0; } }
@keyframes mote {
  from { opacity: 0.95; transform: translate(var(--x), var(--y)) scale(0.5); }
  to { opacity: 0; transform: translate(calc(var(--x) + var(--dx)), calc(var(--y) + var(--dy))) scale(1.1); }
}
@keyframes ripple { from { scale: 0.15; opacity: 1; } to { scale: 1; opacity: 0; } }
@keyframes say {
  0% { scale: 0.4; opacity: 0; transform: translateY(6px); animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  18% { scale: 1; opacity: 1; transform: translateY(0); animation-timing-function: linear; }
  65% { opacity: 1; transform: translateY(-12px); animation-timing-function: ease-in; }
  100% { scale: 0.9; opacity: 0; transform: translateY(-30px); }
}

@keyframes cute-float {
  0% { opacity: 0; translate: 0 0; scale: 0.4; }
  15% { opacity: 1; scale: 1.1; }
  100% { opacity: 0; translate: var(--dx, 0px) -70px; scale: 0.8; }
}
@keyframes hop {
  25% { translate: 0 0; scale: 1.08 0.9; }
  55% { translate: 0 -14px; scale: 0.95 1.06; }
}
@keyframes egg-spin { to { transform: rotate(720deg); } }
@keyframes boop { 35% { scale: 1.2; } 65% { scale: 0.94; } }
@keyframes spin-once { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes egg-hue { to { filter: hue-rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .mote, .ripple, .bubble, .glint, .stars .shooting { display: none; }
  /* Clouds hold still, spread across the sky. */
  .cloud { animation: none !important; }
  .cloud-layer.far .cloud:nth-child(1) { left: 6%; }
  .cloud-layer.far .cloud:nth-child(2) { left: 30%; }
  .cloud-layer.far .cloud:nth-child(3) { left: 58%; }
  .cloud-layer.far .cloud:nth-child(4) { left: 86%; }
  .cloud-layer.near .cloud:nth-child(1) { left: 2%; }
  .cloud-layer.near .cloud:nth-child(2) { left: 72%; }
  .cloud-layer.near .cloud:nth-child(3) { left: 40%; }
  html.anim-ready .card > *, html.anim-ready .dock { opacity: 1; }
}

/* 12. Responsive ---------------------------------------------------------- */
@media (max-width: 480px) {
  .stage { justify-content: flex-start; padding-top: max(36px, env(safe-area-inset-top)); }
  .card { padding: 26px 16px 16px; border-radius: 26px; }
  .avatar-ring { width: 100px; height: 100px; }
  .links { grid-template-columns: 1fr; }
  .volume { width: 70px; }
  .dock { gap: 6px; padding: 7px; }
  .dock-btn { width: 40px; height: 40px; }
}

@media (max-height: 700px) and (min-width: 481px) {
  .stage { justify-content: flex-start; }
}
