/* CastShare tournament panel — dark "live telemetry" console in the CastShare palette. */
:root {
  /* App palette (presentation/theme): BackgroundDark, SurfaceDark, MossGreen, SkyBlue, SandyBeach, CoralRed. */
  --bg: #0b1218;
  --bg-deep: #081017;
  --surface: #121c23;
  --surface-2: #162129;
  --surface-3: #1c2a33;
  --line: rgba(224, 225, 221, 0.08);
  --line-strong: rgba(224, 225, 221, 0.14);
  --ink: #e0e1dd;
  --muted: #8b9aa5;
  --faint: #5d6d78;
  --moss: #2a9d8f;
  --moss-bright: #4cc3b3;
  --sky: #2c7da0;
  --sky-bright: #61b3d6;
  --sand: #e9c46a;
  --sunset: #f4a261;
  --coral: #e76f51;
  --ocean: #012a4a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --display: "Geist", "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --chrome: rgba(11, 18, 24, 0.97);
  --chrome-strong: rgba(18, 28, 35, 0.97);
  --chrome-soft: rgba(11, 18, 24, 0.85);
  --scrim: rgba(8, 16, 23, 0.6);
  --map-filter: invert(1) hue-rotate(185deg) brightness(0.62) contrast(1.05) saturate(0.55) sepia(0.15);
  --map-dots: rgba(224, 225, 221, 0.05);
  --map-tint: linear-gradient(180deg, rgba(1, 42, 74, 0.18), rgba(11, 18, 24, 0.35));
  --topbar-h: 64px;
  --panel-w: 400px;
  color-scheme: dark;
}

/* Light theme: CastShare light palette (app theme BackgroundLight / OnSurfaceLight, site styles.css).
   Follows the device unless the viewer picked a theme with the toggle (data-theme on <html>). */
:root[data-theme="light"] {
  --bg: #f4f7f9;
  --bg-deep: #e9eff2;
  --surface: #ffffff;
  --surface-2: #f5f8fa;
  --surface-3: #e7eef2;
  --line: rgba(16, 42, 54, 0.08);
  --line-strong: rgba(16, 42, 54, 0.15);
  --ink: #102a36;
  --muted: #5e7078;
  --faint: #8a9aa3;
  --moss: #2a9d8f;
  --moss-bright: #1d7f73;
  --sky: #2c7da0;
  --sky-bright: #1f6a8a;
  --sand: #b07a1c;
  --sunset: #d9813f;
  --coral: #c4553b;
  --ocean: #dfe8ee;
  --shadow: 0 16px 40px rgba(16, 42, 54, 0.14);
  --chrome: rgba(255, 255, 255, 0.97);
  --chrome-strong: rgba(255, 255, 255, 0.98);
  --chrome-soft: rgba(255, 255, 255, 0.9);
  --scrim: rgba(16, 42, 54, 0.35);
  --map-filter: saturate(0.5) contrast(0.97) brightness(1.03);
  --map-dots: rgba(16, 42, 54, 0.05);
  --map-tint: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(223, 232, 238, 0.25));
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-family: var(--mono); }
.amber { color: var(--sand); }
.muted { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--moss-bright) 55%, transparent); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* ---------- Map ---------- */
.map { position: fixed; inset: 0; z-index: 0; background: var(--ocean); }

/* Dark nautical look from standard OSM tiles. */
.map .leaflet-tile-pane {
  filter: var(--map-filter);
}

.map::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  background:
    radial-gradient(circle, var(--map-dots) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--map-tint);
}

body.signed-out .map { filter: blur(3px) brightness(0.7); }

.map .leaflet-control-attribution { background: transparent; color: var(--faint); font-size: 10px; }
.map .leaflet-control-attribution a { color: var(--faint); }

.map .leaflet-control-zoom {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.map .leaflet-control-zoom a {
  width: 38px;
  height: 38px;
  line-height: 38px;
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.map .leaflet-control-zoom a:hover { background: var(--surface-3); }

/* Angler markers: glowing rings, rank badge, name chip. */
.angler-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--marker, #2a9d8f) 30%, var(--bg));
  color: #ffffff;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 800;
  box-shadow:
    0 0 0 2px var(--marker, #2a9d8f),
    0 0 18px color-mix(in srgb, var(--marker, #2a9d8f) 70%, transparent);
  transition: transform 0.2s ease;
}

:root[data-theme="light"] .angler-marker {
  background: var(--marker, #2a9d8f);
  box-shadow: 0 0 0 3px #ffffff, 0 6px 16px rgba(16, 42, 54, 0.3);
}

.angler-marker.stale { filter: grayscale(1) brightness(0.8); box-shadow: 0 0 0 2px #5d6d78; }
.angler-marker.selected { transform: scale(1.25); }

.angler-marker.selected::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--marker, #2a9d8f) 80%, transparent);
  animation: spin 12s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.angler-marker b {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--sand);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  border: 1px solid var(--line-strong);
}

.leaflet-tooltip.angler-label {
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--chrome-soft);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 11px;
  box-shadow: none;
}
.leaflet-tooltip.angler-label::before { display: none; }

/* Selected angler card on the map. */
.leaflet-popup.hud-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--chrome-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.leaflet-popup.hud-popup .leaflet-popup-content { margin: 0; min-width: 240px; }
.leaflet-popup.hud-popup .leaflet-popup-tip { background: var(--chrome-strong); }
.leaflet-popup.hud-popup a.leaflet-popup-close-button { color: var(--muted); top: 6px; right: 6px; }

.hud-card { padding: 12px 14px; font-family: var(--sans); }
.hud-card header { display: flex; align-items: center; gap: 8px; padding-right: 18px; }
.hud-card header strong { font-family: var(--display); font-size: 14px; }
.hud-card header i { width: 7px; height: 7px; border-radius: 50%; background: var(--moss-bright); }
.hud-card header i.weak { background: var(--sand); }
.hud-card header i.off { background: var(--faint); }
.hud-card .rank-chip {
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--moss) 50%, transparent);
  border-radius: 5px;
  color: var(--moss-bright);
}
.hud-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.hud-card dt { color: var(--faint); font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.hud-card dd { margin: 2px 0 0; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--moss-bright); }
.hud-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.hud-card footer .mono { color: var(--moss-bright); font-size: 11px; white-space: nowrap; }

.map-footer {
  position: fixed;
  right: 64px;
  bottom: 8px;
  z-index: 5;
  display: flex;
  gap: 14px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--chrome-soft);
  color: var(--faint);
  font-size: 10px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 14px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line-strong); }
.brand-text { display: grid; line-height: 1.1; }
.brand-text b { font-family: var(--display); font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.brand-text small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.event-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 340px;
  height: 42px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
}

.live-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--faint); }
.live-dot.live { background: var(--moss-bright); animation: pulse 1.8s ease-in-out infinite; }

.event-picker select {
  min-width: 0;
  max-width: 100%;
  height: 40px;
  padding: 0 24px 0 0;
  border: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9aa5' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 2px center / 14px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  appearance: none;
  cursor: pointer;
  outline: none;
}

.event-picker select option { background: var(--surface-2); color: var(--ink); }

.telemetry { display: flex; align-items: center; min-width: 0; }

.telemetry > div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.telemetry span { color: var(--muted); font-size: 12px; }
.telemetry b { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--moss-bright); }
.telemetry b.amber { color: var(--sand); letter-spacing: 0.04em; }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.pill-button,
.signout-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pill-button, .signout-button { white-space: nowrap; }
.pill-button:hover { border-color: color-mix(in srgb, var(--moss) 60%, transparent); }

.pill-button svg, .signout-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pill-button svg { color: var(--moss-bright); }

.signout-button {
  border-color: color-mix(in srgb, var(--coral) 45%, transparent);
  background: color-mix(in srgb, var(--coral) 10%, transparent);
  color: var(--coral);
}

.lang {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
}

.lang button {
  height: 30px;
  min-width: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.lang button[aria-pressed="true"] { background: var(--surface-3); color: var(--moss-bright); }

/* ---------- Side panel ---------- */
.sheet {
  position: fixed;
  z-index: 10;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px 20px;
  background: var(--chrome);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
  animation: rise 0.45s ease both;
}

.sheet-handle { display: none; }

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.head-place { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.status[data-state="live"] {
  border-color: color-mix(in srgb, var(--moss) 55%, transparent);
  background: color-mix(in srgb, var(--moss) 12%, transparent);
  color: var(--moss-bright);
}

.status[data-state="live"] i { animation: pulse 1.8s ease-in-out infinite; }
.status[data-state="done"] { color: var(--sky-bright); border-color: color-mix(in srgb, var(--sky) 50%, transparent); }

.sheet-head h1 {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }

.stats div {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}

.stats dt { color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stats dd {
  margin: 4px 0 2px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stats small {
  display: block;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.stats .accent dd, .stats .accent small { color: var(--moss-bright); }
.stats .attention.active { border-color: color-mix(in srgb, var(--sand) 40%, transparent); background: color-mix(in srgb, var(--sand) 7%, var(--surface)); }
.stats .attention.active dd, .stats .attention.active small { color: var(--sand); }

.sync {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
}

.sync svg { width: 16px; height: 16px; fill: none; stroke: var(--moss-bright); stroke-width: 2; stroke-linecap: round; }
.sync small { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 500; }

/* ---------- Organizer actions ---------- */
.organizer-actions {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}

.organizer-actions[data-tone="attention"] { border-color: color-mix(in srgb, var(--sand) 45%, transparent); }
.organizer-actions[data-tone="done"] { border-color: color-mix(in srgb, var(--moss) 50%, transparent); }
.organizer-state strong { display: block; font-family: var(--display); font-size: 14px; }
.organizer-state small { display: block; margin-top: 3px; line-height: 1.45; font-size: 12.5px; }
.organizer-actions .button { min-height: 40px; width: 100%; }
.organizer-actions .button:disabled { opacity: 0.55; cursor: progress; }

/* ---------- Tabs ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 2px -16px 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tabs button[aria-selected="true"] { color: var(--moss-bright); border-bottom-color: var(--moss-bright); }

.tabs em {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sand) 20%, transparent);
  color: var(--sand);
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
  line-height: 18px;
}

.tab-panel { display: grid; gap: 10px; }
.empty { padding: 8px 2px; line-height: 1.5; }

.section-title {
  margin: 10px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Search & chips ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}

.search svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13.5px; outline: none; }
.search input::placeholder { color: var(--faint); }
.search:focus-within { border-color: color-mix(in srgb, var(--moss) 60%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chips button {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chips button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }

/* ---------- Angler cards ---------- */
.angler-cards { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

.angler-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.angler-card.clickable { cursor: pointer; }
.angler-card.clickable:hover { border-color: var(--line-strong); background: var(--surface-2); }

.angler-card.selected {
  border-color: color-mix(in srgb, var(--moss) 70%, transparent);
  background: color-mix(in srgb, var(--moss) 9%, var(--surface));
}

.avatar-square {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--marker, #2a9d8f) 60%, transparent);
  background: color-mix(in srgb, var(--marker, #2a9d8f) 18%, transparent);
  color: var(--ink);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 800;
}

.avatar-square i {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--moss-bright);
}

.avatar-square i.weak { background: var(--sand); }
.avatar-square i.off { background: var(--faint); }

.card-main { min-width: 0; }
.card-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-name strong { font-family: var(--display); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-chip { flex: none; color: var(--sand); font-family: var(--mono); font-size: 11px; font-weight: 600; }

.signal-chip {
  flex: none;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--sand) 16%, transparent);
  color: var(--sand);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-status { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.card-status.online { color: var(--moss-bright); }
.card-status.weak { color: var(--sand); }

.card-score { text-align: right; white-space: nowrap; }
.card-score strong { display: block; font-family: var(--display); font-size: 14px; }
.card-score small { display: block; margin-top: 2px; color: var(--moss-bright); font-family: var(--mono); font-size: 12px; }

.card-foot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.card-foot button { border: 0; background: none; color: var(--moss-bright); font-weight: 700; font-size: 12px; cursor: pointer; }

/* ---------- Rows (recent catches) ---------- */
.rows { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }

.rows li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}

.rows li:last-child { border-bottom: 0; }
.row-main { min-width: 0; flex: 1; }
.row-main strong { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  padding: 2px 7px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill.valid { background: color-mix(in srgb, var(--moss) 16%, transparent); color: var(--moss-bright); }
.pill.pending, .pill.flagged { background: color-mix(in srgb, var(--sand) 16%, transparent); color: var(--sand); }
.pill.rejected { background: color-mix(in srgb, var(--coral) 16%, transparent); color: var(--coral); }

.row-action {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--sky-bright);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Standings ---------- */
.rows.standings li.standing {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 40px minmax(84px, auto);
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
}

.rows.standings li.standing.clickable { cursor: pointer; }
.rows.standings li.standing.clickable:hover,
.rows.standings li.standing.selected { background: var(--surface); border-radius: 10px; }

.rows.standings .standings-head {
  padding-top: 2px;
  padding-bottom: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.standing .place {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.standings-head .place { width: auto; height: auto; place-items: start center; }
.podium .place { color: #0b1218; }
.podium-1 .place { background: var(--sand); box-shadow: 0 0 14px color-mix(in srgb, var(--sand) 45%, transparent); }
.podium-2 .place { background: #b8c4cc; }
.podium-3 .place { background: var(--sunset); }

.standing .who { display: flex; align-items: center; gap: 10px; min-width: 0; }

.dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--marker, #2a9d8f) 60%, transparent);
  background: color-mix(in srgb, var(--marker, #2a9d8f) 18%, transparent);
  color: var(--ink);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 800;
}

.standing .row-main strong { font-family: var(--display); font-size: 14px; }

.standing .tag {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--sand) 16%, transparent);
  color: var(--sand);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.standing .num { color: var(--muted); font-family: var(--mono); font-size: 12.5px; text-align: center; }
.standing .result { text-align: right; white-space: nowrap; }
.standing .result strong { display: block; font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--moss-bright); }
.podium-1 .result strong { font-size: 15.5px; }
.standing .result small { display: block; margin-top: 1px; color: var(--faint); font-family: var(--mono); font-size: 10.5px; }
.standings-head .num, .standings-head .result { color: var(--faint); font-family: var(--mono); }

/* ---------- Review cards ---------- */
.review-list { display: grid; gap: 10px; }

.review-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--sand) 30%, transparent);
  border-radius: 12px;
  background: var(--surface);
  animation: rise 0.3s ease both;
}

.review-photo {
  width: 88px;
  height: 88px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-3);
  cursor: zoom-in;
}

.review-photo.placeholder { display: grid; place-items: center; color: var(--faint); font-size: 26px; cursor: default; }
.review-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.review-body strong { font-family: var(--display); font-size: 15px; }
.review-body .measure { font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--moss-bright); }
.review-body small { color: var(--muted); font-size: 12px; }
.review-body .note { color: var(--sand); font-size: 12px; }
.review-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }

.review-actions button {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.review-actions .approve { border: 0; background: var(--moss); color: #ffffff; }
.review-actions .reject { border: 1px solid color-mix(in srgb, var(--coral) 45%, transparent); background: transparent; color: var(--coral); }
.review-actions .edit { flex: 0 0 auto; padding: 0 12px; border: 1px solid var(--line-strong); background: transparent; color: var(--sky-bright); }
.review-actions button:disabled { opacity: 0.5; cursor: progress; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: var(--moss);
  color: #ffffff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 22px color-mix(in srgb, var(--moss) 25%, transparent);
}

.button:hover { background: color-mix(in srgb, var(--moss) 88%, #ffffff); }
.button svg { width: 20px; height: 20px; }
.button-light { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: none; }
.button-light:hover { background: var(--surface-3); }
.button-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); box-shadow: none; }
.button-ghost:hover { background: var(--surface-2); }
.button-danger { background: var(--coral); box-shadow: none; }
.button-danger:hover { background: color-mix(in srgb, var(--coral) 88%, #ffffff); }

.button-danger-soft {
  background: color-mix(in srgb, var(--coral) 10%, transparent);
  color: var(--coral);
  border: 1px solid color-mix(in srgb, var(--coral) 45%, transparent);
  box-shadow: none;
}

.button-danger-soft:hover { background: color-mix(in srgb, var(--coral) 18%, transparent); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  bottom: 22px;
  left: calc(var(--panel-w) + (100% - var(--panel-w)) / 2);
  z-index: 40;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(620px, calc(100% - var(--panel-w) - 40px));
  transform: translateX(-50%);
}

.toast {
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  animation: rise 0.3s ease both;
}

.toast.error { border-color: color-mix(in srgb, var(--coral) 55%, transparent); color: var(--coral); }

.catch-toast {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--moss) 55%, transparent);
  border-radius: 12px;
  background: var(--chrome-strong);
  box-shadow: var(--shadow), 0 0 26px color-mix(in srgb, var(--moss) 18%, transparent);
  animation: rise 0.35s ease both;
}

.catch-toast-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--moss) 18%, transparent);
}

.catch-toast-icon svg { width: 16px; height: 16px; fill: none; stroke: var(--moss-bright); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.catch-toast p { margin: 0; font-size: 13px; line-height: 1.4; }
.catch-toast p b { color: var(--moss-bright); }
.catch-toast p em { color: var(--sand); font-style: normal; font-weight: 700; }
.catch-toast small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.catch-toast button { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }

/* ---------- Auth ---------- */
.auth {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: var(--scrim);
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 30px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--chrome-strong);
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.brand-large { justify-self: start; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 17px; }
.auth-card h1 { margin: 8px 0 0; font-family: var(--display); font-size: 28px; letter-spacing: -0.03em; }
.auth-card > .muted { line-height: 1.5; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-family: var(--mono); font-size: 11px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.email-form { display: grid; gap: 12px; }
.email-form label, .dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }

.email-form input, .dialog textarea, .dialog input, .dialog select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  outline: none;
}

.email-form input:focus, .dialog textarea:focus, .dialog input:focus, .dialog select:focus { border-color: var(--moss); }
.form-error { margin: 0; color: var(--coral); font-size: 13px; font-weight: 600; }
.fine { font-size: 12px; text-align: center; }

/* ---------- Overlay & dialogs ---------- */
.overlay {
  position: fixed;
  inset: var(--topbar-h) 0 0;
  z-index: 15;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.overlay-card {
  width: min(460px, 100%);
  padding: 30px 26px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 0.45s ease both;
}

.overlay-card h2 { margin: 14px 0 6px; font-family: var(--display); font-size: 22px; }
.overlay-card > p { margin: 0 0 22px; line-height: 1.5; }

.overlay-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 14px;
  background: var(--surface-3);
  font-size: 24px;
}

.dialog {
  width: min(440px, calc(100% - 32px));
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.dialog h2 { margin: 0 0 4px; font-family: var(--display); font-size: 19px; }
.dialog form { display: grid; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .button { min-height: 40px; padding: 0 16px; }
.dialog .button:disabled { opacity: 0.55; cursor: progress; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-wide { width: min(540px, calc(100% - 32px)); }
.dialog #publish-preview { max-height: 46vh; overflow-y: auto; }

.photo-viewer { padding: 0; background: transparent; border: 0; box-shadow: none; width: auto; max-width: 92vw; }
.photo-viewer img { display: block; max-width: 92vw; max-height: 86vh; border-radius: 14px; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1320px) {
  .telemetry > div:nth-child(1) { display: none; }
}

@media (max-width: 1120px) {
  .telemetry { display: none; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 58px; }
  .brand-text, .pill-button span, .signout-button span { display: none; }
  .event-picker { flex: 1; max-width: none; }
  .topbar { gap: 8px; padding: 0 10px; }
  .pill-button, .signout-button { padding: 0 10px; }
  .map-footer { display: none; }
  .map .leaflet-control-zoom { display: none; }

  .sheet {
    top: auto;
    right: 0;
    width: auto;
    max-height: 50vh;
    padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 18px 18px 0 0;
    transition: max-height 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .sheet.expanded { max-height: calc(100vh - var(--topbar-h) - 12px); }

  .sheet-handle {
    display: grid;
    place-items: center;
    flex: none;
    height: 20px;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .sheet-handle span { width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong); }
  .tabs { margin: 0 -14px; padding: 0 14px; }
  .toasts { left: 50%; width: calc(100% - 24px); bottom: auto; top: calc(var(--topbar-h) + 10px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Public page settings ---------- */
.public-page {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch-row strong { display: block; font-family: var(--display); font-size: 14px; }
.switch-row small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; }

.switch-row input {
  appearance: none;
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch-row input:checked { background: color-mix(in srgb, var(--moss) 45%, transparent); border-color: var(--moss); }
.switch-row input:checked::after { transform: translateX(18px); background: #ffffff; }
.switch-row input:disabled { opacity: 0.5; cursor: progress; }

.public-options { display: grid; gap: 10px; }
.public-options label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }

.public-options select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
}

.link-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.link-row a { flex: 1; min-width: 0; color: var(--sky-bright); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Theme toggle ---------- */
.theme-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.theme-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-button .moon { display: none; }
:root[data-theme="light"] .theme-button .sun { display: none; }
:root[data-theme="light"] .theme-button .moon { display: block; }

/* Participant: own catches */
.review-card.mine { border-color: var(--line); }
.mine-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Catch spots ---------- */
.catch-pin {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--moss);
  box-shadow: 0 0 0 2px var(--bg), 0 3px 8px rgba(0, 0, 0, 0.35);
}

.catch-pin svg { width: 16px; height: 16px; fill: #ffffff; }
.catch-pin svg .eye { fill: var(--moss); }
.catch-pin.pending svg .eye, .catch-pin.flagged svg .eye { fill: var(--sand); }
.catch-pin.rejected svg .eye { fill: var(--coral); }

.catch-pin.pending, .catch-pin.flagged { background: var(--sand); }
.catch-pin.rejected { background: var(--coral); opacity: 0.75; }
.hud-card .spot-photo { display: block; width: 100%; max-height: 140px; margin-top: 10px; border-radius: 8px; object-fit: cover; cursor: zoom-in; }
.hud-card header .pill { margin-left: auto; }
#catch-spots[aria-pressed="false"] { opacity: 0.55; }
