/*
 * NSW South Coast Fishing Forecast — styles
 * Visual language borrowed from nautical charts: italic serif for water names,
 * depth-tint blues for the score scale, chart magenta for cautions and restricted
 * zones, and a "night chart" palette for dark mode.
 */

:root {
  color-scheme: light;
  --page: #f2f6f8;
  --surface: #ffffff;
  --surface-2: #e8f1f6;      /* shoal tint */
  --ink: #13222d;
  --ink-2: #44555f;
  --muted: #6f7f89;
  --rule: #d3dde3;
  --rule-strong: #a9b8c1;
  --magenta: #a3195b;        /* chart magenta: cautions, restricted areas */
  --magenta-wash: #f8e9f0;
  --daylight: #e2a93b;
  --focus: #1c5cab;
  --heat-1: #86b6ef; --heat-2: #5598e7; --heat-3: #2a78d6; --heat-4: #1c5cab; --heat-5: #0d366b;
  --heat-ink-lo: #13222d; --heat-ink-hi: #ffffff;
  --bar: #2a78d6;
  --tide: #1c5cab;
  --tide-wash: rgba(42, 120, 214, 0.10);
  --night-band: rgba(19, 34, 45, 0.05);
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --shadow: 0 8px 24px rgba(19, 34, 45, 0.14);
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "Barlow", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --sans-narrow: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, Arial Narrow, sans-serif;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b1620; --surface: #0f1d28; --surface-2: #142838;
    --ink: #dce6ec; --ink-2: #a6b7c2; --muted: #7d909c; --rule: #22384a; --rule-strong: #34506a;
    --magenta: #e0609a; --magenta-wash: #2a1424; --daylight: #b88a2e; --focus: #6da7ec;
    --heat-1: #184f95; --heat-2: #256abf; --heat-3: #3987e5; --heat-4: #6da7ec; --heat-5: #b7d3f6;
    --heat-ink-lo: #ffffff; --heat-ink-hi: #0b1620;
    --bar: #3987e5; --tide: #6da7ec; --tide-wash: rgba(109, 167, 236, 0.12); --night-band: rgba(0, 0, 0, 0.25);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1620; --surface: #0f1d28; --surface-2: #142838;
  --ink: #dce6ec; --ink-2: #a6b7c2; --muted: #7d909c; --rule: #22384a; --rule-strong: #34506a;
  --magenta: #e0609a; --magenta-wash: #2a1424; --daylight: #b88a2e; --focus: #6da7ec;
  --heat-1: #184f95; --heat-2: #256abf; --heat-3: #3987e5; --heat-4: #6da7ec; --heat-5: #b7d3f6;
  --heat-ink-lo: #ffffff; --heat-ink-hi: #0b1620;
  --bar: #3987e5; --tide: #6da7ec; --tide-wash: rgba(109, 167, 236, 0.12); --night-band: rgba(0, 0, 0, 0.25);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
}
a { color: inherit; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------------ top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 30; }
.topbar .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand svg { flex: none; }
.brand-name { font-family: var(--sans-narrow); font-weight: 600; font-size: 17px; letter-spacing: 0.01em; }
.brand-name span { color: var(--muted); font-weight: 500; }

.search { position: relative; flex: 1; max-width: 560px; }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: var(--radius);
  border: 1px solid var(--rule-strong); background: var(--page); font-size: 16px;
}
.search input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; background: var(--surface); }
.search .glass { position: absolute; left: 13px; top: 12px; color: var(--muted); pointer-events: none; }
.suggest {
  position: absolute; top: 48px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow: auto; padding: 6px 0; display: none;
}
.suggest.open { display: block; }
.suggest .group { padding: 8px 14px 4px; font-size: 13px; color: var(--muted); }
.suggest button {
  display: flex; width: 100%; text-align: left; gap: 12px; align-items: baseline; justify-content: space-between;
  padding: 8px 14px; border: 0; background: none; cursor: pointer;
}
.suggest button:hover, .suggest button.active { background: var(--surface-2); }
.suggest button[disabled] { cursor: not-allowed; opacity: 0.6; }
.suggest .s-name { font-family: var(--serif); font-style: italic; font-size: 17px; }
.suggest .s-meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.suggest .s-note { display: block; font-size: 13px; color: var(--magenta); font-style: normal; font-family: var(--sans); }

.tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn {
  height: 38px; min-width: 38px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 15px;
}
.icon-btn:hover { border-color: var(--rule-strong); }

.settings { position: absolute; right: 24px; top: 60px; width: 340px; background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: none; z-index: 40; }
.settings.open { display: block; }
.settings h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.field select, .field input[type="number"] { width: 100%; height: 38px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--page); padding: 0 10px; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.4; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { height: 38px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--rule-strong); background: var(--surface); cursor: pointer; font-size: 15px; }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn:hover { filter: brightness(0.97); }

/* ------------------------------------------------------------------ start screen */
.start { padding: 56px 0 72px; }
.start h1 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(40px, 6vw, 64px); line-height: 1.05; margin: 0 0 14px; letter-spacing: -0.01em; max-width: 14ch; }
.start .lede { font-size: 18px; color: var(--ink-2); max-width: 60ch; margin: 0 0 36px; }
.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 40px; }
.area h2 { font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.area ul { list-style: none; margin: 0; padding: 0; }
.area li button { background: none; border: 0; padding: 4px 0; cursor: pointer; font-family: var(--serif); font-style: italic; font-size: 17px; text-align: left; }
.area li button:hover { text-decoration: underline; text-underline-offset: 3px; }
.recent { margin: 0 0 40px; }
.recent h2 { font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 15px; }
.chip:hover { border-color: var(--ink-2); }

/* ------------------------------------------------------------------ location header */
.loc-head { padding: 36px 0 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px 32px; align-items: end; }
.loc-name { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(38px, 5.5vw, 60px); line-height: 1.02; margin: 0; letter-spacing: -0.01em; }
.loc-sub { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 26px; font-size: 15px; color: var(--ink-2); align-items: center; }
.loc-sub dt { display: inline; color: var(--muted); margin-right: 6px; }
.loc-sub dd { display: inline; margin: 0; }
.loc-sub .inline-field select { max-width: 270px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); padding: 3px 8px; font-size: 15px; }
.now-score { text-align: right; }
.now-score .big { font-size: 56px; font-weight: 600; line-height: 1; font-family: var(--sans); }
.now-score .big small { font-size: 22px; color: var(--muted); font-weight: 500; }
.now-score .lbl { font-size: 14px; color: var(--ink-2); }

.notes { margin: 18px 0 8px; display: grid; gap: 8px; }
.note { border-left: 3px solid var(--rule-strong); padding: 6px 0 6px 12px; font-size: 15px; color: var(--ink-2); max-width: 95ch; }
.note.restrict, .note.notake, .note.closed { border-left-color: var(--magenta); background: var(--magenta-wash); color: var(--ink); padding-right: 12px; border-radius: 0 var(--radius) var(--radius) 0; }
.note.notake strong, .note.closed strong { color: var(--magenta); }
.note.warn { border-left-color: var(--critical); }
.status-line { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.status-line.err { color: var(--critical); }

/* ------------------------------------------------------------------ sections */
.section { padding: 28px 0 8px; }
.section > h2, .section-head h2 { font-size: 22px; font-weight: 600; margin: 0; font-family: var(--sans-narrow); letter-spacing: 0.005em; }
.section-head { display: flex; align-items: baseline; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head p { margin: 0; color: var(--ink-2); font-size: 15px; }
.section-head .spacer { flex: 1; }

/* best windows */
.windows { display: flex; flex-wrap: wrap; gap: 10px; }
.window {
  display: grid; grid-template-columns: auto auto; gap: 0 14px; align-items: center; text-align: left;
  border: 1px solid var(--rule); background: var(--surface); border-radius: var(--radius); padding: 10px 14px; cursor: pointer; min-width: 190px;
}
.window:hover { border-color: var(--rule-strong); }
.window .w-when { font-weight: 600; font-size: 15px; }
.window .w-time { color: var(--ink-2); font-size: 14px; }
.window .w-score { grid-row: 1 / span 2; grid-column: 2; font-size: 28px; font-weight: 600; justify-self: end; }
.window .w-why { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 32ch; }

/* ------------------------------------------------------------------ heat grid (the neatline frame) */
.neatline { border: 1px solid var(--ink); padding: 3px; background: var(--surface); }
.neatline-inner { border: 1px solid var(--rule-strong); padding: 16px 16px 12px; overflow-x: auto; }
.profile-pick { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.profile-pick select { height: 36px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); padding: 0 10px; max-width: 320px; }
.heat { display: grid; grid-template-columns: 92px repeat(24, minmax(30px, 1fr)); gap: 2px; min-width: 880px; }
.heat .hh { font-size: 12px; color: var(--muted); text-align: left; padding: 0 0 4px 2px; font-variant-numeric: tabular-nums; font-family: var(--sans-narrow); }
.heat .dl { font-size: 14px; padding-right: 8px; display: flex; flex-direction: column; justify-content: center; line-height: 1.15; cursor: pointer; background: none; border: 0; text-align: left; }
.heat .dl b { font-weight: 600; }
.heat .dl span { color: var(--muted); font-size: 12px; }
.heat .dl.sel b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cell {
  position: relative; height: 38px; border: 0; border-radius: 3px; padding: 0; cursor: pointer;
  font-family: var(--sans-narrow); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--heat-ink-lo); background: var(--surface-2);
}
.cell.h1 { background: var(--heat-1); } .cell.h2 { background: var(--heat-2); }
.cell.h3 { background: var(--heat-3); color: var(--heat-ink-hi); }
.cell.h4 { background: var(--heat-4); color: var(--heat-ink-hi); } .cell.h5 { background: var(--heat-5); color: var(--heat-ink-hi); }
:root[data-theme="dark"] .cell.h3 { color: #ffffff; }
.cell.past { opacity: 0.32; }
.cell:hover { filter: brightness(1.12) saturate(1.05); }
.cell.sel { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 2; }
.cell .tm { position: absolute; top: 1px; left: 3px; font-size: 10px; font-weight: 600; line-height: 1; opacity: 0.85; }
.cell .wx { position: absolute; bottom: 1px; right: 3px; font-size: 11px; line-height: 1; color: var(--magenta); font-weight: 700; }
.cell.h3 .wx, .cell.h4 .wx, .cell.h5 .wx { color: #ffd1e6; }
.cell .nowmark { position: absolute; top: -5px; left: 50%; margin-left: -5px; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--magenta); }
.cell.missing { background: transparent; border: 1px solid var(--rule); cursor: default; }
.dayband { grid-column: 2 / -1; height: 4px; position: relative; margin: -1px 0 4px; }
.dayband i { position: absolute; top: 0; bottom: 0; background: var(--daylight); border-radius: 2px; opacity: 0.8; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.scale { display: flex; gap: 2px; align-items: stretch; flex: 1 1 420px; max-width: 520px; }
.scale span { display: flex; flex-direction: column; font-size: 12px; color: var(--ink-2); flex: 1 1 0; min-width: 0; line-height: 1.25; }
.scale span::before { content: ""; display: block; height: 12px; border-radius: 2px; margin-bottom: 3px; }
.scale .s1::before { background: var(--heat-1); } .scale .s2::before { background: var(--heat-2); }
.scale .s3::before { background: var(--heat-3); } .scale .s4::before { background: var(--heat-4); } .scale .s5::before { background: var(--heat-5); }
.key-sun { display: inline-block; width: 22px; height: 4px; background: var(--daylight); border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.key-glyph { font-weight: 700; margin-right: 4px; }
.key-glyph.m { color: var(--magenta); }

/* ------------------------------------------------------------------ day + hour detail */
.detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.panel h3 { font-size: 19px; margin: 0 0 4px; font-weight: 600; }
.panel .sub { color: var(--ink-2); font-size: 15px; margin: 0 0 14px; }
.daystats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 22px; margin: 0 0 18px; font-size: 15px; }
.daystats div { border-top: 1px solid var(--rule); padding-top: 6px; }
.daystats dt { color: var(--muted); font-size: 13px; }
.daystats dd { margin: 0; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--sans-narrow); font-size: 12px; fill: var(--muted); }
.chart .lbl-strong { fill: var(--ink); font-weight: 600; }
.chart .grid { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--rule-strong); stroke-width: 1; shape-rendering: crispEdges; }
.chart .bar { fill: var(--bar); }
.chart .bar.past { opacity: 0.35; }
.chart .bar.sel { fill: var(--heat-5); }
.chart .night { fill: var(--night-band); }
.chart .tide-line { fill: none; stroke: var(--tide); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .tide-area { fill: var(--tide-wash); stroke: none; }
.chart .dot { fill: var(--tide); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; }
.chart .selcol { fill: var(--surface-2); }
.chart-title { font-size: 14px; color: var(--ink-2); margin: 14px 0 2px; }

.hour-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hour-score { font-size: 40px; font-weight: 600; line-height: 1; }
.hour-score small { font-size: 16px; color: var(--muted); font-weight: 500; }
.rating-word { font-size: 15px; color: var(--ink-2); }
.factors { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; }
.factor .f-top { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.factor .f-top b { font-weight: 600; }
.factor .f-top span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; margin: 5px 0 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--bar); border-radius: 4px; }
.factor p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.warns { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.warns li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 8px 10px; border-radius: var(--radius); background: var(--magenta-wash); }
.warns li .ico { flex: none; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--critical); }
.warns li.caution .ico { background: var(--warning); color: #13222d; }
.cond { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; margin: 8px 0 0; }
.cond dt { color: var(--muted); }
.cond dd { margin: 0; font-variant-numeric: tabular-nums; }

details.more { margin-top: 18px; border-top: 1px solid var(--rule); padding-top: 10px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.tbl-wrap { overflow-x: auto; margin-top: 10px; }
table.hourly { border-collapse: collapse; font-size: 13px; width: 100%; min-width: 760px; font-variant-numeric: tabular-nums; }
table.hourly th, table.hourly td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.hourly th:first-child, table.hourly td:first-child { text-align: left; }
table.hourly th { color: var(--muted); font-weight: 500; }
table.hourly tr.sel td { background: var(--surface-2); }

/* ------------------------------------------------------------------ species */
.sortbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); padding: 10px 0; border-bottom: 1px solid var(--rule); }
.sortbar span { margin-right: 6px; }
.seg { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 14px; }
.seg.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.species { border-top: 1px solid var(--ink); }
.species .sp:first-of-type { border-top: 0; }
.sp { border-bottom: 1px solid var(--rule); }
.sp-row { display: grid; grid-template-columns: minmax(200px, 2.2fr) minmax(130px, 1fr) 90px minmax(150px, 1.3fr) 32px; gap: 16px; align-items: center; padding: 12px 4px; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.sp-row:hover { background: var(--surface); }
.sp-name { font-weight: 600; font-size: 16px; }
.sp-name i { display: block; font-family: var(--serif); font-weight: 400; color: var(--muted); font-size: 14px; }
.sp-name .tag { display: inline-block; font-size: 12px; font-weight: 600; border: 1px solid var(--magenta); color: var(--magenta); border-radius: 3px; padding: 0 5px; margin-left: 6px; vertical-align: 2px; }
.pres { font-size: 14px; }
.pres .meter { display: block; margin: 4px 0 0; height: 6px; max-width: 160px; }
.pres .meter i { background: var(--heat-4); }
.act { font-size: 22px; font-weight: 600; text-align: right; }
.act small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.sp-best { font-size: 14px; color: var(--ink-2); }
.chev { transition: transform 0.15s ease; color: var(--muted); justify-self: end; }
.sp.open .chev { transform: rotate(90deg); }
.sp-body { display: none; padding: 4px 4px 22px; }
.sp.open .sp-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; }
.sp-body h4 { font-size: 15px; margin: 6px 0 8px; font-weight: 600; }
.sp-body p { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); max-width: 70ch; }
.lures { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.lure { border-left: 3px solid var(--bar); padding: 2px 0 2px 12px; }
.lure .l-name { font-weight: 600; }
.lure .l-meta { font-size: 14px; color: var(--ink-2); }
.lure .l-how { font-size: 14px; margin-top: 2px; }
.lure .l-col { font-size: 14px; margin-top: 2px; }
.lure .l-col b { font-weight: 600; }
.lure .l-why { font-size: 13px; color: var(--muted); }
.sp-actions { margin-top: 12px; }
.facts { font-size: 14px; display: grid; gap: 6px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0 0 6px; }
.show-more { margin-top: 12px; }
.others { columns: 3 220px; column-gap: 32px; font-size: 14px; margin: 10px 0 0; padding: 0; list-style: none; }
.others li { break-inside: avoid; padding: 3px 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 10px; }
.others li span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ misc */
.loading { color: var(--ink-2); padding: 30px 0; display: flex; gap: 12px; align-items: center; }
.loading .bob { width: 12px; height: 12px; border-radius: 50%; background: var(--magenta); animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.refreshing { opacity: 0.55; transition: opacity 0.2s; }
.error-box { border-left: 3px solid var(--critical); padding: 10px 14px; background: var(--surface); margin: 20px 0; max-width: 80ch; }
.error-box p { margin: 0 0 10px; }
.demo-flag { display: inline-block; background: var(--warning); color: #13222d; font-weight: 600; font-size: 13px; padding: 2px 8px; border-radius: 3px; margin-left: 10px; vertical-align: middle; font-family: var(--sans); font-style: normal; }
.how { font-size: 15px; color: var(--ink-2); max-width: 85ch; }
.how table { border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.how th, .how td { border-bottom: 1px solid var(--rule); padding: 4px 12px 4px 0; text-align: left; }
.how td.n { text-align: right; font-variant-numeric: tabular-nums; }
footer { margin-top: 48px; border-top: 1px solid var(--rule); padding: 22px 0 40px; color: var(--muted); font-size: 13px; }
footer p { margin: 0 0 8px; max-width: 110ch; }

.tooltip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 10px; font-size: 13px; max-width: 290px; display: none; line-height: 1.35; }
.tooltip .tt-v { font-size: 18px; font-weight: 600; }
.tooltip .tt-k { color: var(--ink-2); }
.tooltip .tt-l { color: var(--muted); margin-top: 3px; }

@media (max-width: 920px) {
  .detail { grid-template-columns: 1fr; }
  .sp.open .sp-body { grid-template-columns: 1fr; }
  .sp-row { grid-template-columns: minmax(150px, 2fr) minmax(100px, 1fr) 70px 24px; }
  .sp-row .sp-best { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .topbar .wrap { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-name span { display: none; }
  .loc-head { grid-template-columns: 1fr; }
  .now-score { text-align: left; }
  .settings { left: 16px; right: 16px; width: auto; }
  .sp-row { grid-template-columns: minmax(0, 1fr) 64px 18px; gap: 4px 12px; }
  .sp-row .sp-name { grid-column: 1; grid-row: 1; }
  .sp-row .pres { grid-column: 1; grid-row: 2; }
  .sp-row .act { grid-column: 2; grid-row: 1 / span 2; }
  .sp-row .chev { grid-column: 3; grid-row: 1 / span 2; }
  .window { min-width: 0; flex: 1 1 100%; }
  .neatline-inner { padding: 10px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media print {
  .topbar, .settings, .tools { display: none; }
  .neatline-inner { overflow: visible; }
}
