/* Faceshots — map first. The terrain map is the page; everything else floats on it.
   Raw values are quiet (they match the shading); adjusted values carry the weight. */

:root {
  --ink: #17212c;
  --ink-2: #4a5866;
  --ink-3: #7a8794;
  --paper: #ffffff;
  --paper-2: #eef2f5;
  --line: #d5dde4;
  --glass: rgba(255, 255, 255, 0.92);
  --accent: #1f5fa8;       /* glacier blue: selection, adjusted numbers */
  --accent-ink: #ffffff;
  --up: #1f7a4f;
  --down: #b4372f;
  --summit: #5a3fa0;
  --mid: #1f5fa8;
  --base: #2a8a68;
  --shadow: 0 6px 24px rgba(15, 25, 35, 0.18), 0 1px 3px rgba(15, 25, 35, 0.12);
  --radius-lg: 14px;
  --radius-sm: 8px;
  --font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --font-num: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", var(--font);
  --dock-h: 116px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8eef3;
    --ink-2: #b2bfcb;
    --ink-3: #8090a0;
    --paper: #18222d;
    --paper-2: #222e3b;
    --line: #33414f;
    --glass: rgba(22, 32, 43, 0.93);
    --accent: #7fb6f0;
    --accent-ink: #0e1822;
    --up: #6fd19f;
    --down: #ff8f84;
    --summit: #b9a3ff;
    --mid: #7fb6f0;
    --base: #6fd1ad;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e8eef3;
  --ink-2: #b2bfcb;
  --ink-3: #8090a0;
  --paper: #18222d;
  --paper-2: #222e3b;
  --line: #33414f;
  --glass: rgba(22, 32, 43, 0.93);
  --accent: #7fb6f0;
  --accent-ink: #0e1822;
  --up: #6fd19f;
  --down: #ff8f84;
  --summit: #b9a3ff;
  --mid: #7fb6f0;
  --base: #6fd1ad;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.4 var(--font);
  color: var(--ink);
  background: var(--paper-2);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: fixed; z-index: 1000; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.01em;
  background: var(--glass); padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow);
}
.tabs {
  display: flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--glass); box-shadow: var(--shadow);
}
.tabs button {
  border: 0; background: none; padding: 5px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

/* ---------------------------------------------------------------- views */
main { position: fixed; inset: 0; }
.view { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; z-index: 0; background: #e8e8e6; } /* own stack: panel sits above map controls */
.leaflet-container { font: inherit; }
.snow-overlay { image-rendering: auto; }
/* Shaded relief darkens the light base beneath it without adding any hue. */
.hillshade { mix-blend-mode: multiply; } /* opacity lives in the layer options */
.leaflet-top.leaflet-right { top: calc(52px + env(safe-area-inset-top)); }
/* The dock floats 8-10px above the bottom edge; clear it plus a small gap. */
.leaflet-bottom.leaflet-right { bottom: calc(var(--dock-h) + 12px + env(safe-area-inset-bottom)); }
/* Credits stay tucked behind a small chip until tapped. */
.leaflet-control-attribution {
  display: none; font-size: 10px; line-height: 1.4;
  max-width: min(340px, calc(100vw - 32px)); margin: 0 10px 4px 0 !important;
  padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, .92) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.leaflet-control-attribution.is-open { display: block; }
.credits-chip {
  font: inherit; font-size: 10px; line-height: 1; color: #444; cursor: pointer;
  border: 0; border-radius: 999px; padding: 4px 8px;
  background: rgba(255, 255, 255, .8); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}
.credits-chip[aria-expanded="true"] { background: #fff; color: #111; }

/* ---------------------------------------------------------------- pins */
/* The marker element is a zero-size point on the summit; a dot marks it and the label
   hangs off whichever corner layoutPins() picked (pin-ne/nw/se/sw). */
.pin { overflow: visible; }
.pin::before {
  content: ""; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--paper);
}
.pin-lbl {
  position: absolute; display: flex; flex-direction: column; align-items: flex-start;
  background: var(--paper); color: var(--ink);
  border-radius: 6px; padding: 2px 7px 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.08);
  white-space: nowrap; line-height: 1.1;
}
.pin-ne .pin-lbl { left: 0; bottom: 6px; border-bottom-left-radius: 0; }
.pin-nw .pin-lbl { right: 0; bottom: 6px; border-bottom-right-radius: 0; }
.pin-se .pin-lbl { left: 0; top: 6px; border-top-left-radius: 0; }
.pin-sw .pin-lbl { right: 0; top: 6px; border-top-right-radius: 0; }
.pin-e .pin-lbl { left: 6px; top: 0; transform: translateY(-50%); }
.pin-w .pin-lbl { right: 6px; top: 0; transform: translateY(-50%); }
.pin-name { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.pin-val { font-family: var(--font-num); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pin-trend { font-size: 11px; font-weight: 700; }
.pin-trend.up { color: var(--up); }
.pin-trend.down { color: var(--down); }
.pin.is-active { z-index: 1000 !important; }
.pin.is-active .pin-lbl { background: var(--ink); color: var(--paper); }
.pin.is-active .pin-name { color: var(--paper); opacity: .8; }
.pin.is-active::before { background: var(--accent); }

/* Cluster bubble: a zero-size point at the group's centre with a dark pill on it, so it
   reads as "several pins here" next to the white resort labels. Click zooms in. */
.cluster { overflow: visible; cursor: pointer; }
.cluster-lbl {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  background: var(--ink); color: var(--paper);
  border-radius: 999px; padding: 4px 10px 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 0 0 2px var(--paper);
  font-family: var(--font-num); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  white-space: nowrap; line-height: 1.1;
}
.cluster:hover .cluster-lbl, .cluster:focus-visible .cluster-lbl { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------- legend */
.legend {
  position: absolute; z-index: 800; left: 16px;
  top: calc(56px + env(safe-area-inset-top));
  display: flex; align-items: flex-end; gap: 0;
  background: var(--glass); padding: 5px 8px 4px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 10px; color: var(--ink-2); max-width: calc(100vw - 80px); overflow-x: auto;
}
.lg-unit { margin-right: 6px; font-weight: 700; align-self: center; }
.lg-cell { display: flex; flex-direction: column; align-items: flex-start; }
.lg-cell i { display: block; width: 21px; height: 9px; opacity: .8; } /* matches OVERLAY_OPACITY */
.lg-cell + .lg-cell i { border-left: 1px solid var(--paper); }
.lg-cell b { font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---------------------------------------------------------------- dock */
.dock {
  position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(720px, calc(100vw - 20px));
  background: var(--glass); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 8px 10px 6px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.dock-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: flex; background: var(--paper-2); border-radius: 999px; padding: 2px; }
.seg button {
  border: 0; background: none; padding: 5px 11px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); min-height: 32px;
}
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.time-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#run-select {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 3px 8px; font-size: 13px; min-height: 28px;
}
.time-row { margin-top: 6px; flex-wrap: nowrap; }
.play {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--ink); color: var(--paper); display: grid; place-items: center;
}
.play svg { width: 18px; height: 18px; fill: currentColor; }
.play .i-pause, .play[aria-pressed="true"] .i-play { display: none; }
.play[aria-pressed="true"] .i-pause { display: inline; }
.play:disabled { opacity: .4; }
.slider-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#time-label { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
#step-slider { width: 100%; margin: 2px 0 0; accent-color: var(--accent); height: 28px; }
.updated { margin: 0; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.updated span { white-space: nowrap; } /* wrap only between models */
.status { margin: 0; font-size: 11px; color: var(--down); }
.status:empty { display: none; }

/* ---------------------------------------------------------------- resort panel */
.panel {
  position: absolute; z-index: 900;
  top: calc(56px + env(safe-area-inset-top)); right: 56px; bottom: calc(var(--dock-h) + 24px);
  width: 360px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}
.panel-grip { display: none; }
.panel-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.panel-head h2 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -0.01em; }
.panel-sub { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.icon-btn {
  border: 0; background: var(--paper-2); width: 32px; height: 32px; border-radius: 50%;
  flex: none; font-size: 14px; color: var(--ink-2);
}

/* The elevation stack: summit on top, like the mountain. */
.stack { margin: 12px 0 4px; }
.stack-row {
  display: grid; grid-template-columns: 1fr 72px 88px; align-items: baseline;
  padding: 7px 0 7px 10px; border-left: 3px solid var(--line);
}
.stack-row + .stack-row { border-top: 1px solid var(--line); }
.stack-head { border-left-color: transparent; padding-top: 0; padding-bottom: 2px; font-size: 11px; color: var(--ink-3); }
.stack-row.one { grid-template-columns: 1fr 88px; } /* Raw chosen: one column */
.stack-head span { text-align: right; }
.lv-summit.stack-row { border-left-color: var(--summit); }
.lv-mid.stack-row { border-left-color: var(--mid); }
.lv-base.stack-row { border-left-color: var(--base); }
.stack-lvl b { display: block; font-size: 15px; }
.stack-lvl small { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.stack-num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.stack-num.raw { font-size: 17px; color: var(--ink-2); }
.stack-num.main { font-size: 26px; font-weight: 700; color: var(--ink); }
.stack-num.main.na { color: var(--ink-3); font-weight: 400; }

/* Raw / Adjusted / Tuned (panel, All resorts, Scorecard); the caption explains Tuned. */
.kind-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 10px; }
.kind-note { margin: 0; font-size: 12px; color: var(--ink-3); min-width: 0; }

.panel-sec { margin-top: 14px; }
.panel-sec h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 13px; margin: 4px 0; }
.small { font-size: 11px; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-size: 9px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .cursor { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 2; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.raw { stroke-width: 1.4; stroke-dasharray: 4 3; opacity: .85; }
.chart .ln.lv-summit { stroke: var(--summit); }
.chart .ln.lv-mid { stroke: var(--mid); }
.chart .ln.lv-base { stroke: var(--base); }
.chart.trend .trend-ln { stroke: var(--ink); }
.chart.trend circle { fill: var(--ink); }
.chart.trend .dot-lbl { fill: var(--ink); font-weight: 700; }
.chart-key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 0; font-size: 11px; color: var(--ink-2); }
.chart-key i { display: inline-block; width: 14px; height: 0; margin-right: 4px; vertical-align: middle; border-top: 2px solid; }
.chart-key .lv-summit i { border-color: var(--summit); }
.chart-key .lv-mid i { border-color: var(--mid); }
.chart-key .lv-base i { border-color: var(--base); }
.chart-key .solid { border-color: var(--ink-2); }
.chart-key .dash { border-top-style: dashed; border-color: var(--ink-2); }
.trend-sum { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); }
.trend-big { font-size: 18px; font-weight: 700; color: var(--ink); font-family: var(--font-num); }
.trend-big.up { color: var(--up); }
.trend-big.down { color: var(--down); }

/* ---------------------------------------------------------------- table views */
.view-table { background: var(--paper-2); overflow: auto; padding: calc(60px + env(safe-area-inset-top)) 16px 24px; }
body[data-view="all"] .dock .time-row, body[data-view="all"] #model-seg, body[data-view="big"] .dock, body[data-view="brief"] .dock, body[data-view="score"] .dock { display: none; }
body[data-view="all"] .view-table { padding-bottom: calc(var(--dock-h) + 8px); }
.table-wrap { max-width: 760px; margin: 0 auto; }
.table-note { color: var(--ink-2); font-size: 13px; margin: 0 0 8px; }
.view-table .kind-row { margin: 0 0 8px; }
.view-table .kind-row .seg { background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.grid-table {
  width: 100%; border-collapse: collapse; background: var(--paper);
  border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.grid-table th, .grid-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.grid-table thead th { font-size: 13px; background: var(--paper-2); vertical-align: bottom; }
.grid-table thead th small, .grid-table td small { display: block; font-weight: 400; font-size: 10px; color: var(--ink-3); }
.grid-table th[scope="rowgroup"] { text-align: left; vertical-align: top; font-size: 14px; }
.grid-table thead th:first-child, .grid-table thead th:nth-child(2) { text-align: left; }
.grid-table td.lvl { text-align: left; color: var(--ink-2); font-size: 13px; }
.grid-table tr.grp > * { border-top: 2px solid var(--line); }
.grid-table .raw { color: var(--ink-3); }
.grid-table .adj { font-weight: 700; }
.grid-table .sep { color: var(--ink-3); }
.grid-table .na { color: var(--ink-3); }
.placeholder { text-align: center; color: var(--ink-2); font-size: 17px; margin-top: 30vh; }

/* ---------------------------------------------------------------- scorecard */
.view-score .table-wrap { max-width: 860px; }
.sc-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.sc-head .table-note { margin-top: 2px; }
.sc-filters { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 10px 0 6px; }
.sc-filters .seg { background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.sc-lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.sc-model-row { margin-top: 18px; }
.sc-season-pick { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
/* Many seasons scroll inside their own pill, never the page. */
.sc-seasons { position: relative; min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.sc-seasons::-webkit-scrollbar { display: none; }
.sc-seasons button { flex: none; white-space: nowrap; }
.sc-season-empty { margin-top: 12vh; }
.sc-sec { margin-top: 16px; }
.sc-sec h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.sc-sec h3 small { font-weight: 500; font-size: 12px; color: var(--ink-3); margin-left: 4px; }
.sc-note { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--paper);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; color: var(--ink-2); }
/* Tables scroll sideways inside their own box; the page never does. */
.sc-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); background: var(--paper); max-width: 100%; }
.sc-scroll .grid-table { box-shadow: none; border-radius: 0; }
.sc-table th, .sc-table td { white-space: nowrap; }
.sc-table thead th { text-align: right; }
.sc-table thead th:first-child { text-align: left; }
.sc-table tbody th { text-align: left; font-size: 13px; }
.sc-table th small, .sc-table td small { display: block; font-weight: 400; font-size: 10px; color: var(--ink-3); }
.sc-leader thead th.mdl { text-align: center; font-size: 14px; border-bottom: 0; }
.sc-leader thead th.kind { font-size: 11px; font-weight: 600; color: var(--ink-3); }
.sc-leader thead th.kind.sel { color: var(--ink); }
.sc-leader .mdl-first { border-left: 1px solid var(--line); }
.sc-leader td { font-family: var(--font-num); font-size: 15px; }
.sc-leader td[colspan] { text-align: center; }
.sc-table td.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 700; }
.sc-table thead th.sel { color: var(--accent); }
.sc-table .na, .sc-table .na b { color: var(--ink-3); font-weight: 400; }
.sc-table .fc { font-weight: 700; }
.sc-table .ob { color: var(--ink-2); }
.view-score .over { color: var(--down); }
.view-score .under { color: var(--accent); }
.sc-table td.check { color: var(--ink-2); font-style: italic; }
.sc-table td.st { text-align: left; }

.storm { background: var(--paper); border-radius: var(--radius-sm); box-shadow: var(--shadow); margin-bottom: 6px; overflow: hidden; }
.storm-head {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none;
  padding: 9px 12px; text-align: left; min-height: 44px;
}
.storm-name { flex: 1; min-width: 0; font-weight: 700; }
.storm-name small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.storm-nums { font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.storm-nums b { margin-left: 8px; }
.chev { color: var(--ink-3); width: 1em; text-align: center; }
.storm.is-open .storm-head { border-bottom: 1px solid var(--line); }
.storm-detail { padding: 0; }
.storm-detail .sc-scroll { box-shadow: none; border-radius: 0; }

.sc-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sc-charts > p { grid-column: 1 / -1; margin: 0; }
.sc-fig { margin: 0; background: var(--paper); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 8px 10px; min-width: 0; }
.sc-fig figcaption { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.sc-bars text { font-size: 11px; }
.sc-bars text.bin { fill: var(--ink-2); font-weight: 600; }
.sc-bars text.val { fill: var(--ink); font-weight: 700; }
.sc-bars text.na { fill: var(--ink-3); }
.sc-bars .n { fill: var(--ink-3); font-weight: 400; font-size: 9px; }
.sc-bars .zero { stroke: var(--ink-3); stroke-width: 1; }
.sc-bars .bar.over { fill: var(--down); }
.sc-bars .bar.under { fill: var(--accent); }
.chart-key .sw { width: 10px; height: 10px; border: 0; border-radius: 2px; }
.chart-key .sw.over { background: var(--down); }
.chart-key .sw.under { background: var(--accent); }

/* ---------------------------------------------------------------- phone */
@media (max-width: 640px) {
  /* Compact brand on phones so the tabs still fit (each span would stack if the name had more than one). */
  .brand { font-size: 13px; line-height: 1.15; padding: 4px 10px; border-radius: 14px; }
  .brand span { display: block; white-space: nowrap; }
  .tabs button { padding: 5px 9px; font-size: 13px; }
  .topbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .legend { left: 10px; }
  .pin-lbl { padding: 1px 5px 2px; }
  .pin-name { font-size: 10px; }
  .pin-val { font-size: 14px; }
  .leaflet-control-zoom { display: none; }
  .dock { width: calc(100vw - 16px); bottom: calc(8px + env(safe-area-inset-bottom)); }
  .seg button { padding: 5px 9px; font-size: 13px; }
  .updated { font-size: 10.5px; letter-spacing: -0.01em; }
  /* Bottom sheet: sits above the dock, covers the lower half of the map. */
  .panel {
    left: 8px; right: 8px; width: auto; top: auto;
    bottom: calc(var(--dock-h) + 48px + env(safe-area-inset-bottom)); /* clear the map attribution */
    max-height: 58vh; border-radius: var(--radius-lg) var(--radius-lg) 10px 10px;
    padding-top: 8px;
  }
  .panel-grip { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 8px; }
  .grid-table th, .grid-table td { padding: 5px 4px; font-size: 12px; }
  .grid-table td .sep { display: none; }
  .grid-table td .raw, .grid-table td .adj { display: block; }
}
/* The stacked brand, four tabs and the ? button need ~490px; tighten them below that. */
@media (max-width: 500px) {
  .brand { font-size: 11px; padding: 4px 6px; border-radius: 12px; }
  .tabs { gap: 0; }
  .tabs button { padding: 5px 6px; font-size: 12.5px; }
}
@media (max-width: 640px) {
  .sc-head h2 { font-size: 19px; }
  .sc-filters .seg button { padding: 5px 8px; font-size: 12.5px; }
  .kind-note { flex-basis: 100%; } /* the Tuned caption goes below the control */
  .sc-leader td { font-size: 13px; }
  .sc-charts { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .brand { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
.pin:focus-visible { outline: none; }
.pin:focus-visible .pin-lbl { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- help button + guide */
.help-btn {
  flex: none; width: 32px; height: 32px; margin-left: auto; border: 0; border-radius: 50%;
  background: var(--glass); box-shadow: var(--shadow); color: var(--ink);
  font-size: 16px; font-weight: 800; line-height: 1;
}
.help-btn:hover, .help-btn[aria-expanded="true"] { background: var(--ink); color: var(--paper); }

.guide {
  width: min(560px, calc(100vw - 24px)); max-height: min(760px, calc(100dvh - 32px));
  padding: 0; border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow);
  background: var(--paper); color: var(--ink);
}
.guide[open] { display: flex; flex-direction: column; }
.guide::backdrop { background: rgba(15, 25, 35, 0.45); }
.guide-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.guide-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.guide-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 8px; font-size: 14px; }
.guide-lede { margin: 10px 0 0; color: var(--ink-2); }
.guide-sec { margin-top: 16px; }
.guide-sec h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.guide-sec p { margin: 0; }
.guide-steps, .guide-tips { margin: 0; padding-left: 20px; }
.guide-steps li, .guide-tips li { margin: 0 0 6px; }
.guide-dl { margin: 0; }
.guide-dl dt { font-weight: 700; font-size: 13px; color: var(--ink); margin-top: 8px; }
.guide-dl dt:first-child { margin-top: 0; }
.guide-dl dd { margin: 1px 0 0; color: var(--ink-2); }
.guide .up { color: var(--up); font-weight: 700; }
.guide .down { color: var(--down); font-weight: 700; }
.guide-foot { margin: 18px 0 4px; font-size: 12px; color: var(--ink-3); }
.guide-actions { display: flex; justify-content: flex-end; padding: 10px 16px 12px; border-top: 1px solid var(--line); }
.guide-done {
  border: 0; border-radius: 999px; padding: 8px 18px; min-height: 40px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
@media (max-width: 640px) {
  .help-btn { width: 30px; height: 30px; font-size: 15px; }
  .guide { width: calc(100vw - 16px); max-height: calc(100dvh - 24px); }
  .guide-head h2 { font-size: 18px; }
}
/* Brand + four tabs + help button need ~430px at the tightest sizes; below 440px keep
   the brand for screen readers only (it is the page's h1) and give the tabs the room. */
@media (max-width: 440px) {
  .brand {
    display: block; position: absolute; width: 1px; height: 1px; padding: 0; margin: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; box-shadow: none;
  }
}

/* Consensus: run-picker subtitle and the per-model row in the resort panel */
.run-sub { margin: 2px 0 6px; font-size: 12px; color: var(--ink-3); }
.members { margin-top: 10px; }
.member-head { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.member-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.member { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.member small { font-size: 11px; color: var(--ink-3); }
.member b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 17px; color: var(--ink); }
.member b.na { color: var(--ink-3); font-weight: 400; }

/* ---------------------------------------------------------------- briefing */
.view-brief .brief { max-width: 640px; }
.brief-fresh { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.brief-label { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.brief-stale {
  margin: 10px 0 0; padding: 8px 10px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--down) 12%, var(--paper)); color: var(--ink); font-size: 13px; font-weight: 600;
  border-left: 3px solid var(--down);
}
.brief-empty { margin-top: 24vh; font-size: 15px; }
.brief-body { margin-top: 12px; }
.brief-headline { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.brief-lead { margin: 6px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; }
.brief-narr { margin-top: 12px; font-size: 16px; line-height: 1.5; }
.brief-narr p { margin: 0 0 10px; }
.brief-bottom {
  margin: 4px 0 0; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--paper); box-shadow: 0 0 0 1px var(--line); font-size: 15px;
}
.brief-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chip {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink-2); font-size: 14px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.brief-img {
  display: block; width: 100%; max-width: 540px; margin: 14px auto 0; padding: 0; border: 0;
  border-radius: var(--radius-lg); overflow: hidden; background: #101820; box-shadow: var(--shadow);
}
.brief-img img { display: block; width: 100%; height: auto; }
.brief-resorts {
  list-style: none; margin: 14px 0 0; padding: 0; background: var(--paper);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.brief-row {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center;
  gap: 4px 10px; padding: 4px 8px 4px 12px; min-height: 52px;
}
.brief-row + .brief-row { border-top: 1px solid var(--line); }
.brief-name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.brief-range { font-family: var(--font-num); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge {
  min-height: 44px; min-width: 108px; padding: 0 12px; border-radius: 999px; border: 0;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-agree { background: color-mix(in srgb, var(--up) 16%, var(--paper)); color: var(--up); }
.badge-split { background: color-mix(in srgb, var(--summit) 16%, var(--paper)); color: var(--summit); }
/* The explanation: tooltip on hover (mouse) or keyboard focus, toggled by a tap. */
.tip {
  display: none; position: absolute; z-index: 5; right: 8px; top: calc(100% - 4px);
  width: max-content; max-width: min(300px, calc(100vw - 56px));
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper);
  font-size: 13px; line-height: 1.35; box-shadow: var(--shadow); pointer-events: none;
}
@media (hover: hover) { .badge:hover + .tip { display: block; } }
.badge:focus-visible + .tip, .brief-row.tip-open .tip { display: block; }
.brief-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 16px; }
.share-btn {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px;
}
.share-dl { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-weight: 600; }
.share-msg { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--ink-2); }
.share-msg:empty { display: none; }
@media (max-width: 640px) {
  .brief-headline { font-size: 22px; }
  .brief-narr { font-size: 15px; }
}
/* Five tabs and the ? button: 44px tap areas without a taller bar (the hit area reaches past the pill). */
.tabs button, .help-btn { position: relative; }
.tabs button { min-width: 44px; }
.tabs button::after { content: ""; position: absolute; inset: -8px 0; }
.help-btn::after { content: ""; position: absolute; inset: -8px -7px; border-radius: 50%; }
@media (max-width: 380px) {
  .topbar { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .tabs button { padding: 5px 4px; font-size: 12px; }
}
