/*
 * Abyssal Space — underwater-cosmos theme layer.
 * Loaded after legacy inline styles so this semantic theme can supersede old
 * purple card treatments without touching gameplay logic or renderer behavior.
 */
:root {
  color-scheme: dark;
  --abyss-void: #030711;
  --abyss-deep: #071321;
  --abyss-blue: #0a2032;
  --abyss-water: #0b2837;
  --glass-surface: rgba(9, 25, 39, .82);
  --glass-raised: rgba(14, 36, 51, .9);
  --glass-edge: rgba(135, 207, 230, .2);
  --glass-edge-active: rgba(113, 231, 246, .65);
  --text-primary: #e8f6fc;
  --text-secondary: #a5c0d0;
  --text-quiet: #7895a9;
  --biolume-cyan: #65e7e8;
  --biolume-teal: #58cbb9;
  --nebula-violet: #9a8bff;
  --star-pearl: #d8f7ff;
  --danger-coral: #ff8798;
  --bg: var(--abyss-void);
  --panel: var(--glass-surface);
  --line: var(--glass-edge);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --purple: var(--nebula-violet);
  --abyss-ease: cubic-bezier(.2,.7,.2,1);
  --abyss-fast: 150ms;
  --abyss-medium: 220ms;
}
html { background: var(--abyss-void); }
body {
  color: var(--text-primary);
  background:
    radial-gradient(ellipse at 50% -18%, rgba(30, 98, 125, .25), transparent 48%),
    radial-gradient(ellipse at 8% 38%, rgba(22, 91, 104, .13), transparent 38%),
    radial-gradient(ellipse at 92% 72%, rgba(66, 51, 119, .15), transparent 40%),
    linear-gradient(180deg, #071321 0%, #040b16 46%, #030711 100%);
  background-attachment: fixed;
  isolation: isolate;
}
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  opacity: .48;
  background:
    radial-gradient(1px 1px at 8% 14%, #c8f5ff9c 50%, transparent 100%),
    radial-gradient(1px 1px at 22% 68%, #b2e9ff75 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 79% 17%, #e2e0ff8c 50%, transparent 100%),
    radial-gradient(1px 1px at 91% 48%, #a4f8ef7a 50%, transparent 100%),
    radial-gradient(1px 1px at 64% 83%, #c8f5ff70 50%, transparent 100%),
    radial-gradient(1px 1px at 37% 31%, #c8f5ff65 50%, transparent 100%),
    radial-gradient(1px 1px at 53% 9%, #e2e0ff70 50%, transparent 100%);
}
body::after {
  opacity: .55;
  background:
    radial-gradient(ellipse at 50% 34%, transparent 0 22%, rgba(3, 7, 17, .12) 60%, rgba(3, 7, 17, .65) 100%),
    radial-gradient(ellipse at 16% 56%, rgba(24, 122, 142, .09), transparent 42%),
    radial-gradient(ellipse at 84% 26%, rgba(112, 87, 194, .09), transparent 38%);
}
.trainer-page { position: relative; isolation: isolate; }
.trainer-top {
  padding-top: 28px !important;
  padding-bottom: 22px !important;
}
.trainer-brand {
  color: #e5f8ff !important;
  text-shadow: 0 0 12px rgba(101, 231, 232, .2), 0 0 34px rgba(101, 231, 232, .1) !important;
  letter-spacing: .16em !important;
}
.trainer-description { color: var(--text-secondary) !important; }
.mini-home-title {
  color: #e1f8ff !important;
  text-shadow: 0 0 24px rgba(101, 231, 232, .15) !important;
}
.mini-home-number { color: #80cbd4 !important; }
.mini-home-description { color: var(--text-quiet) !important; }

/* Floating instruments share one cool, restrained material system. */
.trainer-card {
  position: relative;
  border: 1px solid var(--glass-edge) !important;
  border-radius: 13px !important;
  background:
    linear-gradient(145deg, rgba(15, 39, 54, .94), rgba(7, 18, 31, .9) 70%) !important;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, .28),
    inset 0 1px 0 rgba(216, 247, 255, .055) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--abyss-medium) var(--abyss-ease),
              background-color var(--abyss-medium) var(--abyss-ease),
              box-shadow var(--abyss-medium) var(--abyss-ease);
}
.trainer-card:hover {
  border-color: rgba(101, 231, 232, .32) !important;
  box-shadow: 0 18px 44px rgba(0,0,0,.32), inset 0 1px 0 rgba(216,247,255,.075) !important;
}
.trainer-card h2 {
  color: #8fd9df !important;
  letter-spacing: .17em !important;
  font-size: 10px !important;
}
.hud-item {
  border: 1px solid rgba(135, 207, 230, .13) !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, rgba(11, 31, 45, .85), rgba(5, 16, 28, .8)) !important;
}
.hud-item span { color: var(--text-quiet) !important; }
.hud-item strong { color: #e0f7ff !important; }
.hold-preview {
  border: 1px solid rgba(135, 207, 230, .16) !important;
  border-radius: 9px !important;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(31, 105, 121, .19), transparent 72%),
    rgba(3, 12, 22, .74) !important;
}
.next-preview { background: transparent !important; }
.rhythm-outlier {
  border-color: rgba(135, 207, 230, .16) !important;
  background: rgba(3, 13, 23, .75) !important;
}
.rhythm-metric { color: var(--text-secondary) !important; }
.rhythm-metric strong, .rhythm-outlier-title { color: var(--text-primary) !important; }
.rhythm-pattern { color: #b6aaff !important; }

/* The board is the sharp, high-confidence instrument inside the soft volume. */
.board-wrap {
  position: relative;
  border: 1px solid rgba(115, 203, 221, .42) !important;
  border-radius: 10px !important;
  padding: 7px !important;
  background:
    linear-gradient(145deg, rgba(23, 57, 72, .95), rgba(5, 15, 27, .98) 68%) !important;
  box-shadow:
    0 28px 70px rgba(0,0,0,.52),
    0 0 0 1px rgba(101,231,232,.06),
    0 0 38px rgba(52, 175, 194, .105),
    inset 0 1px 0 rgba(216,247,255,.11) !important;
}
.board {
  background-color: #040c16 !important;
  outline: 1px solid rgba(145, 213, 227, .08);
  outline-offset: -1px;
}
.board-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(164, 241, 248, .06), transparent 22% 78%, rgba(120, 117, 223, .045));
}
.board-wrap > * { position: relative; }
.board .cell.ghost { opacity: .42; }

/* Controls: glass hardware with clear, accessible focus and immediate response. */
.action-button, button, input, select, textarea {
  accent-color: var(--biolume-cyan);
}
.action-button {
  color: var(--text-primary) !important;
  border: 1px solid rgba(135, 207, 230, .25) !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, rgba(17, 48, 63, .94), rgba(7, 23, 36, .96)) !important;
  box-shadow: inset 0 1px 0 rgba(216,247,255,.07) !important;
  transition: border-color var(--abyss-fast) var(--abyss-ease), background var(--abyss-fast) var(--abyss-ease), transform var(--abyss-fast) var(--abyss-ease) !important;
}
.action-button:hover {
  color: #f2feff !important;
  border-color: var(--glass-edge-active) !important;
  background: linear-gradient(180deg, rgba(22, 67, 80, .98), rgba(8, 32, 45, .98)) !important;
  box-shadow: 0 0 18px rgba(101,231,232,.08), inset 0 1px 0 rgba(216,247,255,.1) !important;
}
.action-button:active { transform: translateY(1px) !important; }
:where(button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--biolume-cyan) !important;
  outline-offset: 3px !important;
}
.rules-card .settings-range { accent-color: var(--biolume-cyan) !important; }
.rules-toggle input, .settings-checks input { accent-color: var(--biolume-cyan) !important; }
.finesse-prompt span {
  border-color: rgba(216,247,255,.88) !important;
  background: rgba(3, 12, 22, .95) !important;
  text-shadow: none !important;
  box-shadow: 0 10px 28px rgba(0,0,0,.55), 0 0 22px rgba(101,231,232,.09) !important;
}
.finesse-prompt .finesse-key.done { color: #76edbb !important; border-color: #76edbb !important; }
.finesse-prompt .finesse-key.next { color: #ff9ba9 !important; border-color: #ff9ba9 !important; }
.finesse-prompt .finesse-key.pending { color: #ffc0c8 !important; border-color: #87505d !important; }

/* Settings surfaces use the same underwater instrument language. */
.trainer-settings-label { color: var(--text-secondary) !important; }
.settings-gear {
  border-color: rgba(135,207,230,.28) !important;
  background: linear-gradient(145deg, rgba(14,45,59,.96), rgba(5,17,29,.96)) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.3), 0 0 20px rgba(101,231,232,.07) !important;
}
.power-orb, .power-orbit, .power-star { color: var(--biolume-cyan) !important; }
.settings-panel, .settings-modal, [data-settings-panel] {
  color: var(--text-primary);
}
.settings-panel .trainer-card, .settings-modal .trainer-card {
  background: var(--glass-surface) !important;
}

/* Mobile controls retain their touch geometry, but share the new material. */
.mobile-control {
  color: #e7fbff !important;
  border-color: rgba(135,207,230,.4) !important;
  background: rgba(6, 24, 37, .88) !important;
  box-shadow: 0 5px 18px rgba(0,0,0,.38), inset 0 1px 0 rgba(216,247,255,.1) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mobile-control:active, .mobile-control.pressed {
  background: rgba(25, 91, 102, .94) !important;
  border-color: var(--biolume-cyan) !important;
}
.mobile-controls-editbar {
  border-color: var(--glass-edge) !important;
  background: rgba(4, 15, 27, .96) !important;
}
.mobile-controls-editbar button {
  border-color: rgba(135,207,230,.25) !important;
  background: rgba(11,31,45,.96) !important;
  color: var(--text-primary) !important;
}
.toast {
  color: var(--text-primary) !important;
  border-color: var(--glass-edge-active) !important;
  background: rgba(5, 20, 32, .97) !important;
  box-shadow: 0 10px 32px rgba(0,0,0,.4), 0 0 20px rgba(101,231,232,.08) !important;
}
::selection { color: #031017; background: var(--biolume-cyan); }

/* Keep the background atmospheric, not animated. Gameplay motion stays native. */
@media (max-width: 900px) {
  body { background-attachment: scroll; }
  .trainer-card { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (max-width: 560px) {
  .trainer-top { padding-inline: 14px !important; }
  .trainer-brand { letter-spacing: .12em !important; }
  .board-wrap { box-shadow: 0 18px 42px rgba(0,0,0,.48), 0 0 24px rgba(52,175,194,.09) !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* Second pass: make the liquid-space material specific to the real interface. */
:root {
  --glass-line-soft: rgba(135, 207, 230, .12);
  --glass-fill-deep: rgba(4, 15, 27, .94);
  --water-glow: rgba(69, 203, 202, .12);
  --instrument-label: #91cbd6;
}
.trainer-page {
  isolation: isolate;
}
.trainer-page::before,
.trainer-page::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
  left: 50%;
  transform: translateX(-50%);
  width: min(1120px, 100%);
}
.trainer-page::before {
  top: 90px;
  height: 580px;
  opacity: .8;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(36, 143, 159, .13), transparent 38%),
    radial-gradient(ellipse at 14% 42%, rgba(21, 100, 125, .09), transparent 34%),
    radial-gradient(ellipse at 88% 58%, rgba(89, 74, 161, .08), transparent 36%);
}
.trainer-page::after {
  top: 170px;
  height: 430px;
  opacity: .55;
  background:
    linear-gradient(118deg, transparent 0 22%, rgba(117, 229, 233, .035) 31%, transparent 42%),
    linear-gradient(68deg, transparent 0 60%, rgba(126, 111, 221, .03) 68%, transparent 78%);
  mask-image: linear-gradient(to bottom, transparent, black 15%, black 75%, transparent);
}
.trainer-main, .trainer-shell, .trainer-layout, .trainer-side, .board-column, .rules-column {
  min-width: 0;
}
.trainer-shell {
  position: relative;
}
.mini-home {
  position: relative;
  padding: 8px 0 20px;
}
.mini-home::after {
  content: "";
  display: block;
  width: 76px;
  height: 1px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, rgba(101,231,232,.55), transparent);
}
.trainer-description {
  max-width: 52ch;
  margin-inline: auto;
  line-height: 1.65 !important;
}
.trainer-card {
  overflow: hidden;
  background-clip: padding-box !important;
}
.trainer-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 13%;
  right: 13%;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(190,244,249,.2), transparent);
}
.trainer-card h2 {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5 !important;
}
.trainer-card h2::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--biolume-teal);
  box-shadow: 0 0 9px rgba(88,203,185,.32);
}
.hold-preview {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.next-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 10px 0 4px;
}
.next-preview .mini-piece {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--glass-line-soft);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(11,34,47,.72), rgba(3,13,23,.58));
}
.next-preview .mini-piece:first-child {
  border-color: rgba(101,231,232,.32);
  background: linear-gradient(145deg, rgba(20,64,76,.68), rgba(4,18,29,.76));
  box-shadow: inset 0 1px 0 rgba(216,247,255,.06), 0 0 18px rgba(101,231,232,.035);
}
.next-preview .mini-grid {
  display: grid;
  align-content: center;
  justify-content: center;
}
.hud-item {
  transition: border-color var(--abyss-fast) var(--abyss-ease), background var(--abyss-fast) var(--abyss-ease);
}
.hud-item:focus-within {
  border-color: var(--glass-edge-active) !important;
}
.rules-card .rule-control,
.rules-card .rules-toggle {
  border-color: var(--glass-line-soft) !important;
}
.rules-card .rule-control {
  padding-block: 10px !important;
}
.rules-card .rule-control-head,
.settings-control-head {
  gap: 12px;
}
.rules-card label,
.settings-card label {
  color: var(--text-secondary);
}
.rules-card output,
.settings-card output {
  color: var(--biolume-cyan);
  font-variant-numeric: tabular-nums;
}
.rules-card .rules-toggle {
  padding: 10px 9px !important;
  border-radius: 7px;
  transition: background var(--abyss-fast) var(--abyss-ease), border-color var(--abyss-fast) var(--abyss-ease);
}
.rules-card .rules-toggle:has(input:checked) {
  background: rgba(31, 94, 98, .16);
  border-color: rgba(101,231,232,.28) !important;
}
.rules-card .rules-toggle:has(input:focus-visible) {
  outline: 2px solid var(--biolume-cyan);
  outline-offset: 2px;
}
.trainer-card [data-content-region] p,
.trainer-card p {
  color: var(--text-secondary);
}
.trainer-card[data-content-region="training-signal"] {
  background:
    radial-gradient(ellipse at 0% 0%, rgba(37, 130, 140, .1), transparent 68%),
    linear-gradient(145deg, rgba(10,29,42,.9), rgba(4,14,25,.9)) !important;
}
.trainer-card[data-content-region="training-signal"] p {
  line-height: 1.7 !important;
}
.rhythm-card:not([hidden]) {
  border-color: rgba(101,231,232,.24) !important;
}
.rhythm-metric {
  padding-block: 7px;
  border-bottom: 1px solid var(--glass-line-soft);
}
.rhythm-metric:last-child { border-bottom: 0; }
.rhythm-metric span {
  letter-spacing: .09em;
  font-size: 9px;
}
.rhythm-metric strong {
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.finesse-prompt {
  isolation: isolate;
}
.finesse-prompt .finesse-key {
  min-width: 26px;
  text-align: center;
  line-height: 1.35;
}
.settings-panel {
  color: var(--text-primary) !important;
}
.settings-backdrop {
  background: rgba(1, 6, 14, .78) !important;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.settings-card {
  color: var(--text-primary) !important;
  border: 1px solid rgba(135,207,230,.28) !important;
  border-radius: 16px !important;
  background:
    radial-gradient(ellipse at 100% 0%, rgba(42,116,130,.16), transparent 40%),
    linear-gradient(145deg, rgba(12,31,45,.99), rgba(3,11,21,.99)) !important;
  box-shadow: 0 30px 100px rgba(0,0,0,.62), inset 0 1px 0 rgba(216,247,255,.07) !important;
}
.settings-heading {
  border-bottom-color: var(--glass-line-soft) !important;
}
.settings-title, .settings-section-title {
  color: var(--text-primary) !important;
}
.settings-section {
  border-bottom-color: var(--glass-line-soft) !important;
}
.settings-hint {
  color: var(--text-quiet) !important;
}
.settings-close, .settings-reset {
  color: var(--text-primary) !important;
  border-color: rgba(135,207,230,.22) !important;
  background: rgba(7,23,36,.92) !important;
}
.settings-close:hover, .settings-reset:hover {
  border-color: var(--glass-edge-active) !important;
  background: rgba(17,55,67,.95) !important;
}
.settings-bind-list > *, .settings-control, .settings-checks label {
  border-color: var(--glass-line-soft) !important;
}
.settings-card input[type="range"] {
  accent-color: var(--biolume-cyan);
}
.settings-card input[type="checkbox"] {
  accent-color: var(--biolume-cyan);
}
.trainer-settings-control {
  filter: drop-shadow(0 5px 16px rgba(0,0,0,.28));
}
.trainer-settings-label {
  letter-spacing: .18em !important;
}
.toast {
  border-radius: 9px !important;
  letter-spacing: .035em;
}
@supports not (backdrop-filter: blur(1px)) {
  .trainer-card, .mobile-control, .settings-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}
@media (max-width: 900px) {
  .trainer-page::before { top: 70px; height: 440px; }
  .trainer-page::after { display: none; }
  .next-preview { flex-direction: row; flex-wrap: wrap; gap: 5px; }
  .next-preview .mini-piece { min-width: 43px; min-height: 31px; padding: 3px 5px; }
}
@media (max-width: 560px) {
  .mini-home { padding-bottom: 12px; }
  .trainer-card { border-radius: 10px !important; }
  .trainer-card h2 { letter-spacing: .12em !important; }
  .next-preview { gap: 4px; }
  .next-preview .mini-piece { min-width: 36px; min-height: 28px; }
  .settings-card { border-radius: 12px !important; }
  .settings-backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .trainer-card, .hud-item, .action-button, .rules-card .rules-toggle {
    transition: none !important;
  }
}


/* Third pass — give the world a signature, not just a palette.
   The playfield remains clean; the "living" quality lives at its perimeter. */
:root {
  --abyss-luminous-edge: rgba(113, 231, 246, .72);
  --abyss-halo-cool: rgba(50, 190, 205, .18);
  --abyss-halo-violet: rgba(112, 94, 198, .12);
}
.trainer-page::before {
  width: min(1260px, 100%);
  top: 115px;
  height: 680px;
  opacity: .92;
  background:
    radial-gradient(ellipse at 50% 36%, rgba(22, 110, 135, .13), transparent 32%),
    radial-gradient(ellipse at 12% 56%, rgba(27, 118, 130, .09), transparent 35%),
    radial-gradient(ellipse at 88% 25%, rgba(87, 73, 157, .09), transparent 34%),
    radial-gradient(ellipse at 50% 100%, rgba(5, 37, 54, .2), transparent 48%);
}
.trainer-brand {
  text-shadow:
    0 0 1px rgba(232,250,255,.65),
    0 0 16px rgba(101,231,232,.23),
    0 0 48px rgba(44,166,189,.14) !important;
}
.mini-home-title {
  letter-spacing: .015em;
  text-shadow:
    0 1px 0 rgba(255,255,255,.08),
    0 0 26px rgba(101,231,232,.18) !important;
}
.board-wrap {
  isolation: isolate;
  border-color: rgba(132, 222, 232, .52) !important;
  box-shadow:
    0 30px 76px rgba(0,0,0,.58),
    0 0 0 1px rgba(101,231,232,.1),
    0 0 30px rgba(52,175,194,.12),
    inset 0 1px 0 rgba(216,247,255,.15) !important;
}
.board-wrap::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -13px;
  border-radius: 18px;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, var(--abyss-halo-cool), transparent 60%),
    radial-gradient(ellipse at 0% 45%, rgba(40,151,170,.08), transparent 52%),
    radial-gradient(ellipse at 100% 80%, var(--abyss-halo-violet), transparent 58%);
  filter: blur(13px);
  opacity: .8;
}
.board-wrap::before {
  background:
    linear-gradient(118deg, rgba(190,247,250,.1), transparent 18% 72%, rgba(126,111,221,.055)),
    linear-gradient(180deg, rgba(101,231,232,.025), transparent 28%);
}
.trainer-side > .trainer-card:first-child,
.rules-column > .trainer-card:first-child {
  box-shadow:
    0 16px 40px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(216,247,255,.06),
    inset 0 0 26px rgba(57,153,170,.025) !important;
}
.trainer-card:hover {
  transform: translateY(-1px);
}
.trainer-card h2::before {
  box-shadow: 0 0 7px rgba(88,203,185,.35), 0 0 15px rgba(88,203,185,.12);
}
.action-button:focus-visible,
.settings-gear:focus-visible,
.mobile-control:focus-visible {
  box-shadow: 0 0 0 4px rgba(101,231,232,.13), 0 0 22px rgba(101,231,232,.12) !important;
}
.mobile-control:active, .mobile-control.pressed {
  box-shadow:
    0 0 0 2px rgba(101,231,232,.15),
    0 0 20px rgba(101,231,232,.14),
    inset 0 1px 0 rgba(216,247,255,.16) !important;
}
@media (max-width: 900px) {
  .board-wrap::after { inset: -8px; filter: blur(9px); opacity: .58; }
  .trainer-card:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .trainer-card { transform: none !important; }
}
@media (forced-colors: active) {
  .board-wrap, .trainer-card, .settings-card, .mobile-control {
    border: 1px solid CanvasText !important;
    box-shadow: none !important;
  }
  :where(button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid Highlight !important;
  }
}


/* Human-scale details: small controls and queue previews should feel designed,
   not merely recolored. Ambient drift is slow and independent of game timing. */
.next-preview .mini-piece:first-child::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 5px;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 15%, rgba(182,246,250,.08) 48%, transparent 75%);
}
.settings-gear {
  position: relative;
  overflow: hidden;
  border-radius: 13px !important;
  border: 1px solid rgba(126,224,234,.36) !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(105,228,235,.18), transparent 58%),
    linear-gradient(145deg, rgba(13,47,60,.96), rgba(4,17,29,.98)) !important;
}
.settings-gear::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(168,239,243,.1);
  border-radius: 10px;
  pointer-events: none;
}
.power-orb {
  filter: drop-shadow(0 0 7px rgba(101,231,232,.3));
}
.action-button, .mobile-control, .mobile-controls-editbar button,
.settings-close, .settings-reset {
  position: relative;
  overflow: hidden;
}
.action-button::after, .mobile-control::after,
.mobile-controls-editbar button::after,
.settings-close::after, .settings-reset::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(207,249,251,.075), transparent 34% 70%, rgba(101,231,232,.035));
  opacity: .7;
}
.action-button:active, .settings-close:active, .settings-reset:active {
  box-shadow: inset 0 2px 8px rgba(0,0,0,.24), 0 0 0 1px rgba(101,231,232,.13) !important;
}
.mobile-control {
  border-color: rgba(130,222,234,.42) !important;
  background:
    radial-gradient(circle at 30% 20%, rgba(101,231,232,.14), transparent 64%),
    linear-gradient(145deg, rgba(13,43,56,.92), rgba(4,15,27,.94)) !important;
  box-shadow: 0 5px 18px rgba(0,0,0,.4), inset 0 1px 0 rgba(216,247,255,.13), 0 0 15px rgba(44,166,189,.055) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mobile-controls.editing .mobile-control::after {
  background: none;
  border: 1px dashed rgba(130,222,234,.5);
  border-radius: inherit;
}
.mobile-controls-editbar {
  border-color: rgba(130,222,234,.26) !important;
  background: linear-gradient(145deg, rgba(10,31,44,.98), rgba(3,12,22,.98)) !important;
  box-shadow: 0 16px 40px rgba(0,0,0,.48), inset 0 1px 0 rgba(216,247,255,.06) !important;
}
.mobile-controls-editbar button {
  border-color: rgba(130,222,234,.28) !important;
  background: linear-gradient(180deg, rgba(15,47,60,.96), rgba(5,20,32,.98)) !important;
}
.trainer-actions .action-button {
  letter-spacing: .035em;
}
@media (max-width: 560px) {
  .mobile-control { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* A suspended-water layer: the world drifts, but the playfield stays exact.
   Staggered phases avoid a synchronized, mechanical bobbing effect. */
/* Pieces, cards and board glow stay still. Only the background current drifts. */
.hold-preview .mini-piece .mini-grid,
.next-preview .mini-piece .mini-grid {
  transform-origin: center;
}


/* ==========================================================================
   ABYSSAL ECOSYSTEM / V2
   Shift the metaphor from "blue glass UI" to a habitat with depth, suspended
   matter, refracted light and precision instruments. Ambient layers never
   touch game state, board geometry, or input timing.
   ========================================================================== */
:root {
  --abyss-blackwater: #02070d;
  --abyss-midwater: #071a25;
  --abyss-shelf: #102d36;
  --abyss-phosphor: #9af7d5;
  --abyss-lantern: #f4c98b;
  --abyss-violet-light: #b8a6ff;
  --abyss-glass: rgba(8, 25, 34, .76);
  --abyss-glass-rim: rgba(166, 230, 219, .22);
}

/* Depth is built in layers: distant light, marine snow, then the habitat.
   Keep atmosphere in a few composited planes rather than DOM particles. */
.trainer-page {
  background:
    radial-gradient(ellipse at 50% 4%, rgba(41, 116, 119, .15), transparent 35%),
    radial-gradient(ellipse at 4% 52%, rgba(35, 102, 106, .11), transparent 28%),
    radial-gradient(ellipse at 96% 38%, rgba(105, 73, 130, .10), transparent 30%);
}
.trainer-page::before,
.trainer-page::after {
  content: "";
  position: fixed;
  inset: -8vh -6vw;
  z-index: -1;
  pointer-events: none;
}
.trainer-page::before {
  opacity: .46;
  background:
    radial-gradient(ellipse at 17% 17%, rgba(177, 245, 223, .20) 0, transparent 1.2%),
    radial-gradient(ellipse at 17% 17%, rgba(108, 204, 188, .08) 0, transparent 12%),
    radial-gradient(ellipse at 83% 29%, rgba(193, 178, 255, .16) 0, transparent 1.1%),
    radial-gradient(ellipse at 83% 29%, rgba(144, 127, 217, .07) 0, transparent 13%),
    radial-gradient(ellipse at 74% 79%, rgba(245, 205, 143, .11) 0, transparent 1%),
    radial-gradient(ellipse at 74% 79%, rgba(245, 205, 143, .045) 0, transparent 10%),
    radial-gradient(1px 1px at 12% 35%, rgba(210,255,239,.7) 50%, transparent 100%),
    radial-gradient(1px 1px at 27% 74%, rgba(210,255,239,.46) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 69% 19%, rgba(213,204,255,.62) 50%, transparent 100%),
    radial-gradient(1px 1px at 91% 63%, rgba(210,255,239,.56) 50%, transparent 100%),
    radial-gradient(1px 1px at 58% 87%, rgba(245,205,143,.52) 50%, transparent 100%),
    radial-gradient(1px 1px at 42% 11%, rgba(210,255,239,.4) 50%, transparent 100%);
}
.trainer-page::after {
  opacity: .26;
  background:
    linear-gradient(112deg, transparent 0 24%, rgba(135, 225, 209, .055) 29%, transparent 35% 100%),
    linear-gradient(72deg, transparent 0 58%, rgba(174, 161, 255, .05) 63%, transparent 70% 100%),
    radial-gradient(ellipse at 50% 0%, rgba(181, 245, 222, .11), transparent 45%),
    repeating-radial-gradient(ellipse at 50% -12%, transparent 0 22px, rgba(165, 236, 217, .018) 23px 24px, transparent 25px 48px);
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 78%);
}
/* Cards become small pieces of submerged hardware: asymmetric light,
   a fine inner rim, and an optical highlight rather than a uniform blue slab. */
.trainer-card {
  overflow: hidden;
  border-color: var(--abyss-glass-rim) !important;
  background:
    radial-gradient(ellipse at 8% 0%, rgba(123, 221, 195, .075), transparent 48%),
    linear-gradient(155deg, rgba(12, 34, 41, .90), rgba(4, 14, 24, .88) 68%) !important;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, .27),
    inset 0 1px 0 rgba(220, 255, 241, .075),
    inset 1px 0 0 rgba(166, 230, 219, .025) !important;
}
.trainer-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(174, 246, 222, .35), transparent);
  opacity: .72;
}
.trainer-card h2 {
  color: #a5e6d4 !important;
  text-shadow: 0 0 18px rgba(113, 225, 192, .10);
}
.trainer-card:hover {
  border-color: rgba(154, 247, 213, .34) !important;
}

/* The board reads as a lit viewing port, with a quiet spectral rim.
   No transforms are applied to the board or its cells. */
.board-wrap {
  border-color: rgba(154, 225, 211, .48) !important;
  background:
    linear-gradient(145deg, rgba(28, 66, 69, .97), rgba(4, 17, 25, .99) 62%, rgba(24, 19, 42, .96)) !important;
  box-shadow:
    0 30px 78px rgba(0, 0, 0, .58),
    0 0 0 1px rgba(154, 247, 213, .075),
    0 0 42px rgba(64, 189, 157, .10),
    0 0 100px rgba(89, 104, 169, .055),
    inset 0 1px 0 rgba(222, 255, 242, .18),
    inset 0 0 0 1px rgba(0, 0, 0, .22) !important;
}
.board-wrap::before {
  z-index: 2;
  background:
    linear-gradient(118deg, rgba(199, 255, 233, .085), transparent 17% 78%, rgba(186, 166, 255, .065)),
    linear-gradient(180deg, rgba(192, 255, 232, .025), transparent 18% 84%, rgba(0, 0, 0, .11));
}
.board-wrap::after {
  inset: -14px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 18% 8%, rgba(133, 244, 208, .22), transparent 42%),
    radial-gradient(ellipse at 85% 92%, rgba(165, 145, 255, .13), transparent 43%);
  filter: blur(17px);
  opacity: .34;
}

/* Previews are held in dark water, not laid on empty page space. */
.hold-preview {
  border-color: rgba(149, 222, 204, .22) !important;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(116, 228, 193, .12), transparent 58%),
    linear-gradient(160deg, rgba(6, 24, 30, .9), rgba(3, 10, 18, .92)) !important;
  box-shadow: inset 0 1px 0 rgba(223, 255, 241, .055), inset 0 0 22px rgba(72, 180, 151, .035);
}
.next-preview {
  border-radius: 9px;
  background:
    radial-gradient(ellipse at 50% 4%, rgba(113, 215, 187, .065), transparent 56%) !important;
}
.hud-item {
  border-color: rgba(149, 222, 204, .15) !important;
  background:
    linear-gradient(145deg, rgba(13, 37, 42, .88), rgba(5, 16, 24, .88)) !important;
}
.hud-item strong { text-shadow: 0 0 16px rgba(154, 247, 213, .09); }
.trainer-brand {
  text-shadow: 0 0 16px rgba(154, 247, 213, .18), 0 0 44px rgba(70, 180, 153, .09) !important;
}
.mini-home-title {
  text-shadow: 0 0 26px rgba(154, 247, 213, .14) !important;
}

/* A second, warmer organism-light is reserved for rare accents, not body text. */
.mini-home-number { color: #b5dfce !important; }
.rhythm-pattern { color: var(--abyss-violet-light) !important; }
.finesse-prompt .finesse-key.done {
  color: var(--abyss-phosphor) !important;
  border-color: var(--abyss-phosphor) !important;
  box-shadow: 0 0 14px rgba(154, 247, 213, .12);
}
.action-button:hover {
  border-color: rgba(154, 247, 213, .48) !important;
  background: linear-gradient(145deg, rgba(20, 57, 56, .96), rgba(5, 24, 31, .98)) !important;
}
:where(button, input, select, textarea, [tabindex]):focus-visible {
  outline-color: var(--abyss-phosphor) !important;
  box-shadow: 0 0 0 4px rgba(154, 247, 213, .10) !important;
}

/* Avoid fixed-screen visual work on narrow devices and honor system motion. */
@media (max-width: 720px) {
  .trainer-page::before,
  .trainer-page::after {
    animation: none;
    inset: 0;
    opacity: .22;
  }
  .trainer-card { backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
  .board-wrap::after { filter: blur(10px); opacity: .24; }
}
@media (max-width: 560px) {
  .trainer-page::after { display: none; }
  .trainer-card { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .trainer-page::before,
  .trainer-page::after { animation: none !important; transform: none !important; }
}
@media (forced-colors: active) {
  .trainer-page::before, .trainer-page::after { display: none !important; }
}


/* ==========================================================================
   ABYSSAL ECOSYSTEM / V2.1 — authored depth, not extra neon
   A more legible spatial composition: distant vertical water columns,
   a soft habitat horizon, and localized instrument light. No new markup.
   ========================================================================== */
.trainer-top {
  isolation: isolate;
}
.trainer-top::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(113, 194, 174, .10) 12%,
    rgba(173, 238, 213, .42) 48%,
    rgba(164, 143, 224, .18) 72%,
    transparent 100%);
  box-shadow: 0 0 18px rgba(94, 205, 174, .07);
}
.trainer-layout {
  position: relative;
  isolation: isolate;
}
.trainer-layout::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: -42px -5vw -28px;
  opacity: .42;
  background:
    linear-gradient(180deg, transparent, rgba(100, 206, 181, .025) 22%, transparent 76%),
    linear-gradient(90deg, transparent 0 8%, rgba(121, 226, 198, .045) 8.2%, transparent 8.8% 26%, rgba(159, 145, 235, .035) 26.2%, transparent 27% 72%, rgba(121, 226, 198, .03) 72.2%, transparent 73% 92%, rgba(121, 226, 198, .035) 92.2%, transparent 93%);
  mask-image: linear-gradient(180deg, transparent, black 14%, black 72%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, black 14%, black 72%, transparent);
}
.mini-home {
  position: relative;
  isolation: isolate;
}
.mini-home::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -26px;
  left: 50%;
  width: min(52vw, 460px);
  height: 82px;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(106, 215, 181, .105), transparent 62%),
    radial-gradient(ellipse at 50% 90%, rgba(167, 149, 239, .055), transparent 70%);
  filter: blur(9px);
}
.mini-home::after {
  content: "";
  display: block;
  width: clamp(48px, 7vw, 86px);
  height: 2px;
  margin: 13px auto 0;
  border-radius: 100%;
  background: linear-gradient(90deg, transparent, rgba(154, 247, 213, .68), rgba(184, 166, 255, .44), transparent);
  box-shadow: 0 0 12px rgba(154, 247, 213, .13);
  opacity: .75;
}

/* The instruments share a habitat, but not the same surface treatment.
   Hold is a contained chamber; Next is a vertical sightline; metrics are
   discrete readouts. This separation makes the layout feel authored. */
.trainer-side:first-of-type .trainer-card:nth-child(2) {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(112, 223, 190, .10), transparent 48%),
    linear-gradient(155deg, rgba(9, 31, 35, .94), rgba(3, 13, 20, .94) 72%) !important;
}
.trainer-layout > .trainer-side:nth-of-type(2) > .trainer-card {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(176, 165, 255, .07), transparent 50%),
    linear-gradient(155deg, rgba(12, 29, 38, .92), rgba(4, 14, 23, .91) 72%) !important;
}
.rules-column > .trainer-card {
  background:
    radial-gradient(ellipse at 100% 0%, rgba(184, 166, 255, .065), transparent 42%),
    linear-gradient(155deg, rgba(13, 26, 38, .91), rgba(4, 13, 23, .93) 72%) !important;
}

/* A local reflection appears only when the person points to or focuses an
   instrument. Avoid a permanent moving sheen over important information. */
@media (hover: hover) and (pointer: fine) {
  .trainer-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(112deg, transparent 12%, rgba(190, 255, 231, .045) 42%, transparent 67%);
    transition: opacity 220ms ease;
  }
  .trainer-card:hover::after { opacity: 1; }
}
.trainer-card:focus-within {
  border-color: rgba(154, 247, 213, .34) !important;
}
.trainer-card:focus-within::before {
  opacity: 1;
  background: linear-gradient(90deg, transparent, rgba(154, 247, 213, .45), transparent);
}
@media (max-width: 900px) {
  .trainer-layout::before { inset-inline: -12px; opacity: .2; }
  .mini-home::before { width: 90vw; }
}
@media (max-width: 560px) {
  .trainer-layout::before { display: none; }
  .mini-home::before { width: 100vw; opacity: .7; }
  .mini-home::after { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .trainer-card::after { transition: none !important; }
}
@media (forced-colors: active) {
  .trainer-top::after, .trainer-layout::before,
  .mini-home::before, .mini-home::after { display: none !important; }
}


/* ==========================================================================
   ABYSSAL ECOSYSTEM / V2.2 — make the water feel inhabited
   Surface light above, deep-water void around the play instrument, and
   organic habitat contours at the far edges. The center stays quiet.
   ========================================================================== */
:root {
  --abyss-light: rgba(155, 242, 226, .22);
  --abyss-living-edge: rgba(101, 231, 202, .28);
  --abyss-ink: #020912;
}
body {
  background:
    radial-gradient(ellipse 74% 30% at 50% -7%, rgba(103, 207, 204, .15), transparent 76%),
    radial-gradient(ellipse 34% 42% at -8% 36%, rgba(22, 117, 133, .11), transparent 74%),
    radial-gradient(ellipse 28% 36% at 108% 64%, rgba(92, 75, 142, .10), transparent 74%),
    linear-gradient(180deg, #081a29 0%, #06121e 28%, #030b15 68%, #020710 100%) !important;
  background-attachment: fixed;
}
.trainer-page::before {
  opacity: .76;
  background:
    linear-gradient(112deg, transparent 0 14%, rgba(102, 213, 203, .025) 18%, transparent 24% 100%),
    linear-gradient(77deg, transparent 0 35%, rgba(125, 225, 211, .04) 40%, transparent 47% 100%),
    linear-gradient(101deg, transparent 0 67%, rgba(130, 157, 224, .035) 73%, transparent 80% 100%),
    radial-gradient(ellipse at 50% 8%, rgba(78, 181, 187, .14), transparent 42%),
    radial-gradient(ellipse at 6% 74%, rgba(21, 97, 112, .13), transparent 38%),
    radial-gradient(ellipse at 96% 60%, rgba(94, 76, 142, .09), transparent 37%);
  mask-image: linear-gradient(180deg, transparent, black 8%, black 70%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, black 8%, black 70%, transparent);
}
.trainer-page::after {
  opacity: .56;
  background:
    radial-gradient(ellipse at 50% 44%, transparent 0 25%, rgba(2, 7, 16, .12) 56%, rgba(2, 7, 16, .72) 100%),
    radial-gradient(ellipse at 3% 96%, rgba(29, 113, 113, .12), transparent 28%),
    radial-gradient(ellipse at 97% 100%, rgba(100, 75, 147, .10), transparent 31%);
}
/* The habitat lives at the margins: asymmetric, soft reef-like silhouettes. */
.trainer-shell::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 18px -28px 0;
  opacity: .72;
  background:
    radial-gradient(ellipse 17% 12% at 0% 18%, rgba(30, 104, 112, .15), transparent 76%),
    radial-gradient(ellipse 13% 19% at 1% 36%, rgba(19, 79, 94, .13), transparent 74%),
    radial-gradient(ellipse 19% 10% at 100% 28%, rgba(63, 90, 127, .12), transparent 78%),
    radial-gradient(ellipse 12% 18% at 100% 48%, rgba(46, 71, 103, .12), transparent 76%),
    linear-gradient(90deg, transparent 0 2%, rgba(92, 205, 185, .08) 2.2%, transparent 2.6% 97.2%, rgba(116, 165, 196, .07) 97.5%, transparent 98%);
  filter: blur(8px);
}
.trainer-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 0 -16px;
  opacity: .32;
  background:
    radial-gradient(ellipse 21% 4% at 0% 0%, rgba(132, 230, 207, .18), transparent 78%),
    radial-gradient(ellipse 16% 5% at 100% 0%, rgba(155, 170, 235, .14), transparent 78%);
}
/* Pressure-rated viewing window; the actual playfield remains untouched. */
.board-wrap {
  border-color: rgba(143, 229, 223, .48) !important;
  background:
    linear-gradient(145deg, rgba(34, 73, 82, .97), rgba(6, 20, 31, .99) 36%, rgba(3, 12, 23, .99) 72%) !important;
  box-shadow:
    0 30px 72px rgba(0, 0, 0, .54),
    0 0 0 1px rgba(120, 236, 219, .09),
    0 0 52px rgba(42, 165, 167, .12),
    inset 0 1px 0 rgba(226, 255, 249, .17),
    inset 0 0 0 3px rgba(2, 10, 17, .55) !important;
}
.board-wrap::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(181, 244, 230, .075);
  border-radius: 6px;
  pointer-events: none;
}
.board {
  background-color: var(--abyss-ink) !important;
  outline-color: rgba(156, 224, 220, .12);
}
/* Related instruments, deliberately not identical cards. */
.trainer-side:first-of-type .trainer-card:nth-child(2) {
  border-radius: 18px 9px 14px 9px !important;
  box-shadow: inset 0 1px 0 rgba(190, 255, 235, .075), 0 14px 34px rgba(0,0,0,.24) !important;
}
.trainer-layout > .trainer-side:nth-of-type(2) > .trainer-card {
  border-radius: 9px 18px 9px 14px !important;
}
.hud-item {
  border-color: rgba(143, 211, 213, .17) !important;
  background: linear-gradient(135deg, rgba(15, 44, 54, .8), rgba(4, 17, 29, .86)) !important;
}
.hud-item strong {
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(110, 231, 215, .09);
}
.hold-preview {
  border-color: rgba(123, 218, 197, .2) !important;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(66, 157, 145, .16), transparent 65%),
    linear-gradient(180deg, rgba(3, 18, 27, .95), rgba(3, 11, 20, .98)) !important;
}
.action-button {
  border-color: rgba(130, 212, 205, .29) !important;
  background: linear-gradient(180deg, rgba(18, 54, 63, .96), rgba(5, 22, 34, .98)) !important;
  box-shadow: inset 0 1px 0 rgba(210, 255, 245, .10), 0 3px 12px rgba(0,0,0,.15) !important;
}
.action-button:hover {
  border-color: rgba(158, 247, 220, .66) !important;
  box-shadow: inset 0 1px 0 rgba(210, 255, 245, .14), 0 0 18px rgba(69, 203, 183, .09) !important;
}
.action-button:active {
  transform: translateY(1px) !important;
  box-shadow: inset 0 2px 7px rgba(0,0,0,.24) !important;
}
.action-button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #b1f7e4 !important;
  outline-offset: 3px !important;
}
.next-preview .mini-piece {
  border-color: rgba(128, 204, 205, .16) !important;
  border-radius: 10px 6px 9px 6px !important;
  background: linear-gradient(145deg, rgba(12, 40, 51, .76), rgba(3, 14, 24, .7)) !important;
  box-shadow: inset 0 1px 0 rgba(218, 255, 245, .045);
}
.next-preview .mini-piece:first-child {
  border-color: rgba(134, 237, 214, .36) !important;
  background: linear-gradient(145deg, rgba(23, 71, 75, .82), rgba(4, 23, 31, .82)) !important;
  box-shadow: inset 0 1px 0 rgba(218, 255, 245, .1), 0 0 18px rgba(80, 213, 187, .045);
}
.rhythm-outlier {
  border-radius: 5px 11px 5px 11px !important;
  border-color: rgba(147, 185, 217, .2) !important;
}
.rules-column > .trainer-card {
  border-color: rgba(135, 197, 209, .17) !important;
}
@media (max-width: 900px) {
  .trainer-shell::before { inset-inline: -8px; opacity: .34; filter: blur(5px); }
  .trainer-shell::after { opacity: .18; }
}
@media (max-width: 560px) {
  body { background-attachment: scroll; }
  .trainer-shell::before, .trainer-shell::after { display: none; }
  .board-wrap { box-shadow: 0 18px 42px rgba(0,0,0,.48), 0 0 28px rgba(42,165,167,.08), inset 0 1px 0 rgba(226,255,249,.12) !important; }
  .trainer-card { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .action-button { transition: none !important; }
}
@media (forced-colors: active) {
  .trainer-shell::before, .trainer-shell::after, .board-wrap::after { display: none !important; }
}


/* V2.3 — shift the metaphor from outer space to actual water.
   Replace the inherited starfield with suspended marine snow and a readable
   surface-to-abyss gradient. Keep the effect static: no gameplay motion. */
body::before {
  opacity: .52;
  background:
    radial-gradient(1px 1px at 7% 18%, rgba(202, 244, 233, .38) 50%, transparent 100%),
    radial-gradient(1px 1px at 13% 61%, rgba(130, 222, 209, .24) 50%, transparent 100%),
    radial-gradient(1px 1px at 24% 34%, rgba(191, 239, 233, .28) 50%, transparent 100%),
    radial-gradient(1px 1px at 32% 79%, rgba(146, 217, 213, .2) 50%, transparent 100%),
    radial-gradient(1px 1px at 47% 22%, rgba(195, 244, 231, .22) 50%, transparent 100%),
    radial-gradient(1px 1px at 59% 66%, rgba(147, 220, 210, .25) 50%, transparent 100%),
    radial-gradient(1px 1px at 68% 42%, rgba(206, 245, 236, .22) 50%, transparent 100%),
    radial-gradient(1px 1px at 78% 83%, rgba(135, 209, 203, .2) 50%, transparent 100%),
    radial-gradient(1px 1px at 91% 27%, rgba(196, 238, 229, .3) 50%, transparent 100%),
    radial-gradient(ellipse 72% 19% at 50% 0%, rgba(157, 235, 217, .09), transparent 74%),
    linear-gradient(180deg, rgba(122, 208, 204, .025), transparent 22% 100%);
}
body::after {
  opacity: .66;
  background:
    radial-gradient(ellipse 82% 22% at 50% -6%, rgba(118, 213, 201, .11), transparent 74%),
    linear-gradient(180deg, transparent 0%, rgba(3, 12, 22, .02) 22%, rgba(2, 8, 17, .18) 58%, rgba(1, 5, 12, .56) 100%),
    radial-gradient(ellipse at 5% 77%, rgba(21, 108, 111, .11), transparent 34%),
    radial-gradient(ellipse at 96% 66%, rgba(57, 90, 122, .10), transparent 35%);
}
/* A subtle surface line gives the page a vertical world, not a starry void. */
.trainer-top { position: relative; }
.trainer-top::before {
  content: "";
  position: absolute;
  left: max(18px, 5vw);
  right: max(18px, 5vw);
  top: 8px;
  height: 1px;
  pointer-events: none;
  opacity: .5;
  background: linear-gradient(90deg, transparent, rgba(153, 235, 218, .22) 16%, rgba(153, 235, 218, .12) 50%, rgba(153, 235, 218, .2) 84%, transparent);
}
.trainer-top::after {
  content: "";
  position: absolute;
  pointer-events: none;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: min(620px, 80vw);
  height: 100%;
  opacity: .58;
  background: radial-gradient(ellipse at 50% 0%, rgba(116, 221, 205, .10), transparent 72%);
}
.trainer-brand, .trainer-description { position: relative; z-index: 1; }
/* Recessed content rather than uniform glass: a dark quiet pocket behind play. */
.trainer-main { position: relative; }
.trainer-main::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  top: 22px;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, 100%);
  border-radius: 46% 46% 18px 18px / 4% 4% 18px 18px;
  background:
    radial-gradient(ellipse at 50% 4%, rgba(19, 67, 78, .16), transparent 62%),
    linear-gradient(180deg, rgba(1, 8, 16, .06), rgba(1, 6, 13, .18) 64%, transparent);
}
@media (max-width: 560px) {
  .trainer-top::before { left: 14px; right: 14px; opacity: .35; }
  .trainer-top::after { opacity: .32; }
  .trainer-main::before { width: 100%; border-radius: 20px; }
}
@media (prefers-reduced-transparency: reduce) {
  .trainer-card { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .trainer-shell::before, .trainer-shell::after { opacity: .12; }
}


/* ==========================================================================
   AQUA SPACE / V2.4 — the hybrid is the point
   Not "underwater instead of space": a liquid cosmic abyss. Distinguish
   distant pinprick stars from nearer suspended particles by scale, density,
   hue and motion. Preserve the playfield as the stable visual anchor.
   ========================================================================== */
:root {
  --aqua-space-void: #01050d;
  --aqua-space-midnight: #061522;
  --aqua-space-current: rgba(86, 205, 199, .075);
  --aqua-space-starlight: rgba(205, 237, 255, .48);
}
body {
  background:
    radial-gradient(ellipse 70% 34% at 50% -9%, rgba(100, 202, 206, .16), transparent 72%),
    radial-gradient(ellipse 38% 40% at 2% 26%, rgba(19, 111, 139, .12), transparent 75%),
    radial-gradient(ellipse 32% 44% at 99% 45%, rgba(91, 66, 151, .12), transparent 76%),
    radial-gradient(ellipse 50% 55% at 50% 54%, rgba(8, 44, 60, .16), transparent 78%),
    linear-gradient(180deg, #081a2a 0%, #061321 31%, #030b16 70%, #01050d 100%) !important;
}
/* Far-field stars are tiny and sharp; near-field marine snow is softer,
   slightly larger and concentrated in the lower water column. */
body::before {
  opacity: .62;
  background:
    radial-gradient(1px 1px at 5% 14%, rgba(218, 244, 255, .58) 50%, transparent 100%),
    radial-gradient(1px 1px at 18% 43%, rgba(184, 231, 244, .34) 50%, transparent 100%),
    radial-gradient(1px 1px at 29% 9%, rgba(226, 245, 255, .5) 50%, transparent 100%),
    radial-gradient(1px 1px at 41% 31%, rgba(195, 230, 247, .32) 50%, transparent 100%),
    radial-gradient(1px 1px at 56% 13%, rgba(220, 241, 255, .48) 50%, transparent 100%),
    radial-gradient(1px 1px at 73% 24%, rgba(209, 238, 251, .36) 50%, transparent 100%),
    radial-gradient(1px 1px at 88% 11%, rgba(227, 245, 255, .54) 50%, transparent 100%),
    radial-gradient(1px 1px at 95% 49%, rgba(187, 227, 241, .32) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 12% 76%, rgba(148, 224, 219, .22) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 35% 88%, rgba(151, 219, 219, .18) 50%, transparent 100%),
    radial-gradient(2px 2px at 67% 73%, rgba(156, 230, 220, .23) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 84% 91%, rgba(167, 224, 230, .18) 50%, transparent 100%),
    radial-gradient(ellipse 70% 20% at 50% 0%, rgba(159, 238, 222, .09), transparent 75%),
    linear-gradient(180deg, rgba(113, 204, 209, .018), transparent 34% 100%);
}
/* The current is a broad, almost imperceptible curved lens—not a grid,
   wireframe, or decorative sci-fi HUD. Drift only this ambient layer. */
body::after {
  opacity: .48;
  background:
    radial-gradient(ellipse 68% 42% at 50% 48%, transparent 55%, rgba(75, 181, 190, .045) 57%, transparent 60%),
    radial-gradient(ellipse 88% 57% at 50% 50%, transparent 66%, rgba(126, 146, 215, .035) 67%, transparent 69%),
    linear-gradient(108deg, transparent 0 19%, rgba(112, 227, 212, .025) 25%, transparent 32% 100%),
    linear-gradient(76deg, transparent 0 64%, rgba(157, 143, 239, .028) 70%, transparent 76% 100%),
    linear-gradient(180deg, transparent 0%, rgba(2, 8, 17, .06) 44%, rgba(1, 5, 12, .52) 100%);
  animation: aqua-space-current-drift 58s ease-in-out infinite alternate;
}
@keyframes aqua-space-current-drift {
  from { transform: translate3d(-.8%, -.4%, 0) scale(1); }
  to { transform: translate3d(.8%, .6%, 0) scale(1.025); }
}
/* Float is communicated by optical separation and slight ambient parallax;
   controls and gameplay pieces remain stationary and exact. */
.trainer-card {
  background:
    radial-gradient(ellipse at 12% 0%, rgba(116, 229, 210, .075), transparent 46%),
    linear-gradient(150deg, rgba(10, 31, 43, .78), rgba(3, 12, 23, .91) 76%) !important;
  box-shadow:
    0 16px 44px rgba(0, 0, 0, .28),
    0 1px 0 rgba(205, 250, 240, .035),
    inset 0 1px 0 rgba(218, 255, 246, .07),
    inset 0 0 0 1px rgba(117, 209, 214, .025) !important;
}
.board-wrap {
  border-color: rgba(145, 231, 226, .5) !important;
  box-shadow:
    0 28px 76px rgba(0, 0, 0, .58),
    0 0 0 1px rgba(131, 225, 223, .085),
    0 0 38px rgba(48, 180, 177, .09),
    0 0 92px rgba(98, 89, 170, .045),
    inset 0 1px 0 rgba(228, 255, 251, .17),
    inset 0 0 0 3px rgba(1, 9, 17, .56) !important;
}
@media (max-width: 720px) {
  body::before { opacity: .4; }
}
@media (forced-colors: active) {
  body::before, body::after { display: none !important; }
}


/* Canonical ambient motion: one lightweight CSS layer, no canvas loop.
   Keep it visible on touch screens; reduced-motion preferences still win. */
.trainer-page::before,
.trainer-page::after {
  animation: none !important;
  transform: none;
}

body::after {
  inset: -3vh -3vw;
  animation: aqua-space-current-drift 34s ease-in-out infinite alternate;
}

@media (max-width: 720px) {
  body::after {
    animation-duration: 42s;
    opacity: .38;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after,
  .trainer-page::before,
  .trainer-page::after {
    animation: none !important;
    transform: none !important;
  }
}
