/* Foil Finder: dark "glacier" theme. Deep lake navy with aqua-to-mint accents.
   Dark is the only theme; it does not follow the system setting. */
:root {
  color-scheme: dark;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Outfit", "Inter", system-ui, sans-serif;

  --bg: #06131c;
  --glow-1: rgba(84, 170, 196, .10);
  --glow-2: rgba(84, 190, 160, .07);
  --panel: rgba(255, 255, 255, .045);
  --panel-solid: #0d212d;
  --soft: rgba(255, 255, 255, .06);
  --ink: #eaf6fa;
  --muted: #8eaab9;
  --line: rgba(255, 255, 255, .09);
  --accent: #6bbfd2;
  --accent-ink: #04202a;
  --grad: linear-gradient(135deg, #5db4c9, #62c4a8);
  --good: #4fd0a0;
  --warn: #ffc457;
  --bad: #ff7a70;
  --gust: #ff9a6b;
  --go: #4fd0a0;
  --look: #74b6ea;
  --marginal: #ffc457;
  --no: #7d93a3;
  --offshore: #ff7a70;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -20px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 6% -8%, var(--glow-1), transparent 62%),
    radial-gradient(820px 520px at 100% 0%, var(--glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }
.wrap { max-width: 1220px; margin: 0 auto; padding: 0 18px; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 24px 0 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 13px; }
.logo { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 6px 14px rgba(84, 170, 196, .22)); }
h1 { margin: 0; font: 700 27px/1.1 var(--display); letter-spacing: -.02em; }
.sub { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.status { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
#refresh {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 7px 16px; cursor: pointer; font-weight: 600; font-size: 13px;
  transition: border-color .15s, transform .15s;
}
#refresh:hover { border-color: var(--accent); }
#refresh:active { transform: scale(.97); }
#refresh:disabled { opacity: .5; cursor: default; }

/* ---------- controls ---------- */
.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(250px, 1.35fr) minmax(220px, 1.15fr) minmax(120px, .55fr);
  gap: 16px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
@media (max-width: 980px) { .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .controls { grid-template-columns: minmax(0, 1fr); } }
.field { min-width: 0; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.field-head output { text-transform: none; letter-spacing: 0; font: 600 15px var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.range-pair { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 5px 10px; color: var(--muted); font-size: 13px; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; gap: 3px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 9px;
  padding: 7px 6px; cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--muted);
  transition: color .15s, background .15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed=true] { background: var(--grad); color: var(--accent-ink); font-weight: 700; box-shadow: 0 4px 12px -8px rgba(84, 170, 196, .6); }
.seg.small { max-width: 150px; }

/* ---------- headline ---------- */
.headline {
  position: relative;
  margin: 16px 0; padding: 13px 18px 13px 42px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  font-size: 15.5px;
}
.headline::before { content: ""; position: absolute; left: 18px; top: 20px; width: 10px; height: 10px; border-radius: 50%; background: var(--no); }
.headline b { font-family: var(--display); font-weight: 600; font-size: 16.5px; margin-right: 4px; }
.headline.good { border-color: color-mix(in srgb, var(--go) 45%, transparent); background: color-mix(in srgb, var(--go) 9%, var(--panel)); }
.headline.good::before { background: var(--go); box-shadow: 0 0 0 0 color-mix(in srgb, var(--go) 60%, transparent); animation: pulse 2.2s infinite; }
.headline.good b { color: var(--go); }
.headline.bad { color: var(--bad); }
.headline.bad::before { background: var(--bad); }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .headline.good::before { animation: none; } }

/* ---------- add to home screen ---------- */
.install {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px;
  margin: 0 0 16px; padding: 12px 12px 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  border-radius: 16px;
}
.install[hidden] { display: none; }
.install-icon { width: 44px; height: 44px; border-radius: 11px; display: block; }
.install-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.install-text b { font: 600 15px var(--display); }
.install-text span { font-size: 13px; color: var(--muted); }
.install-go { border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; background: var(--grad); color: var(--accent-ink); font-weight: 700; font-size: 13px; white-space: nowrap; }
.install-close { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.install-close:hover { color: var(--ink); background: var(--soft); }
.install-steps { display: none; grid-column: 1 / -1; margin: 8px 0 2px; padding: 12px 14px 12px 34px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.install-steps li { padding: 2px 0; }
.install-steps b { color: var(--ink); font-weight: 600; }
.install-steps .ico { width: 17px; height: 17px; vertical-align: -3px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install.open[data-mode=ios] .steps-ios, .install.open[data-mode=menu] .steps-menu { display: block; }
@media (max-width: 480px) {
  .install { grid-template-columns: auto minmax(0, 1fr) auto; }
  .install-go { grid-column: 2 / 3; justify-self: start; margin-top: 4px; }
  .install-close { grid-column: 3; grid-row: 1; }
}

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 22px; align-items: start; }
.map-wrap { position: sticky; top: 16px; }
#map { height: min(72vh, 660px); border-radius: 20px; border: 1px solid var(--line); background: var(--soft); z-index: 0; box-shadow: var(--shadow); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 12px 4px 0; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.k-go { background: #22b07a; } .k-look { background: #3b8fd6; } .k-marginal { background: #e59a1c; } .k-no { background: #75828f; }
@media (max-width: 900px) {
  /* Phones: the map pins to the top of the screen and the spot list scrolls
     underneath it, so tapping a spot never pushes the map out of view. */
  :root { --map-h: clamp(300px, 46svh, 440px); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .map-wrap {
    position: sticky; top: 0; z-index: 20; order: -1;
    margin: 0 -18px; padding: 8px 12px 8px;
    background: var(--bg); box-shadow: 0 14px 18px -14px rgba(0, 0, 0, .8);
  }
  #map { height: var(--map-h); border-radius: 16px; }
  .legend { margin: 7px 6px 0; gap: 2px 14px; font-size: 11.5px; }
  .map-key { display: none; }
}
.leaflet-container { font: inherit; }
/* wind markers */
.mk { background: none; border: 0; }
.mk svg { display: block; overflow: visible; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.mk-num { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.mk-gust {
  position: absolute; padding: 0 5px; border-radius: 999px;
  background: #06131c; color: #ffb48f; border: 1px solid rgba(255, 255, 255, .55);
  font: 700 10.5px/15px var(--display); font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* "All spots" button on the map */
.map-all {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  background: var(--panel-solid); color: var(--ink); font: 600 12px var(--font); box-shadow: var(--shadow);
}
.map-all:hover { border-color: var(--accent); }
.map-key { margin: 6px 4px 0; font-size: 12px; color: var(--muted); }
/* standard map colours, dimmed slightly so the map does not glare on the dark page */
.leaflet-tile-pane { filter: brightness(.93) saturate(.92); }
.leaflet-bar { border: 1px solid var(--line) !important; border-radius: 12px !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--panel-solid); color: var(--ink); border-bottom-color: var(--line); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--panel-solid) 80%, transparent) !important; color: var(--muted) !important; border-radius: 8px 0 0 0; }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-tooltip { background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px 10px; }
.leaflet-tooltip-top::before { border-top-color: var(--panel-solid); }

/* ---------- cards ---------- */
.list { display: grid; gap: 14px; }
.card {
  --vc: var(--no);
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 16px 18px 14px 22px; box-shadow: var(--shadow); cursor: pointer; outline: none;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color .15s, transform .15s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--vc); opacity: .9; }
.card.v-go { --vc: var(--go); border-color: color-mix(in srgb, var(--go) 38%, transparent); box-shadow: var(--shadow), 0 18px 50px -28px var(--go); }
.card.v-look { --vc: var(--look); }
.card.v-marginal { --vc: var(--marginal); }
.card.v-offshore { --vc: var(--offshore); }
.card.v-no::before, .card.v-nodata::before { opacity: .35; }
.card:hover { border-color: color-mix(in srgb, var(--vc) 55%, var(--line)); }
.card.active, .card:focus-visible { border-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 12px; }
.rank { flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--soft); color: var(--muted); display: grid; place-items: center; font: 600 13px var(--display); }
.title { flex: 1; min-width: 0; }
.title h3 { margin: 0; font: 600 19px/1.2 var(--display); letter-spacing: -.01em; }
.title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 500; color: var(--ink); }
.score {
  flex: none; min-width: 84px; text-align: center; line-height: 1.1; padding: 7px 12px 8px; border-radius: 14px;
  background: color-mix(in srgb, var(--vc) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--vc) 38%, transparent);
}
.score b { display: block; font: 700 28px/1 var(--display); color: var(--vc); font-variant-numeric: tabular-nums; }
.score span { display: block; margin-top: 3px; font-size: 10.5px; font-weight: 700; color: var(--vc); text-transform: uppercase; letter-spacing: .07em; }

.wind { display: flex; align-items: center; gap: 18px; margin: 14px 0 12px; padding: 12px 14px; background: var(--soft); border-radius: 14px; flex-wrap: wrap; }
.wind.nodata { color: var(--muted); font-size: 14px; }
.wind-now { display: flex; align-items: baseline; gap: 5px; }
.big { font: 700 40px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.unit { color: var(--muted); font-size: 13px; font-weight: 500; }
.wind-meta { flex: 1; min-width: 130px; font-size: 14px; color: var(--muted); }
.wind-meta b { color: var(--ink); font-weight: 600; }
.dir { display: flex; align-items: center; gap: 6px; }
.arrow { width: 16px; height: 16px; flex: none; fill: var(--accent); }
.wind-trend {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  border: 1px solid transparent; background: transparent; border-radius: 12px;
  padding: 6px 8px; margin: -6px -8px; cursor: pointer; text-align: right;
  transition: background .15s, border-color .15s;
}
.wind-trend:hover, .wind-trend:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); outline: none; }
.trend-row { display: flex; gap: 8px; align-items: baseline; }
.more { font-size: 12px; font-weight: 600; color: var(--accent); }
.spark { width: 132px; height: 34px; display: block; }
.spark.placeholder { background: transparent; }
.spark-band { fill: var(--good); opacity: .16; }
.spark-avg { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark-gust { fill: none; stroke: var(--gust); stroke-width: 1; opacity: .7; vector-effect: non-scaling-stroke; }
.trend { font-size: 12px; color: var(--muted); }
.trend.up { color: var(--good); font-weight: 600; }
.trend.down { color: var(--warn); font-weight: 600; }

.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.reasons li { padding-left: 18px; position: relative; }
.reasons li::before { content: ""; position: absolute; left: 2px; top: .58em; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .7; }
.reasons li.good::before { background: var(--good); opacity: 1; }
.reasons li.warn::before { background: var(--warn); opacity: 1; }
.reasons li.bad::before { background: var(--bad); opacity: 1; }
/* icon chips: the spot at a glance */
.tags { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.tag {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 32px; padding: 5px 11px 5px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--soft);
  font-size: 12.5px; font-weight: 500; color: var(--ink); line-height: 1.2;
}
.tag .ico { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tag.hazard { border-color: color-mix(in srgb, var(--warn) 38%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.tag.hazard .ico { stroke: var(--warn); }
.tag.perk { border-color: color-mix(in srgb, var(--good) 34%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.tag.perk .ico { stroke: var(--good); }
.tag.lvl-advanced .ico { stroke: var(--warn); }
.tag.wind { padding: 4px 12px 4px 5px; border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.tag.wind span { display: inline-flex; align-items: baseline; gap: 7px; }
.tag.wind b { font-weight: 600; }
.tag.wind small { font-size: 11.5px; color: var(--muted); }
.mini-compass { width: 22px; height: 22px; flex: none; }
.mini-compass .ring { fill: none; stroke: var(--muted); stroke-width: 1; opacity: .7; }
.mini-compass .best { fill: var(--good); }
.mini-compass .also { fill: var(--good); opacity: .35; }
.mini-compass .north { stroke: var(--muted); stroke-width: 1.4; }
.mini-compass .now { fill: var(--ink); stroke: var(--panel-solid); stroke-width: 1.2; }
.about { margin: 10px 0 0; }
.about summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); list-style: none; }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: "›"; display: inline-block; transition: transform .15s; }
.about[open] summary::after { transform: rotate(90deg); }
.about .notes { margin-top: 6px; }
.works { margin: 12px 0 0; font-size: 13.5px; color: var(--muted); }
.works b { color: var(--ink); font-weight: 600; }
.works + .notes { margin-top: 4px; }
.notes { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }
.foot { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------- footer ---------- */
.bottom { padding: 26px 0 34px; color: var(--muted); font-size: 12.5px; }
.safety { border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); border-radius: 20px; padding: 18px 22px; color: var(--ink); }
.safety h2 { margin: 0 0 10px; font: 600 17px var(--display); display: flex; align-items: center; gap: 10px; }
.safety h2::before { content: "!"; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--warn); color: var(--bg); font: 700 14px/22px var(--display); text-align: center; }
.safety ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px 26px; font-size: 13.5px; color: var(--muted); }
.safety li b { color: var(--ink); font-weight: 600; }
.credits { margin: 14px 4px 0; }
.visits { display: block; margin-top: 6px; opacity: .75; }
.visits[hidden] { display: none; }

/* ---------- wind history modal ---------- */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 12, 18, .66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(960px, 100%); min-width: 0; max-height: calc(100dvh - 24px);
  display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font: 600 22px/1.2 var(--display); letter-spacing: -.01em; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
#detailClose { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--soft); font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
#detailClose:hover, #detailClose:focus-visible { border-color: var(--accent); color: var(--ink); outline: none; }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; min-width: 0; }
.detail-empty { color: var(--muted); padding: 30px 0; text-align: center; margin: 0; }

.now { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.dial { width: 104px; height: 104px; flex: none; }
.dial circle { fill: var(--soft); stroke: var(--line); stroke-width: 1.5; }
.dial-ticks { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.dial text { font-size: 9px; font-weight: 700; fill: var(--muted); text-anchor: middle; }
.dial-arrow { fill: var(--accent); stroke: var(--panel-solid); stroke-width: 1; }
.now-dir { display: flex; flex-direction: column; line-height: 1.25; }
.now-dir b { font: 600 21px var(--display); font-variant-numeric: tabular-nums; }
.now-dir span { color: var(--muted); font-size: 13px; }
.now-box { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 7px 16px 9px; text-align: center; min-width: 74px; }
.now-box small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.now-box b { font: 700 32px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--accent); }
.now-box.gust b { color: var(--gust); }
.now-extra { display: flex; flex-direction: column; color: var(--muted); font-size: 14px; line-height: 1.4; }

.detail-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin: 18px 0 12px; }
.detail-bar .seg.small { max-width: none; min-width: 200px; }

/* the recommended guideline: what the green shading everywhere below means */
.reco {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px;
  border: 1px solid color-mix(in srgb, var(--good) 50%, transparent);
  background: color-mix(in srgb, var(--good) 10%, transparent);
  border-radius: 14px; padding: 9px 16px 9px 10px;
}
.reco-tag { background: var(--good); color: var(--accent-ink); border-radius: 8px; padding: 4px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.reco-item { font-size: 13.5px; color: var(--muted); }
.reco-item small { display: inline-block; margin-right: 7px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--good); }
.reco-item b { font: 600 15px var(--display); color: var(--ink); margin-right: 5px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
.hist { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hist th, .hist td { padding: 5px 8px; text-align: center; white-space: nowrap; }
.hist th { position: sticky; left: 0; z-index: 1; background: var(--panel-solid); color: var(--muted); font-weight: 600; text-align: left; border-right: 1px solid var(--line); }
.hist tr + tr th, .hist tr + tr td { border-top: 1px solid var(--line); }
.hist .time { color: var(--muted); }
.hist .time.hour { color: var(--ink); font-weight: 700; background: var(--soft); }
.hist .n { font: 600 14.5px var(--display); }
.hist .n.in { background: color-mix(in srgb, var(--good) 24%, transparent); }
.hist .n.over { background: color-mix(in srgb, var(--warn) 28%, transparent); }
.hist .arrow { display: block; margin: 2px auto; width: 13px; height: 13px; fill: var(--ink); }
.hist .deg { color: var(--muted); font-size: 11.5px; }

.chart { position: relative; margin-top: 18px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .band { fill: var(--good); opacity: .15; }
.chart .band.soft { opacity: .07; }
.chart .band-edge { stroke: var(--good); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .75; }
.chart .band-label { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; fill: var(--good); paint-order: stroke; stroke: var(--panel-solid); stroke-width: 3px; }
.chart .avg-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.chart .gust-line { fill: none; stroke: var(--gust); stroke-width: 1.5; stroke-linejoin: round; }
.chart .guide { stroke: var(--muted); stroke-width: 1; }
.chart .avg-dot { fill: var(--accent); stroke: var(--panel-solid); stroke-width: 1.5; }
.chart .gust-dot { fill: var(--gust); stroke: var(--panel-solid); stroke-width: 1.5; }
.chart .dir-dot { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.chart-tip {
  position: absolute; top: 14px; pointer-events: none; z-index: 2;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 12px; font-size: 12.5px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5); white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.chart-tip b { font: 600 14px var(--display); }
.chart-tip .t-avg { color: var(--accent); }
.chart-tip .t-gust { color: var(--gust); }
.chart-tip span:last-child:not(.t-gust) { color: var(--muted); }
.legend-line { margin: 6px 0 0; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; justify-content: center; }
.legend-line i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-left: 10px; }
.legend-line i:first-child { margin-left: 0; }
.k-avg { background: var(--accent); }
.k-gust { background: var(--gust); }
.legend-line .k-band, .legend-line .k-in { height: 10px; background: color-mix(in srgb, var(--good) 32%, transparent); border: 1px solid color-mix(in srgb, var(--good) 60%, transparent); }
.legend-line .k-over { height: 10px; background: color-mix(in srgb, var(--warn) 32%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 60%, transparent); }
.legend-line .k-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.table-key { justify-content: flex-start; margin: 8px 2px 0; }
.detail-foot { margin: 16px 0 0; font-size: 13px; text-align: center; }
@media (max-width: 600px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal-card { max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .dial { width: 84px; height: 84px; }
  .now-dir { flex: 1 1 50%; }
  .big { font-size: 34px; }
  .score { min-width: 74px; }
}
