:root {
  --bg: #071222;
  --panel: rgba(10, 22, 40, 0.9);
  --panel-solid: #0c1a30;
  --stroke: rgba(160, 200, 255, 0.14);
  --text: #e8f0fc;
  --muted: #9ab0cc;
  --ice: #7ec8ff;
  --snow: #d8ecff;
  --teal: #5ee0c8;
  --warm: #ffb080;
  --ok: #7dffb8;
  --violet: #a8c4ff;
  --danger: #ff7a9a;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: Outfit, system-ui, sans-serif;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --max: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ice); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.bg-layer {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
}
.bg-img {
  width: 100%; height: 100%; object-fit: cover; opacity: 0.4; filter: saturate(1.05);
}
.bg-gradient {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 15% 0%, rgba(60, 120, 200, 0.32), transparent 55%),
    radial-gradient(ellipse 70% 45% at 90% 15%, rgba(120, 180, 255, 0.18), transparent 50%),
    linear-gradient(180deg, rgba(6, 14, 28, 0.55), rgba(6, 14, 28, 0.94) 70%);
}
.bg-noise {
  position: absolute; inset: 0; opacity: 0.06;
  background: url("assets/noise.svg") repeat;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  backdrop-filter: blur(14px);
  background: rgba(6, 14, 28, 0.78);
  border-bottom: 1px solid var(--stroke);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); font-weight: 600; text-decoration: none;
}
.brand img { border-radius: 7px; }
.nav-links {
  display: none; gap: 14px; margin-left: 12px; flex: 1;
}
.nav-links a {
  color: var(--muted); font-size: 0.9rem; font-weight: 500; text-decoration: none;
}
.nav-links a:hover { color: var(--text); }
.pill {
  margin-left: auto;
  font-family: var(--mono); font-size: 0.72rem;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(126, 200, 255, 0.12); color: var(--ice);
  border: 1px solid rgba(126, 200, 255, 0.28);
  white-space: nowrap;
}

.wrap {
  width: min(var(--max), calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 64px;
  display: flex; flex-direction: column; gap: 18px;
}

.hero {
  display: grid; gap: 18px;
  padding: 8px 0 4px;
}
.eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--ice); letter-spacing: 0.02em;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 6vw, 2.75rem);
  letter-spacing: -0.03em; line-height: 1.1;
}
.lede { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 58ch; }
.lede strong { color: var(--text); }
.ticker {
  list-style: none; padding: 0; margin: 16px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ticker li {
  font-family: var(--mono); font-size: 0.78rem;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
}
.ticker span { display: block; color: var(--muted); font-size: 0.68rem; margin-bottom: 2px; }
.hero-art {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--stroke); box-shadow: var(--shadow);
  background: var(--panel-solid);
}
.hero-art img { width: 100%; }

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: calc(var(--radius) + 4px);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0 0 4px; font-size: 1.25rem; letter-spacing: -0.02em; }
.panel-head p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.accent { border-radius: 12px; flex-shrink: 0; }

.enso-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
.enso-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}
.enso-card .label, .result .label, .meter-block .label, .metrics dt {
  margin: 0; font-family: var(--mono); font-size: 0.72rem;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.enso-card .value {
  margin: 4px 0 6px; font-size: 1.15rem; font-weight: 600;
}
.enso-card .value.ice, .big.ice { color: var(--ice); }
.enso-card .value.snow, .big.snow { color: var(--snow); }
.enso-card .value.warm, .big.warm { color: var(--warm); }
.enso-card .value.teal { color: var(--teal); }
.enso-card .detail, .result .detail { margin: 0; color: var(--muted); font-size: 0.9rem; }

.lab-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.lab-layout { display: grid; gap: 12px; }
.canvas-wrap {
  position: relative;
  min-height: 320px;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 20%, #1a3058, #050a14 70%);
  border: 1px solid var(--stroke);
  touch-action: none;
}
#snowCanvas { width: 100%; height: 100%; display: block; min-height: 320px; }
.canvas-badge {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--mono); font-size: 0.68rem;
  padding: 4px 8px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.45); color: var(--ok);
  border: 1px solid rgba(125, 255, 184, 0.3);
}
.canvas-hint {
  position: absolute; bottom: 8px; left: 0; right: 0;
  text-align: center; margin: 0;
  font-size: 0.75rem; color: rgba(200, 220, 255, 0.55);
  pointer-events: none;
}
.status-board {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}
.status-board h3 { margin: 0 0 10px; font-size: 1rem; }
.metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px;
}
.metrics div {
  padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.22);
}
.metrics dd {
  margin: 2px 0 0; font-family: var(--mono); font-size: 0.95rem; font-weight: 500;
}
.meter-block .label { margin-bottom: 6px; }
.meter-block .label span { color: var(--ice); font-weight: 600; }
.meter {
  height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08);
  overflow: hidden; margin-bottom: 6px;
}
.meter-fill {
  display: block; height: 100%; width: 62%;
  background: linear-gradient(90deg, var(--violet), var(--ice));
  border-radius: inherit; transition: width 0.35s ease;
}
.micro { margin: 0; font-size: 0.8rem; color: var(--muted); }
.warn-note { margin-top: 10px; color: var(--warm); }
.nested-notes {
  margin-top: 12px; font-size: 0.85rem; color: var(--muted);
}
.nested-notes summary { cursor: pointer; color: var(--text); }

.btn {
  border-radius: 999px; padding: 10px 16px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(135deg, rgba(126, 200, 255, 0.95), rgba(94, 224, 200, 0.85));
  color: #061018; font-weight: 600; border-color: transparent;
}
.btn.ghost { background: transparent; }

.region-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
.region-card {
  text-align: left;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s, background 0.15s;
}
.region-card:hover { background: rgba(255, 255, 255, 0.055); }
.region-card.active {
  border-color: rgba(126, 200, 255, 0.55);
  background: rgba(126, 200, 255, 0.1);
}
.region-card h3 {
  margin: 0 0 6px; font-size: 1.02rem; letter-spacing: -0.01em;
}
.signal {
  display: inline-block;
  font-family: var(--mono); font-size: 0.72rem;
  padding: 3px 8px; border-radius: 999px;
  margin-bottom: 8px;
  border: 1px solid var(--stroke);
}
.signal.above { color: var(--ok); border-color: rgba(125, 255, 184, 0.35); background: rgba(125, 255, 184, 0.08); }
.signal.near { color: var(--ice); border-color: rgba(126, 200, 255, 0.35); background: rgba(126, 200, 255, 0.08); }
.signal.below { color: var(--warm); border-color: rgba(255, 176, 128, 0.35); background: rgba(255, 176, 128, 0.08); }
.signal.mixed { color: var(--violet); border-color: rgba(168, 196, 255, 0.35); background: rgba(168, 196, 255, 0.08); }
.region-card .track, .region-card .elev-tip {
  margin: 0 0 6px; color: var(--muted); font-size: 0.88rem;
}
.prep-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.prep-chips span {
  font-size: 0.75rem;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--stroke);
  color: var(--snow);
}

.live-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
.live-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}
.live-card .town {
  margin: 0 0 4px; font-weight: 600;
}
.live-card .meta {
  margin: 0; font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
}
.live-metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
}
.live-metrics div {
  padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.22);
}
.live-metrics dt {
  font-family: var(--mono); font-size: 0.68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.live-metrics dd {
  margin: 2px 0 0; font-family: var(--mono); font-size: 1rem; color: var(--ice);
}

.odds-layout {
  display: grid; gap: 14px;
}
.odds-controls { display: flex; flex-direction: column; gap: 12px; }
.field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.88rem; color: var(--muted);
}
.field em { font-style: normal; color: var(--ice); font-family: var(--mono); font-size: 0.85rem; }
.field select,
.field input[type="number"] {
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.28); color: var(--text);
}
.field input[type="range"] { width: 100%; accent-color: var(--ice); }
.odds-results { margin-top: 4px; }
.result-cards {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
.result {
  padding: 14px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--stroke);
}
.big {
  margin: 4px 0 6px; font-size: 1.35rem; font-weight: 700;
  font-family: var(--mono); letter-spacing: -0.02em;
}
.odds-side {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}
.odds-side h3 { margin: 0 0 8px; font-size: 1rem; }
.bullet-list {
  margin: 0; padding-left: 1.15em; color: var(--muted); font-size: 0.92rem;
}
.bullet-list li { margin-bottom: 6px; }

.export-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 14px;
}
.export-status { font-size: 0.85rem; color: var(--ok); min-height: 1.2em; }

.compare-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.compare-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
.compare-card {
  padding: 14px; border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
}
.compare-card h3 { margin: 0 0 8px; font-size: 1rem; }
.compare-card .empty { margin: 0; color: var(--muted); font-size: 0.9rem; }
.compare-card .cda {
  font-family: var(--mono); font-size: 1.2rem; color: var(--ice); margin: 0 0 8px;
}
.compare-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; }
.delta-card .cda { color: var(--snow); }

.prose-block { margin-bottom: 18px; }
.prose-block:last-child { margin-bottom: 0; }
.prose-block h3 { margin: 0 0 8px; font-size: 1.05rem; }
.prose-block p, .prose-block li { color: var(--muted); }
.prose-block ul, .prose-block ol { padding-left: 1.2em; }
.prose-block strong { color: var(--text); }

.glossary {
  display: grid; gap: 10px; margin: 0;
}
.glossary div {
  padding: 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}
.glossary dt {
  font-family: var(--mono); font-size: 0.85rem; color: var(--ice); margin-bottom: 4px;
}
.glossary dd { margin: 0; color: var(--muted); font-size: 0.92rem; }

.faq-list details {
  padding: 12px 0;
  border-bottom: 1px solid var(--stroke);
}
.faq-list summary {
  cursor: pointer; font-weight: 600; list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::before {
  content: "+"; display: inline-block; width: 1.2em; color: var(--ice);
}
.faq-list details[open] summary::before { content: "–"; }
.faq-list p { margin: 8px 0 0; color: var(--muted); font-size: 0.95rem; }

.site-footer {
  width: min(var(--max), calc(100% - 28px));
  margin: 0 auto 40px;
  padding-top: 8px;
  border-top: 1px solid var(--stroke);
  color: var(--muted); font-size: 0.88rem;
}
.site-footer p { margin: 0 0 4px; }
.footer-links a { color: var(--ice); }

@media (min-width: 720px) {
  .nav-links { display: flex; }
  .hero {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
  }
  .enso-grid { grid-template-columns: 1fr 1fr; }
  .lab-layout { grid-template-columns: 1.4fr 0.9fr; }
  .canvas-wrap, #snowCanvas { min-height: 420px; }
  .region-grid { grid-template-columns: 1fr 1fr; }
  .live-grid { grid-template-columns: 1fr 1fr; }
  .result-cards { grid-template-columns: 1fr 1fr 1fr; }
  .odds-layout { grid-template-columns: 1.25fr 0.85fr; }
  .compare-grid { grid-template-columns: 1fr 1fr 1fr; }
  .glossary { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 960px) {
  .enso-grid { grid-template-columns: repeat(4, 1fr); }
  .region-grid { grid-template-columns: repeat(4, 1fr); }
  .live-grid { grid-template-columns: repeat(3, 1fr); }
  .wrap { padding-top: 28px; }
  .panel { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .meter-fill { transition: none; }
}
