body[data-theme="midnight-trench"] {
  --space: #06172e;
  --ink: #f4f9ff;
  --mute: #bfd5e9;
  --card: #102742;
  --line: #375976;
  --accent: #ffa68d;
  --accent2: #67e8ee;
  --btn-ink: #061a2c;
  --ocean-art: url("../assets/themes/midnight-trench.webp");
}

body[data-theme="harbor-dawn"] {
  --space: #091e32;
  --ink: #f4fbff;
  --mute: #c8deeb;
  --card: #16344b;
  --line: #4b7286;
  --accent: #9be2ff;
  --accent2: #ffb5a9;
  --btn-ink: #281c25;
  --ocean-art: url("../assets/themes/harbor-dawn.webp");
}

body[data-theme="glow-reef"] {
  --space: #19142f;
  --ink: #fbf6ff;
  --mute: #dcc9ec;
  --card: #2b234b;
  --line: #675687;
  --accent: #f5a7d9;
  --accent2: #baf3ab;
  --btn-ink: #15271d;
  --ocean-art: url("../assets/themes/glow-reef.webp");
}

body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) #sky {
  /* Lower the brightest artwork values behind the header, prompts and scores. */
  background:
    linear-gradient(180deg, rgba(5, 12, 30, .40), rgba(5, 12, 30, .52) 63%, rgba(5, 12, 30, .23)),
    var(--ocean-art) center 54% / cover no-repeat,
    var(--space);
}

body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) #sky::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--space) 94%);
  opacity: clamp(0, calc(var(--alt) * .48), .48);
  transition: opacity .55s ease;
}

body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) :is(#planet, #stars) {
  display: none;
}

body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) .mode.daily {
  color: var(--btn-ink);
  background: var(--accent2);
}

body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) .dock {
  background: var(--space);
}

body.reduced:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) #sky::before {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) #sky::before {
    transition: none;
  }
}

/* Modest animation on two layers, independent of gameplay timing. */
#oceanEffects {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) #oceanEffects {
  display: block;
}

.ocean-light {
  position: absolute;
  inset: -12% -8%;
  opacity: .52;
}

.ocean-particles i {
  display: block;
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--size);
  height: var(--size);
  background: currentColor;
  animation: ocean-drift var(--duration) linear var(--offset) infinite;
}

.ocean-particles i:nth-child(1) { --x: 10%; --y: 72%; --size: 3px; --duration: 16s; --offset: -9s; }
.ocean-particles i:nth-child(2) { --x: 33%; --y: 86%; --size: 4px; --duration: 24s; --offset: -4s; }
.ocean-particles i:nth-child(3) { --x: 71%; --y: 68%; --size: 3px; --duration: 19s; --offset: -14s; }
.ocean-particles i:nth-child(4) { --x: 88%; --y: 94%; --size: 6px; --duration: 26s; --offset: -11s; }
.ocean-particles i:nth-child(5) { --x: 17%; --y: 45%; --size: 4px; --duration: 22s; --offset: -16s; }
.ocean-particles i:nth-child(6) { --x: 81%; --y: 49%; --size: 3px; --duration: 17s; --offset: -3s; }

body[data-theme="midnight-trench"] .ocean-light {
  background: conic-gradient(from 147deg at 80% 4%, transparent 7deg, #8fe8ff43 8deg 14deg,
    transparent 15deg 22deg, #7be6fa28 23deg 32deg, transparent 33deg);
  animation: ocean-sway 18s ease-in-out infinite alternate;
  transform-origin: 80% 5%;
}

body[data-theme="midnight-trench"] .ocean-particles { color: #abeaff; }

body[data-theme="harbor-dawn"] .ocean-light {
  background: radial-gradient(ellipse at 54% 4%, #b8edff60, #f5ada425 21%, transparent 52%);
  animation: ocean-sway 13s ease-in-out infinite alternate;
  transform-origin: 50% 3%;
}

body[data-theme="harbor-dawn"] .ocean-particles { color: #c6efff; }
body[data-theme="harbor-dawn"] .ocean-particles i {
  border: 1px solid currentColor;
  border-radius: 40%;
  background: transparent;
}

body[data-theme="glow-reef"] .ocean-light {
  background: radial-gradient(ellipse at 17% 86%, #9ffb7c3c, transparent 26%),
    radial-gradient(ellipse at 87% 78%, #c38aff48, transparent 25%);
  animation: reef-glow 11s ease-in-out infinite alternate;
}

body[data-theme="glow-reef"] .ocean-particles { color: #c9edaa; }

@keyframes ocean-sway {
  from { transform: translate3d(-3%, 0, 0) rotate(-4deg); opacity: .30; }
  to { transform: translate3d(4%, 0, 0) rotate(3deg); opacity: .68; }
}

@keyframes reef-glow {
  from { opacity: .20; }
  to { opacity: .68; }
}

@keyframes ocean-drift {
  0% { transform: translate3d(-6px, 10vh, 0); opacity: 0; }
  20%, 68% { opacity: .44; }
  100% { transform: translate3d(12px, -35vh, 0); opacity: 0; }
}

body.ocean-paused #oceanEffects * { animation-play-state: paused; }
body.reduced #oceanEffects { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  #oceanEffects { visibility: hidden; }
  #oceanEffects * { animation: none !important; }
}

[data-krill-skin][src$=".png"] { image-rendering: pixelated; }
.krill-skin-picker { display: flex; align-items: center; gap: 7px; max-width: 60%; }
.krill-skin-picker .skin-preview { width: 42px; height: 42px; flex: 0 0 42px; object-fit: contain; }
.set .krill-skin-picker select { min-width: 0; max-width: 100%; }

body:is([data-theme="midnight-trench"], [data-theme="harbor-dawn"], [data-theme="glow-reef"], [data-theme="deep-dive"]) #flight {
  background:
    linear-gradient(180deg, rgba(5, 12, 30, .76), rgba(5, 12, 30, .46)),
    var(--ocean-art) center 60% / cover no-repeat,
    var(--space);
}

/* ================= Krillion Geography: explorer map look ================= */
body[data-theme="deep-dive"] #sky {
  background: linear-gradient(180deg, rgba(42,26,14,.22), rgba(42,26,14,.10) 55%, rgba(42,26,14,.30)), var(--ocean-art) center 54% / cover no-repeat, var(--space);
}
body[data-theme="deep-dive"] #oceanEffects { display: none; }
body[data-theme="deep-dive"] :is(.card, .mode, .sheet, .icon-btn, .pl-row, .tut-card, .bonus-card) {
  background-color: #f6e6c0; border-color: #a8743c; color: #3a2312; box-shadow: 0 3px 0 #7a4a22;
}
body[data-theme="deep-dive"] .mode { background-image: linear-gradient(180deg, #fbf0d4, #efd9a8); }
body[data-theme="deep-dive"] .mode .md, body[data-theme="deep-dive"] .sub { color: #6e4d2e; }
body[data-theme="deep-dive"] .mode.daily { background: linear-gradient(180deg, #2aa89c, #1f8f86); color: #fff8e6; border-color: #145e58; }
body[data-theme="deep-dive"] .mode.daily .md { color: #e4fff9; }
body[data-theme="deep-dive"] .btn { background: #c8461f; color: #fff8e6; box-shadow: 0 4px 0 #7d2a10; }
body[data-theme="deep-dive"] .btn.ghost { background: #f6e6c0; color: #3a2312; box-shadow: 0 3px 0 #a8743c; border: 2px solid #a8743c; }
body[data-theme="deep-dive"] .btn.go { background: #1f8f86; box-shadow: 0 4px 0 #145e58; }
body[data-theme="deep-dive"] .dock { background: rgba(246,230,192,.96); border-top: 3px solid #a8743c; }
body[data-theme="deep-dive"] .dock input { background: #fffaf0; color: #3a2312; border-color: #a8743c; }
body[data-theme="deep-dive"] .top .brand .b2, body[data-theme="deep-dive"] .hero h1, body[data-theme="deep-dive"] .hero .sub,
body[data-theme="deep-dive"] main > section > h2, body[data-theme="deep-dive"] .hud .hl, body[data-theme="deep-dive"] .hud .hv {
  color: #fff8e6; text-shadow: 0 2px 0 #3a2312, 0 0 6px rgba(42,26,14,.7);
}
body[data-theme="deep-dive"] .sheet h3, body[data-theme="deep-dive"] .sheet h2 { color: #3a2312; }
body[data-theme="deep-dive"] select, body[data-theme="deep-dive"] .chip { background: #fffaf0; color: #3a2312; border-color: #a8743c; }
body[data-theme="deep-dive"] #flight {
  background: linear-gradient(180deg, rgba(42,26,14,.55), rgba(42,26,14,.25)), var(--ocean-art) center 60% / cover no-repeat, var(--space);
}
