/* sailboss per-regatta landing-page styles
 * (the SPA at <slug>.sailboss.ai/ that lists leaderboards + races
 *  for one regatta — distinct from the cross-regatta hub at the App).
 *
 * Mobile-first dark theme matching the 3D viewer aesthetic. Two top-level
 * panels (leaderboard, per-boat) render into #app.
 */

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: -apple-system, system-ui, "Inter", "Segoe UI", sans-serif;
  background: #0d0f12;
  color: #e7e9ec;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.regatta-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 36px;
}
.regatta-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
  line-height: 1.2;
}
.back-link {
  display: inline-flex;
  align-items: center;
  background: #1a2030;
  border: 1px solid #232b39;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: #c4ccd9;
  text-decoration: none;
}
.back-link:hover { background: #232b3a; color: #fff; }

.share-btn {
  background: #2c4470;
  border: 1px solid #3a5894;
  border-radius: 6px;
  padding: 7px 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.share-btn:hover { background: #345285; }
.share-btn:active { transform: translateY(1px); }

/* 2D / 3D snippet-viewer preference pill (persists to localStorage). */
.viewer-pref {
  display: inline-flex;
  background: #141823;
  border: 1px solid #1f2630;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.viewer-pref-btn {
  background: transparent;
  border: none;
  color: #8b94a3;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
}
.viewer-pref-btn:hover { color: #c4ccd9; }
.viewer-pref-btn.active {
  background: #2c4470;
  color: #fff;
}

/* ── Nav tabs ────────────────────────────────────────────────────────── */
.regatta-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid #232b39;
}
.regatta-nav-tab {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #8b94a3;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.regatta-nav-tab.active {
  color: #e7e9ec;
  border-bottom-color: #4a78c8;
}
.regatta-nav-tab:hover { color: #e7e9ec; }

/* ── Races grid (cross-race nav) ────────────────────────────────────── */
.races-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.race-card {
  display: block;
  background: #141823;
  border: 1px solid #1f2630;
  border-radius: 8px;
  padding: 18px 16px;
  color: #e7e9ec;
  text-decoration: none;
  transition: background 80ms, border-color 80ms;
}
.race-card:hover {
  background: #1a1f2c;
  border-color: #2c3445;
}
.race-card-num {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.race-card-sub {
  font-size: 12px;
  color: #8b94a3;
}

/* ── Leaderboard panel ──────────────────────────────────────────────── */
.lb-panel { display: flex; flex-direction: column; gap: 12px; }

.lb-meta {
  background: #141823;
  border: 1px solid #1f2630;
  border-radius: 8px;
  padding: 12px 14px;
}
.lb-description {
  font-size: 13px;
  color: #c4ccd9;
  margin-bottom: 10px;
  line-height: 1.4;
}
.lb-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lb-slider-label {
  font-size: 12px;
  color: #8b94a3;
  font-weight: 600;
}
.lb-slider {
  flex: 1;
  accent-color: #4a78c8;
}
.lb-slider-readout {
  font-size: 12px;
  color: #c4ccd9;
  font-variant-numeric: tabular-nums;
  min-width: 64px;
  text-align: right;
}

.lb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lb-tab {
  background: #1a2030;
  border: 1px solid #232b39;
  border-radius: 6px;
  padding: 7px 11px;
  color: #c4ccd9;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.lb-tab:hover { background: #232b3a; }
.lb-tab.active {
  background: #2c4470;
  border-color: #3a5894;
  color: #fff;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}
.lb-row {
  display: grid;
  grid-template-columns: 36px 56px 1fr auto;
  gap: 10px;
  align-items: center;
  background: #141823;
  border: 1px solid #1f2630;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.lb-row:hover { background: #1a2030; transform: translateX(2px); }
.lb-rank {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #8b94a3;
  text-align: right;
}
.lb-sail {
  font-variant-numeric: tabular-nums;
  color: #8b94a3;
  font-size: 12px;
}
.lb-name { color: #e7e9ec; font-weight: 600; }
.lb-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #f1c40f;
  text-align: right;
  min-width: 50px;
}

.lb-empty {
  padding: 24px;
  color: #8b94a3;
  text-align: center;
  font-size: 13px;
}

/* ── Per-boat panel ──────────────────────────────────────────────────── */
.bp-meta {
  font-size: 13px;
  color: #8b94a3;
  margin-bottom: 12px;
}
.bp-meta strong { color: #e7e9ec; }

.bp-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bp-section {
  background: #141823;
  border: 1px solid #1f2630;
  border-radius: 8px;
}
.bp-section-header {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #e7e9ec;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.bp-section-header::-webkit-details-marker { display: none; }
.bp-section-header::before {
  content: "▸";
  color: #8b94a3;
  font-size: 11px;
  transition: transform 0.15s ease;
}
.bp-section[open] > .bp-section-header::before { transform: rotate(90deg); }
.bp-section-count {
  background: #1f2630;
  color: #8b94a3;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}

.bp-instances {
  padding: 0 8px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bp-instance {
  display: grid;
  grid-template-columns: 1fr auto 24px;
  gap: 10px;
  align-items: center;
  background: #0d0f12;
  border: 1px solid #1f2630;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  color: #e7e9ec;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.bp-instance:hover { background: #1a2030; }
.bp-instance-label { color: #c4ccd9; }
.bp-instance-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #f1c40f;
}
.bp-instance-play {
  color: #4a78c8;
  font-size: 11px;
}

/* ── Toast ───────────────────────────────────────────────────────────── */
.regatta-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a2030;
  border: 1px solid #2c333d;
  color: #e7e9ec;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1000;
}
.regatta-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error {
  background: #2a1a1a;
  color: #ff9a9a;
  border: 1px solid #5a2a2a;
  border-radius: 6px;
  padding: 14px;
  font-size: 13px;
}

/* ── Cohort pill (Phase 1: search + multi-select) ──────────────────── */
.cohort-pill {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 0 12px 0;
  background: #161c24;
  border: 1px solid #2c333d;
  border-radius: 8px;
}
.cohort-search-btn {
  background: #1f2630;
  border: 1px solid #2c333d;
  color: #f1c40f;
  font: 12px/1.2 system-ui, -apple-system, sans-serif;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.cohort-search-btn:hover {
  background: #2a323d;
}
.cohort-hint {
  color: #6f7886;
  font: 11px/1.4 system-ui, -apple-system, sans-serif;
}
.cohort-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
.cohort-chip {
  background: #1a2030;
  border: 1px solid #2c333d;
  color: #cfd6df;
  font: 11px/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.cohort-chip:hover {
  background: #2a3240;
}
.cohort-chip.focus {
  background: #2a2310;
  border-color: #f1c40f;
  color: #f1c40f;
}
.cohort-clear {
  background: transparent;
  border: 1px solid #2c333d;
  color: #8b94a3;
  font: 11px/1.2 system-ui, -apple-system, sans-serif;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.cohort-clear:hover {
  color: #ff9a9a;
  border-color: #5a2a2a;
}
.lb-row.in-cohort {
  background: linear-gradient(90deg, rgba(241,196,15,0.08) 0%, transparent 60%);
  border-left: 2px solid #f1c40f;
}
.bp-add-cohort {
  background: #1f2630;
  border: 1px solid #2c333d;
  color: #f1c40f;
  font: 11px/1.2 system-ui, -apple-system, sans-serif;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 8px;
}
.bp-add-cohort:hover {
  background: #2a323d;
}

/* ── Race-of-the-day card + reel/recap CTAs (Phase 3) ──────────────── */
.race-of-day {
  margin: 0 0 16px 0;
  padding: 14px 16px;
  background: linear-gradient(90deg, #2a2310 0%, #161c24 80%);
  border: 1px solid #f1c40f;
  border-radius: 8px;
}
.race-of-day:empty { display: none; }
.rod-eyebrow {
  font: 10px/1.4 ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f1c40f;
  margin-bottom: 4px;
}
.rod-headline {
  font: 600 15px/1.3 system-ui, -apple-system, sans-serif;
  color: #f5f7fb;
  margin-bottom: 8px;
}
.rod-cta {
  display: inline-block;
  background: #f1c40f;
  color: #11161d;
  font: 600 13px/1.2 system-ui, -apple-system, sans-serif;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
}
.rod-cta:hover {
  background: #f5d041;
}

.race-card-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.race-card-row .race-card {
  flex: 1 1 auto;
}
.race-card-recap {
  flex: 0 0 auto;
  background: #1f2630;
  border: 1px solid #2c333d;
  color: #f1c40f;
  font: 11px/1.2 system-ui, -apple-system, sans-serif;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  display: flex;
  align-items: center;
}
.race-card-recap:hover {
  background: #2a323d;
  border-color: #f1c40f;
}

.bp-watch-reel {
  background: #f1c40f;
  color: #11161d;
  font: 600 11px/1.2 system-ui, -apple-system, sans-serif;
  padding: 4px 10px;
  border-radius: 4px;
  text-decoration: none;
  margin-left: 8px;
}
.bp-watch-reel:hover {
  background: #f5d041;
}

/* ── "How did I do today" mini-view (Phase 4 / US-9) ───────────────── */
.bp-today {
  margin: 12px 0;
  padding: 12px 14px;
  background: #161c24;
  border: 1px solid #2c333d;
  border-radius: 8px;
}
.bp-today-header {
  font: 600 11px/1.4 ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f1c40f;
  margin-bottom: 8px;
}
.bp-today-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bp-today-row {
  display: grid;
  grid-template-columns: 60px 60px 1fr 1fr;
  gap: 12px;
  align-items: baseline;
  font: 12px/1.4 system-ui, -apple-system, sans-serif;
  color: #cfd6df;
}
.bp-today-race {
  font-weight: 600;
  color: #f5f7fb;
}
.bp-today-finish {
  font: 700 14px/1.2 ui-monospace, monospace;
  color: #f1c40f;
}
.bp-today-gain { color: #6cbf3f; }
.bp-today-loss { color: #e74c3c; }
.bp-today-flat { color: #6f7886; font-style: italic; }
@media (max-width: 600px) {
  .bp-today-row { grid-template-columns: 1fr 1fr; }
  .bp-today-row > * { font-size: 11px; }
}

/* ── Cross-regatta hub link (Phase 5) ──────────────────────────────── */
.all-regattas-link {
  display: inline-block;
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 100;
  background: rgba(15, 18, 23, 0.85);
  border: 1px solid #2c333d;
  color: #8b94a3;
  font: 11px/1.2 system-ui, -apple-system, sans-serif;
  padding: 4px 10px;
  border-radius: 4px;
  text-decoration: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.all-regattas-link:hover {
  color: #f1c40f;
  border-color: #f1c40f;
}
