:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --hover: rgba(11, 11, 11, 0.05);
  --this-year: #2a78d6;
  --highlight: #eb6834;
  --context: #c3c2b7;
  --above: #e34948;
  --below: #2a78d6;
  --neutral: #898781;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --hover: rgba(255, 255, 255, 0.06);
    --this-year: #3987e5;
    --highlight: #d95926;
    --context: #52514e;
    --above: #e66767;
    --below: #3987e5;
    --neutral: #898781;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; margin: 20px 0 0; }

.page-header { padding: 20px 24px 4px; }
.page-header p, .hint, .footnote { color: var(--text-secondary); font-size: 13px; }
.hint { margin-top: 2px; }
.footnote { padding: 0 4px; }
.footnote a { color: inherit; }

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 24px 32px;
  align-items: start;
}
.controls, .results, #content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
#content[hidden] { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.card-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; }

/* Controls */
input, button { font: inherit; color: inherit; }
input[type="search"], input[type="number"] {
  width: 100%;
  padding: 7px 9px;
  background: var(--page);
  border: 1px solid var(--axis);
  border-radius: 6px;
}
button {
  padding: 7px 12px;
  background: var(--page);
  border: 1px solid var(--axis);
  border-radius: 6px;
  cursor: pointer;
}
button:hover { background: var(--hover); }
:focus-visible { outline: 2px solid var(--this-year); outline-offset: 1px; }

.search { display: flex; gap: 8px; margin-top: 10px; }
.search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 190px;
  overflow-y: auto;
}
.search-results button { width: 100%; text-align: left; border: 0; background: none; }
.search-results button:hover { background: var(--hover); }
.search-results .empty { padding: 6px 8px; color: var(--text-secondary); font-size: 13px; }

.map { height: 230px; margin-top: 10px; border-radius: 8px; border: 1px solid var(--border); cursor: crosshair; }
.coords { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.coords label, .slider span { font-size: 13px; color: var(--text-secondary); }
.coords input { margin-top: 3px; }

.slider { display: block; margin-top: 14px; }
.slider span { display: flex; justify-content: space-between; gap: 8px; }
.slider output { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.slider input { width: 100%; margin: 6px 0 0; accent-color: var(--this-year); }

.segmented { display: inline-flex; border: 1px solid var(--axis); border-radius: 6px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; background: none; font-size: 13px; }
.segmented button + button { border-left: 1px solid var(--axis); }
.segmented button[aria-pressed="true"] { background: var(--text-primary); color: var(--surface); }

/* Results */
.explainer summary { font-weight: 600; font-size: 16px; cursor: pointer; }
.explainer ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.explainer p { margin-top: 10px; color: var(--text-secondary); }
.explainer strong { color: var(--text-primary); }
.explainer { font-size: 14px; }
.headline { font-size: 19px; font-weight: 600; line-height: 1.3; margin: 6px 0 4px; }

.enso-now { font-size: 13px; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
.enso-now strong { color: var(--text-primary); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

.pools { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; }
.pool { display: grid; gap: 3px; align-content: start; text-align: left; padding: 12px; border-radius: 8px; background: none; border: 1px solid var(--border); }
.pool[aria-checked="true"] { border-color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--text-primary); }
.pool:disabled { cursor: not-allowed; opacity: 0.5; }
.pool .name { font-weight: 600; }
.pool .tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.pool .meta, .pool .years { font-size: 13px; color: var(--text-secondary); }
.pool .years { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.legend .swatch.block { width: 10px; height: 10px; border: 0; border-radius: 2px; }
.status { color: var(--text-secondary); min-height: 22px; }
.status.error { color: var(--text-primary); font-weight: 600; }
.status.error::before { content: "⚠ "; }
#content.stale { opacity: 0.5; transition: opacity 0.2s; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.tile { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.tile .label { font-size: 13px; color: var(--text-secondary); }
.tile .value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.tile .delta { font-size: 13px; color: var(--text-secondary); }
.tile.current { box-shadow: inset 0 0 0 2px var(--text-primary); }
.tile .tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--text-secondary); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 18px; height: 0; border-top: 2px solid; }
.legend .swatch.dashed { border-top-style: dashed; }

.chart-box { position: relative; height: 340px; margin-top: 8px; }
.chart-box-short { height: 220px; }
.chase-map { height: 480px; cursor: grab; }
.legend .swatch.round { width: 10px; height: 10px; border: 0; border-radius: 50%; }
.verdict { font-weight: 600; }

.table-scroll { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th { color: var(--text-secondary); font-weight: 600; }
th[colspan] { text-align: center; border-left: 1px solid var(--grid); }
.num { text-align: right; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
tbody tr.selected { background: var(--hover); box-shadow: inset 3px 0 0 var(--highlight); }
tbody tr.selected td:first-child { font-weight: 700; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 24px; }
  .page-header { padding: 16px 16px 0; }
}

/* Colour accents */
:root {
  --accent-1: #eb6834;
  --accent-2: #eda100;
  --accent-3: #e34948;
  --accent-4: #4a3aa7;
  --accent-5: #1baf7a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent-1: #d95926;
    --accent-2: #c98500;
    --accent-3: #e66767;
    --accent-4: #9085e9;
    --accent-5: #199e70;
  }
}

.page-header {
  background: linear-gradient(120deg, #16213e 0%, #3a2a6e 50%, #0e5f6b 100%);
  color: #ffffff;
  padding: 22px 24px 20px;
}
.page-header h1::before { content: "🌪️ "; }
.page-header p { color: rgba(255, 255, 255, 0.88); font-size: 14px; }

.card { border-top: 4px solid var(--card-accent, var(--border)); }
#pool-card { --card-accent: var(--accent-4); }
#chase-card { --card-accent: var(--accent-1); }
#enso-card { --card-accent: var(--accent-5); }
.explainer { --card-accent: var(--accent-2); }

.tile { border-top: 3px solid var(--accent, var(--border)); }
.pool { border-left: 4px solid var(--accent, var(--axis)); }

.verdict-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 10px; }
/* Fixed colours (not themed) so the white label always has enough contrast. */
.verdict-badge { color: #ffffff; font-weight: 700; letter-spacing: 0.03em; padding: 6px 14px; border-radius: 999px; }
.verdict-badge[data-rating="active"] { background: #c2410c; }
.verdict-badge[data-rating="average"] { background: #5f5e5a; }
.verdict-badge[data-rating="quiet"] { background: #1c5cab; }
.confidence { font-size: 13px; color: var(--text-secondary); }

@media (max-width: 860px) {
  .page-header { padding: 18px 16px 16px; }
}

/* Tornado map */
/* Grey out the base map so the tornado dots are the loudest thing on it. */
.chase-map .leaflet-tile-pane { filter: grayscale(1) contrast(0.8) brightness(1.1); }
.map-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.legend .swatch.round { border: 1px solid rgba(0, 0, 0, 0.45); }
.leaflet-tooltip { font: 13px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; }
.leaflet-tooltip.map-label { background: rgba(255, 255, 255, 0.92); border: 1px solid #52514e; color: #0b0b0b; font-weight: 600; padding: 2px 7px; box-shadow: none; }
.leaflet-tooltip.map-label::before { display: none; }

/* Tornado details popup */
.leaflet-popup-content { margin: 12px 14px; font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: #0b0b0b; min-width: 220px; }
.tornado-popup h4 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.tornado-popup .when { color: #52514e; margin: 2px 0 8px; }
.tornado-popup dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; }
.tornado-popup dt { color: #52514e; }
.tornado-popup dd { margin: 0; font-weight: 600; }
.tornado-popup .note { color: #52514e; margin: 8px 0 0; font-size: 12px; }
.tornado-popup .dot { width: 12px; height: 12px; margin: 0; border: 1px solid rgba(0, 0, 0, 0.45); }
.chase-map .leaflet-interactive { cursor: pointer; }

/* ENSO outlook */
#ensofc-card { --card-accent: var(--accent-3); }
.verdict-badge[data-rating="elnino"] { background: #b3261e; }
.verdict-badge[data-rating="lanina"] { background: #1c5cab; }
.verdict-badge[data-rating="neutral"] { background: #5f5e5a; }
.numbers { margin-top: 10px; font-size: 13px; }
.numbers summary { cursor: pointer; color: var(--text-secondary); }
.track-record { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.hint a { color: inherit; }
.legend .swatch.band { width: 18px; height: 10px; border: 0; border-radius: 2px; opacity: 0.25; }

/* Hurricane season */
#tropical-card { --card-accent: var(--below); }
.legend .swatch.track { width: 20px; height: 0; border-top: 4px solid; border-radius: 2px; }

/* Never let a chart drawn at an earlier, wider size push the page sideways. */
.card { min-width: 0; }
.chart-box canvas { max-width: 100%; }

/* Terms notice: covers the whole app until "I understand" is pressed */
.terms-overlay { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 8, 18, 0.72); backdrop-filter: blur(3px); }
.terms-notice { width: min(520px, 100%); display: grid; gap: 14px; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--glow); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45); font-size: 15px; }
.terms-notice p { margin: 0; color: var(--text-secondary); }
.terms-notice a { color: inherit; }
.terms-notice button { justify-self: start; padding: 10px 18px; background: var(--brand); color: #ffffff; border-color: transparent; font-weight: 700; }
.terms-off .terms-link { display: none; }

/* Pages */
.pages { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; position: sticky; top: 8px; z-index: 1000; }
.pages button { flex: 1 0 auto; border: 0; background: none; padding: 9px 14px; border-radius: 7px; font-weight: 600; white-space: nowrap; color: var(--text-secondary); }
.pages button:hover { background: var(--hover); }
.pages button[aria-current="page"] { background: var(--text-primary); color: var(--surface); }
.off-page { display: none !important; }

/* Header actions */
.page-header { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.page-header .brand { flex: 1 1 420px; min-width: 0; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-button { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.3); color: #ffffff; border-radius: 999px; padding: 7px 14px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-button:hover { background: rgba(255, 255, 255, 0.24); }

/* Collapsible side panels */
.panel > summary { list-style: none; display: flex; align-items: baseline; gap: 10px; cursor: pointer; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: "▾"; margin-left: auto; color: var(--text-secondary); }
.panel:not([open]) > summary::after { content: "▸"; }
.panel > summary h2 { flex: none; }
.summary-note { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.location-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.location-actions button { font-size: 13px; padding: 7px 8px; }
.saved-places { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.saved-places:empty { display: none; }
.saved-place { display: inline-flex; align-items: center; border: 1px solid var(--axis); border-radius: 999px; overflow: hidden; font-size: 13px; }
.saved-place button { border: 0; border-radius: 0; background: none; padding: 5px 10px; }
.saved-place button.remove { padding: 5px 9px 5px 4px; color: var(--text-secondary); }
.reset { margin-top: 14px; width: 100%; font-size: 13px; }

/* Home */
.home { display: grid; gap: 12px; }
.home-head h2 { font-size: 20px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 12px; }
.home-card { display: grid; gap: 8px; align-content: start; text-align: left; padding: 16px; cursor: pointer; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--card-accent, var(--border)); transition: transform 0.12s, box-shadow 0.12s; }
.home-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); background: var(--surface); }
.home-card .top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.home-card .title { font-weight: 700; font-size: 16px; }
.home-card .verdict-badge { font-size: 12px; padding: 4px 10px; }
.home-card .text { color: var(--text-secondary); font-size: 14px; }
.home-card .big { font-size: 22px; font-weight: 700; line-height: 1.2; }
.home-card .more { color: var(--this-year); font-weight: 600; font-size: 13px; }

/* Page tabs: icon over label */
.pages button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pages .icon { font-size: 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; background: var(--text-primary); color: var(--surface); padding: 10px 16px; border-radius: 8px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }

/* Phones: the page tabs become a bar along the bottom, like an app. */
@media (max-width: 860px) {
  body { padding-bottom: 76px; }
  .pages { position: fixed; top: auto; bottom: 0; left: 0; right: 0; border-radius: 0; border-width: 1px 0 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; justify-content: space-between; }
  .pages button { flex: 1 1 0; flex-direction: column; gap: 1px; padding: 6px 2px; font-size: 11px; min-width: 52px; }
  .pages .icon { font-size: 19px; }
  .toast { bottom: 92px; }
  .header-actions { width: 100%; }
  .page-header p { display: none; }
  .tile .value { font-size: 24px; }
}

@media (max-width: 860px) {
  /* Help is in the header on phones, which leaves room for six clear tabs. */
  .pages button[data-goto="help"] { display: none; }
  .pages button { min-width: 0; }
  .home, .home-head { min-width: 0; }
}

/* ==========================================================================
   Storm theme: deep night-sky surfaces with radar-bright accents.
   Chart colours (--this-year, --highlight, --above, --below, --neutral) were
   checked for colour-blind separation and contrast against these surfaces.
   ========================================================================== */
:root {
  --page: #eef3fb;
  --surface: #ffffff;
  --surface-2: #f5f8fe;
  --text-primary: #0a1224;
  --text-secondary: #46536b;
  --text-muted: #7a879d;
  --grid: #e1e8f3;
  --axis: #c5d0e2;
  --border: rgba(22, 104, 227, 0.16);
  --hover: rgba(22, 104, 227, 0.08);
  --this-year: #1668e3;
  --highlight: #e8590c;
  --context: #c2cad8;
  --above: #e03131;
  --below: #1668e3;
  --neutral: #8a8377;
  --accent-1: #f76707;
  --accent-2: #f5a700;
  --accent-3: #f03e5f;
  --accent-4: #7c4dff;
  --accent-5: #0fb58c;
  --glow: #0878a8;
  --brand: linear-gradient(90deg, #1668e3, #7c4dff);
  --page-glow: radial-gradient(1100px 520px at 8% -8%, rgba(22, 104, 227, 0.12), transparent 70%),
    radial-gradient(900px 480px at 100% 0%, rgba(124, 77, 255, 0.1), transparent 70%);
  --card-shadow: 0 1px 2px rgba(10, 18, 36, 0.06), 0 10px 28px rgba(10, 18, 36, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #060b16;
    --surface: #0e1626;
    --surface-2: #131d31;
    --text-primary: #f2f6ff;
    --text-secondary: #a9b6cf;
    --text-muted: #7384a3;
    --grid: #1c2940;
    --axis: #2b3b5a;
    --border: rgba(96, 165, 250, 0.18);
    --hover: rgba(96, 165, 250, 0.1);
    --this-year: #2f8fff;
    --highlight: #ea640c;
    --context: #4a5b7a;
    --above: #f0524f;
    --below: #2f8fff;
    --neutral: #8f8a7e;
    --accent-1: #ff7a1a;
    --accent-2: #ffd60a;
    --accent-3: #ff4d6d;
    --accent-4: #a78bfa;
    --accent-5: #22d3a6;
    --glow: #22d3ee;
    --brand: linear-gradient(90deg, #22d3ee, #a78bfa);
    --page-glow: radial-gradient(1100px 520px at 8% -8%, rgba(47, 143, 255, 0.2), transparent 70%),
      radial-gradient(900px 480px at 100% 0%, rgba(167, 139, 250, 0.16), transparent 70%),
      radial-gradient(800px 500px at 50% 110%, rgba(34, 211, 166, 0.08), transparent 70%);
    --card-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}

body { background: var(--page-glow), var(--page); background-attachment: fixed; }

/* Header: a storm front rolling through. */
.page-header {
  background: linear-gradient(115deg, #070b24 0%, #1a1464 32%, #6d28d9 58%, #0e7490 82%, #070b24 100%);
  background-size: 220% 100%;
  animation: storm-front 26s ease-in-out infinite alternate;
  border-bottom: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow: 0 8px 30px rgba(34, 211, 238, 0.12);
}
@keyframes storm-front { from { background-position: 0% 0; } to { background-position: 100% 0; } }
@media (prefers-reduced-motion: reduce) { .page-header { animation: none; } }
.page-header h1 { letter-spacing: 0.01em; text-shadow: 0 0 22px rgba(34, 211, 238, 0.55); }
.chip-button { backdrop-filter: blur(6px); }
.chip-button:hover { box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.7), 0 0 18px rgba(34, 211, 238, 0.35); }

/* Cards and tiles */
.card, .home-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--card-shadow);
  border-top-color: var(--card-accent, var(--glow));
}
.home-card:hover { background: linear-gradient(180deg, var(--surface), var(--surface-2)); box-shadow: 0 0 0 1px var(--card-accent, var(--glow)), 0 14px 34px rgba(0, 0, 0, 0.3); }
.home-card .big, .tile .value { letter-spacing: -0.01em; }
.tile, .pool { background: var(--surface-2); }
.tile { border-top-color: var(--accent, var(--glow)); }
.tile.current { box-shadow: inset 0 0 0 2px var(--glow), 0 0 18px color-mix(in srgb, var(--glow) 35%, transparent); }
.pool[aria-checked="true"] { border-color: var(--glow); box-shadow: inset 0 0 0 1px var(--glow), 0 0 18px color-mix(in srgb, var(--glow) 30%, transparent); }
.headline { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-head h2 { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
h3 { color: var(--text-primary); }
h3::before { content: ""; display: inline-block; width: 4px; height: 0.9em; margin-right: 8px; border-radius: 2px; background: var(--brand); vertical-align: -0.08em; }

/* Buttons, tabs and toggles */
button { transition: background 0.12s, box-shadow 0.12s, border-color 0.12s; }
input[type="search"], input[type="number"] { background: var(--surface-2); }
.search button[type="submit"] { background: var(--brand); color: #ffffff; border-color: transparent; font-weight: 600; }
.pages { box-shadow: var(--card-shadow); backdrop-filter: blur(10px); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.pages button[aria-current="page"], .segmented button[aria-pressed="true"] { background: var(--brand); color: #ffffff; box-shadow: 0 0 16px color-mix(in srgb, var(--glow) 40%, transparent); }
.slider input { accent-color: var(--glow); }
.slider output { color: var(--glow); }
:focus-visible { outline-color: var(--glow); }

/* Verdict badges: fixed colours so the white label always has enough contrast. */
.verdict-badge { box-shadow: 0 0 18px rgba(0, 0, 0, 0.25); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); }
.verdict-badge[data-rating="active"] { background: linear-gradient(90deg, #d9480f, #c2255c); box-shadow: 0 0 18px rgba(240, 82, 79, 0.5); }
.verdict-badge[data-rating="average"] { background: linear-gradient(90deg, #4c5a78, #5f5e7a); }
.verdict-badge[data-rating="quiet"] { background: linear-gradient(90deg, #1864ab, #0b7285); box-shadow: 0 0 18px rgba(47, 143, 255, 0.45); }
.verdict-badge[data-rating="elnino"] { background: linear-gradient(90deg, #c92a2a, #d9480f); box-shadow: 0 0 18px rgba(240, 82, 79, 0.5); }
.verdict-badge[data-rating="lanina"] { background: linear-gradient(90deg, #1864ab, #5f3dc4); box-shadow: 0 0 18px rgba(47, 143, 255, 0.45); }
.verdict-badge[data-rating="neutral"] { background: linear-gradient(90deg, #4c5a78, #5f5e7a); }

.track-record { background: var(--surface-2); border-left: 3px solid var(--accent-5); }
.toast { background: var(--brand); color: #ffffff; }
tbody tr.selected { background: var(--hover); }
th { color: var(--glow); }
.map { border-color: var(--axis); box-shadow: 0 0 0 1px var(--border); }

@media (max-width: 860px) {
  .pages button { overflow: hidden; }
  .pages button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 350px) {
  .pages button { font-size: 9.5px; padding: 6px 0; }
}

/* ==========================================================================
   Page banners: each page opens with an animated picture of its subject.
   ========================================================================== */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; min-height: 150px; padding: 22px 24px; border-radius: 14px; color: #ffffff; background: var(--hero-bg, linear-gradient(120deg, #0b1026, #1e3a8a 55%, #0e7490)); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.12) 55%, transparent 100%); pointer-events: none; }
.hero-text { position: relative; z-index: 2; max-width: 58%; }
.hero-text h2 { font-size: 26px; line-height: 1.15; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5); }
.hero-text p { margin-top: 6px; font-size: 14px; color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5); }
.hero-art { position: absolute; z-index: 1; top: 0; right: 0; bottom: 0; width: 48%; max-width: 340px; }
.hero-art svg { width: 100%; height: 100%; display: block; overflow: visible; }

.hero[data-art="home"] { --hero-bg: linear-gradient(120deg, #04121f, #0b3b4f 55%, #0f766e); }
.hero[data-art="tornadoes"] { --hero-bg: linear-gradient(120deg, #0a1512, #1f3a33 50%, #4b5563); }
.hero[data-art="hurricanes"] { --hero-bg: linear-gradient(120deg, #020617, #0c4a6e 55%, #0e7490); }
.hero[data-art="weather"] { --hero-bg: linear-gradient(120deg, #0c2a5b, #0369a1 55%, #f59e0b 130%); }
.hero[data-art="years"] { --hero-bg: linear-gradient(120deg, #150f3d, #4c1d95 60%, #7c3aed); }
.hero[data-art="help"] { --hero-bg: linear-gradient(120deg, #0f172a, #334155); }
.hero[data-art="enso"] { --hero-bg: linear-gradient(120deg, #1e1b4b, #4338ca 55%, #0891b2); }
.hero[data-art="enso"][data-phase="elnino"] { --hero-bg: linear-gradient(120deg, #3b0a1e, #b91c1c 55%, #ea580c); }
.hero[data-art="enso"][data-phase="lanina"] { --hero-bg: linear-gradient(120deg, #0b1445, #1d4ed8 55%, #0891b2); }

.art-spin { animation: art-spin var(--spin, 12s) linear infinite; transform-origin: 120px 75px; }
.art-spin.reverse { animation-direction: reverse; }
@keyframes art-spin { to { transform: rotate(360deg); } }

/* Tornado */
.art-funnel ellipse { animation: art-sway 1.9s ease-in-out infinite; }
@keyframes art-sway { 0%, 100% { transform: translateX(calc(var(--amp) * -1)); } 50% { transform: translateX(var(--amp)); } }
.art-bolt { animation: art-flash 3.4s linear infinite; }
@keyframes art-flash { 0%, 84%, 100% { opacity: 0; } 86% { opacity: 1; } 88% { opacity: 0.15; } 90% { opacity: 1; } 95% { opacity: 0; } }
.art-debris circle { animation: art-fling 1.3s linear infinite; }
@keyframes art-fling { 0% { transform: translate(-30px, 2px); opacity: 0; } 20% { opacity: 1; } 50% { transform: translate(0, -7px); } 80% { opacity: 1; } 100% { transform: translate(30px, 2px); opacity: 0; } }

/* Radar */
.art-blip { animation: art-blip 4s ease-out infinite; }
@keyframes art-blip { 0%, 100% { opacity: 0.15; } 10% { opacity: 1; } 60% { opacity: 0.25; } }

/* Ocean */
.art-wave { animation: art-drift var(--drift, 9s) linear infinite; }
@keyframes art-drift { to { transform: translateX(-240px); } }
.art-glow { animation: art-pulse 4s ease-in-out infinite; transform-origin: 190px 38px; }
@keyframes art-pulse { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.12); opacity: 1; } }

/* Weather */
.art-cloud { animation: art-float 7s ease-in-out infinite; }
@keyframes art-float { 0%, 100% { transform: translateX(-8px); } 50% { transform: translateX(10px); } }
.art-rain line { animation: art-fall 0.9s linear infinite; }
@keyframes art-fall { from { transform: translate(4px, -10px); opacity: 0; } 30% { opacity: 1; } to { transform: translate(-6px, 22px); opacity: 0; } }

/* Years */
.art-bars rect { animation: art-grow 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
@keyframes art-grow { 0%, 100% { transform: scaleY(0.78); } 50% { transform: scaleY(1); } }

/* Help */
.art-ring { animation: art-ripple 3s ease-out infinite; transform-origin: 120px 75px; }
@keyframes art-ripple { from { transform: scale(0.4); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .hero-art * { animation: none !important; }
}
@media (max-width: 860px) {
  .hero { min-height: 128px; padding: 18px 16px; }
  .hero-text { max-width: 62%; }
  .hero-text h2 { font-size: 21px; }
  .hero-text p { font-size: 13px; }
  .hero-art { width: 50%; }
}

/* Phones: the outlook comes first; location and settings sit below it
   (the location button in the header jumps straight to them). */
@media (max-width: 860px) {
  .results { order: 1; }
  .controls { order: 2; }
}

/* Wordmark */
.page-header h1::before { content: none; }
.wordmark { display: flex; align-items: center; gap: 14px; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; text-shadow: none; }
.wordmark img { border-radius: 12px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 26px rgba(34, 211, 238, 0.6); }
.wordmark .mark-a { color: #ffffff; text-shadow: 0 0 24px rgba(255, 255, 255, 0.35); }
.wordmark .mark-b { margin-left: 0.24em; background: linear-gradient(90deg, #22d3ee, #a78bfa 60%, #f472b6); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.55)); }
.page-header p.tagline { margin-top: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; color: #67e8f9; }
.page-header p.tagline + p { margin-top: 4px; }
@media (max-width: 860px) {
  .wordmark { font-size: 28px; gap: 10px; }
  .wordmark img { width: 38px; height: 38px; }
  .page-header p.tagline { display: block; }
}

/* Pacific map */
#pacific-card { --card-accent: var(--accent-3); }
.pacific-map { height: 360px; cursor: crosshair; background: #0b1730; }
.pacific-map .leaflet-tile-pane { filter: grayscale(1) contrast(0.9) brightness(0.75); }
.pacific-map .leaflet-image-layer { image-rendering: auto; mix-blend-mode: normal; }
.scale { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.scale-bar { flex: 1; height: 12px; border-radius: 6px; border: 1px solid var(--axis); background: linear-gradient(90deg, #053061, #2166ac, #67a9cf, #f7f7f7, #ef8a62, #b2182b, #67001f); }
.plain-list { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.plain-list strong { color: var(--text-primary); }
.hero[data-art="pacific"] { --hero-bg: linear-gradient(120deg, #06142e, #0b3a6b 55%, #0e7490); }
.hero[data-art="pacific"][data-phase="elnino"] { --hero-bg: linear-gradient(120deg, #06142e, #7c2d12 60%, #dc2626); }
.art-tongue { animation: art-pulse 5s ease-in-out infinite; transform-origin: 150px 75px; }
@media (max-width: 860px) { .pacific-map { height: 250px; } }

/* Home actions, alerts and changes */
.home-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.home-actions button { font-weight: 600; }
#report-button, #notify-button { background: var(--brand); color: #ffffff; border-color: transparent; }
.changes { border-top-color: var(--accent-2); }
.changes h2 { font-size: 16px; }
.changes ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.changes button { margin-top: 10px; }
#alerts-card { --card-accent: var(--accent-2); }
.alert-options { display: grid; gap: 8px; margin-top: 12px; font-size: 14px; }
.alert-options label { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.alert-options input { width: 18px; height: 18px; accent-color: var(--glow); }

/* Hurricane basin switch, track record */
.basin-toggle { margin-top: 10px; }
#record-card { --card-accent: var(--accent-5); }
#record-table td.right { color: var(--accent-5); font-weight: 700; }
#record-table td.wrong { color: var(--text-muted); }
#record-table td { white-space: nowrap; }

/* Radar page */
#radar-card { --card-accent: #3ddc6a; }
.radar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; margin-top: 12px; }
.radar-map { height: 560px; margin-top: 0; background: #1b2a41; cursor: grab; }
.radar-controls { display: grid; gap: 8px; align-content: start; font-size: 14px; }
.radar-controls .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.radar-controls label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.radar-controls input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--glow); }
.radar-controls select, .radar-controls input[type="date"] { font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--axis); border-radius: 6px; padding: 5px 8px; }
.radar-controls input[type="range"] { width: 100%; accent-color: var(--glow); }
.radar-controls .soft { color: var(--text-secondary); font-size: 13px; }
.radar-controls .soft:empty { display: none; }
#radar-loop { font-size: 13px; padding: 5px 10px; }
.hero[data-art="radar"] { --hero-bg: linear-gradient(120deg, #02140e, #064e3b 55%, #15803d); }
@media (max-width: 1100px) { .radar-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .radar-map { height: 58vh; }
  /* With eight tabs, the bottom bar scrolls sideways instead of squeezing the labels. */
  .pages { justify-content: flex-start; }
  .pages button { flex: 1 0 62px; }
}

/* Rows with display:flex would otherwise ignore the "hidden" attribute. */
.radar-controls [hidden] { display: none !important; }

/* Title: ENSO Atlas + Radar */
.wordmark .mark-c { margin-left: 0.3em; font-size: 0.62em; font-weight: 800; letter-spacing: 0.04em; color: #3ddc6a; text-shadow: 0 0 18px rgba(61, 220, 106, 0.6); vertical-align: 0.18em; }

/* Chase map controls */
.radar-main { display: grid; gap: 8px; min-width: 0; }
.radar-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.radar-toolbar button { font-size: 13px; padding: 6px 12px; font-weight: 600; }
.radar-controls h3 { margin: 6px 0 0; font-size: 14px; }
.layer-options { display: flex; flex-wrap: wrap; gap: 6px; }
.layer-options button { font-size: 12px; padding: 5px 9px; border-radius: 999px; }
.layer-options button[aria-checked="true"] { background: var(--brand); color: #ffffff; border-color: transparent; }
.heat-bar { position: relative; height: 12px; border-radius: 6px; border: 1px solid var(--axis); }
#heat-mark { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; background: #ffffff; border: 1px solid #10151f; border-radius: 2px; }
.heat-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-secondary); }
#heat-play { width: 36px; padding: 5px 0; }
.radar-controls .row input[type="range"] { flex: 1; }
.radar-help summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; }
.radar-help p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-secondary); }
.radar-help b { color: var(--text-primary); }
.hover-tip { background: #10151f; color: #f2f5fb; border: 1px solid #ffd866; border-radius: 8px; font: 600 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; padding: 4px 9px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.hover-tip::before { display: none; }
.score-badge { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; color: #10151f; margin-left: 6px; }
.score-badge.Prime { background: #ff5fd2; } .score-badge.Good { background: #ff7a45; } .score-badge.Fair { background: #ffd866; }
.score-badge.Marginal { background: #8fd694; } .score-badge.Low { background: #9fb0cc; }
.chase-popup dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; }
.chase-popup dt { color: #52514e; }
.chase-popup dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.chase-popup .note { color: #52514e; margin: 8px 0 0; font-size: 12px; }

/* Full screen: the map fills the screen with the controls in a side panel. */
.radar-layout:fullscreen, .radar-layout.expanded {
  background: var(--page); padding: 12px; margin: 0; gap: 12px;
  grid-template-columns: minmax(0, 1fr) 340px; height: 100vh; width: 100vw;
}
.radar-layout.expanded { position: fixed; inset: 0; z-index: 4000; }
.radar-layout:fullscreen .radar-main, .radar-layout.expanded .radar-main { grid-template-rows: auto 1fr; min-height: 0; }
.radar-layout:fullscreen .radar-map, .radar-layout.expanded .radar-map { height: 100%; }
.radar-layout:fullscreen .radar-controls, .radar-layout.expanded .radar-controls { overflow-y: auto; max-height: calc(100vh - 24px); padding-right: 4px; }
@media (max-width: 860px) {
  .radar-layout:fullscreen, .radar-layout.expanded { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; overflow-y: auto; }
  .radar-layout:fullscreen .radar-map, .radar-layout.expanded .radar-map { height: 75vh; }
}

.radar-toolbar button { white-space: nowrap; }
.hover-tip { font-weight: 500; line-height: 1.45; }
.hover-tip strong { color: #ffd866; }

/* Radar page banner: pulses leaving the radar dome, and a throbbing storm core */
.art-beam { animation: art-beam 2.4s ease-out infinite; transform-origin: 60px 74px; }
@keyframes art-beam { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(2.6); opacity: 0; } }
.art-core { animation: art-core 1.6s ease-in-out infinite; transform-origin: 178px 80px; }
@keyframes art-core { 0%, 100% { transform: scale(0.7); opacity: 0.7; } 50% { transform: scale(1.3); opacity: 1; } }

/* Anything marked hidden stays hidden, even if its own style sets display:flex or grid. */
[hidden] { display: none !important; }
