/* graphers.dev — frutiger-aero observatory for living data
   Palette: "Tropical Server Room"
   ------------------------------------------------------- */

:root {
    --water:        #A6E3F4;
    --deep:         #0B3A52;
    --bubble:       #F4FBFF;
    --plankton:     #7FE3C4;
    --coral:        #FFB36B;
    --anomaly:      #B388FF;
    --sediment:     #C9A66B;
    --chrome-rim:   #9DD9F1;
    --aqua-glow:    #5BC0EB;

    --tank-w:       min(1180px, 92vw);
    --tank-h:       calc(100vh - 64px);

    --ease-quart:   cubic-bezier(0.22, 1, 0.36, 1);
    --ease-circ:    cubic-bezier(0.85, 0, 0.15, 1);
    --t-default:    600ms;

    --font-display: "Krona One", "Inter", sans-serif;
    --font-body:    "Inter", "Helvetica Neue", sans-serif;
    --font-mono:    "JetBrains Mono", ui-monospace, monospace;
    --font-hand:    "Caveat", "Inter", cursive;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bubble);
    color: var(--deep);
    font-family: var(--font-body);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    cursor: default;
}

body {
    position: relative;
    background:
        radial-gradient(ellipse at 18% 12%, rgba(166,227,244,0.55) 0%, transparent 55%),
        radial-gradient(ellipse at 82% 88%, rgba(127,227,196,0.4) 0%, transparent 60%),
        linear-gradient(180deg, #F4FBFF 0%, #E8F7FF 70%, #DDF1FB 100%);
}

/* Plankton field canvas */
#plankton-field {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Bubble layer (cursor-follow rising bubbles) */
#bubble-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
    overflow: hidden;
}
#bubble-layer .bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(244,251,255,0.95), rgba(166,227,244,0.4) 60%, rgba(157,217,241,0.1));
    box-shadow:
        inset 0 0 4px rgba(244,251,255,0.9),
        0 0 4px rgba(166,227,244,0.8);
    will-change: transform, opacity;
}

/* ---------- HUD ---------- */
.hud {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    z-index: 80;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 22px;
    background:
        linear-gradient(180deg, rgba(244,251,255,0.65) 0%, rgba(232,247,255,0.85) 100%);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-top: 1px solid rgba(157,217,241,0.7);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        0 -8px 24px -10px rgba(11,58,82,0.18);
}
.hud-left, .hud-right {
    display: flex;
    align-items: center;
}
.hud-right {
    justify-content: flex-end;
}
.station-id {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--deep);
    padding: 6px 12px;
    border: 1px solid rgba(11,58,82,0.18);
    border-radius: 999px;
    background: rgba(255,255,255,0.55);
}
.hud-center {
    display: flex;
    gap: 22px;
    align-items: center;
}
.hud-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    min-width: 96px;
}
.metric-label {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 0.22em;
    color: rgba(11,58,82,0.65);
}
.metric-value {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    color: var(--deep);
    font-variant-numeric: tabular-nums;
}
.hud-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid rgba(11,58,82,0.22);
    border-radius: 999px;
    background: linear-gradient(180deg, #F4FBFF 0%, #DDF1FB 100%);
    color: var(--deep);
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: transform 220ms var(--ease-quart), box-shadow 220ms var(--ease-quart);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.85),
        0 6px 14px -6px rgba(11,58,82,0.25);
}
.hud-toggle:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.95), 0 10px 18px -6px rgba(11,58,82,0.3); }
.hud-toggle.is-on { background: linear-gradient(180deg, #7FE3C4 0%, #A6E3F4 100%); color: var(--deep); }
.toggle-led {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--coral);
    box-shadow: 0 0 6px var(--coral), inset 0 0 2px rgba(255,255,255,0.7);
    animation: led-pulse 2.4s ease-in-out infinite;
}
.hud-toggle.is-on .toggle-led { background: var(--plankton); box-shadow: 0 0 8px var(--plankton); }
@keyframes led-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

/* ---------- HALL & TANK TRACK ---------- */
.hall {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 64px;
    overflow: hidden;
    z-index: 5;
}
.hall-track {
    display: flex;
    height: 100%;
    align-items: stretch;
    gap: 0;
    will-change: transform;
    transform: translate3d(0,0,0);
}

/* ---------- A SINGLE TANK ---------- */
.tank {
    position: relative;
    flex: 0 0 auto;
    width: var(--tank-w);
    height: 100%;
    margin: 0 22px;
    overflow: hidden;
    border-radius: 22px;
    isolation: isolate;
    transition: filter 600ms var(--ease-quart);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.6),
        0 30px 56px -22px rgba(11,58,82,0.35),
        0 12px 22px -10px rgba(11,58,82,0.18);
}

/* thermocline rule between tanks */
.tank::after {
    content: "";
    position: absolute;
    top: 6%;
    bottom: 6%;
    right: -23px;
    width: 1px;
    background: linear-gradient(180deg,
        rgba(157,217,241,0) 0%,
        rgba(157,217,241,0.6) 30%,
        rgba(157,217,241,0.6) 70%,
        rgba(157,217,241,0) 100%);
}

/* altitude offset */
.tank[data-altitude="surface"]    { transform: translateY(-2.4vh); }
.tank[data-altitude="midwater"]   { transform: translateY(0); }
.tank[data-altitude="abyss"]      { transform: translateY(2.4vh); }

/* the three glass panes */
.tank-pane {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    transition: transform 600ms var(--ease-quart);
}
.tank-pane.back {
    background:
        linear-gradient(165deg, var(--water) 0%, var(--plankton) 100%);
    opacity: 0.72;
    z-index: 0;
}
.tank-pane.mid {
    background:
        radial-gradient(ellipse at 20% 14%, rgba(244,251,255,0.55) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 80%, rgba(127,227,196,0.35) 0%, transparent 55%);
    z-index: 1;
}
.tank-pane.front {
    background:
        linear-gradient(180deg, rgba(244,251,255,0.18) 0%, rgba(244,251,255,0) 18%, rgba(11,58,82,0.04) 100%);
    border: 1px solid var(--chrome-rim);
    border-radius: inherit;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        inset 0 -2px 0 rgba(157,217,241,0.4),
        inset 12px 0 24px -12px rgba(244,251,255,0.6),
        inset -12px 0 24px -12px rgba(11,58,82,0.18);
    z-index: 5;
}

/* meniscus */
.tank-meniscus {
    position: absolute;
    top: -6px;
    left: 6%;
    right: 6%;
    height: 18px;
    background: radial-gradient(ellipse at 50% 100%, rgba(157,217,241,0.85) 0%, rgba(157,217,241,0.35) 50%, transparent 80%);
    border-radius: 50%;
    z-index: 6;
    filter: blur(0.6px);
    pointer-events: none;
}
.tank-meniscus::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 12%;
    right: 12%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(244,251,255,0.95), transparent);
    border-radius: 50%;
    filter: blur(0.5px);
}

/* lens flare */
.tank-flare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background:
        linear-gradient(135deg, transparent 0%, transparent 30%, rgba(244,251,255,0.18) 45%, transparent 60%, transparent 70%, rgba(244,251,255,0.08) 80%, transparent 90%);
    mix-blend-mode: screen;
    opacity: 0.85;
}

/* noise overlay (svg filter via data uri stand-in: subtle css noise) */
.tank-noise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 0.04;
    background-image:
        repeating-radial-gradient(circle at 13% 21%, rgba(11,58,82,0.4) 0 0.5px, transparent 0.5px 3px),
        repeating-radial-gradient(circle at 73% 67%, rgba(11,58,82,0.4) 0 0.5px, transparent 0.5px 3px),
        repeating-radial-gradient(circle at 41% 84%, rgba(11,58,82,0.4) 0 0.5px, transparent 0.5px 3px);
    mix-blend-mode: multiply;
}

/* tank content layer */
.tank-content {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    padding: clamp(48px, 6vh, 80px) clamp(40px, 5vw, 72px) clamp(40px, 5vh, 64px);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: clamp(20px, 3vh, 36px);
}

/* ---------- TANK TITLE BLOCK ---------- */
.tank-title-block {
    max-width: 720px;
}
.tank-eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.32em;
    color: rgba(11,58,82,0.65);
    padding: 4px 10px;
    border: 1px solid rgba(11,58,82,0.2);
    border-radius: 4px;
    background: rgba(244,251,255,0.55);
    margin-bottom: 14px;
}
.tank-title {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    line-height: 0.95;
    letter-spacing: 0.12em;
    color: var(--bubble);
    -webkit-text-stroke: 1px var(--chrome-rim);
    text-shadow:
        0 0 14px rgba(91,192,235,0.35),
        0 2px 0 rgba(11,58,82,0.18);
}
.tank-title-block.dark .tank-title {
    color: #DDF1FB;
    -webkit-text-stroke: 1px #5BC0EB;
    text-shadow:
        0 0 18px rgba(179,136,255,0.4),
        0 2px 0 rgba(0,0,0,0.55);
}
.tank-title-block.dark .tank-eyebrow {
    color: rgba(244,251,255,0.85);
    border-color: rgba(244,251,255,0.45);
    background: rgba(11,58,82,0.55);
}
.tank-title-block.dark .tank-caption {
    color: rgba(232,247,255,0.85);
}
.tank-caption {
    margin: 0;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(11,58,82,0.85);
    max-width: 56ch;
}

/* caveat marginalia note */
.caveat-note {
    position: absolute;
    top: 110px;
    right: 5%;
    font-family: var(--font-hand);
    font-size: 1.25rem;
    color: rgba(11,58,82,0.78);
    transform: rotate(var(--rot, -1.5deg));
    max-width: 280px;
    line-height: 1.35;
    z-index: 14;
    pointer-events: none;
    text-shadow: 0 1px 0 rgba(244,251,255,0.55);
}
.caveat-note.dark { color: rgba(244,251,255,0.85); text-shadow: 0 0 6px rgba(179,136,255,0.35); }
.caveat-note em { font-family: var(--font-mono); font-style: normal; font-size: 0.9em; padding: 0 4px; background: rgba(244,251,255,0.7); border-radius: 3px; }

/* ---------- TANK 1 — INFLOW ---------- */
.tank-inflow .tank-pane.back {
    background: linear-gradient(165deg, #B7E9F7 0%, #A6E3F4 60%, #7FE3C4 100%);
}
.inflow-chamber {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}
.inflow-stage {
    width: min(540px, 80%);
    height: 100%;
    max-height: 56vh;
}
.inflow-floor {
    position: absolute;
    left: 5%;
    right: 5%;
    bottom: 4%;
    height: 5px;
    background: linear-gradient(90deg, transparent, rgba(11,58,82,0.5), transparent);
    border-radius: 4px;
}
.json-snippet {
    position: absolute;
    left: 5%;
    bottom: 92px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--deep);
    background: rgba(244,251,255,0.7);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(11,58,82,0.12);
    z-index: 12;
}
.json-snippet .key  { color: var(--coral); }
.json-snippet .num  { color: var(--plankton); }
.json-snippet .k    { color: rgba(11,58,82,0.55); }

/* ---------- TANK 2 — SCHEMA REEF ---------- */
.tank-reef .tank-pane.back {
    background: linear-gradient(165deg, #BCEAF7 0%, #A6E3F4 50%, #84DECC 100%);
}
.reef-chamber {
    position: relative;
    width: 100%;
    height: 100%;
}
.reef-substrate {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 60px;
    pointer-events: none;
}
.polyp-field {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.polyp {
    position: absolute;
    transform-origin: 50% 100%;
    cursor: pointer;
    z-index: 4;
}
.polyp .polyp-tether {
    width: 1.5px;
    background: rgba(11,58,82,0.45);
    margin: 0 auto;
    transform-origin: top center;
}
.polyp .polyp-head {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(244,251,255,0.95) 0%, rgba(166,227,244,0.85) 100%);
    border: 1px solid rgba(157,217,241,0.85);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        0 6px 14px -6px rgba(11,58,82,0.3);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--deep);
    white-space: nowrap;
    transition: transform 320ms var(--ease-quart), box-shadow 320ms var(--ease-quart);
}
.polyp.is-warn .polyp-head { background: linear-gradient(180deg, #FFE0BE 0%, #FFB36B 100%); border-color: var(--coral); }
.polyp.is-grow .polyp-head { background: linear-gradient(180deg, #DEFAEC 0%, #7FE3C4 100%); border-color: var(--plankton); }
.polyp:hover .polyp-head {
    transform: translateX(-50%) translateY(-3px) scale(1.04);
    box-shadow: 0 12px 22px -8px rgba(11,58,82,0.45), inset 0 1px 0 rgba(255,255,255,0.85);
}
.polyp .polyp-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) rotate(-1.5deg);
    font-family: var(--font-hand);
    font-size: 1rem;
    color: var(--deep);
    background: rgba(244,251,255,0.92);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px dashed rgba(11,58,82,0.25);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms var(--ease-quart);
    z-index: 20;
}
.polyp:hover .polyp-tooltip { opacity: 1; }

/* ---------- TANK 3 — PLOT POOL ---------- */
.tank-plot .tank-pane.back {
    background: linear-gradient(165deg, #C0EBF8 0%, #9ED9F1 50%, #7FE3C4 100%);
}
.plot-chamber {
    position: relative;
    width: 100%;
    height: 100%;
}
.plot-pool {
    width: 100%;
    height: 100%;
}
.plot-pool .axis-grid {
    stroke: rgba(11,58,82,0.18);
    stroke-width: 0.6;
    stroke-dasharray: 2 4;
}
.plot-pool .axis-label {
    font-family: var(--font-mono);
    font-size: 9px;
    fill: rgba(11,58,82,0.7);
    letter-spacing: 0.12em;
}
.plot-pool .fish {
    cursor: pointer;
    transition: filter 240ms var(--ease-quart);
}
.plot-pool .fish:hover { filter: drop-shadow(0 0 6px rgba(91,192,235,0.85)); }
.plot-pool .fish.is-pinned { filter: drop-shadow(0 0 8px var(--coral)); }
.plot-pool .ripple-ring {
    fill: none;
    stroke: rgba(91,192,235,0.65);
    stroke-width: 1;
    pointer-events: none;
}
.row-inspector {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%) translateY(20px);
    width: min(420px, 70%);
    background: linear-gradient(180deg, rgba(244,251,255,0.95) 0%, rgba(232,247,255,0.92) 100%);
    border: 1px solid var(--chrome-rim);
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.85),
        0 22px 42px -16px rgba(11,58,82,0.45);
    opacity: 0;
    transition: transform 480ms var(--ease-quart), opacity 320ms var(--ease-quart);
    z-index: 20;
}
.row-inspector.is-open {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.inspector-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.inspector-label {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.24em;
    color: rgba(11,58,82,0.7);
}
.inspector-close {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--deep);
    background: transparent;
    border: 1px solid rgba(11,58,82,0.25);
    border-radius: 999px;
    padding: 3px 10px;
    cursor: pointer;
    transition: background 200ms var(--ease-quart);
}
.inspector-close:hover { background: rgba(11,58,82,0.08); }
.inspector-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 14px;
    row-gap: 6px;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
}
.inspector-grid dt { color: rgba(11,58,82,0.6); }
.inspector-grid dd { margin: 0; color: var(--deep); font-weight: 500; }

/* ---------- TANK 4 — JOIN CHANNEL ---------- */
.tank-join .tank-pane.back {
    background: linear-gradient(165deg, #B5E6F4 0%, #8FD3EE 50%, #7FE3C4 100%);
}
.join-chamber {
    position: relative;
    width: 100%;
    height: 100%;
}
.join-aqueduct {
    width: 100%;
    height: 100%;
}
.join-aqueduct .aqueduct-glass {
    fill: rgba(244,251,255,0.18);
    stroke: rgba(157,217,241,0.7);
    stroke-width: 1.4;
}
.join-aqueduct .stream {
    fill: none;
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 28 8;
    animation: flow 4.2s linear infinite;
}
.join-aqueduct .stream.left  { stroke: rgba(127,227,196,0.85); }
.join-aqueduct .stream.right { stroke: rgba(166,227,244,0.85); }
.join-aqueduct .stream.merge { stroke: url(#grad-water); stroke-width: 22; }
.join-aqueduct .node-label {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.18em;
    fill: rgba(11,58,82,0.85);
}
.join-aqueduct .node-circle {
    fill: rgba(244,251,255,0.85);
    stroke: var(--chrome-rim);
    stroke-width: 1.4;
}
@keyframes flow {
    to { stroke-dashoffset: -240; }
}
.join-controls {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(244,251,255,0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--chrome-rim);
    border-radius: 999px;
    padding: 6px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.7),
        0 12px 22px -10px rgba(11,58,82,0.35);
    z-index: 20;
}
.join-btn {
    padding: 8px 16px;
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: rgba(11,58,82,0.7);
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: all 240ms var(--ease-quart);
}
.join-btn:hover { color: var(--deep); background: rgba(166,227,244,0.4); }
.join-btn.is-active {
    background: linear-gradient(180deg, #FFE0BE 0%, #FFB36B 100%);
    color: var(--deep);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 10px -4px rgba(255,179,107,0.6);
}

/* ---------- TANK 5 — AGGREGATION TRENCH ---------- */
.tank-trench .tank-pane.back {
    background: linear-gradient(180deg, #5FA9C9 0%, #2C6A8A 70%, #0B3A52 100%);
}
.tank-trench .tank-title { color: #DDF1FB; -webkit-text-stroke: 1px #9DD9F1; }
.tank-trench .tank-caption { color: rgba(232,247,255,0.85); }
.tank-trench .tank-eyebrow {
    color: rgba(232,247,255,0.85);
    background: rgba(11,58,82,0.55);
    border-color: rgba(157,217,241,0.45);
}
.trench-chamber {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 28px;
    align-items: stretch;
}
.trench-stage {
    width: 100%;
    height: 100%;
    max-height: 60vh;
    justify-self: center;
}
.trench-stage .trench-glass {
    fill: rgba(244,251,255,0.05);
    stroke: rgba(157,217,241,0.5);
    stroke-width: 1;
}
.trench-stage .stratum-band {
    transition: opacity 600ms var(--ease-quart), filter 600ms var(--ease-quart);
}
.trench-stage .stratum-label {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.22em;
    fill: #DDF1FB;
    text-shadow: 0 0 12px var(--plankton);
}
.trench-stage .mote {
    fill: rgba(244,251,255,0.85);
}
.trench-strata-legend {
    list-style: none;
    margin: 0;
    padding: 16px 18px;
    align-self: end;
    background: rgba(11,58,82,0.55);
    border: 1px solid rgba(157,217,241,0.45);
    border-radius: 14px;
    color: #DDF1FB;
    box-shadow: inset 0 1px 0 rgba(244,251,255,0.18);
    backdrop-filter: blur(8px);
    margin-bottom: 24px;
    min-width: 180px;
}
.trench-strata-legend li {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(157,217,241,0.25);
    font-family: var(--font-mono);
    font-size: 12px;
}
.trench-strata-legend li:last-child { border-bottom: none; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.legend-text { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.22em; }
.legend-val  { font-variant-numeric: tabular-nums; color: #A6E3F4; }

/* ---------- TANK 6 — ANOMALY ---------- */
.tank-anomaly .tank-pane.back {
    background: linear-gradient(180deg, #08263A 0%, #04101C 70%, #000509 100%);
}
.tank-anomaly .tank-pane.mid {
    background:
        radial-gradient(ellipse at 50% 65%, rgba(179,136,255,0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 18% 22%, rgba(91,192,235,0.18) 0%, transparent 50%);
}
.anomaly-chamber {
    position: relative;
    width: 100%;
    height: 100%;
}
.anomaly-stage {
    width: 100%;
    height: 100%;
}
.anomaly-stage .normal-dot { fill: rgba(244,251,255,0.55); }
.anomaly-stage .outlier-dot {
    fill: var(--anomaly);
    filter: drop-shadow(0 0 4px var(--anomaly));
    animation: anomaly-pulse 3.6s ease-in-out infinite;
}
.anomaly-stage .sigma-line {
    stroke: rgba(157,217,241,0.5);
    stroke-width: 0.75;
    stroke-dasharray: 4 6;
}
.anomaly-stage .sigma-label {
    font-family: var(--font-mono);
    font-size: 10px;
    fill: rgba(157,217,241,0.7);
}
@keyframes anomaly-pulse {
    0%,100% { opacity: 0.45; transform: scale(1); }
    50%     { opacity: 1;    transform: scale(1.7); }
}
.outlier-tooltip {
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -110%);
    font-family: var(--font-hand);
    font-size: 1rem;
    color: #E8F7FF;
    background: rgba(11,58,82,0.85);
    border: 1px solid rgba(179,136,255,0.4);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 30;
    opacity: 0;
    transition: opacity 200ms var(--ease-quart);
}
.outlier-tooltip.is-shown { opacity: 1; }

/* ---------- TANK 7 — SEDIMENT ---------- */
.tank-sediment .tank-pane.back {
    background: linear-gradient(180deg, #B6DDC8 0%, #97BEA5 35%, #6E9483 70%, #4B6F5C 100%);
}
.sediment-chamber {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(11,58,82,0.18);
}
.sediment-band {
    position: relative;
    flex: 1 1 auto;
    cursor: pointer;
    border-bottom: 1px solid rgba(11,58,82,0.18);
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 22px;
    transition: flex-grow 600ms var(--ease-quart);
}
.sediment-band:last-child { border-bottom: none; }
.sediment-band.is-expanded { flex: 6 1 auto; }
.sediment-band-bg {
    position: absolute; inset: 0; pointer-events: none;
}
.sediment-band-label {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.2em;
    color: rgba(11,58,82,0.85);
    text-shadow: 0 1px 0 rgba(244,251,255,0.65);
    z-index: 2;
}
.sediment-thumb {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%) scale(0.92);
    opacity: 0;
    transition: opacity 600ms var(--ease-quart), transform 600ms var(--ease-quart);
    width: clamp(220px, 28vw, 360px);
    height: 60%;
    background: linear-gradient(180deg, rgba(244,251,255,0.92) 0%, rgba(232,247,255,0.88) 100%);
    border: 1px solid var(--chrome-rim);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 18px 32px -14px rgba(11,58,82,0.45);
    pointer-events: none;
    z-index: 3;
    overflow: hidden;
}
.sediment-band.is-expanded .sediment-thumb {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}
.sediment-thumb svg {
    width: 100%;
    height: 100%;
    display: block;
}
.domain-fossil {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) rotate(-1deg);
    font-family: var(--font-hand);
    color: rgba(11,58,82,0.45);
    font-size: 1.4rem;
    z-index: 4;
    pointer-events: none;
    text-shadow: 0 1px 0 rgba(244,251,255,0.7);
}
.fossil-mark {
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.25em;
    color: rgba(201,166,107,0.75);
    margin-right: 10px;
    text-transform: lowercase;
}
.fossil-sub { font-size: 0.95rem; }

/* ---------- BESTIARY ---------- */
.tank-bestiary .tank-pane.back {
    background: linear-gradient(165deg, #C8EEFA 0%, #A6E3F4 50%, #7FE3C4 100%);
}
.bestiary-grid {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    padding-right: 8px;
}
.bestiary-card {
    background: linear-gradient(180deg, rgba(244,251,255,0.92) 0%, rgba(232,247,255,0.85) 100%);
    border: 1px solid var(--chrome-rim);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 14px 24px -12px rgba(11,58,82,0.3);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 260ms var(--ease-quart), box-shadow 260ms var(--ease-quart);
}
.bestiary-card:hover {
    transform: translateY(-3px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 22px 36px -16px rgba(11,58,82,0.4);
}
.bestiary-card svg {
    width: 100%;
    height: 90px;
}
.bestiary-name {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--deep);
}
.bestiary-latin {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 12px;
    color: rgba(11,58,82,0.7);
}
.bestiary-habitat {
    font-family: var(--font-hand);
    font-size: 1.05rem;
    color: rgba(11,58,82,0.8);
    transform: rotate(-0.6deg);
}

/* ---------- TANK LIST DROPDOWN (still water mode) ---------- */
.tank-list {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 90;
    background: linear-gradient(180deg, rgba(244,251,255,0.96) 0%, rgba(232,247,255,0.96) 100%);
    border: 1px solid var(--chrome-rim);
    border-radius: 18px;
    padding: 22px 26px;
    box-shadow: 0 32px 64px -24px rgba(11,58,82,0.4), inset 0 1px 0 rgba(255,255,255,0.85);
    min-width: 280px;
}
.tank-list h3 {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.22em;
    margin: 0 0 14px;
    color: var(--deep);
}
.tank-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}
.tank-list button {
    width: 100%;
    text-align: left;
    background: rgba(166,227,244,0.18);
    border: 1px solid rgba(157,217,241,0.45);
    color: var(--deep);
    padding: 10px 14px;
    border-radius: 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: background 220ms var(--ease-quart);
}
.tank-list button:hover { background: rgba(166,227,244,0.45); }

/* still water mode — freeze */
body.still-water .tank-flare,
body.still-water .anomaly-stage .outlier-dot,
body.still-water .toggle-led {
    animation-play-state: paused;
}
body.still-water .join-aqueduct .stream {
    animation-play-state: paused;
}

/* ---------- responsive niceties ---------- */
@media (max-width: 720px) {
    .hud-center { gap: 12px; }
    .hud-metric { min-width: 72px; }
    .metric-label { font-size: 8px; }
    .metric-value { font-size: 11px; }
    .station-id { font-size: 10px; padding: 4px 9px; }
    .tank { margin: 0 12px; border-radius: 16px; }
    .caveat-note { display: none; }
}
