/* LoudVector's family look (as in its transit apps): navy ink, violet-grey greys, Outfit,
   violet for actions and the |title⟩ brackets, a navy dark theme. On top of that, two weather
   hues: amber for sun and warmth, blue for rain. */
:root {
  color-scheme: light dark;
  --violet: #5b3df5;
  --on-violet: #ffffff;
  --bg: #f5f4fa;
  --surface: #ffffff;
  --surface-2: #eeecf6;
  --ink: #16132e;
  --muted: #5e5a78;
  --line: #e8e6f1;
  --sun: #e08a00;
  --moon: #5b3df5;
  --rain: #1f6fd6;
  --rain-soft: #dbe8fb;
  --snow: #6a86b8;
  --cold: #4a8fe0;
  --warm: #f0a020;
  /* Temperatures, the same in every forecast (public/app.js TEMP_STOPS): -10, 0, 8, 15, 21, 27
     and 33 °C, from frost through mild to heat. */
  --tc0: #7b6be0;
  --tc1: #3f7fe0;
  --tc2: #2aa9c0;
  --tc3: #45b465;
  --tc4: #dcb726;
  --tc5: #ee8522;
  --tc6: #dc412c;
  --alert-bg: #1f6fd6;
  --alert-ink: #ffffff;
  --radius: 16px;
  --gutter: 16px;
  --shadow: 0 1px 2px rgb(22 19 46 / 0.06), 0 2px 10px rgb(22 19 46 / 0.05);
  --font: Outfit, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --violet: #9c8cff;
    --on-violet: #16132e;
    --bg: #16132e;
    --surface: #1e1a3c;
    --surface-2: #2a2550;
    --ink: #f3f2fa;
    --muted: #ada9cb;
    --line: #2e2950;
    --sun: #ffbf47;
    --moon: #b9adff;
    --rain: #6aaeff;
    --rain-soft: #243a63;
    --snow: #a9bde3;
    --cold: #6aaeff;
    --warm: #ffbf47;
    --tc0: #a597ff;
    --tc1: #6aaeff;
    --tc2: #4fd0dc;
    --tc3: #6fd68a;
    --tc4: #ffd54a;
    --tc5: #ffa24a;
    --tc6: #ff6a55;
    --alert-bg: #2f6fd0;
    --alert-ink: #ffffff;
    --shadow: none;
  }
}

@font-face { font-family: Outfit; src: url("fonts/Outfit-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Outfit; src: url("fonts/Outfit-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Outfit; src: url("fonts/Outfit-SemiBold.ttf") format("truetype"); font-weight: 600 900; font-display: swap; }

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font: 16px/1.4 var(--font); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100svh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--violet); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
/* The bar's background runs the full width; its title and buttons line up with the 640 px
   column the page sits in (so on a wide screen they aren't off at the far edges). */
:root { --column: 640px; }
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  min-height: 56px;
  padding: env(safe-area-inset-top)
    max(var(--gutter), env(safe-area-inset-right), calc((100% - var(--column)) / 2 + var(--gutter) - 8px)) 0
    max(var(--gutter), env(safe-area-inset-left), calc((100% - var(--column)) / 2 + var(--gutter)));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.title { margin: 0 auto 0 0; font-size: 1.375rem; font-weight: 500; letter-spacing: 0.02em; }
.ket { color: var(--violet); font-weight: 400; }
.title .ket:first-child { margin-right: 0.06em; }
.title .ket:last-child { margin-left: 0.04em; }
.bar-title { margin: 0 auto 0 0; min-width: 0; font-size: 1.125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 22px;
  background: transparent; color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.text-btn {
  min-height: 40px; padding: 0 14px; border: 0; border-radius: 20px;
  background: var(--surface-2); color: var(--ink); font-weight: 500;
}

svg.ui { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Page ---------- */
.page {
  width: 100%; max-width: var(--column); margin: 0 auto;
  padding: 4px max(var(--gutter), env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.loading { color: var(--muted); text-align: center; padding: 48px 0; }
.stale { margin: 0 0 10px; color: var(--muted); font-size: 0.8125rem; text-align: center; }

/* ---------- Rain alert ---------- */
.alert {
  margin: 0 0 12px; padding: 14px 16px 12px;
  border-radius: var(--radius); background: var(--alert-bg); color: var(--alert-ink);
}
.alert-main { display: flex; gap: 12px; align-items: flex-start; color: inherit; text-decoration: none; }
/* "Got it", under the text (36 px icon + 12 px gap in). */
.alert-ok {
  display: block; min-height: 36px; margin: 10px 0 0 48px; padding: 0 16px;
  border: 1.5px solid rgb(255 255 255 / 0.7); border-radius: 18px;
  background: transparent; color: inherit; font: inherit; font-weight: 500; font-size: 0.9375rem;
}
.alert-ok:hover { background: rgb(255 255 255 / 0.14); }
.alert-ok:focus-visible { outline-color: #ffffff; }
.alert svg { flex: none; width: 36px; height: 36px; --wx-cloud: transparent; }
.alert .wx { --sun: #ffd27a; --rain: #ffffff; --snow: #ffffff; color: #ffffff; }
.alert strong { display: block; font-size: 1.0625rem; font-weight: 600; }
.alert p { margin: 2px 0 0; opacity: 0.92; font-size: 0.9375rem; }
.alert.new { animation: drop-in 0.35s ease-out; }
@keyframes drop-in { from { transform: translateY(-6px); opacity: 0; } }
/* Beach news (a beach alert still among the device's notifications), in the beach violet. */
.alert.news { background: var(--violet); color: var(--on-violet); }
.alert.news svg { padding: 4px; color: currentColor; }
@media (prefers-reduced-motion: reduce) { .alert, .icon-btn.spin svg { animation: none; } }

/* ---------- Place cards ---------- */
.places { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.card {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 2px 12px; align-items: center;
  width: 100%; padding: 14px 16px; border: 0; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink);
  text-align: left; text-decoration: none;
}
a.card:hover { background: color-mix(in srgb, var(--surface) 92%, var(--violet)); }
.card .wx { grid-row: 1 / span 2; width: 48px; height: 48px; }
.card .name { min-width: 0; font-size: 1.0625rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .name .here-mark { width: 14px; height: 14px; margin-right: 4px; vertical-align: -1px; color: var(--violet); }
.card .sub { min-width: 0; color: var(--muted); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .temp { grid-row: 1; grid-column: 3; justify-self: end; font-size: 1.75rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.card .hilo { grid-row: 2; grid-column: 3; justify-self: end; color: var(--muted); font-size: 0.8125rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card .outlook {
  grid-column: 2 / span 2; margin-top: 6px;
  display: flex; align-items: center; gap: 6px;
  font-size: 0.875rem; color: var(--muted);
}
.card .outlook.wet { color: var(--rain); font-weight: 500; }
.card .outlook svg { flex: none; width: 16px; height: 16px; }
/* The time there, for places whose clocks differ from the phone's. */
.card .outlook .local-clock {
  display: inline-flex; flex: none; align-items: center; gap: 4px; margin-left: auto; padding-left: 8px;
  color: var(--muted); font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.card .outlook .local-clock svg { width: 14px; height: 14px; }
/* What to wear, in short. */
.card .wear-line {
  grid-column: 2 / span 2; display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 2px;
  color: var(--muted); font-size: 0.8125rem;
}
.card .wear-line svg { flex: none; width: 16px; height: 16px; }

/* Edit mode: a drag handle, and move and remove buttons, on each card. */
.edit-hint { margin: 0 0 10px; color: var(--muted); font-size: 0.875rem; text-align: center; }
.card.editing { grid-template-columns: auto 1fr auto; padding: 8px 8px 8px 4px; gap: 2px 4px; }
.card.editing .name { grid-row: 1; grid-column: 2; }
.card.editing .sub { grid-row: 2; grid-column: 2; }
.card.editing .tools { grid-row: 1 / span 2; grid-column: 3; display: flex; }
.drag-handle {
  grid-row: 1 / span 2; grid-column: 1;
  display: grid; place-items: center; width: 40px; height: 44px;
  color: var(--muted); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.drag-handle svg { width: 22px; height: 22px; }
.sorting li { position: relative; transition: transform 0.15s ease; }
.sorting li.dragging { z-index: 2; transition: none; }
.sorting li.dragging .card { box-shadow: 0 10px 28px rgb(0 0 0 / 0.22); cursor: grabbing; }
.sorting li.dragging .drag-handle { cursor: grabbing; color: var(--violet); }
@media (prefers-reduced-motion: reduce) { .sorting li { transition: none; } }
.tools .icon-btn:disabled { opacity: 0.3; cursor: default; }
.tools .remove { color: #c0362c; }
@media (prefers-color-scheme: dark) { .tools .remove { color: #ff8a80; } }

.add-card {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; margin-top: 10px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: transparent; color: var(--violet); font-weight: 500; text-decoration: none;
}
.add-card svg { width: 20px; height: 20px; }

.offer {
  display: grid; gap: 10px; margin: 0 0 12px; padding: 16px;
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.offer h2 { margin: 0; font-size: 1.0625rem; font-weight: 600; }
.offer p { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.offer .row { display: flex; flex-wrap: wrap; gap: 8px; }
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 22px;
  background: var(--violet); color: var(--on-violet); font-weight: 500; text-decoration: none;
}
.primary svg { width: 18px; height: 18px; }
.ghost { min-height: 44px; padding: 0 16px; border: 0; border-radius: 22px; background: transparent; color: var(--muted); font-weight: 500; }
.note { margin: 0; color: var(--muted); font-size: 0.875rem; }
.note.warn { color: #b3261e; }
.note.center { margin-top: 8px; text-align: center; }
.note.pad { padding: 12px; }
/* Notifications full (app.js pushNote): friendly, not an error, with the chocolate link. */
.push-full { display: grid; justify-items: start; gap: 6px; }
.push-full p { margin: 0; }
.push-full .kofi { display: inline-flex; align-items: center; min-height: 36px; color: var(--violet); font-weight: 600; text-decoration: none; }
.gap { height: 16px; }
@media (prefers-color-scheme: dark) { .note.warn { color: #ff8a80; } }

.welcome { padding: 32px 8px 8px; text-align: center; }
.welcome .wx { width: 88px; height: 88px; }
.welcome h2 { margin: 8px 0 4px; font-size: 1.375rem; font-weight: 600; }
.welcome p { margin: 0 auto 20px; max-width: 30ch; color: var(--muted); }

/* ---------- Search ---------- */
.search { position: relative; margin: 4px 0 12px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; min-height: 50px; padding: 0 16px 0 44px;
  border: 1.5px solid var(--line); border-radius: 25px; background: var(--surface); font-size: 1.0625rem;
}
.search input:focus { outline: none; border-color: var(--violet); }
.results { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.results button {
  display: grid; gap: 0 12px; grid-template-columns: 28px 1fr auto; align-items: center;
  width: 100%; min-height: 56px; padding: 8px 12px; border: 0; border-radius: 12px;
  background: transparent; text-align: left;
}
.results button:hover { background: var(--surface); }
.results .flag { font-size: 1.25rem; text-align: center; }
.results .where { display: block; color: var(--muted); font-size: 0.875rem; }
.results .added { color: var(--muted); font-size: 0.8125rem; }

/* ---------- Detail ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 0 16px; align-items: center; padding: 8px 4px 16px; }
.hero .wx { width: 96px; height: 96px; grid-row: 1 / span 5; }
.hero .now { font-size: 3.5rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.hero .desc { font-size: 1.125rem; font-weight: 500; }
.hero .more { color: var(--muted); font-size: 0.9375rem; }
.hero .where-sub { grid-column: 2; margin-top: 6px; color: var(--muted); font-size: 0.875rem; }
.hero .local-time { grid-column: 2; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
/* What to wear: the main layer, then anything to bring. */
.wear-list { margin: -6px 0 0; padding: 0 0 0 20px; }
.wear-list li { margin: 3px 0; }

.panel { margin: 0 0 12px; padding: 14px 16px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 10px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.panel .lead { margin: -4px 0 12px; font-weight: 500; }
.panel .lead.wet { color: var(--rain); }

.nowcast { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; align-items: end; height: 64px; }
.nowcast i { display: block; min-height: 3px; border-radius: 4px 4px 2px 2px; background: var(--line); }
.nowcast i.wet { background: var(--rain); }
.nowcast i.maybe { background: color-mix(in srgb, var(--rain) 40%, var(--surface)); }
.panel .source { margin: 10px 0 0; color: var(--muted); font-size: 0.75rem; }
/* The latest wind at the nearest station, above a beach's hour-by-hour strip. */
.wind-now { margin: -2px 0 12px; font-size: 0.875rem; }
.wind-now .src { color: var(--muted); }
.nowcast-axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

/* The hour-by-hour strips scroll sideways: a finger swipes them, so phones hide the scrollbar;
   with a mouse there's a thin one, and the strip can be dragged too (app.js). */
.hours { display: flex; gap: 4px; margin: 0 -16px; padding: 0 16px 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.hours.dragging { scroll-snap-type: none; cursor: grabbing; }
@media (hover: hover) and (pointer: fine) { .hours { cursor: grab; -webkit-user-select: none; user-select: none; } }
@media (hover: none) {
  .hours { padding-bottom: 2px; scrollbar-width: none; }
  .hours::-webkit-scrollbar { display: none; }
}
.hour { flex: none; display: grid; justify-items: center; gap: 4px; width: 52px; padding: 6px 0; border-radius: 12px; scroll-snap-align: start; font-variant-numeric: tabular-nums; }
.hour.first { background: var(--surface-2); }
.hour .h { color: var(--muted); font-size: 0.8125rem; }
.hour .wx { width: 30px; height: 30px; }
.hour .t { font-weight: 600; }
.hour .p { min-height: 1.1em; color: var(--rain); font-size: 0.75rem; font-weight: 500; }

.days { display: grid; margin: 0; padding: 0; list-style: none; }
.day {
  display: grid; grid-template-columns: 4.6em 28px 3em 2.6em 1fr 2.6em; gap: 8px; align-items: center;
  min-height: 46px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.day:first-child { border-top: 0; }
.day .d { font-weight: 500; }
.day .wx { width: 28px; height: 28px; }
.day .p { color: var(--rain); font-size: 0.8125rem; font-weight: 500; }
.day .lo { color: var(--muted); text-align: right; }
.day .hi { font-weight: 600; }
.range { position: relative; height: 6px; border-radius: 3px; background: var(--surface-2); }
.range i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, var(--cold), var(--warm)); } /* the day's own colours come inline */

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 12px; }
.fact { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.fact dt { color: var(--muted); font-size: 0.8125rem; }
.fact dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.fact dd small { color: var(--muted); font-size: 0.875rem; font-weight: 400; }
.fact .arrow { display: inline-block; width: 16px; height: 16px; margin-left: 4px; vertical-align: -2px; color: var(--muted); }

/* ---------- Settings ---------- */
.group { margin: 0 0 12px; padding: 4px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
.setting .label small { display: block; color: var(--muted); font-size: 0.8125rem; }
.seg { display: inline-flex; padding: 3px; border-radius: 20px; background: var(--surface-2); }
/* The language switch's six choices wrap onto a second line on a narrow screen. */
.setting.stack .seg { flex-wrap: wrap; align-self: flex-start; }
.seg button { min-width: 52px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 17px; background: transparent; color: var(--muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .seg button[aria-pressed="true"] { background: var(--violet); color: var(--on-violet); } }
.switch { position: relative; flex: none; width: 52px; height: 32px; border: 0; border-radius: 16px; background: var(--line); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--violet); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.prose { color: var(--muted); font-size: 0.9375rem; }
.prose h2 { margin: 20px 0 6px; color: var(--ink); font-size: 1rem; font-weight: 600; }
.prose p { margin: 0 0 10px; }

/* ---------- Footer ---------- */
.foot { display: grid; justify-items: center; gap: 2px; margin-top: 28px; text-align: center; }
.foot a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 8px; font-size: 0.8125rem; }
.foot .kofi { color: var(--muted); }
.foot .credit { margin: 0; color: var(--muted); font-size: 0.75rem; }
.foot .credit a { min-height: 0; padding: 0; font-size: inherit; color: inherit; }
.built-by { gap: 6px; color: var(--violet); font-weight: 500; text-decoration: none; }
.built-by:hover { text-decoration: underline; }
.built-by .lv-mark { width: 18px; height: 18px; flex: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - 32px); padding: 8px 8px 8px 16px; border-radius: 24px;
  background: var(--ink); color: var(--bg); transform: translateX(-50%); box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
}
.toast button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 18px; background: transparent; color: var(--bg); font-weight: 600; text-decoration: underline; }

/* ---------- Weather icons ---------- */
svg.wx { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.hero svg.wx, .welcome svg.wx { stroke-width: 1.2; }
.wx .sun { stroke: var(--sun); }
.wx .moon { stroke: var(--moon); }
.wx .cloud { stroke: currentColor; fill: var(--wx-cloud, var(--surface)); }
.wx .rain { stroke: var(--rain); }
.wx .snow { stroke: var(--snow); stroke-width: 2.4; }
.wx .bolt { stroke: var(--sun); }
.wx .fog { stroke: currentColor; opacity: 0.7; }
.hours .wx, .days .wx { color: var(--muted); }
.page > .welcome .wx, .hero .wx { --wx-cloud: var(--bg); }

/* Notifications row: a switch the browser can't use is shown but greyed out. */
.switch:disabled { opacity: 0.4; cursor: default; }
.group .note.pad { padding: 0 0 12px; }

/* stats.html: the running accuracy test */
.stat-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.stat { display: grid; align-content: start; gap: 6px; padding: 12px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--muted); font-size: 0.8125rem; line-height: 1.3; }
.stat .big { color: var(--ink); font-size: 1.75rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.scores { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
.scores th, .scores td { padding: 8px 4px; border-top: 1px solid var(--line); text-align: right; }
.scores thead th { border-top: 0; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.scores tbody th { text-align: left; font-weight: 500; }
.scores .muted { color: var(--muted); }
.chart { display: block; width: 100%; height: auto; font-size: 9px; fill: var(--muted); }
.chart .gridline { stroke: var(--line); }
.chart polyline { fill: none; stroke-width: 2; }
.chart .s-alert { stroke: var(--rain); fill: var(--rain); }
.chart polyline.s-alert, .chart polyline.s-radar, .chart polyline.s-persist { fill: none; }
.chart .s-radar { stroke: var(--violet); fill: var(--violet); }
.chart .s-persist { stroke: var(--muted); fill: var(--muted); stroke-dasharray: 3 3; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 8px 0 0; color: var(--muted); font-size: 0.75rem; }
.legend .key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.legend .key.s-alert { background: var(--rain); }
.legend .key.s-radar { background: var(--violet); }
.legend .key.s-persist { background: var(--muted); }

/* "Rain alerts for <place>" on a place's page, and the bell on its card */
.group.watch { margin: 0 0 12px; }
.card .name .watch-mark { width: 14px; height: 14px; margin-left: 6px; vertical-align: -1px; color: var(--violet); }

/* Radar map on a place's page */
.radar-map { position: relative; }
/* One finger scrolls the page as usual; two pinch the map (public/app.js). */
.radar-map svg {
  display: block; width: 100%; height: auto; border-radius: 12px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
}
.radar-map svg.moving { cursor: grabbing; }
.map-btn.centre { margin-top: 4px; color: var(--violet); }
.map-hint { margin: 6px 0 0; color: var(--muted); font-size: 0.75rem; text-align: center; }
.map-hint .by-touch { display: none; }
@media (pointer: coarse) {
  .map-hint .by-touch { display: inline; }
  .map-hint .by-mouse { display: none; }
}
.radar-map.placeholder { aspect-ratio: 180 / 150; border-radius: 12px; background: var(--surface-2); }
.radar-zoom { position: absolute; top: 8px; right: 8px; display: grid; gap: 6px; }
.map-btn {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 10px; background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.18); color: var(--ink);
}
.map-btn svg { width: 20px; height: 20px; }
.map-btn:hover { background: var(--surface); }
.map-btn:disabled { opacity: 0.4; cursor: default; }
.radar .sea { fill: #dde6f2; }
.radar .land { fill: #f6f5f0; }
.radar .lake { fill: #dde6f2; }
.radar .coastline { fill: none; stroke: #7b809c; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.8; }
.radar .border { fill: none; stroke: #7b809c; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; opacity: 0.7; }
.radar .spot { fill: var(--violet); stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.radar .spot-ring { fill: none; stroke: var(--violet); stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: 0.6; }
.radar-controls { display: flex; align-items: center; gap: 2px; margin-top: 8px; }
.radar-controls .icon-btn:disabled { opacity: 0.3; cursor: default; }
.radar-slider { flex: 1; min-width: 0; accent-color: var(--violet); }
.radar-time { margin: 2px 0 0; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.radar-legend { display: flex; align-items: center; gap: 3px; margin-top: 10px; color: var(--muted); font-size: 0.75rem; }
.radar-legend i { flex: 1; height: 8px; border-radius: 2px; }
.radar-legend span:first-child { margin-right: 4px; }
.radar-legend span:last-child { margin-left: 4px; }
@media (prefers-color-scheme: dark) {
  .radar .sea, .radar .lake { fill: #1b1840; }
  .radar .land { fill: #2b2752; }
  .radar .coastline { stroke: #8e88b8; }
  .radar .border { stroke: #8e88b8; }
}

.section-title { margin: 24px 4px 4px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.panel .note.weak { margin-top: 8px; font-size: 0.8125rem; }

/* ---------- Beach alerts ---------- */
.beach-link { margin-top: 10px; padding: 0 16px; text-align: center; }
.beach-link svg { flex: none; }
.welcome-mark { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 36px; background: var(--surface-2); color: var(--violet); }
.welcome-mark svg { width: 40px; height: 40px; }
.list-head { margin: 18px 4px 6px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.list-head:first-child { margin-top: 4px; }
.page > .note { margin: 0 4px 8px; }
.results button:disabled { cursor: default; }

.beach-card .sport-mark { grid-row: 1 / span 2; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 24px; background: var(--surface-2); color: var(--violet); }
.beach-card .sport-mark svg { width: 28px; height: 28px; }
.beach-card .tag { grid-row: 1; grid-column: 3; justify-self: end; padding: 2px 10px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.beach-card .outlook.good, .beach-days .good { color: var(--violet); font-weight: 500; }
.card .name .watch-mark { width: 14px; height: 14px; margin-left: 6px; vertical-align: -1px; color: var(--violet); }

.beach-days { display: grid; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.beach-days li { display: grid; grid-template-columns: 6.5em 1fr; gap: 8px; align-items: center; min-height: 40px; border-top: 1px solid var(--line); color: var(--muted); }
.beach-days li:first-child { border-top: 0; }
.beach-days .d { color: var(--ink); font-weight: 500; }

/* Hour by hour: daylight hours, those that suit you in violet. */
.bhours { gap: 3px; }
.bhour { flex: none; display: grid; justify-items: center; gap: 2px; width: 56px; padding: 4px 0 8px; border-radius: 12px; font-variant-numeric: tabular-nums; font-size: 0.8125rem; }
.bhour.first { margin-left: 10px; }
.bhour.first:first-child { margin-left: 0; }
.bhour .dl { min-height: 1.2em; color: var(--ink); font-weight: 600; white-space: nowrap; }
.bhour .h { color: var(--muted); }
.bhour .arrow { width: 18px; height: 18px; color: var(--ink); }
.bhour .kn { font-size: 1.125rem; font-weight: 600; line-height: 1.1; }
.bhour .g { color: var(--muted); font-size: 0.75rem; }
.bhour .g::before { content: "G "; }
.bhour .side { min-height: 1.2em; padding: 0 6px; border-radius: 8px; font-size: 0.6875rem; font-weight: 500; white-space: nowrap; }
.bhour .side.onshore, .bhour .side.side-on, .bhour .side.side { color: var(--ink); background: var(--surface-2); }
.bhour .side.side-off, .bhour .side.offshore { color: #b3261e; background: color-mix(in srgb, #b3261e 12%, var(--surface)); }
.bhour .wv { margin-top: 4px; font-weight: 500; }
.bhour .wv.away { color: var(--muted); font-weight: 400; }
.bhour .pd { color: var(--muted); font-size: 0.75rem; }
@media (prefers-color-scheme: dark) {
  .bhour .side.side-off, .bhour .side.offshore { color: #ff8a80; background: color-mix(in srgb, #ff8a80 14%, var(--surface)); }
}

/* The rule: steppers, side chips. */
.setting.stack { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 0; }
.setting.link { color: var(--ink); text-decoration: none; }
.setting.link svg { flex: none; width: 20px; height: 20px; color: var(--muted); }
/* The bell after a name with alerts on: in Settings' "Alerts on", and the front page's beach link */
.setting .label .watch-mark, .beach-link .watch-mark { width: 14px; height: 14px; margin-left: 5px; vertical-align: -1px; color: var(--violet); }
.alerts-on { scroll-margin-top: 72px; }
.alerts-on .note { margin: 4px 0 12px; }
.toast a { padding: 0 14px; color: var(--bg); font-weight: 600; text-decoration: underline; white-space: nowrap; }
.stepper { display: inline-flex; flex: none; align-items: center; gap: 2px; padding: 2px; border-radius: 22px; background: var(--surface-2); }
.stepper .icon-btn { width: 36px; height: 36px; }
.stepper .icon-btn svg { width: 18px; height: 18px; }
.stepper output { min-width: 3.6em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 18px; background: transparent; color: var(--muted); font-weight: 500; font-size: 0.875rem; }
.chip[aria-pressed="true"] { border-color: var(--violet); background: var(--violet); color: var(--on-violet); }

/* Which way it faces. */
.faces-row { display: grid; grid-template-columns: 136px 1fr; gap: 16px; align-items: center; }
.faces .lead { margin: 0 0 6px; }
.faces.unset { outline: 2px solid var(--violet); }
.faces-slider { width: 100%; margin: 4px 0 8px; accent-color: var(--violet); }
.dial { display: block; width: 136px; height: 136px; }
.dial text { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.dial .sea { fill: var(--rain-soft); }
.dial .land { fill: color-mix(in srgb, var(--warm) 22%, var(--surface)); }
.dial .shore { stroke: var(--warm); stroke-width: 2; }
.dial .sea-label { fill: var(--rain); font-size: 12px; font-weight: 600; }
.dial .arc { fill: var(--line); }
.dial .arc.on { fill: var(--violet); }
@media (max-width: 380px) { .faces-row { grid-template-columns: 1fr; justify-items: center; } }
/* This beach: its name, where it is (tap the map to move it) and another beach from it */
.panel.faces h3.sub { margin: 18px 0 8px; font-size: 0.95rem; font-weight: 600; }
.name-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.name-row label { font-weight: 600; }
.name-row input, .coords-row input { width: 100%; min-width: 0; font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: inherit; }
.pos-map svg { display: block; width: 100%; height: auto; border-radius: 12px; cursor: crosshair; touch-action: manipulation; }
.pos-actions { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; }
.pos-actions .text-btn { display: inline-flex; align-items: center; gap: 6px; }
.coords-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.copy-row { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.copy-row .ghost { display: inline-flex; align-items: center; gap: 6px; }

.row.center { display: flex; justify-content: center; margin: 8px 0; }
.ghost.danger { display: inline-flex; align-items: center; gap: 6px; color: #b3261e; }
.ghost.danger svg { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { .ghost.danger { color: #ff8a80; } }

/* Several sports at one beach. */
.beach-days .ws { display: grid; gap: 2px; padding: 6px 0; }
.group-head { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 1rem; font-weight: 600; }
.group-head svg { width: 22px; height: 22px; color: var(--violet); }
.chip.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.chip.with-icon svg { width: 18px; height: 18px; }
.reset-faces { margin-top: 8px; }

/* A colour per sport, so hours and windows for several sports can show side by side. */
:root { --kite: #5b3df5; --windsurf: #0b8a7a; --surf: #d4561c; }
@media (prefers-color-scheme: dark) { :root { --kite: #9c8cff; --windsurf: #3cc9b4; --surf: #ff9566; } }
.kite { --sport: var(--kite); }
.windsurf { --sport: var(--windsurf); }
.surf { --sport: var(--surf); }
.beach-days .good, .beach-card .outlook.good { color: var(--sport, var(--violet)); }
.beach-days .ws .good::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 4px; background: currentColor; vertical-align: 1px; }
.beach-card .sport-mark, .group-head svg { color: var(--sport, var(--violet)); }
.chip.with-icon[aria-pressed="true"] { border-color: var(--sport); background: var(--sport); }
/* Per hour, one bar per sport: coloured when the hour suits it, so runs of good hours read as
   bands across the strip and several sports stack. */
.bhour .bands { display: grid; gap: 3px; justify-self: stretch; margin: 4px -2px 0; }
.bhour .bands i { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); }
.bhour .bands i.on { background: var(--sport); }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 0; color: var(--muted); font-size: 0.75rem; }
.legend-row .key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; }
.legend-row .key i { width: 16px; height: 6px; border-radius: 3px; background: var(--sport); }
/* Days 4 to 7: a rough outlook. */
.beach-days li.divider { display: block; min-height: 0; padding: 10px 0 4px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 0.75rem; }
.beach-days li.divider + li { border-top: 0; }
.beach-days li.rough .d { color: var(--muted); }
.beach-days li.rough .good { font-weight: 400; }

/* ---------- Wide screens ----------
   A computer gets the room: cards in a grid, and a place's or beach's page in two columns.
   The blocks are the same as on a phone (where they stack in this order); here they're placed
   by name. Settings and the search pages stay narrower, for reading. */
@media (min-width: 960px) {
  #app { --column: 1120px; }
  #app[data-view="settings"], #app[data-view="add"], #app[data-view="beach-add"] { --column: 760px; }

  .places { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
  .places.sorting { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; }

  .place-page, .beach-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; align-items: start; }
  .place-page {
    grid-template-areas:
      "top top"
      "hero radar"
      "extras radar"
      "rain radar"
      "wear radar"
      "hours hours"
      "days facts"
      "foot foot";
    grid-template-rows: auto auto auto auto 1fr;
  }
  .pp-top { grid-area: top; }
  .pp-hero { grid-area: hero; }
  .pp-extras { grid-area: extras; }
  .pp-rain { grid-area: rain; }
  .pp-wear { grid-area: wear; }
  .pp-radar { grid-area: radar; }
  .pp-hours { grid-area: hours; }
  .pp-days { grid-area: days; }
  .pp-facts { grid-area: facts; }
  .pp-foot { grid-area: foot; }

  /* Left: the days, then each sport's settings. Right: alerts and sports, the map just under
     them, the swell and water, then the tides and the beach itself. */
  .beach-page {
    grid-template-areas:
      "unset unset"
      "strip strip"
      "days alerts"
      "days map"
      "rules map"
      "rules sea"
      "rules tides"
      "rules faces"
      "foot foot";
    grid-template-rows: auto auto auto auto auto auto auto 1fr auto;
  }
  .bp-alerts { grid-area: alerts; }
  .bp-sea { grid-area: sea; }
  .bp-tides { grid-area: tides; }
  .bp-map { grid-area: map; }
  .bp-unset { grid-area: unset; }
  .bp-strip { grid-area: strip; }
  .bp-days { grid-area: days; }
  .bp-rules { grid-area: rules; }
  .bp-faces { grid-area: faces; }
  .bp-foot { grid-area: foot; }
}
/* ---------- Swell and water on a beach's page ---------- */
.sea-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.sea-table th, .sea-table td { padding: 7px 4px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.sea-table thead th { padding-top: 0; border-top: 0; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.sea-table tbody th { font-weight: 600; white-space: nowrap; }
.sea-table td small { display: block; color: var(--muted); font-size: 0.75rem; }
.sea-table .away { color: var(--muted); }
.sea-table tr.rough { opacity: 0.72; }
.water { margin: 12px 0 0; }
.water small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.75rem; }

/* A beach's "See it elsewhere" links. */
.sources .links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.sources .links .text-btn { display: inline-flex; align-items: center; text-decoration: none; font-size: 0.875rem; }
.sources .note { margin: -4px 0 10px; }

/* ---------- Wind map on a beach's page ---------- */
.wind-map svg { display: block; width: 100%; height: auto; border-radius: 12px; }
.windmap .wm-arrows path:not(.head) { stroke-width: 2.4px; stroke-linecap: round; vector-effect: non-scaling-stroke; fill: none; }
.windmap .wm-arrows { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.wind-slider { flex: 1; min-width: 0; accent-color: var(--violet); }
.wind-time { font-size: 0.9375rem; }
.wind-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 10px; color: var(--muted); font-size: 0.75rem; }
.wind-legend .lab { color: var(--ink); font-weight: 500; }
.wind-legend .key { display: inline-flex; align-items: center; gap: 4px; }
.wind-legend .key i { width: 14px; height: 6px; border-radius: 3px; }
.wind-legend.waves .key i { height: 10px; border-radius: 2px; }
@media (prefers-color-scheme: dark) {
  .windmap .wm-arrows { filter: drop-shadow(0 0 1.2px rgb(0 0 0 / 0.9)); }
}

/* ---------- Tides on a beach's page ---------- */
.tide-chart { display: block; width: 100%; height: auto; margin: 0 0 8px; overflow: visible; }
.tide-chart .area { fill: var(--rain-soft); }
.tide-chart .line { fill: none; stroke: var(--rain); stroke-width: 1.6; }
.tide-chart .night { fill: var(--surface-2); }
.tide-chart .grid { stroke: var(--line); stroke-width: 0.6; }
.tide-chart .zero { stroke: var(--muted); stroke-width: 0.6; stroke-dasharray: 3 2; }
.tide-chart .midnight { stroke: var(--muted); stroke-width: 0.6; opacity: 0.5; }
.tide-chart text { fill: var(--muted); font-size: 8.5px; font-family: var(--font); }
.tide-chart .axis { text-anchor: end; }
.tide-chart .day { fill: var(--ink); font-weight: 600; }
.tide-chart .ev { text-anchor: middle; fill: var(--ink); font-size: 8px; font-variant-numeric: tabular-nums; }
.tide-chart .hw { fill: var(--rain); }
.tide-chart .lw { fill: var(--muted); }
.tide-chart .now { stroke: var(--violet); stroke-width: 1.2; }
.tide-chart .now-label { text-anchor: middle; fill: var(--violet); font-weight: 600; }
.tide-days { display: grid; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; font-size: 0.875rem; }
.tide-days li { display: grid; grid-template-columns: 6.5em 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.tide-days li:first-child { border-top: 0; }
.tide-days .d { font-weight: 500; }
.tide-days .evs { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.tide-days .hw { color: var(--rain); font-weight: 500; }
.tide-days small { color: var(--muted); font-weight: 400; }
.bhour .tide-mark { min-height: 1.2em; color: var(--rain); font-size: 0.6875rem; font-weight: 600; }
.tide-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sources .raw { margin: 10px 0 0; color: var(--muted); font-size: 0.8125rem; }
.pos-actions .ui, .copy-row .ui { width: 18px; height: 18px; flex: none; }
/* + and − on the beach page's maps */
.wind-map, .pos-map { position: relative; }
.map-zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 6px; }
.map-zoom .icon-btn { width: 34px; height: 34px; background: var(--surface); border-radius: 10px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.18); }
.map-zoom .icon-btn[disabled] { opacity: 0.4; }
/* The strip after the first three days: every 3 hours, paler, with a line where it starts */
.bhour.rough, .hour.rough { opacity: 0.72; }
.bhour.rough-start, .hour.rough-start { border-left: 1.5px dashed var(--muted); padding-left: 6px; }
.hour .dl { min-height: 1.2em; color: var(--ink); font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
/* A quieter note after a panel heading */
.h2-note { font-size: 0.85em; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: normal; }
/* Adding a beach or a place: the country picker (onto a second line when it doesn't fit), and the
   UK's nations under it */
.country-pick { margin: 12px 0 4px; }
.country-pick .seg { flex-wrap: wrap; }
.country-pick .seg button { min-width: 0; }
.list-head.sub { margin: 12px 4px 6px; text-transform: none; letter-spacing: normal; color: var(--ink); font-weight: 600; font-size: 0.875rem; }
/* Settings: the contents, each section's place under the top bar, and the data list */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.toc a { padding: 7px 12px; border-radius: 16px; background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.prose [id^="s-"] { scroll-margin-top: 72px; }
.prose h3 { margin: 16px 0 4px; font-size: 0.95rem; }
.data-list { padding-left: 18px; }
.data-list li { margin: 0 0 10px; }
/* The UKHO's required credit: Arial, at least 12 px, on two lines, in black or white */
.admiralty-credit { display: block; margin-top: 6px; font: 12px/1.4 Arial, Helvetica, sans-serif; color: var(--ink); }
/* The demo: a strip across the top of every page, and its front page */
.demo-banner { padding: 8px 16px; background: var(--violet); color: var(--on-violet); font-size: 0.8125rem; text-align: center; }
.demo-banner a { color: inherit; font-weight: 600; }
.demo-intro { margin-top: 12px; }
.demo-part { display: flex; align-items: center; gap: 8px; margin: 24px 4px 0; font-size: 1.125rem; font-weight: 600; }
.demo-part svg { flex: none; width: 22px; height: 22px; color: var(--violet); }
.demo-part.beaches { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-part + .list-head { margin-top: 8px; }
