/* ==========================================================================
   WakeSpotting — production design tokens + components
   Direction: "Bold & Energetic Dark v3" (design/bold-dark-v3), refined.
   Authority: design/DESIGN-SYSTEM.md. Implementation specs: design/REDLINES.md.

   Rules of the file:
   · Everything is namespaced --ws-* / .ws-*.
   · No font downloads, no images, no JS dependencies. Inter is used when the
     OS has it; the system stack carries the look otherwise.
   · JS may read any token via getComputedStyle(document.documentElement)
     .getPropertyValue('--ws-…') — MapLibre paint colors come from here, not
     from literals in viewer.js.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1 · TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Base darks — night water, never pure black */
  --ws-ink:        #020a14;   /* page edge, deepest layer */
  --ws-bg:         #04101f;   /* default page background */
  --ws-bg-2:       #0a1a30;   /* raised background wash */
  --ws-panel:      rgba(12, 28, 50, .82);
  --ws-panel-solid:#0c1f38;   /* opaque card/panel base */

  /* Glass — translucent overlays only (see DESIGN-SYSTEM §5 for rules) */
  --ws-glass:        rgba(14, 32, 56, .58);
  --ws-glass-strong: rgba(12, 28, 50, .78);
  --ws-glass-solid:  rgba(10, 24, 42, .94);  /* fallback when no backdrop-filter */

  /* Borders */
  --ws-border:    rgba(160, 200, 235, .14);
  --ws-border-hi: rgba(160, 200, 235, .26);

  /* Text */
  --ws-text:   #f2f7fc;   /* primary — 18.5:1 on bg */
  --ws-text-2: #c3d3e2;   /* secondary — 14.4:1 */
  --ws-muted:  #7e93a8;   /* labels, captions — 7.0:1 */
  --ws-faint:  #45586c;   /* decorative only — 3.2:1, never for reading */

  /* Accents */
  --ws-lime:   #3fe8d8;   /* signal: rider, performance, primary action */
  --ws-lime-2: #7ff0e4;   /* pressed/gradient partner of lime */
  --ws-live:   #ff4b32;   /* broadcast state + End action ONLY */
  --ws-cyan:   #6fb4e8;   /* environment: wind, water, geofence, viewer-self */
  --ws-amber:  #ffb52b;   /* caution: GPS degraded, outside zone, expiring */
  --ws-orange: #ff6b24;   /* reserved: top-speed emphasis partner of track-hot */
  --ws-on-lime:#032027;   /* text on lime surfaces — 16.4:1 */

  /* Track gradient (speed → color; exact mapping in DESIGN-SYSTEM §7.6) */
  --ws-track-cold: #7fd8c8;   /* ≤ 6 km/h — off foil */
  --ws-track-mid:  #3fe8d8;   /* 12–22 km/h — on foil */
  --ws-track-hot:  #ff7128;   /* ≥ 30 km/h — top end */
  --ws-track-halo: rgba(2, 10, 20, .55);

  /* Map paint (read by viewer.js for MapLibre layers).
     Opacities retuned for the CARTO dark basemap (REDLINES-CARDS §9). */
  --ws-fence-stroke: #6fb4e8;
  --ws-fence-stroke-op: 0.7;
  --ws-fence-fill:   #6fb4e8;
  --ws-fence-fill-op: 0.08;

  /* Radius */
  --ws-r-sm: 9px;
  --ws-r-md: 12px;
  --ws-r-lg: 18px;
  --ws-r-xl: 24px;
  --ws-pill: 999px;

  /* Spacing (4-base scale; use these, not ad-hoc values) */
  --ws-s-1: 4px;  --ws-s-2: 8px;   --ws-s-3: 12px; --ws-s-4: 16px;
  --ws-s-5: 20px; --ws-s-6: 24px;  --ws-s-7: 32px; --ws-s-8: 40px;
  --ws-s-9: 56px; --ws-s-10: 72px;

  /* Elevation */
  --ws-shadow-1: 0 14px 34px rgba(0, 0, 0, .28);
  --ws-shadow-2: 0 30px 90px rgba(0, 0, 0, .48);
  --ws-glow-lime: 0 10px 30px rgba(63, 232, 216, .17);
  --ws-glow-live: 0 10px 30px rgba(255, 75, 50, .15);

  /* Type */
  --ws-font: Inter, ui-sans-serif, system-ui, -apple-system,
             BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ws-font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ws-t-fast: 120ms;   /* press, hover */
  --ws-t-med:  240ms;   /* sheet, toast, chip state */
  --ws-t-slow: 900ms;   /* marker position ease (matches viewer.js lerp) */
  --ws-ease:   cubic-bezier(.2, .7, .2, 1);

  /* Z layers */
  --ws-z-map: 0; --ws-z-hud: 8; --ws-z-sheet: 10; --ws-z-topbar: 20;
  --ws-z-overlay: 40; --ws-z-toast: 60;
}

/* --------------------------------------------------------------------------
   2 · BASE
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--ws-ink); }
body {
  margin: 0;
  font-family: var(--ws-font);
  background: var(--ws-bg);
  color: var(--ws-text);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg, img { display: block; max-width: 100%; }

/* Focus: one rule, everywhere. Lime ring, offset so it reads on any surface. */
:focus-visible {
  outline: 2px solid var(--ws-lime);
  outline-offset: 2px;
  border-radius: 4px;
}

.ws-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -5%, rgba(111, 180, 232, .13), transparent 28%),
    radial-gradient(circle at 8% 10%, rgba(63, 232, 216, .06), transparent 20%),
    linear-gradient(180deg, #081a30 0, #04101f 55%, #020a14 100%);
}
.ws-noise { position: relative; }
.ws-noise::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: .055; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.ws-container { width: min(1240px, calc(100% - 40px)); margin: auto; }
.ws-row  { display: flex; align-items: center; gap: var(--ws-s-3); }
.ws-grid { display: grid; gap: var(--ws-s-4); }
.ws-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ws-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ws-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* --------------------------------------------------------------------------
   3 · TYPOGRAPHY
   -------------------------------------------------------------------------- */
.ws-h1 { font-size: 58px; line-height: .94; letter-spacing: -.055em; font-weight: 650; margin: 0; }
.ws-h2 { font-size: 34px; line-height: 1;   letter-spacing: -.04em;  font-weight: 600; margin: 0; }
.ws-h3 { font-size: 23px; line-height: 1.05; letter-spacing: -.025em; font-weight: 600; margin: 0; }
.ws-body  { color: var(--ws-text-2); line-height: 1.55; }
.ws-muted { color: var(--ws-muted); }
.ws-eyebrow {
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase;
  font-weight: 600; color: var(--ws-lime);
}
.ws-label {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ws-muted); font-weight: 550;
}
.ws-value {
  font-size: 30px; font-weight: 650; letter-spacing: -.055em;
  font-variant-numeric: tabular-nums;
  /* values never wrap or clip — metric() fit-shrinks the font instead */
  white-space: nowrap;
}
.ws-unit {
  font-size: 12px; color: var(--ws-text-2); font-weight: 550;
  margin-left: 3px; letter-spacing: 0;
}
/* Hero numeral — the recorder speed readout. Never below 72px on phones. */
.ws-numeral-hero {
  font-size: clamp(72px, 26vw, 112px); line-height: .9;
  font-weight: 650; letter-spacing: -.06em; font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   4 · SURFACES
   -------------------------------------------------------------------------- */
.ws-card {
  position: relative;
  background: linear-gradient(180deg, rgba(15, 35, 43, .92), rgba(7, 19, 24, .95));
  border: 1px solid var(--ws-border);
  border-radius: var(--ws-r-md);
  box-shadow: var(--ws-shadow-1);
  overflow: hidden;
}
.ws-glass {
  background-color: var(--ws-glass-solid);   /* solid fallback first */
  background-image: linear-gradient(180deg, rgba(15, 35, 42, .74), rgba(7, 18, 23, .56));
  border: 1px solid var(--ws-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
}
@supports (backdrop-filter: blur(2px)) {
  .ws-glass {
    background-color: rgba(7, 18, 23, .70);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
  }
}
.ws-inset { box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 -20px 70px rgba(0,0,0,.2); }
.ws-glowline {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(63, 232, 216, .58), transparent);
  box-shadow: 0 0 10px rgba(63, 232, 216, .2);
}

/* --------------------------------------------------------------------------
   5 · BRAND
   -------------------------------------------------------------------------- */
.ws-brand {
  display: flex; align-items: center; gap: 11px;
  font-size: 13px; font-weight: 700; letter-spacing: .08em;
}
.ws-brand-mark { width: 30px; height: 24px; position: relative; }
.ws-brand-mark::before, .ws-brand-mark::after {
  content: ""; position: absolute; background: var(--ws-lime);
  transform: skewX(-28deg); border-radius: 3px;
}
.ws-brand-mark::before { left: 0; top: 5px;    width: 18px; height: 7px; }
.ws-brand-mark::after  { right: 0; bottom: 4px; width: 18px; height: 7px; }

.ws-topbar {
  height: 60px; display: flex; align-items: center;
  border-bottom: 1px solid var(--ws-border);
  background-color: #061116;
  position: relative; z-index: var(--ws-z-topbar);
}
@supports (backdrop-filter: blur(2px)) {
  .ws-topbar { background-color: rgba(2, 9, 12, .68); backdrop-filter: blur(24px) saturate(130%); }
}

/* --------------------------------------------------------------------------
   6 · CHIPS + STATUS
   -------------------------------------------------------------------------- */
.ws-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 10px; border: 1px solid var(--ws-border);
  border-radius: var(--ws-pill); background: rgba(10, 28, 35, .72);
  font-size: 11px; font-weight: 500; color: var(--ws-text-2);
  white-space: nowrap;
}
.ws-chip-live {
  border-color: rgba(255, 75, 50, .42); color: #fff;
  background: rgba(255, 75, 50, .12);
}
.ws-chip-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ws-live);
  box-shadow: 0 0 0 4px rgba(255, 75, 50, .11), 0 0 16px rgba(255, 75, 50, .8);
  animation: ws-live-pulse 2.4s ease-in-out infinite;
}
.ws-chip-lime  { color: var(--ws-on-lime); background: var(--ws-lime); border-color: transparent; }
.ws-chip-ghost { background: rgba(3, 12, 16, .28); }
.ws-chip-warn  { border-color: rgba(255, 181, 43, .4); color: var(--ws-amber); background: rgba(255, 181, 43, .1); }
.ws-chip-cyan  { border-color: rgba(111, 180, 232, .35); color: var(--ws-cyan); background: rgba(111, 180, 232, .08); }

@keyframes ws-live-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,75,50,.11), 0 0 16px rgba(255,75,50,.8); }
  50%      { box-shadow: 0 0 0 2px rgba(255,75,50,.06), 0 0 6px  rgba(255,75,50,.4); }
}

/* Recorder geofence pill — three states driven by class */
.ws-pill {
  align-self: center; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 550; padding: 8px 16px;
  border-radius: var(--ws-pill); border: 1px solid var(--ws-border);
  background: rgba(10, 28, 35, .72); color: var(--ws-muted);
  transition: background var(--ws-t-med), color var(--ws-t-med);
}
.ws-pill.inside  { background: rgba(63, 232, 216, .12); color: var(--ws-lime);  border-color: rgba(63, 232, 216, .3); }
.ws-pill.outside { background: rgba(255, 181, 43, .12); color: var(--ws-amber); border-color: rgba(255, 181, 43, .3); }

/* Watchers count — "3 watching" */
.ws-watchers { font-size: 12px; font-weight: 600; color: var(--ws-muted); }
.ws-watchers b { color: var(--ws-cyan); font-variant-numeric: tabular-nums; }

/* Status line ("live", "reconnecting…", errors) */
.ws-status { font-size: 12px; color: var(--ws-muted); min-height: 16px; }
.ws-status .ended { color: var(--ws-amber); font-weight: 550; }
.ws-status .err   { color: var(--ws-live);  font-weight: 550; }

/* --------------------------------------------------------------------------
   7 · BUTTONS
   -------------------------------------------------------------------------- */
.ws-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--ws-border); border-radius: 10px;
  min-height: 44px; padding: 0 17px;
  background: rgba(14, 33, 40, .82); color: var(--ws-text);
  font-weight: 550; cursor: pointer; text-decoration: none;
  transition: transform var(--ws-t-fast), filter var(--ws-t-fast);
}
.ws-btn:active { transform: scale(.98); filter: brightness(1.12); }
.ws-btn:disabled { opacity: .45; cursor: default; transform: none; }
.ws-btn-primary {
  background: linear-gradient(180deg, #7ff0e4, #3fe8d8);
  color: var(--ws-on-lime); border: none;
  box-shadow: var(--ws-glow-lime), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.ws-btn-danger {
  background: linear-gradient(180deg, #ff604a, #f53f26);
  border: 0; color: #fff; box-shadow: var(--ws-glow-live);
}
.ws-btn-ghost { background: rgba(3, 12, 16, .28); }
.ws-btn-sm { min-height: 34px; padding: 0 13px; font-size: 12px; border-radius: 8px; }
.ws-btn-lg { min-height: 58px; font-size: 18px; border-radius: 12px; width: 100%; }

/* Round icon button (locate, AR side buttons) */
.ws-btn-round {
  width: 48px; height: 48px; min-height: 0; padding: 0;
  border-radius: 50%; font-size: 19px;
  background: var(--ws-glass-solid); color: var(--ws-text-2);
  border: 1px solid var(--ws-border-hi);
}
@supports (backdrop-filter: blur(2px)) {
  .ws-btn-round { background: rgba(3, 12, 16, .62); backdrop-filter: blur(14px); }
}
.ws-btn-round.active { background: var(--ws-cyan); color: var(--ws-ink); border-color: transparent; }

/* AR shutter — camera language, not a form button */
.ws-shutter {
  width: 74px; height: 74px; border-radius: 50%; cursor: pointer;
  border: 5px solid #fff; background: rgba(255, 255, 255, .22);
  transition: background var(--ws-t-fast), transform var(--ws-t-fast);
}
.ws-shutter:active { background: #fff; transform: scale(.94); }

/* --------------------------------------------------------------------------
   8 · FORMS (record login gate, future forms)
   -------------------------------------------------------------------------- */
.ws-input {
  font-family: var(--ws-font); font-size: 17px; font-weight: 550;
  color: var(--ws-text); background: rgba(3, 12, 16, .6);
  border: 1px solid var(--ws-border-hi); border-radius: 10px;
  padding: 14px 16px; width: 100%;
  transition: border-color var(--ws-t-fast);
}
.ws-input::placeholder { color: var(--ws-faint); font-weight: 500; }
.ws-input:focus { border-color: var(--ws-lime); outline: none; }
.ws-field-label {
  display: block; margin-bottom: 6px;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ws-muted); font-weight: 550;
}
.ws-hint { font-size: 12px; color: var(--ws-muted); line-height: 1.5; }

/* Trim slider (AR compass align) */
.ws-range { appearance: none; -webkit-appearance: none; width: 100%; height: 28px; background: none; }
.ws-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(80,233,226,.4), rgba(200,255,34,.5), rgba(80,233,226,.4));
}
.ws-range::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--ws-lime); border: 3px solid var(--ws-ink);
  box-shadow: 0 0 0 1px rgba(200,255,34,.4), 0 2px 8px rgba(0,0,0,.5);
}
.ws-range::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(80,233,226,.4); }
.ws-range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ws-lime); border: 3px solid var(--ws-ink);
}

/* --------------------------------------------------------------------------
   9 · METRICS + SPEED RING
   -------------------------------------------------------------------------- */
.ws-metric {
  position: relative; padding: 14px 15px;
  border: 1px solid var(--ws-border); border-radius: 10px;
  background: linear-gradient(180deg, rgba(15, 38, 46, .64), rgba(7, 22, 27, .52));
  overflow: hidden;
}
.ws-metric.hot { border-color: rgba(63, 232, 216, .18); }
.ws-metric.hot::after {
  content: ""; position: absolute; inset: auto 0 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--ws-lime), transparent);
}

/* Plain stat (no card chrome) — recorder secondary stats */
.ws-stat { text-align: center; }
.ws-stat .ws-value { font-size: 24px; }

/* Speed ring: set --ws-ring-pct (0–100) from JS; 100 = 40 km/h */
.ws-speed-ring {
  --ws-ring-pct: 0;
  width: 132px; aspect-ratio: 1; border-radius: 50%; padding: 7px;
  background: conic-gradient(var(--ws-lime) 0 calc(var(--ws-ring-pct) * 1%),
              rgba(94, 122, 129, .22) calc(var(--ws-ring-pct) * 1%));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 0 35px rgba(63, 232, 216, .08);
}
.ws-speed-ring-inner {
  height: 100%; border-radius: 50%; display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 50% 34%, #102a31, #02090c 72%);
  border: 1px solid rgba(255, 255, 255, .06);
}
.ws-speed-ring strong { display: block; font-size: 39px; line-height: .85; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
.ws-speed-ring span { font-size: 10px; color: var(--ws-muted); letter-spacing: .1em; text-transform: uppercase; }

/* Hourly wind bars — lime = foilable (≥7 m/s), cyan tint = marginal (≥4), panel below */
.ws-windbars { display: flex; align-items: flex-end; gap: 6px; height: 72px; }
.ws-windbars .bar {
  flex: 1; min-width: 6px; max-width: 14px; border-radius: 4px;
  background: var(--ws-panel-solid); border: 1px solid transparent;
}
.ws-windbars .bar.ok   { background: rgba(16, 46, 48, 1); border-color: rgba(111, 180, 232, .35); }
.ws-windbars .bar.good { background: var(--ws-lime); border-color: transparent; }
.ws-windbars .tick { font-size: 9px; color: var(--ws-muted); text-align: center; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Sparkline */
.ws-spark { height: 42px; }
.ws-spark svg { width: 100%; height: 100%; overflow: visible; }
.ws-spark path.line { fill: none; stroke: var(--ws-lime); stroke-width: 2.4; filter: drop-shadow(0 0 5px rgba(200,255,34,.26)); }
.ws-spark path.fill { fill: url(#sparkfill); }

/* --------------------------------------------------------------------------
   10 · BOTTOM SHEET + RIDER ROWS (map viewer)
   -------------------------------------------------------------------------- */
.ws-sheet {
  position: fixed; left: 10px; right: 10px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  z-index: var(--ws-z-sheet);
  padding: 14px 16px 16px; border-radius: var(--ws-r-lg) var(--ws-r-lg) 16px 16px;
  max-height: 44vh; overflow-y: auto;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .32);
}
.ws-sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--ws-border-hi); margin: 0 auto 10px;
}
.ws-sheet-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--ws-s-3); margin-bottom: var(--ws-s-2);
}
.ws-sheet-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }

.ws-rider-row {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  gap: var(--ws-s-3); padding: 9px 0;
  border-top: 1px solid var(--ws-border);
}
.ws-rider-row:first-child { border-top: 0; }
.ws-rider-row .name { font-size: 14px; font-weight: 650; }
.ws-rider-row .meta { font-size: 11px; color: var(--ws-muted); margin-top: 1px; }
.ws-rider-row .speed {
  font-size: 22px; font-weight: 700; letter-spacing: -.05em;
  font-variant-numeric: tabular-nums; color: var(--ws-lime);
}
.ws-rider-row.stale .speed { color: var(--ws-muted); }
.ws-rider-row .unit { font-size: 11px; color: var(--ws-muted); margin-left: 3px; font-weight: 550; }

/* --------------------------------------------------------------------------
   11 · MAP MARKERS (viewer)
   -------------------------------------------------------------------------- */
.ws-marker { width: 34px; height: 34px; display: grid; place-items: center; }
.ws-marker svg { transition: transform var(--ws-t-slow) linear; filter: drop-shadow(0 0 6px rgba(63, 232, 216, .55)); }
.ws-marker.stale { opacity: .8; }
.ws-marker.stale svg { filter: none; }
.ws-marker.outside { opacity: .45; }

/* Session start/end dots (replay) */
.ws-dot {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 3px solid #fff; background: var(--ws-lime);
  box-shadow: 0 0 0 6px rgba(63, 232, 216, .12), 0 0 25px rgba(63, 232, 216, .35);
}
.ws-dot.end { background: var(--ws-live); box-shadow: 0 0 0 6px rgba(255, 75, 50, .12), 0 0 25px rgba(255, 75, 50, .35); }

/* Viewer's own position: cyan — you are environment, riders are lime */
.ws-me-marker { width: 60px; height: 60px; position: relative; }
.ws-me-marker .cone {
  position: absolute; inset: 0; transform-origin: 50% 50%; border-radius: 50%;
  background: conic-gradient(from -30deg, rgba(111, 180, 232, .35) 0deg 60deg, transparent 60deg);
  transition: transform 200ms linear;
}
.ws-me-marker .dot {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--ws-cyan); border: 3px solid #fff;
  box-shadow: 0 0 8px rgba(111, 180, 232, .8);
}

.ws-locate {
  position: fixed; right: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  z-index: calc(var(--ws-z-sheet) + 1);
}

/* Spot features on the live map: hazard ⚠ (amber = caution) + POI pins
   (neutral content chrome), with a small note popover on tap. */
.ws-hz-pin, .ws-poi-pin {
  display: grid; place-items: center; cursor: pointer; border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35); z-index: 1;
}
.ws-hz-pin {
  width: 26px; height: 26px; color: var(--ws-amber);
  background: var(--ws-glass-solid); border: 1.5px solid var(--ws-amber);
}
.ws-hz-pin svg { width: 16px; height: 16px; display: block; }
.ws-poi-pin {
  width: 26px; height: 26px; color: var(--ws-text);
  background: var(--ws-glass-solid); border: 1px solid rgba(255, 255, 255, .38);
}
.ws-poi-pin svg { width: 16px; height: 16px; display: block; }
[data-ws-theme="sun"] .ws-poi-pin { border-color: rgba(2, 8, 11, .35); }

.ws-map-pop .maplibregl-popup-content {
  padding: 0; background: transparent; box-shadow: none; border-radius: 0;
}
.ws-map-pop .maplibregl-popup-tip { display: none; }
.ws-featpop {
  max-width: 220px; padding: 9px 12px; border-radius: 8px;
  background: var(--ws-glass-solid); border: 1px solid var(--ws-border-hi);
  box-shadow: var(--ws-shadow-1); color: var(--ws-text);
  font-family: var(--ws-font);
}
.ws-featpop .t { font-size: 12px; font-weight: 650; letter-spacing: .01em; }
.ws-featpop.warn .t { color: var(--ws-amber); }
.ws-featpop .n { margin-top: 3px; font-size: 12px; line-height: 1.45; color: var(--ws-text-2); }

/* Country-level locator inset: small non-interactive mini-map, lime ring on
   the spot. The page positions #inset; this styles the frame. */
.ws-inset {
  width: 110px; height: 110px; border-radius: var(--ws-r-md, 14px);
  overflow: hidden; border: 1px solid var(--ws-border-hi);
  box-shadow: var(--ws-shadow-1); background: var(--ws-ink);
  pointer-events: none;
}
.ws-inset .maplibregl-ctrl { display: none; }
.ws-inset-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2.5px solid var(--ws-lime); background: rgba(63, 232, 216, .18);
  box-shadow: 0 0 0 4px rgba(63, 232, 216, .14), 0 0 14px rgba(63, 232, 216, .4);
}

/* Spot photo markers — CONTENT layer: ink puck, white camera glyph, neutral
   border. Always stacks under rider pucks (people over photos). */
.ws-puck { z-index: 2; }
.ws-photo-marker {
  z-index: 1; width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: var(--ws-ink); border: 1px solid rgba(255, 255, 255, .38);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .45);
}
.ws-photo-marker svg { width: 14px; height: 14px; display: block; }
.ws-photo-marker:hover { border-color: rgba(255, 255, 255, .7); }
/* sun mode: --ws-ink flips to white — keep the glyph visible */
[data-ws-theme="sun"] .ws-photo-marker {
  color: var(--ws-text); border-color: rgba(2, 8, 11, .35);
}
[data-ws-theme="sun"] .ws-photo-marker:hover { border-color: rgba(2, 8, 11, .6); }
.ws-photo-marker .n {
  position: absolute; top: -5px; right: -6px; min-width: 15px; height: 15px;
  padding: 0 3px; border-radius: 999px; display: grid; place-items: center;
  background: #fff; color: #020a14; font-size: 9px; font-weight: 650;
  font-variant-numeric: tabular-nums; line-height: 1;
}

/* Photo lightbox (viewer page) — photo + uploader + close over everything */
.ws-photo-lightbox {
  position: fixed; inset: 0; z-index: var(--ws-z-overlay, 40);
  background: rgba(2, 8, 11, .93);
  display: flex; align-items: center; justify-content: center;
}
.ws-photo-lightbox .media { display: flex; align-items: center;
  justify-content: center; width: 100%; }
.ws-photo-lightbox img { max-width: 92vw; max-height: 76vh; object-fit: contain;
  border-radius: 9px; border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: var(--ws-shadow-2); }
.ws-photo-lightbox .ws-vplayer { width: min(880px, 92vw); }
.ws-photo-lightbox .x, .ws-photo-lightbox .nav {
  position: absolute; display: grid; place-items: center; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(2, 8, 11, .72); color: #fff; font-size: 17px;
}
.ws-photo-lightbox .x { top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; }
.ws-photo-lightbox .nav { top: 50%; transform: translateY(-50%); font-size: 24px; }
.ws-photo-lightbox .nav.prev { left: 12px; }
.ws-photo-lightbox .nav.next { right: 12px; }
.ws-photo-lightbox .bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
}
.ws-photo-lightbox .who { flex: 1; font-size: 13px; font-weight: 650; color: #fff;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-photo-lightbox .count { font-size: 11px; color: #7e93a8;
  font-variant-numeric: tabular-nums; }

/* Video player + telemetry overlay plate (DS: media is content — neutral
   chrome; the plate is a HUD readout, bottom-left, above native controls) */
.ws-vplayer { position: relative; display: block; width: 100%; }
.ws-vplayer video { display: block; width: 100%; max-height: 74vh;
  border-radius: 9px; border: 1px solid rgba(255, 255, 255, .16);
  background: #000; box-shadow: var(--ws-shadow-2); }
.ws-vplate {
  position: absolute; left: 10px; bottom: 56px; pointer-events: none;
  display: flex; align-items: baseline; gap: 10px; padding: 7px 12px;
  border-radius: 9px; background: rgba(2, 8, 11, .78);
  border: 1px solid rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ws-vplate .spd b { font-size: 22px; font-weight: 700; letter-spacing: -.04em;
  color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }
.ws-vplate .spd i { font-style: normal; font-size: 10px; font-weight: 550;
  color: #7e93a8; margin-left: 4px; }
.ws-vplate .clk { font-size: 11px; font-weight: 550; color: #7e93a8;
  font-variant-numeric: tabular-nums; }

/* ▶ media-marker variant: same content puck, play glyph = there's a clip */
.ws-photo-marker.video svg { width: 12px; height: 12px; margin-left: 1px; }

/* --------------------------------------------------------------------------
   12 · HUD (AR view)
   -------------------------------------------------------------------------- */
.ws-hud-corners::before, .ws-hud-corners::after {
  content: ""; position: absolute; width: 18px; height: 18px;
  z-index: var(--ws-z-hud); pointer-events: none;
  border-color: var(--ws-hud-corner, rgba(63, 232, 216, .65));
}
.ws-hud-corners::before { left: 13px; top: 13px; border-left: 1px solid; border-top: 1px solid; }
.ws-hud-corners::after  { right: 13px; bottom: 13px; border-right: 1px solid; border-bottom: 1px solid; }

/* AR status bar — glass over camera; solid plate without backdrop-filter */
.ws-ar-status {
  position: fixed; z-index: var(--ws-z-hud);
  top: calc(env(safe-area-inset-top, 0px) + 12px); left: 12px; right: 12px;
  display: flex; justify-content: space-between; gap: var(--ws-s-3);
  padding: 9px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--ws-text-2);
  border: 1px solid var(--ws-border);
  background: var(--ws-glass-solid);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
@supports (backdrop-filter: blur(2px)) {
  .ws-ar-status { background: rgba(2, 8, 11, .66); backdrop-filter: blur(12px); }
}
.ws-ar-status .deg { font-variant-numeric: tabular-nums; color: var(--ws-muted); }

/* AR rider marker: label plate + chevron. Legibility beats elegance in sun. */
.ws-ar-marker {
  position: absolute; transform: translate(-50%, -100%); text-align: center;
  transition: left 250ms linear, top 250ms linear; pointer-events: auto;
}
.ws-ar-marker .lbl {
  display: inline-block; padding: 5px 13px; border-radius: var(--ws-pill);
  background: rgba(2, 8, 11, .88);           /* solid — must survive sunlight */
  border: 1px solid rgba(63, 232, 216, .5);
  font-size: 14px; font-weight: 550; white-space: nowrap; color: var(--ws-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.ws-ar-marker .chev {
  width: 0; height: 0; margin: 4px auto 0;
  border-left: 15px solid transparent; border-right: 15px solid transparent;
  border-top: 21px solid var(--ws-lime);
  filter: drop-shadow(0 1px 0 rgba(2, 8, 11, .9)) drop-shadow(0 0 8px rgba(2, 8, 11, .8));
}
.ws-ar-marker.selected .lbl { border-color: var(--ws-lime); background: rgba(20, 32, 6, .92); color: var(--ws-lime); }
.ws-ar-marker.selected .chev { border-top-color: #fff; }

/* Off-screen rider indicator — plate, not floating text */
.ws-edge-arrow {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  padding: 6px 12px; border-radius: var(--ws-pill);
  background: rgba(2, 8, 11, .88); border: 1px solid rgba(63, 232, 216, .4);
  font-size: 13px; font-weight: 550; color: var(--ws-lime);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}

/* AR bottom control row + trim tray */
.ws-ar-controls {
  position: fixed; z-index: var(--ws-z-hud);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 26px;
}
.ws-ar-tray {
  position: fixed; z-index: var(--ws-z-hud);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 110px); left: 20px; right: 20px;
  display: none; align-items: center; gap: var(--ws-s-3);
  padding: 12px 16px; border-radius: var(--ws-r-md);
  font-size: 13px; font-weight: 600;
}
.ws-ar-tray.open { display: flex; }
.ws-ar-tray .val { width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ws-lime); }

/* --------------------------------------------------------------------------
   13 · OVERLAYS: gate, summary, capture preview, QR
   -------------------------------------------------------------------------- */
.ws-overlay {
  position: fixed; inset: 0; z-index: var(--ws-z-overlay);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--ws-s-4); padding: var(--ws-s-7); text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(111, 180, 232, .1), transparent 40%),
    linear-gradient(180deg, rgba(4, 13, 17, .97), rgba(2, 8, 11, .98));
}
.ws-overlay h1, .ws-overlay h2 { margin: 0; }
.ws-overlay .ws-hint { max-width: 320px; }

/* Session summary sheet (record + viewer ended state) */
.ws-summary { width: min(420px, 100%); padding: var(--ws-s-6); border-radius: var(--ws-r-lg); text-align: center; }
.ws-summary .headline { font-size: 26px; font-weight: 700; letter-spacing: -.04em; }
.ws-summary .statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--ws-s-2); margin-top: var(--ws-s-4); }

/* QR share sheet — code sits on a white plate (scanners need light ground) */
.ws-qr { width: min(360px, 100%); padding: var(--ws-s-6); border-radius: var(--ws-r-lg); text-align: center; }
.ws-qr .plate {
  display: inline-block; padding: var(--ws-s-4); border-radius: var(--ws-r-md);
  background: #fff; box-shadow: var(--ws-shadow-1);
}
.ws-qr .expiry { margin-top: var(--ws-s-3); font-size: 12px; color: var(--ws-amber); font-weight: 600; }

/* Capture preview (AR photo) */
.ws-capture {
  position: fixed; inset: 0; z-index: 50; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: var(--ws-s-4); padding: var(--ws-s-6);
  background: rgba(2, 8, 11, .96);
}
.ws-capture.open { display: flex; }
.ws-capture img { max-width: 100%; max-height: 70vh; border-radius: var(--ws-r-sm); border: 1px solid var(--ws-border); }

/* --------------------------------------------------------------------------
   14 · FEEDBACK: toast, spinner, skeleton, empty
   -------------------------------------------------------------------------- */
.ws-toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
  transform: translateX(-50%) translateY(8px);
  z-index: var(--ws-z-toast); display: none;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 650; color: var(--ws-text);
  background: var(--ws-panel-solid); border: 1px solid var(--ws-border-hi);
  box-shadow: var(--ws-shadow-1); opacity: 0;
  transition: opacity var(--ws-t-med) var(--ws-ease), transform var(--ws-t-med) var(--ws-ease);
}
.ws-toast.show { display: block; opacity: 1; transform: translateX(-50%) translateY(0); }
.ws-toast.ok  { border-color: rgba(63, 232, 216, .4); }
.ws-toast.err { border-color: rgba(255, 75, 50, .5); }

.ws-spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--ws-border-hi); border-top-color: var(--ws-lime);
  animation: ws-spin .8s linear infinite;
}
@keyframes ws-spin { to { transform: rotate(360deg); } }

.ws-skeleton {
  border-radius: 8px; min-height: 14px;
  background: linear-gradient(90deg, rgba(207,244,249,.06) 25%, rgba(207,244,249,.12) 50%, rgba(207,244,249,.06) 75%);
  background-size: 200% 100%;
  animation: ws-shimmer 1.4s ease infinite;
}
@keyframes ws-shimmer { to { background-position: -200% 0; } }

.ws-empty { text-align: center; padding: var(--ws-s-6) var(--ws-s-4); color: var(--ws-muted); }
.ws-empty .title { font-size: 14px; font-weight: 550; color: var(--ws-text-2); }
.ws-empty .body  { font-size: 12px; margin-top: 4px; line-height: 1.5; }

/* --------------------------------------------------------------------------
   15 · SUN MODE — AR camera-overlay rules (REDLINES-CARDS §11.2)
   The old .ws-sun body class is retired; [data-ws-theme="sun"] on <html>
   drives everything. Plates over the camera feed stay ≥ 93% opaque INK even
   in sun — the camera is imagery, not a themed surface; dark plates + white
   chevrons are the highest-contrast marks against sky.
   -------------------------------------------------------------------------- */
[data-ws-theme="sun"] .ws-ar-status,
[data-ws-theme="sun"] .ws-ar-tray { background: rgba(2, 8, 11, .93) !important; backdrop-filter: none !important; }
[data-ws-theme="sun"] .ws-ar-status { color: #c3d3e2; border-color: rgba(160, 200, 235, .14); }
[data-ws-theme="sun"] .ws-ar-marker .lbl,
[data-ws-theme="sun"] .ws-edge-arrow { background: rgba(2, 8, 11, .97); font-size: 15px; color: #f2f7fc; }
[data-ws-theme="sun"] .ws-ar-marker .chev {
  border-top-color: #fff;
  filter: drop-shadow(0 0 2px rgba(2, 8, 11, 1)) drop-shadow(0 2px 4px rgba(2, 8, 11, .9));
}
[data-ws-theme="sun"] .ws-ar-marker.selected .lbl { background: rgba(2, 8, 11, .97); }

/* --------------------------------------------------------------------------
   16 · MOTION SAFETY + RESPONSIVE
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ws-chip-live::before { animation: none; }
  .ws-skeleton { animation: none; background: rgba(207, 244, 249, .08); }
  .ws-marker svg, .ws-ar-marker, .ws-me-marker .cone { transition: none; }
  .ws-toast { transition: opacity var(--ws-t-med); transform: translateX(-50%); }
}

@media (max-width: 850px) {
  .ws-grid-4, .ws-grid-3, .ws-grid-2 { grid-template-columns: 1fr; }
  .ws-h1 { font-size: 43px; }
  .ws-container { width: min(100% - 24px, 1240px); }
}
@media (max-width: 620px) {
  .ws-h1 { font-size: 38px; }
  .ws-h2 { font-size: 29px; }
  .ws-chip { font-size: 10px; padding: 6px 8px; }
}

/* --------------------------------------------------------------------------
   17 · PRODUCT EXTENSIONS (web/) — components the redlines reference that
   need a shared home. Same conventions: --ws-* / .ws-* only.
   -------------------------------------------------------------------------- */

/* Ended-session stat strip inside the viewer bottom sheet (REDLINES §1.7) */
.ws-sheet .statgrid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--ws-s-2); margin: var(--ws-s-2) 0;
}
.ws-sheet .statgrid .ws-metric { padding: 10px 12px; }
.ws-sheet .statgrid .ws-value { font-size: 22px; }

/* Recorder live-mode row (REDLINES §2.1.4) — realtime vs battery saver */
.ws-live-mode {
  display: none; align-items: center; gap: 10px;
  padding: 12px 14px; font-size: 12px; font-weight: 600;
  color: var(--ws-text-2);
}
.ws-live-mode.on { display: flex; }
.ws-live-mode .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ws-muted); flex: none;
  transition: background var(--ws-t-med);
}
.ws-live-mode.realtime .dot {
  background: var(--ws-lime);
  box-shadow: 0 0 8px rgba(63, 232, 216, .6);
}

/* Amber caution span inside the AR status bar (REDLINES §3) */
.ws-ar-status .warn { color: var(--ws-amber); font-weight: 550; }

/* --------------------------------------------------------------------------
   18 · AVATAR PUCK — rider map marker (REDLINES-CARDS §10, amends DS §7.7)
   The puck is the person; the heading is a notch on its rim. JS sets --hdg
   with a cumulative angle so 350°→10° never spins the long way.
   -------------------------------------------------------------------------- */
.ws-puck{position:relative;width:34px;height:34px;border-radius: 50%;
  background:var(--ws-ink);border:2px solid var(--ws-lime);
  display:grid;place-items:center;
  box-shadow:0 0 0 2px rgba(2,8,11,.6), 0 0 16px rgba(200,255,34,.38); /* fresh glow */
  transition:opacity 240ms var(--ws-ease)}
.ws-puck .initial{font:800 14px/1 var(--ws-font);color:var(--ws-text)}
.ws-puck .notch{position:absolute;inset:-2px;border-radius: 50%;pointer-events:none;
  transform:rotate(var(--hdg));transition:transform 900ms linear}
.ws-puck .notch::before{content:"";position:absolute;left:50%;top:-6px;
  transform:translateX(-50%);width:0;height:0;
  border-left:5px solid transparent;border-right:5px solid transparent;
  border-bottom:7px solid var(--ws-lime)}

/* cooling (DS §7.7): glow only when fresh */
.ws-puck.stale{border-color:var(--ws-muted);opacity:.8;
  box-shadow:0 0 0 2px rgba(2,8,11,.6)}
.ws-puck.stale .notch::before{border-bottom-color:var(--ws-muted)}
.ws-puck.outside{opacity:.45}

/* me-variant (ride-along viewer who is also riding): cyan = self */
.ws-puck.me{border-color:var(--ws-cyan);
  box-shadow:0 0 0 2px rgba(2,8,11,.6), 0 0 16px rgba(80,233,226,.34)}
.ws-puck.me .notch::before{border-bottom-color:var(--ws-cyan)}

@media (prefers-reduced-motion: reduce){.ws-puck .notch{transition:none}}

/* --------------------------------------------------------------------------
   19 · CHAT-PREVIEW PRESENTATION (REDLINES-CARDS §7)
   Cards are consumed at ~350px above a text plate in a chat — the styleguide
   judges them the way Messenger shows them. 380px is the real judging
   distance: if a number is illegible here, it's illegible in the chat.
   -------------------------------------------------------------------------- */
.ws-chatframe{width:min(380px,100%);margin:0;border-radius: 10px;overflow:hidden;
  box-shadow:0 8px 28px rgba(0,0,0,.35)}
.ws-chatframe .card{display:block;width:100%;border-radius: 10px 10px 0 0}
.ws-chatframe .plate{padding:10px 12px 12px}
.ws-chatframe .url{font-size:11px;letter-spacing:.05em;text-transform:uppercase;
  font-weight: 550}
.ws-chatframe .title{font-size:15px;font-weight: 600;line-height:1.25;margin-top:3px}
.ws-chatframe .desc{font-size:13px;line-height:1.35;margin-top:2px;display:-webkit-box;
  -webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* variant: Messenger dark (default for the styleguide) */
.ws-chatstage--messenger{background:#18191A;padding:24px;border-radius: 12px}
.ws-chatstage--messenger .plate{background:#242526}
.ws-chatstage--messenger .url{color:#8A8D91}
.ws-chatstage--messenger .title{color:#E4E6EB}
.ws-chatstage--messenger .desc{color:#B0B3B8}

/* variant: iMessage grey bubble */
.ws-chatstage--imessage{background:#FFFFFF;padding:24px;border-radius: 12px}
.ws-chatstage--imessage .ws-chatframe{border-radius: 12px}
.ws-chatstage--imessage .plate{background:#E9E9EB}
.ws-chatstage--imessage .url{color:#8E8E93}
.ws-chatstage--imessage .title{color:#1C1C1E}
.ws-chatstage--imessage .desc{color:#48484A}

/* variant: plain (no chat chrome) */
.ws-chatstage--plain{background:transparent;padding:0}
.ws-chatstage--plain .plate{background:var(--ws-panel-solid);
  border:1px solid var(--ws-border);border-top:0;border-radius: 0 0 10px 10px}
.ws-chatstage--plain .url{color:var(--ws-muted)}
.ws-chatstage--plain .title{color:var(--ws-text)}
.ws-chatstage--plain .desc{color:var(--ws-muted)}

/* --------------------------------------------------------------------------
   20 · SUN THEME — glare mode, not a light theme (REDLINES-CARDS §11)
   Outdoor readability under direct sun + polarized sunglasses: max contrast,
   heavy weights, hard borders. Applied via data-ws-theme="sun" on <html>;
   precedence ?sun=1 → stored choice → auto (07–20 local, /record + /ar only).
   Cards (§11.4) are exempt — og_card.py takes no theme input.
   -------------------------------------------------------------------------- */
[data-ws-theme="sun"]{
  --ws-ink:#FFFFFF;            /* deepest layer flips to brightest */
  --ws-bg:#f7fafc;             /* page ground */
  --ws-bg-2:#e9eff5;
  --ws-panel-solid:#FFFFFF;
  --ws-text:#0b2237;
  --ws-text-2:#2e4a63;
  --ws-muted:#5d768c;          /* 6.7:1 on sun bg — still the small-label floor */
  --ws-faint:#9fb2c2;          /* decorative only, as ever */
  --ws-lime:#1348a6;           /* SIGNAL as cobalt — day CTA color */
  --ws-lime-2:#2f5cb0;
  --ws-live:#FF4B32;           /* unchanged — red text only as white-on-red fills */
  --ws-cyan:#0e6fa8;           /* environment as sea blue */
  --ws-amber:#8A5F00;          /* caution — 5.2:1 */
  --ws-orange:#C2410C;
  --ws-track-cold:#0b7c8f;
  --ws-track-mid:#1348a6;
  --ws-track-hot:#C2410C;
  --ws-border:rgba(11,34,55,.18);
  --ws-border-hi:rgba(11,34,55,.34);
  --ws-glass:rgba(255,255,255,.94);        /* glass disabled: DS §5.5 — solid */
  --ws-glass-strong:rgba(255,255,255,.97);
  --ws-shadow-1:0 10px 24px rgba(10,20,24,.14);
  --ws-shadow-2:0 22px 60px rgba(10,20,24,.20);
}

/* derived paints that live outside the spec table but must follow it */
[data-ws-theme="sun"]{
  color-scheme: light;
  --ws-panel: rgba(255,255,255,.92);
  --ws-glass-solid: rgba(255,255,255,.96);
  --ws-on-lime:#ffffff;                     /* cobalt fills carry white (CTA rule) */
  --ws-track-halo: rgba(255,255,255,.7);    /* dark halo smears on light water */
  --ws-fence-stroke:#0e6fa8;
  --ws-fence-stroke-op: 0.8;
  --ws-fence-fill:#0e6fa8;
  --ws-fence-fill-op: 0.08;
  --ws-hud-corner: rgba(19,72,166,.7);
  --ws-glow-lime: 0 10px 24px rgba(10,20,24,.10);
  --ws-glow-live: 0 10px 24px rgba(10,20,24,.10);
}

/* --------------------------------------------------------------------------
   21 · SUN THEME — component adjustments (REDLINES-CARDS §11.2)
   Hardcoded dark surfaces re-derived; glass and glow die in glare.
   -------------------------------------------------------------------------- */
[data-ws-theme="sun"] body { background: var(--ws-bg); color: var(--ws-text); }
[data-ws-theme="sun"] .ws-shell {
  background: linear-gradient(180deg, #ffffff 0, #f4f8f9 55%, #e9f0f1 100%);
}
[data-ws-theme="sun"] .ws-noise::after { display: none; }  /* clean ground in glare */
[data-ws-theme="sun"] .ws-card {
  background: var(--ws-panel-solid);
  border-color: var(--ws-border-hi);
}
[data-ws-theme="sun"] .ws-glass,
[data-ws-theme="sun"] .ws-topbar {
  background-color: var(--ws-glass-solid) !important;
  background-image: none;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: var(--ws-border-hi);
}
[data-ws-theme="sun"] .ws-btn:not(.ws-btn-primary):not(.ws-btn-danger) {
  background: var(--ws-panel-solid); border-color: var(--ws-border-hi);
}
[data-ws-theme="sun"] .ws-btn-ghost { background: rgba(10, 20, 24, .05); }
[data-ws-theme="sun"] .ws-btn-round { background: var(--ws-panel-solid); color: var(--ws-text-2); }
[data-ws-theme="sun"] .ws-btn-round.active { background: var(--ws-cyan); color: #fff; }
/* lime-filled surfaces keep TRUE lime with ink text (16.4:1) — untouched:
   .ws-btn-primary and .ws-btn-danger use literal hexes by design.
   The brand mark is a lime FILL: true lime, always (§11.1). */
[data-ws-theme="sun"] .ws-brand-mark::before,
[data-ws-theme="sun"] .ws-brand-mark::after { background: #3fe8d8; }
[data-ws-theme="sun"] .ws-input {
  background: var(--ws-panel-solid); border-color: var(--ws-border-hi); color: var(--ws-text);
}
[data-ws-theme="sun"] .ws-chip { background: var(--ws-panel-solid); }
[data-ws-theme="sun"] .ws-chip-ghost { background: rgba(10, 20, 24, .04); }
[data-ws-theme="sun"] .ws-chip-live {           /* ink plate, not white-on-red:
  white on #FF4B32 is 3.33:1 — passes only ≥18px bold (§2.2), and chip text
  is 10-11px. §10/§11.2: plates are literal night ink in BOTH themes (the
  --ws-ink token flips to white in sun); the red lives in border + dot. */
  background: #020a14; color: #fff; border-color: rgba(255, 75, 50, .55);
}
[data-ws-theme="sun"] .ws-chip-lime { background: #1348a6; color: #ffffff;
  border-color: #1348a6; }  /* lime edge ≈1.3:1 on light grey — olive boundary */
/* day primary: solid deep cobalt, white text, NO outline — the night
   aqua gradient with white text + blue ring read wrong on cloud white */
[data-ws-theme="sun"] .ws-btn-primary {
  background: var(--ws-lime); color: #ffffff; border: 0;
  box-shadow: var(--ws-shadow-1);
}
/* hot metric keeps its marker in glare: solid olive bar + border, not a glow
   (sun mode is solid plates — a lime gradient glowline washes out on white) */
[data-ws-theme="sun"] .ws-metric.hot { border-color: rgba(19, 72, 166, .55); }
[data-ws-theme="sun"] .ws-metric.hot::after { background: var(--ws-lime); height: 3px; }
[data-ws-theme="sun"] .ws-chip-warn { background: rgba(138, 95, 0, .12); }
[data-ws-theme="sun"] .ws-chip-cyan { background: rgba(11, 110, 105, .1); }
/* recorder geofence pill (spec §11.2 exact fills) */
[data-ws-theme="sun"] .ws-pill { background: var(--ws-panel-solid); }
[data-ws-theme="sun"] .ws-pill.inside {
  background: rgba(24, 87, 194, .12); color: var(--ws-lime);
  border-color: rgba(24, 87, 194, .35);
}
[data-ws-theme="sun"] .ws-pill.outside {
  background: rgba(138, 95, 0, .14); color: var(--ws-amber);
  border-color: rgba(138, 95, 0, .35);
}
/* recorder live-mode row: white card + hard border */
[data-ws-theme="sun"] .ws-live-mode { color: var(--ws-text-2); }
[data-ws-theme="sun"] .ws-live-mode.realtime .dot { box-shadow: none; }
[data-ws-theme="sun"] .ws-metric {
  background: var(--ws-panel-solid); border-color: var(--ws-border);
}
[data-ws-theme="sun"] [data-ws-theme="sun"] .ws-speed-ring-inner {
  background: var(--ws-panel-solid); border-color: var(--ws-border);
}
[data-ws-theme="sun"] .ws-speed-ring {
  background: conic-gradient(var(--ws-lime) 0 calc(var(--ws-ring-pct) * 1%),
              rgba(10, 20, 24, .14) calc(var(--ws-ring-pct) * 1%));
  box-shadow: 0 0 0 1px var(--ws-border);
}
[data-ws-theme="sun"] .ws-sheet { box-shadow: var(--ws-shadow-1); }
[data-ws-theme="sun"] .ws-overlay {
  background: linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(244, 248, 249, .98));
}
[data-ws-theme="sun"] .ws-toast { background: var(--ws-panel-solid); }
[data-ws-theme="sun"] .ws-skeleton {
  background: linear-gradient(90deg, rgba(10,20,24,.06) 25%, rgba(10,20,24,.12) 50%, rgba(10,20,24,.06) 75%);
  background-size: 200% 100%;
}
[data-ws-theme="sun"] .ws-glowline {
  background: linear-gradient(90deg, transparent, rgba(24, 87, 194, .5), transparent);
  box-shadow: none;
}
[data-ws-theme="sun"] .ws-windbars .bar { background: rgba(10, 20, 24, .08); }
[data-ws-theme="sun"] .ws-windbars .bar.ok {
  background: rgba(11, 110, 105, .14); border-color: rgba(11, 110, 105, .4);
}
[data-ws-theme="sun"] .ws-windbars .bar.good { background: #3fe8d8; }
/* bare red strings are banned in sun (3.1:1) — errors go max-contrast ink */
[data-ws-theme="sun"] .ws-status .err { color: var(--ws-text); }
/* puck in sun: white fill via token flip, glow off (invisible in glare) */
[data-ws-theme="sun"] .ws-puck { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
[data-ws-theme="sun"] .ws-puck.me { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
[data-ws-theme="sun"] .ws-puck.stale { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
[data-ws-theme="sun"] .ws-dot { border-color: #fff; box-shadow: 0 0 0 4px rgba(10, 20, 24, .1); }
[data-ws-theme="sun"] .ws-me-marker .dot { box-shadow: 0 0 0 4px rgba(10, 20, 24, .12); }
/* theme toggle button glyph */
.ws-theme-btn { width: 44px; height: 44px; font-size: 18px; }
