/* Design tokens — the ocean palette used across all views.
   Dark-only by design; theme-battle/theme-sky override body colors directly. */
:root {
    --surface: rgba(100, 160, 220, 0.08);
    --surface-mid: rgba(100, 160, 220, 0.1);
    --line: rgba(100, 160, 220, 0.15);
    --line-mid: rgba(100, 160, 220, 0.2);
    --accent: #4fc3f7;
    --accent-soft: #7fdbff;
    --ink-dim: rgba(192, 216, 240, 0.55);
    --ink-faint: rgba(192, 216, 240, 0.35);
    --good: #50c878;
    --warn: #f0c040;
    --bad: #e05080;
    --market: #3ddc97;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    font-family: system-ui, -apple-system, sans-serif;
    overflow: hidden;
    transition: background 0.4s, color 0.4s;
}

body.theme-ocean {
    background: #060e1a;
    color: #c0d8f0;
}

body.theme-battle {
    background: #0a0e06;
    color: #b8c8a0;
}

body.theme-sky {
    background: #0a1628;
    color: #a0c8e8;
}

header {
    padding: 1rem;
    text-align: center;
    width: 100%;
    position: relative;
}

h1 {
    font-size: 1.4rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.6;
}

/* Site title: emblem + wordmark logo lockup (clicks home), Sora with a
   light-sweep shimmer. Overrides the plain-h1 defaults above. */
@font-face {
    font-family: "Sora";
    src: url("../assets/fonts/sora.woff2") format("woff2");
    font-weight: 300;
    font-display: swap;
}
.site-title {
    margin: 0;
    opacity: 1;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1;
}
.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    cursor: pointer;
}
.site-logo img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line-mid);
    transition: transform 0.18s ease;
}
.site-logo:hover img { transform: translateY(-2px) scale(1.03); }
.site-logo:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.site-wordmark {
    font-family: "Sora", system-ui, sans-serif;
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: none;
    background: linear-gradient(100deg, #bcdcff 0%, #bcdcff 42%, #ffffff 50%, #bcdcff 58%, #bcdcff 100%);
    background-size: 250% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: site-shine 4.5s linear infinite;
}
@keyframes site-shine { to { background-position: -250% center; } }
@media (prefers-reduced-motion: reduce) { .site-wordmark { animation: none; } }

nav {
    margin-top: 0.3rem;
}

nav a {
    color: inherit;
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.3;
    transition: opacity 0.3s;
    margin: 0 0.4rem;
    cursor: pointer;
}

nav a:hover {
    opacity: 0.6;
}

nav a.active {
    opacity: 0.7;
}

/* Nav dropdown */
.nav-dropdown {
    display: inline-block;
    position: relative;
    margin: 0 0.4rem;
}

.nav-dropdown-toggle {
    color: inherit;
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.3;
    transition: opacity 0.3s;
    cursor: pointer;
}

.nav-dropdown-toggle:hover {
    opacity: 0.6;
}

.nav-dropdown-toggle.active {
    opacity: 0.7;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.4rem;
    padding: 0.4rem 0;
    background: rgba(10, 20, 35, 0.95);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 140px;
    z-index: 100;
}

.nav-dropdown-menu.open {
    display: flex;
    flex-direction: column;
}

.nav-dropdown-menu a {
    display: block;
    margin: 0;
    padding: 0.4rem 0.8rem;
    font-size: 0.65rem;
    white-space: nowrap;
}

.nav-dropdown-menu a:hover {
    background: var(--surface-mid);
}

/* ========== Views ========== */
#home, #weather, #tank, #arena, #sky, #dungeon, #fathomfall {
    display: none;
}

#home.active, #weather.active, #tank.active, #arena.active, #sky.active, #dungeon.active, #fathomfall.active {
    display: flex;
}

#weather.active {
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
    -webkit-overflow-scrolling: touch;
}

#tank, #arena, #sky {
    position: relative;
    width: 94vw;
    max-width: 1200px;
    height: calc(100vh - 6rem);
    border-radius: 12px;
    overflow: hidden;
    cursor: crosshair;
}

#dungeon {
    position: relative;
    width: 94vw;
    max-width: 1200px;
    height: 100vh;
    border-radius: 12px;
}

#tank.active, #arena.active, #sky.active, #dungeon.active {
    display: block;
}

/* ========== Fish Tank ========== */
#tank {
    background: linear-gradient(180deg, #0b1a30 0%, #0d2240 40%, #0f2a50 100%);
    border: 1px solid var(--line);
}

.sandy-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, #2a1f0e 0%, #3d2e16 40%, #4a3820 100%);
    border-radius: 0 0 11px 11px;
}

/* Seaweed plants */
.plant {
    position: absolute;
    bottom: 30px;
    width: 8px;
    border-radius: 4px;
    animation: sway 3s ease-in-out infinite;
    transform-origin: bottom center;
}

.plant::before,
.plant::after {
    content: '';
    position: absolute;
    width: 8px;
    border-radius: 4px;
    background: inherit;
}

.plant-1 {
    left: 12%;
    height: 80px;
    background: #1a5c3a;
}

.plant-1::before {
    height: 55px;
    bottom: 10px;
    left: 8px;
    transform: rotate(12deg);
}

.plant-1::after {
    height: 40px;
    bottom: 5px;
    left: -8px;
    transform: rotate(-8deg);
}

.plant-2 {
    right: 18%;
    height: 100px;
    background: #16704a;
    animation-delay: -1s;
}

.plant-2::before {
    height: 70px;
    bottom: 15px;
    left: 9px;
    transform: rotate(10deg);
}

.plant-2::after {
    height: 50px;
    bottom: 8px;
    left: -9px;
    transform: rotate(-14deg);
}

.plant-3 {
    left: 55%;
    height: 65px;
    background: #1a5c3a;
    animation-delay: -2s;
}

.plant-3::before {
    height: 45px;
    bottom: 8px;
    left: 7px;
    transform: rotate(15deg);
}

.plant-3::after {
    height: 35px;
    bottom: 4px;
    left: -7px;
    transform: rotate(-10deg);
}

@keyframes sway {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

/* Fish */
.fish {
    position: absolute;
    pointer-events: none;
    transition: none;
}

.fish-body {
    position: relative;
    width: 100%;
    height: 100%;
}

.fish svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fish .fin {
    animation: fin-wave 0.6s ease-in-out infinite alternate;
    transform-origin: 70% 50%;
}

@keyframes fin-wave {
    0% { transform: rotate(-8deg) scaleY(0.9); }
    100% { transform: rotate(8deg) scaleY(1.1); }
}

.fish .tail {
    animation: tail-wave 0.4s ease-in-out infinite alternate;
    transform-origin: 100% 50%;
}

@keyframes tail-wave {
    0% { transform: rotate(-12deg); }
    100% { transform: rotate(12deg); }
}

/* Bubbles */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(180, 220, 255, 0.4), var(--surface-mid));
    border: 1px solid rgba(150, 200, 240, 0.2);
    pointer-events: none;
    animation: rise linear forwards;
}

@keyframes rise {
    0% {
        transform: translateX(0) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: translateX(15px) scale(1.05);
        opacity: 0.5;
    }
    100% {
        transform: translateX(-10px) scale(1.1);
        opacity: 0;
    }
}

/* ========== Battle Arena ========== */
#arena {
    background: linear-gradient(180deg, #111a0a 0%, #1a2610 40%, #1e2e14 100%);
    border: 1px solid rgba(100, 140, 80, 0.15);
}

.muddy-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(180deg, #2e1f0a 0%, #3a2810 40%, #4a3418 100%);
    border-radius: 0 0 11px 11px;
}

.mound {
    position: absolute;
    bottom: 40px;
    border-radius: 50% 50% 0 0;
    background: linear-gradient(180deg, #2a1e0c 0%, #3a2810 100%);
}

.mound-1 { left: 8%; width: 120px; height: 28px; }
.mound-2 { right: 15%; width: 160px; height: 22px; }
.mound-3 { left: 48%; width: 90px; height: 18px; }

/* Tank vehicles */
.tank {
    position: absolute;
    pointer-events: none;
}

.tank svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Projectile */
.projectile {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #ffe060, #ff8800);
    box-shadow: 0 0 6px 2px rgba(255, 160, 0, 0.5);
    pointer-events: none;
}

/* Explosion */
.explosion {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 200, 50, 0.9), rgba(255, 100, 20, 0.6), transparent 70%);
    animation: explode 0.4s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: translate(-50%, -50%) scale(0.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* Destroyed tank smoke */
.destroy-smoke {
    position: absolute;
    pointer-events: none;
    animation: smoke-up 1s ease-out forwards;
}

@keyframes smoke-up {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -80px) scale(2);
        opacity: 0;
    }
}

/* Dust */
.dust {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(160, 130, 80, 0.5), rgba(120, 100, 60, 0.15));
    pointer-events: none;
    animation: dust-rise linear forwards;
}

@keyframes dust-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    100% {
        transform: translateY(-30px) scale(1.3);
        opacity: 0;
    }
}

/* ========== Fighter Sky ========== */
#sky {
    background: linear-gradient(180deg, #1a3a5c 0%, #2a5a8a 40%, #3a70a0 100%);
    border: 1px solid rgba(120, 180, 240, 0.15);
}

.cloud {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    pointer-events: none;
}

.cloud-1 { top: 12%; left: 10%; width: 180px; height: 60px; border-radius: 60px; }
.cloud-2 { top: 35%; right: 12%; width: 220px; height: 50px; border-radius: 50px; }
.cloud-3 { top: 65%; left: 40%; width: 150px; height: 45px; border-radius: 45px; }

/* Fighter planes */
.plane {
    position: absolute;
    pointer-events: none;
}

.plane svg {
    width: 100%;
    height: 100%;
    display: block;
}

.plane .propeller {
    animation: spin 0.1s linear infinite;
    transform-origin: 100px 25px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Missile */
.missile {
    position: absolute;
    width: 10px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, #ff8800, #ffe060);
    box-shadow: 0 0 8px 2px rgba(255, 160, 0, 0.6);
    pointer-events: none;
}

/* Contrail */
.contrail {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4), rgba(200, 220, 240, 0.1));
    pointer-events: none;
    animation: contrail-fade linear forwards;
}

@keyframes contrail-fade {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}


/* ========== Hint ========== */
.hint {
    padding: 0.6rem;
    font-size: 0.75rem;
    opacity: 0.35;
    letter-spacing: 0.08em;
}

/* ========== Weather Dashboard ========== */
.dashboard {
    width: 94vw;
    max-width: 800px;
    padding: 1rem 0;
}

.dash-toolbar {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--surface-mid);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.6;
}

.toolbar-toggle {
    display: flex;
    border: 1px solid rgba(100, 160, 220, 0.25);
    border-radius: 6px;
    overflow: hidden;
}

.toolbar-toggle .toggle-option {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, background 0.2s;
}

.toolbar-toggle .toggle-option:not(:last-child) {
    border-right: 1px solid var(--line);
}

.toolbar-toggle .toggle-option.active {
    opacity: 1;
    background: var(--line);
}

.toolbar-toggle .toggle-option:hover {
    opacity: 0.8;
}

.dash-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dash-card {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.2rem;
}

.dash-card h2 {
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    margin-bottom: 0.3rem;
}

.card-time {
    font-size: 0.7rem;
    opacity: 0.4;
    margin-bottom: 0.8rem;
}

.temp-row {
    display: flex;
    gap: 1.5rem;
}

.temp-block {
    display: flex;
    flex-direction: column;
}

.temp-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.4;
}

.temp-value {
    font-size: 1.8rem;
    font-weight: 300;
}

.history-section h2 {
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    margin-bottom: 0.6rem;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

#history-table th {
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.4;
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

#history-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid rgba(100, 160, 220, 0.06);
}

#history-table tbody tr:hover {
    background: rgba(100, 160, 220, 0.05);
}

.delta-low { color: var(--good); }
.delta-mid { color: var(--warn); }
.delta-high { color: var(--bad); }

.history-empty {
    font-size: 0.8rem;
    opacity: 0.35;
    padding: 1rem 0;
}

.card-meta {
  text-align: center;
  font-size: 0.75em;
  opacity: 0.6;
  margin-top: 0.5em;
}

.dash-updated {
    font-size: 0.65rem;
    opacity: 0.25;
    margin-top: 1rem;
    text-align: right;
}

.dash-error {
    opacity: 0.35;
    font-size: 0.85rem;
    padding: 2rem 0;
    text-align: center;
}

/* ========== Weather Sub-navigation ========== */
.dash-subnav {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.3);
}

.subnav-btn {
    background: none;
    border: none;
    color: rgba(200, 220, 255, 0.6);
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
}

.subnav-btn.active {
    color: #c8dcff;
    border-bottom-color: #6496ff;
}

/* ========== Data Browser ========== */
.browse-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.browse-controls select {
    background: rgba(0, 20, 60, 0.6);
    color: #c8dcff;
    border: 1px solid rgba(100, 150, 255, 0.3);
    padding: 6px 10px;
    border-radius: 4px;
}

.browse-btn {
    background: rgba(0, 20, 60, 0.4);
    color: rgba(200, 220, 255, 0.6);
    border: 1px solid rgba(100, 150, 255, 0.2);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.browse-btn.active {
    background: rgba(100, 150, 255, 0.2);
    color: #c8dcff;
    border-color: rgba(100, 150, 255, 0.5);
}

.hour-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.hour-btn {
    background: rgba(0, 20, 60, 0.4);
    color: rgba(200, 220, 255, 0.5);
    border: 1px solid rgba(100, 150, 255, 0.15);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: monospace;
    min-width: 72px;
    text-align: center;
}

.hour-btn:hover {
    border-color: rgba(100, 150, 255, 0.4);
    color: #c8dcff;
}

.hour-btn.active {
    background: rgba(100, 150, 255, 0.25);
    color: #c8dcff;
    border-color: #6496ff;
}

.browse-display {
    min-height: 200px;
}

.browse-loading {
    opacity: 0.4;
    font-size: 0.85rem;
}

.raw-json {
    background: rgba(0, 10, 30, 0.6);
    border: 1px solid rgba(100, 150, 255, 0.15);
    border-radius: 6px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #a0c0ff;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.data-card {
    background: rgba(0, 20, 60, 0.4);
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.data-card h4 {
    color: #6496ff;
    margin: 0 0 12px 0;
    font-size: 14px;
}

.data-field {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(100, 150, 255, 0.08);
}

.data-field:last-child {
    border-bottom: none;
}

.data-label {
    color: rgba(200, 220, 255, 0.5);
    font-size: 13px;
}

.data-value {
    color: #c8dcff;
    font-size: 13px;
    font-family: monospace;
}

/* --- Browse Category Bar --- */
.browse-category-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.browse-cat-btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 8px 12px;
}

/* --- Model Filter Pills --- */
.model-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    overflow-x: auto;
}

.model-filter-pill {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
}

/* --- Database Loading --- */
.db-loading { text-align: center; padding: 2rem; }
.db-loading-bar { width: 200px; height: 6px; background: #333; border-radius: 3px; margin: 0.5rem auto; }
.db-loading-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.2s; }
.db-loading-text { color: #aaa; font-size: 0.85rem; }

/* --- Validation Table --- */
.validation-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.validation-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(100, 150, 255, 0.08);
}

.validation-row:last-child {
    border-bottom: none;
}

.validation-header {
    font-size: 11px;
    color: rgba(200, 220, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(100, 150, 255, 0.15);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.validation-cell {
    font-size: 13px;
}

/* --- Error Color Coding --- */
.error-low { color: var(--good); }
.error-medium { color: var(--warn); }
.error-high { color: var(--bad); }

/* ========== Workflow Monitor ========== */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.success { background: var(--good); }
.status-dot.failure { background: var(--bad); }
.status-dot.in_progress { background: var(--warn); animation: pulse 1.5s ease-in-out infinite; }
.status-dot.cancelled { background: rgba(200, 220, 255, 0.3); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.countdown-value {
  font-size: 1.4rem;
  font-weight: 300;
  font-family: monospace;
  letter-spacing: 0.05em;
}

.pipeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.pipeline-table th {
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.4;
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.pipeline-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(100, 160, 220, 0.06);
}
.pipeline-table .step-name {
  text-transform: capitalize;
}
.step-error {
  color: var(--bad);
  font-size: 0.75rem;
  padding-left: 1.2rem;
}

/* ========== V2 Dashboard ========== */
.dash-card-current {
    border-left: 4px solid rgba(100, 160, 220, 0.5);
    background: rgba(100, 160, 220, 0.12);
    margin-bottom: 1.5rem;
}

.dash-card-current .temp-value {
    font-size: 2.2rem;
}

.dash-predictions {
    display: block;
    margin-bottom: 1.5rem;
}

.dash-card-prediction {
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem;
}

.dash-card-prediction .temp-value {
    font-size: 1.3rem;
}

.prediction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}

.prediction-header h2 {
    margin-bottom: 0;
    min-width: 0;
    font-size: 0.9rem;
}

.model-badge {
    display: inline-block;
    background: var(--line-mid);
    border: 1px solid rgba(100, 160, 220, 0.3);
    border-radius: 10px;
    padding: 0.15rem 0.5rem;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.empty-state {
    opacity: 0.35;
    font-size: 0.85rem;
    padding: 1rem 0;
    text-align: center;
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    align-items: center;
}

.history-filter-input,
.history-filter-date {
    background: rgba(0, 20, 60, 0.6);
    color: #c8dcff;
    border: 1px solid rgba(100, 150, 255, 0.3);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.history-filter-input::placeholder {
    color: rgba(200, 220, 255, 0.4);
}

/* Multi-select dropdown */
.multi-select {
    position: relative;
    display: inline-block;
    min-width: 140px;
}

.multi-select-trigger {
    padding: 6px 10px;
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 20, 60, 0.6);
    color: #c8dcff;
    cursor: pointer;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.multi-select-trigger:hover {
    border-color: rgba(100, 150, 255, 0.5);
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: rgba(0, 20, 60, 0.95);
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 4px;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    min-width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.multi-select.open .multi-select-dropdown {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #c8dcff;
}

.multi-select-option:hover {
    background: rgba(100, 150, 255, 0.1);
}

.multi-select-option input[type="checkbox"] {
    margin-right: 6px;
}

.multi-select-clear {
    padding: 4px 8px;
    font-size: 0.7rem;
    color: rgba(200, 220, 255, 0.4);
    cursor: pointer;
    border-top: 1px solid rgba(100, 150, 255, 0.15);
    text-align: center;
}

.multi-select-clear:hover {
    color: #c8dcff;
    background: rgba(100, 150, 255, 0.1);
}

.history-row-count {
    font-size: 0.7rem;
    opacity: 0.35;
    margin-bottom: 0.5rem;
    text-align: right;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background: var(--surface-mid);
}

.show-more-btn {
    display: block;
    width: 100%;
    margin-top: 0.8rem;
    padding: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--line-mid);
    border-radius: 8px;
    color: inherit;
    cursor: pointer;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.show-more-btn:hover {
    opacity: 0.9;
}

/* ========== Home ========== */
#home.active {
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
    -webkit-overflow-scrolling: touch;
}

/* ========== Home Hub (bento grid) ========== */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    width: 94vw;
    max-width: 980px;
    margin: 0 auto;
    padding: 1rem 0 3rem;
}

.hub-span2 { grid-column: span 2; }
.hub-span3 { grid-column: span 3; }
.hub-span4 { grid-column: span 4; }
.hub-span6 { grid-column: span 6; }
.hub-rows2 { grid-row: span 2; }

.hub-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    position: relative;
    text-align: left;
    transition: border-color 0.18s, transform 0.18s, background 0.18s;
}

.hub-tile:hover {
    border-color: rgba(100, 160, 220, 0.35);
    background: rgba(100, 160, 220, 0.12);
    transform: translateY(-2px);
}

a.hub-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.6rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.hub-label {
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-faint);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
}

.hub-label .status-dot, .hub-status .status-dot { width: 7px; height: 7px; }
.status-dot.stale { background: var(--warn); }
.status-dot.market { background: var(--market); box-shadow: 0 0 6px rgba(61, 220, 151, 0.7); }
.status-dot.market-closed { background: var(--bad); box-shadow: 0 0 6px rgba(224, 80, 128, 0.7); }

.hub-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    min-height: 180px;
}

.hub-hero-h {
    font-size: 1.55rem;
    font-weight: 250;
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: #fff;
}

.hub-hero-h b { font-weight: 650; }

.hub-status {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.72rem;
    color: var(--ink-dim);
    margin-top: 0.4rem;
}

.hub-status > span { display: inline-flex; align-items: center; gap: 0.4rem; }

.hub-title {
    font-family: Georgia, serif;
    font-size: 1.45rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: #fff;
    margin-bottom: 0.25rem;
}
.hub-title-sm { font-size: 0.85rem; font-weight: 600; color: #fff; margin-bottom: 0.2rem; }
.ff-version {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    color: var(--accent-soft);
    margin-left: 0.35rem;
}
.hub-desc { font-size: 0.75rem; color: var(--ink-dim); line-height: 1.45; }

.hub-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.6rem; }

.hub-tag {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid rgba(100, 160, 220, 0.35);
    border-radius: 99px;
    padding: 0.15rem 0.55rem;
    color: var(--accent-soft);
    text-decoration: none;
}

a.hub-tag:hover { background: var(--surface-mid); }

.hub-metric-row { display: flex; gap: 1.5rem; }

.hub-big {
    font-size: 1.7rem;
    font-weight: 250;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.hub-big small { font-size: 0.55em; color: var(--ink-dim); font-weight: 400; }
.hub-sub { font-size: 0.72rem; color: var(--ink-dim); margin-top: 0.25rem; }
.hub-spark { display: block; margin-top: 0.55rem; width: 100%; height: 30px; }

.hub-more {
    display: inline-block;
    margin-top: 0.6rem;
    font-size: 0.72rem;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

.hub-more:hover { text-decoration: underline; }

#home-weather-tile { min-height: 92px; }
#home-weather-tile .stale-notice { margin: 0 0 0.5rem; }

/* Fathom Fall tile: game battle backdrop, faded so it dissolves into the tile.
   Strongest at the bottom (behind the sprites), masked to nothing up top so the
   title/description stay readable. */
.ff-tile { overflow: hidden; }
.ff-tile::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../assets/ff/bg.jpg") center bottom / cover no-repeat;
    opacity: 0.5;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.28) 42%, #000 78%);
    mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.28) 42%, #000 78%);
    pointer-events: none;
    z-index: 0;
}
.ff-tile > * { position: relative; z-index: 1; }

/* Floating damage numbers on hits */
.ff-dmg {
    position: absolute;
    z-index: 3;
    font-family: system-ui, sans-serif;
    font-size: 0.62rem;
    font-weight: 800;
    color: #ff7a4a;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, 0);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    animation: ff-dmg-float 0.85s ease-out forwards;
}
.ff-dmg-crit { color: #ffd24a; font-size: 0.8rem; }
@keyframes ff-dmg-float {
    0%   { opacity: 0; transform: translate(-50%, 6px) scale(0.7); }
    18%  { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
    35%  { transform: translate(-50%, -3px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -24px) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .ff-dmg { display: none; } }

/* Fathom Fall battle scene. Frame size (--fw) and column count (--cols) are
   per-sprite so mixed sheets/sizes share one set of keyframes:
   default = 6-col tidekin/256px monsters; .ff-frames4 = 4-col 128px bosses;
   .ff-boss doubles the size. Sits to the right of the Play free tag. */
.ff-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
}
.ff-scene {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 4px;
}
.ff-scene::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-mid), transparent);
}
.ff-side { display: flex; align-items: flex-end; }
.ff-side .ff-sprite:not(:first-child) { margin-left: -8px; }

.ff-sprite {
    --fw: 30px;
    --cols: 6;
    width: var(--fw);
    height: var(--fw);
    background-repeat: no-repeat;
    background-size: calc(var(--cols) * var(--fw)) calc(2 * var(--fw));
    background-position: 0 0;
    animation: ff-idle 1s steps(6) infinite;
    transition: transform 0.15s ease, filter 0.12s ease;
    will-change: background-position;
}
.ff-frames4 { --cols: 4; animation: ff-idle 1s steps(4) infinite; }
.ff-boss { --fw: 60px; }

.ff-enemy .ff-sprite { transform: scaleX(-1); }

.ff-sprite.attacking { animation: ff-attack 0.5s steps(6) 1; }
.ff-frames4.attacking { animation: ff-attack 0.5s steps(4) 1; }

.ff-party .ff-sprite.lunge { transform: translateX(5px); }
.ff-enemy .ff-sprite.lunge { transform: scaleX(-1) translateX(5px); }

.ff-sprite.hit { filter: brightness(1.8) drop-shadow(0 0 4px rgba(255, 107, 74, 0.9)); }

@keyframes ff-idle {
    from { background-position: 0 0; }
    to   { background-position: calc(var(--cols) * var(--fw) * -1) 0; }
}
@keyframes ff-attack {
    from { background-position: 0 calc(var(--fw) * -1); }
    to   { background-position: calc(var(--cols) * var(--fw) * -1) calc(var(--fw) * -1); }
}

@media (prefers-reduced-motion: reduce) {
    .ff-sprite { animation: none !important; background-position: 0 0 !important; transition: none; }
}

/* Open source repo list — titled items like the other tiles */
.hub-repos { display: grid; gap: 0.7rem; margin: 0.15rem 0 0.2rem; }
.hub-repo {
    display: block;
    text-decoration: none;
    color: inherit;
}
.hub-repo-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    transition: color 0.15s;
}
.hub-repo-name::after { content: " \2197"; color: var(--ink-faint); font-weight: 400; }
.hub-repo:hover .hub-repo-name { color: var(--accent-soft); }
.hub-repo:hover .hub-repo-name::after { color: var(--accent-soft); }
.hub-repo-desc {
    display: block;
    font-size: 0.68rem;
    color: var(--ink-dim);
    line-height: 1.35;
    margin-top: 0.05rem;
}

/* Homelab quick-glance stats */
.hl-stats {
    display: grid;
    /* auto-fit: fills the row whether 4 or 5 stats render (agents is optional) */
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0.9rem;
    margin-top: 0.2rem;
}
.hl-stat .hub-big { font-size: 1.5rem; }
.hl-group-label {
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0.85rem 0 0.1rem;
}
@media (max-width: 600px) {
    .hl-stats { grid-template-columns: repeat(3, 1fr); gap: 0.7rem 1rem; }
}

/* Loading skeleton — keeps the public section from ever being empty */
.wx-skeleton { display: flex; gap: 1.5rem; padding: 0.2rem 0; }
.wx-skeleton span {
    display: block;
    height: 1.7rem;
    width: 4.2rem;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface), var(--surface-mid), var(--surface));
    background-size: 200% 100%;
    animation: wx-shimmer 1.3s ease-in-out infinite;
}
@keyframes wx-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Random model-forecast sample (public) */
.wx-models-head {
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0.8rem 0 0.4rem;
}
.wx-models {
    display: grid;
    gap: 0.34rem;
    max-height: 7.4rem;
    overflow-y: auto;
    padding-right: 0.35rem;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    -webkit-overflow-scrolling: touch;
}
.wx-models::-webkit-scrollbar { width: 6px; }
.wx-models::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 99px;
}
.wx-models::-webkit-scrollbar-track { background: transparent; }
.wx-model {
    display: grid;
    grid-template-columns: 2.1rem 1fr auto auto;
    gap: 0.55rem;
    align-items: baseline;
    font-size: 0.76rem;
}
.wx-model-h {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.64rem;
    color: #06251a;
    background: var(--accent-soft);
    border-radius: 5px;
    padding: 0.05rem 0;
    text-align: center;
    font-weight: 600;
}
.wx-model-fam {
    color: var(--ink-dim);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wx-model-val { color: #fff; font-variant-numeric: tabular-nums; }
.wx-model-for { color: var(--ink-faint); font-size: 0.66rem; }

/* Gated footer section — clearly bounded (divider above), signed-out only */
.hub-subgate {
    position: relative;
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
}
.hub-subgate .hub-locked {
    filter: blur(5px) saturate(0.7);
    opacity: 0.5;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    min-height: 3.4rem;
}
.wx-rank-row {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.62rem;
    color: var(--ink-dim);
}
.wx-rank-row i {
    display: block;
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft));
}
.hub-subgate .hub-gate-veil {
    top: 0.9rem;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(6, 14, 26, 0.25), rgba(6, 14, 26, 0.55));
    gap: 0.5rem;
    padding: 0.4rem;
}
.hub-subgate .hub-gate-msg { font-size: 0.72rem; line-height: 1.35; max-width: 24ch; }
.hub-lock-mini { opacity: 0.9; }

/* Gated tile (TankCore) — no veil and no blur here any more: the pane an
   anonymous visitor sees carries real (delayed) numbers, and real numbers are
   never masked, since the mask is cosmetic and the data one inspect away.
   The :has() blur rule below is left for any .hub-gated tile that still pairs
   a veil with decoy content. */
.hub-gated { overflow: hidden; }
/* TankCore: the label sits above the body, which flexes to fill the tile so
   whichever pane is showing has no empty gap below it. */
#tankcore-tile { display: flex; flex-direction: column; }
#tankcore-tile .tankcore-body {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 0.4rem;
}
#tankcore-tile .hub-locked {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.6rem;
}
.hub-locked { transition: filter 0.4s ease, opacity 0.4s ease; }
/* The sub-gate's decoy rows are not a pane wrapper — they stack on their own
   margins, like the homelab tile's. */
#tankcore-tile .hub-subgate .hub-locked { display: block; flex: none; }
/* Two panes in the body: the delayed public feed and the signed-in renderer.
   The auth class sweep shows exactly one of them, and .hub-locked collapses
   with its pane so the visible one always gets the tile's full width. */
#tankcore-tile .hub-locked:has(> .tankcore-pane.auth-hidden) { display: none; }
#tankcore-tile .tankcore-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.6rem;
}
#tankcore-tile .tankcore-pane.auth-hidden { display: none; }
#tankcore-tile .tc-foot { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
#tankcore-tile .tc-meta { opacity: 0.8; text-align: right; }
#tankcore-tile .tc-msg { margin: auto 0; }
/* Shadow-trader rows below the hero: the daily funnel, the posture chips
   (session, opening range, risk) and the rejection tally. */
#tankcore-tile .tc-funnel { margin-top: 0.35rem; opacity: 0.85; }
#tankcore-tile .tc-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
#tankcore-tile .tc-chips .hub-tag.tc-warn { border-color: var(--warn); color: var(--warn); }
#tankcore-tile .tc-chips .hub-tag.tc-alert { border-color: var(--bad); color: var(--bad); }
#tankcore-tile .tc-chips .hub-tag.tc-mode-paper { border-color: var(--warn); color: var(--warn); }
#tankcore-tile .tc-chips .hub-tag.tc-mode-live { border-color: var(--bad); color: var(--bad); }
#tankcore-tile .tc-reject { margin-top: 0.3rem; opacity: 0.85; }
/* Public pane: the spark travels with its caption so the pane's space-between
   cannot separate them. The call to action is the sub-gate's veil below. */
#tankcore-tile .tc-spark .hub-spark { margin-top: 0; }
#tankcore-tile .tc-history { margin-top: 0.3rem; opacity: 0.85; }

.hub-gated:has(.hub-gate-veil:not(.auth-hidden)) .hub-locked {
    filter: blur(7px) saturate(0.7);
    opacity: 0.75;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.hub-gate-veil {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    background: rgba(6, 14, 26, 0.35);
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
}

.hub-gate-lock {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(61, 220, 151, 0.5);
    background: rgba(61, 220, 151, 0.1);
    display: grid;
    place-items: center;
    font-size: 0.8rem;
}

.hub-gate-msg {
    font-size: 0.78rem;
    color: #eaf6ff;
    font-weight: 600;
    text-shadow: 0 1px 8px rgba(6, 14, 26, 0.9);
}

.hub-gate-btn {
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-family: inherit;
    color: #06251a;
    background: var(--market);
    border: none;
    border-radius: 99px;
    padding: 0.45rem 1.05rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.hub-gate-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(61, 220, 151, 0.35); }
.hub-gate-btn:focus-visible { outline: 2px solid var(--market); outline-offset: 2px; }

/* Nearby stations — compact temperature-spread summary.
   Hidden until data arrives, then pops in and pushes the tiles below down. */
.wx-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.unit-toggle {
    display: inline-flex;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 99px;
    overflow: hidden;
}
.unit-toggle button {
    font-family: inherit;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1;
    padding: 0.16rem 0.42rem;
    background: none;
    border: none;
    color: var(--ink-faint);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.unit-toggle button.active {
    background: var(--surface-mid);
    color: var(--accent-soft);
}
.unit-toggle button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

#nearby-tile { display: none; }
#nearby-tile.is-loaded { display: block; animation: nearby-pop 0.4s ease both; }
@keyframes nearby-pop {
    from { opacity: 0; transform: translateY(-10px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    #nearby-tile.is-loaded { animation: none; }
}
.nearby-inner { display: flex; align-items: center; gap: 2rem; }
.nearby-head { flex: 0 0 auto; }
.nearby-head .hub-big { font-size: 1.7rem; }
.nearby-range { flex: 1; min-width: 0; }
.nearby-bar {
    position: relative;
    height: 8px;
    border-radius: 99px;
    margin: 0.55rem 0 0.5rem;
    background: linear-gradient(90deg, #4a9eff, #4acfcf, #ffaa4a, #ff6b4a);
    opacity: 0.85;
}
.nearby-tick {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 15px;
    transform: translate(-50%, -50%);
    border-radius: 2px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
.nearby-home {
    position: absolute;
    top: 50%;
    width: 13px;
    height: 13px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
    z-index: 2;
}
.nearby-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--ink-dim);
}
.nearby-mid { color: #fff; }

@media (max-width: 600px) {
    .nearby-inner { flex-direction: column; align-items: stretch; gap: 0.6rem; }
}

@media (max-width: 900px) {
    .hub-span4 { grid-column: span 6; }
    .hub-span2 { grid-column: span 3; }
    .hub-rows2 { grid-row: span 1; }
    .hub-hero { min-height: 0; }
}

@media (max-width: 600px) {
    .hub-span2, .hub-span3, .hub-span4 { grid-column: span 6; }
    .hub-hero-h { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .hub-tile, .hub-locked, .hub-gate-btn { transition: none; }
    .hub-tile:hover, .hub-gate-btn:hover { transform: none; }
}

.compass-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.compass-card h2 {
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    margin: 0;
}

.compass-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.compass-toggle {
    background: var(--surface-mid);
    border: 1px solid var(--line-mid);
    border-radius: 6px;
    color: inherit;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.compass-toggle:hover, .compass-toggle:focus {
    background: rgba(100, 160, 220, 0.25);
    outline: 1px solid rgba(100, 160, 220, 0.4);
}

.compass-layout {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

.compass-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.compass-cardinal {
    fill: rgba(192, 216, 240, 0.5);
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
}

.compass-cardinal-n {
    fill: rgba(192, 216, 240, 0.8);
}

.compass-ring {
    fill: none;
    stroke: rgba(100, 160, 220, 0.12);
    stroke-dasharray: 4 4;
}

@keyframes compass-float {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(calc(-50% + 1px), calc(-50% - 2px)); }
    50% { transform: translate(calc(-50% - 1px), calc(-50% + 1px)); }
    75% { transform: translate(calc(-50% + 2px), calc(-50% - 1px)); }
}

.compass-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--line);
    border: 1px solid rgba(100, 160, 220, 0.25);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    text-align: center;
    z-index: 2;
}
.center-temp { font-size: 1.2rem; font-weight: 300; }
.center-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.5; }
.center-detail { font-size: 0.65rem; opacity: 0.6; margin-top: 0.2rem; }

.compass-satellite {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(6, 14, 26, 0.85);
    border: 1px solid var(--line-mid);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    text-align: center;
    cursor: pointer;
    animation: compass-float 4s ease-in-out infinite;
    z-index: 1;
    transition: z-index 0s, transform 0.2s ease;
}
.compass-satellite:hover, .compass-satellite:focus {
    z-index: 5;
    animation: none;
    transform: translate(-50%, -50%) scale(1.15);
    outline: 1px solid rgba(100, 160, 220, 0.5);
}
.satellite-temp {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
}
.satellite-distance {
    font-size: 0.6rem;
    opacity: 0.5;
    margin-top: 0.15rem;
}
.satellite-detail {
    display: none;
    font-size: 0.6rem;
    opacity: 0.6;
    margin-top: 0.2rem;
    white-space: nowrap;
}
.compass-satellite:hover .satellite-detail,
.compass-satellite:focus .satellite-detail {
    display: block;
}

.compass-stack {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 1;
}
.stack-badge {
    background: rgba(100, 160, 220, 0.3);
    border: 1px solid rgba(100, 160, 220, 0.4);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    animation: compass-float 4s ease-in-out infinite;
}
.compass-stack .compass-satellite {
    display: none;
    position: relative;
    transform: none;
    margin-top: 0.25rem;
    animation: none;
}
.compass-stack:hover .compass-satellite,
.compass-stack:focus-within .compass-satellite {
    display: block;
}
.compass-stack:hover .stack-badge,
.compass-stack:focus-within .stack-badge {
    display: none;
}
.compass-stack:hover, .compass-stack:focus-within {
    z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
    .compass-satellite,
    .compass-temp-label,
    .stack-badge {
        animation: none;
    }
}

.compass-meta {
    font-size: 0.7rem;
    opacity: 0.4;
    margin-top: 0.75rem;
}

.compass-meta.stale {
    color: var(--warn);
    opacity: 0.8;
}

.stale-notice {
    font-size: 0.7rem;
    color: var(--warn);
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.compass-list {
    display: none;
}
.compass-list-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.2rem;
    border-bottom: 1px solid var(--surface);
}
.compass-list-item:last-child { border-bottom: none; }
.list-direction {
    width: 1.8rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.5;
    flex-shrink: 0;
}
.list-distance {
    width: 3.5rem;
    font-size: 0.7rem;
    opacity: 0.5;
    flex-shrink: 0;
}
.list-temp {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}
.list-detail {
    font-size: 0.65rem;
    opacity: 0.4;
    text-align: right;
    flex-grow: 1;
}

/* ========== Dashboard Compass ========== */
#dash-compass-container {
    margin: 1rem 0;
}
#dash-compass-container .compass-card {
    max-width: min(90vw, 900px);
    margin: 0 auto;
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
    /* --- Existing rules (keep as-is) --- */
    h1 { font-size: 1rem; }
    #tank, #arena, #sky { width: 98vw; height: calc(100vh - 5rem); border-radius: 8px; }
    #dungeon { width: 98vw; height: 100vh; border-radius: 8px; }
    .sandy-bottom { height: 30px; border-radius: 0 0 7px 7px; }
    .muddy-ground { height: 35px; border-radius: 0 0 7px 7px; }
    .plant-1 { height: 60px; }
    .plant-2 { height: 75px; }
    .plant-3 { height: 50px; }
    .mound-1 { width: 80px; height: 20px; }
    .mound-2 { width: 110px; height: 16px; }
    .mound-3 { width: 60px; height: 14px; }
    .dash-cards { flex-direction: column; }
    .dashboard { width: 98vw; }
    .table-scroll { margin: 0 -0.5rem; }
    .browse-controls { gap: 8px; }

    /* --- Navigation: bigger tap targets --- */
    nav {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }
    nav a, .nav-dropdown-toggle {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .nav-dropdown-menu a {
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* --- Sub-navigation: fill width evenly --- */
    .subnav-btn {
        flex: 1;
        text-align: center;
        padding: 10px 8px;
        font-size: 13px;
    }

    /* --- Dashboard cards --- */
    .dash-card { padding: 0.8rem; }
    .temp-value { font-size: 1.5rem; }
    .temp-row { gap: 1rem; }

    /* --- Browse controls: bigger touch targets --- */
    .browse-category-bar { gap: 4px; }
    .browse-cat-btn {
        padding: 8px 6px;
        font-size: 12px;
        min-height: 44px;
    }
    .browse-controls select {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 44px;
    }
    .browse-btn {
        padding: 8px 14px;
        font-size: 14px;
        min-height: 44px;
    }
    .hour-btn {
        min-width: 64px;
        padding: 10px 8px;
        font-size: 13px;
        min-height: 44px;
    }
    .validation-row {
        grid-template-columns: 1.2fr 1fr 1fr 1fr;
        gap: 4px;
        font-size: 12px;
    }
    .validation-cell { font-size: 12px; }

    /* --- Prediction history table: hide Model column --- */
    #history-table th:nth-child(2),
    #history-table td:nth-child(2) {
        display: none;
    }
    #history-table { font-size: 0.75rem; }
    #history-table th,
    #history-table td { padding: 0.4rem 0.35rem; }

    /* --- Pipeline table --- */
    .pipeline-table { font-size: 0.75rem; }
    .pipeline-table th,
    .pipeline-table td { padding: 0.4rem 0.35rem; }

    /* --- Data fields (workflow cards, data browser) --- */
    .data-field { gap: 0.5rem; }
    .data-label { font-size: 12px; }
    .data-value { font-size: 12px; text-align: right; }

    /* --- Format toolbar --- */
    .dash-toolbar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* --- V2: Current reading --- */
    .dash-card-current .temp-value { font-size: 1.8rem; }
    .dash-card-current .temp-row { flex-wrap: wrap; }

    /* --- V2: Prediction cards stack vertically --- */
    .dash-predictions { display: block; }
    .prediction-group-cards { grid-template-columns: 1fr; }
    .dash-card-prediction { min-width: 0; }
    .dash-card-prediction .temp-value { font-size: 1.4rem; }

    /* --- V2: Filter controls stack --- */
    .prediction-filters,
    .history-filters { flex-direction: column; }
    .pred-horizon-btns,
    .history-horizon-btns { width: 100%; }
    .pred-horizon-btn,
    .hist-horizon-btn { flex: 1; text-align: center; min-height: 36px; }
    .history-filter-input,
    .history-filter-date {
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
        min-height: 44px;
    }
    .multi-select { width: 100%; min-width: 0; }
    .multi-select-trigger {
        max-width: none;
        padding: 10px 12px;
        font-size: 14px;
        min-height: 44px;
    }
    .rankings-search { width: 100%; min-height: 44px; font-size: 14px; }
    .rankings-controls { flex-wrap: wrap; }

    /* --- V2: Hide Model Version & Horizon columns on mobile --- */
    .model-version-col,
    .horizon-col { display: none; }

    /* --- Raw JSON --- */
    .raw-json { font-size: 11px; padding: 12px; max-height: 400px; }

    /* --- Table scroll hint (fade on right edge) --- */
    .table-scroll { position: relative; }
    .table-scroll::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to left, rgba(6, 14, 26, 0.8), transparent);
        pointer-events: none;
    }
    .table-scroll.scrolled-end::after { display: none; }

    /* --- Compass --- */
}

/* Feature Rankings tab */
.rankings-section {
    padding: 0 0.5rem;
}

.rankings-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.rankings-select {
    padding: 6px 10px;
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 20, 60, 0.6);
    color: #c8dcff;
    font-size: 0.8rem;
}

.rankings-meta {
    font-size: 0.7rem;
    opacity: 0.5;
}

.rankings-empty p {
    opacity: 0.5;
    font-size: 0.85rem;
}

.ranking-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(100, 160, 220, 0.06);
}

.ranking-rank {
    width: 2rem;
    text-align: right;
    opacity: 0.4;
    font-size: 0.65rem;
}

.ranking-name {
    width: 14rem;
    font-family: monospace;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-bar-container {
    flex: 1;
    height: 6px;
    background: var(--surface);
    border-radius: 3px;
    overflow: hidden;
}

.ranking-bar {
    display: block;
    height: 100%;
    border-radius: 3px;
}

.ranking-bar-positive {
    background: rgba(80, 200, 120, 0.6);
}

.ranking-bar-negative {
    background: rgba(224, 80, 128, 0.6);
}

.ranking-coef {
    width: 5rem;
    text-align: right;
    font-family: monospace;
    font-size: 0.7rem;
    opacity: 0.6;
}

/* Average delta row in prediction history */
.avg-row th {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-bottom: 2px solid var(--line-mid);
    opacity: 1;
}

.avg-delta {
    font-family: monospace;
}

/* ========== Prediction Filters & Grouping ========== */
.prediction-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.pred-horizon-btns,
.history-horizon-btns {
    display: flex;
    gap: 0;
}

.pred-horizon-btn,
.hist-horizon-btn {
    padding: 4px 10px;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    background: rgba(0, 20, 60, 0.4);
    border: 1px solid rgba(100, 150, 255, 0.2);
    color: rgba(200, 220, 255, 0.5);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pred-horizon-btn:first-child,
.hist-horizon-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.pred-horizon-btn:last-child,
.hist-horizon-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.pred-horizon-btn + .pred-horizon-btn,
.hist-horizon-btn + .hist-horizon-btn {
    border-left: none;
}

.pred-horizon-btn.active,
.hist-horizon-btn.active {
    background: rgba(100, 150, 255, 0.25);
    color: #c8dcff;
    border-color: rgba(100, 150, 255, 0.4);
}

.pred-horizon-btn:hover,
.hist-horizon-btn:hover {
    background: rgba(100, 150, 255, 0.15);
    color: #c8dcff;
}

.prediction-group-label {
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.4;
    margin: 0.6rem 0 0.3rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--surface-mid);
}

.prediction-group-label:first-child {
    margin-top: 0;
}

.prediction-group-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.prediction-group-cards .dash-card-prediction {
    min-width: 0;
}

.horizon-col {
    white-space: nowrap;
}

/* ========== Rankings Enhancements ========== */
.rankings-search {
    padding: 6px 10px;
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 20, 60, 0.6);
    color: #c8dcff;
    font-size: 0.75rem;
    min-width: 150px;
}

.rankings-search::placeholder {
    color: rgba(200, 220, 255, 0.3);
}

.coef-positive {
    color: var(--good);
}

.coef-negative {
    color: var(--bad);
}

.rankings-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.rankings-compare-table th {
    font-size: 0.6rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.5;
    padding: 0.5rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.rankings-compare-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid rgba(100, 160, 220, 0.06);
    text-align: right;
    font-family: monospace;
    font-size: 0.7rem;
}

.rankings-compare-table tbody tr:hover {
    background: rgba(100, 160, 220, 0.05);
}

.compare-feature-col {
    text-align: left !important;
    font-family: monospace;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== Dungeon Delvers ========== */
body.theme-dungeon {
    background: #0a0808;
    color: #c8b8a0;
    overflow-y: auto;
}

#dungeon {
    background: linear-gradient(180deg, #1a1210 0%, #2a1e18 40%, #1e1610 100%);
    border: 1px solid rgba(160, 120, 80, 0.15);
}

#dungeon iframe {
    border-radius: 12px;
}

/* ========== Fathom Fall Admin ========== */
#fathomfall.active {
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
    -webkit-overflow-scrolling: touch;
}

.ff-admin-wrap {
    width: 94vw;
    max-width: 900px;
    padding: 1rem 0;
}

.admin-header h2 {
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-bottom: 1rem;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.admin-stat-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(100,150,200,0.3);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.admin-stat-card .stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #88ccee;
}

.admin-stat-card .stat-label {
    font-size: 0.85em;
    color: #8899aa;
    margin-top: 4px;
}

.admin-section {
    margin-bottom: 24px;
}

.admin-section h3 {
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.5;
    margin-bottom: 0.6rem;
}

.admin-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.admin-search {
    padding: 6px 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(100,150,200,0.3);
    border-radius: 4px;
    color: #dde0cc;
    font-size: 14px;
    width: 220px;
}

.admin-search::placeholder {
    color: rgba(200,220,255,0.4);
}

.admin-btn {
    padding: 6px 16px;
    background: rgba(40,80,60,0.6);
    border: 1px solid rgba(80,160,120,0.4);
    border-radius: 4px;
    color: #dde0cc;
    cursor: pointer;
    font-size: 13px;
}

.admin-btn:hover {
    background: rgba(40,80,60,0.8);
}

.admin-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid rgba(100,150,200,0.3);
    color: #8899aa;
    font-weight: normal;
    font-size: 12px;
    text-transform: uppercase;
}

.admin-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(100,150,200,0.1);
}

.admin-table tr:hover td {
    background: rgba(100,150,200,0.05);
}

.admin-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
    align-items: center;
}

.admin-detail-panel {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(100,150,200,0.3);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

@media (max-width: 600px) {
    .ff-admin-wrap { width: 98vw; }
    .admin-stats-grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
    .admin-stat-card .stat-value { font-size: 1.4em; }
    .admin-table { font-size: 12px; }
    .admin-table th, .admin-table td { padding: 6px 4px; }
    .admin-search { width: 140px; font-size: 13px; }
    .admin-controls { flex-wrap: wrap; }
}
