@charset "UTF-8";
/* ════════════════════════════════════════════════════════════════════════
   SplitsDirect — design tokens (single source of truth)
   Mirrors frontend/DESIGN.md. This :root block IS the white-label surface:
   a "Powered by SplitsDirect" partner re-skins everything by overriding these
   variables in their own scope — they never touch the rules below. Chart.js
   and Leaflet read the same tokens at runtime via SplitsDirect.theme.
   ════════════════════════════════════════════════════════════════════════ */
:root {
  /* Canvas & surfaces — near-black, stepped by elevation (never pure #000) */
  --sd-bg: #0A0A0C;
  --sd-surface: #141416;
  --sd-surface-inset: #0E0E10;
  --sd-elevated: #1C1C20;
  --sd-border: #26262B;
  --sd-border-strong: #35353C;
  --sd-grid: #1C1C20;
  /* Text */
  --sd-text: #ECECEF;
  --sd-text-muted: #8B8B94;
  --sd-text-dim: #5A5A62;
  /* Brand — the single interaction accent */
  --sd-accent: #FF6B2C;
  --sd-accent-bright: #FF894F;
  --sd-accent-ink: #1A0E06;
  --sd-accent-glow: color-mix(in srgb, var(--sd-accent) 35%, transparent);
  /* Data channels — each distinct, all distinct from the brand */
  --sd-channel-hr: #ff3131;
  --sd-channel-pace: #46c4ff;
  --sd-channel-cadence: #f8a72e;
  --sd-channel-elevation: #c739ff; /* course elevation — always-on, violet */
  /* Semantic state */
  --sd-success: #34D399;
  --sd-danger: #FF5C5C;
  --sd-warning: #FBBF24;
  --sd-info: #4C9AFF;
  /* Map-only */
  --sd-course-dim: #3A3A42;
  --sd-feed: #EAB308; /* feed / aid station band — amber, distinct from brand */
  --sd-vendor: #AB47BC; /* default vendor/sponsor zone — sponsors may override per-zone */
  /* Type */
  --sd-font-display: 'Space Grotesk', system-ui, sans-serif;
  --sd-font-body: 'Inter', system-ui, sans-serif;
  --sd-font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
  /* Shape */
  --sd-r-sm: 6px;
  --sd-r-md: 10px;
  --sd-r-lg: 14px;
  --sd-r-full: 9999px;
  /* Motion */
  --sd-t-feedback: 160ms;
  --sd-t-content: 300ms;
  --sd-ease: cubic-bezier(0.2, 0, 0, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--sd-bg);
  color: var(--sd-text);
  font-family: var(--sd-font-body);
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

/* Every readable number is tabular mono so digits don't jitter as they tick. */
.chart-value, .splits-table td:not(:first-child), .progress-text, #status {
  font-family: var(--sd-font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Uppercase, wide-tracked instrument label. */
.panel-label, .tab-btn, .chart-caption, .chart-label, .splits-table th, .layer-toggle-btn, .range-label, #live-btn, .x-toggle-slider-text, .athlete-select h3 {
  font-family: var(--sd-font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sd-text-muted);
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

header h1 {
  font-family: var(--sd-font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  margin: 0;
}

.title-split {
  color: var(--sd-text);
  font-weight: 700;
}

.title-direct {
  color: var(--sd-accent);
  font-weight: 700;
}

.athlete-select {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.athlete-select h3 {
  font-size: 0.72rem;
  margin: 0;
}

#athlete-select {
  background: var(--sd-surface-inset);
  color: var(--sd-text);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-sm);
  font-family: var(--sd-font-mono);
  font-size: 0.85em;
  padding: 4px 8px;
}

#athlete-select:focus {
  outline: none;
  border-color: var(--sd-border-strong);
}

#status {
  font-size: 0.7rem;
  padding: 3px 12px;
  border-radius: var(--sd-r-full);
  background: color-mix(in srgb, var(--sd-danger) 14%, transparent);
  color: var(--sd-danger);
  margin-left: 16px;
}

#status.connected {
  background: color-mix(in srgb, var(--sd-success) 14%, transparent);
  color: var(--sd-success);
}

/* x- Toggle - the box around the slider (Time / Distance mode) */
.x-toggle {
  position: relative;
  display: inline-block;
  width: 310px;
  height: 34px;
  margin-bottom: 12px;
}

/* Hide default HTML checkbox */
.x-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.x-toggle-slider {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  overflow: hidden;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--sd-surface-inset);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-full);
  transition: var(--sd-t-feedback) var(--sd-ease);
}

.x-toggle-slider-text { /* Text styling */
  font-size: 0.78rem;
  z-index: 1;
  transition: color var(--sd-t-feedback), opacity var(--sd-t-feedback);
}

/* Default state: left (Time) active */
.x-toggle-slider-text.left {
  color: var(--sd-accent);
  opacity: 1;
}

.x-toggle-slider-text.right {
  color: var(--sd-text-dim);
  opacity: 0.6;
}

/* Checked state: right (Distance) active */
input:checked + .x-toggle-slider .left {
  color: var(--sd-text-dim);
  opacity: 0.6;
}

input:checked + .x-toggle-slider .right {
  color: var(--sd-accent);
  opacity: 1;
}

.x-toggle-slider:before {
  position: absolute;
  content: "";
  height: 28px;
  width: 149px;
  left: 2px;
  bottom: 2px;
  background-color: var(--sd-elevated);
  border-radius: var(--sd-r-full);
  transition: var(--sd-t-feedback) var(--sd-ease);
}

input:checked + .x-toggle-slider:before {
  transform: translateX(155px);
}

#live-btn {
  background: var(--sd-surface-inset);
  color: var(--sd-text-dim);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-full);
  padding: 4px 14px;
  font-size: 0.68rem;
  cursor: pointer;
  transition: var(--sd-t-feedback) var(--sd-ease);
}

#live-btn.active {
  background: color-mix(in srgb, var(--sd-success) 14%, transparent);
  color: var(--sd-success);
  border-color: color-mix(in srgb, var(--sd-success) 40%, transparent);
}

.range-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-md);
  padding: 10px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.range-tune {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-label {
  margin-right: 4px;
}

.scrub-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
}

.scrub-bar input[type=range] {
  flex: 1;
  accent-color: var(--sd-accent);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.chart-box {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-md);
  padding: 16px;
  min-width: 0;
  overflow: hidden;
}

.progress-track {
  position: relative;
  height: 36px;
  background: var(--sd-surface-inset);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--sd-accent);
  transition: width var(--sd-t-content) var(--sd-ease);
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--sd-text);
  text-shadow: 0 1px 3px color-mix(in srgb, var(--sd-bg) 70%, transparent);
}

/* Overlays the map as a Leaflet control (top-right), so it needs its own
   panel background to stay readable over the map tiles. */
.layer-toggles {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
  max-width: 60vw;
  padding: 6px;
  border-radius: var(--sd-r-md);
  border: 1px solid var(--sd-border);
  background: color-mix(in srgb, var(--sd-bg) 90%, transparent);
  position: absolute;
  top: 30px;
  right: 0px;
}

.layer-toggle-btn {
  background: var(--sd-surface-inset);
  color: var(--sd-text-dim);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-full);
  padding: 4px 12px;
  cursor: pointer;
  transition: var(--sd-t-feedback) var(--sd-ease);
}

.layer-toggle-btn.active {
  background: var(--sd-elevated);
  color: var(--sd-accent);
  border-color: color-mix(in srgb, var(--sd-accent) 40%, transparent);
}

.map-section {
  position: relative;
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-md);
  padding: 16px;
  margin-bottom: 16px;
}

.map-menu {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.menu-btn {
  background: var(--sd-elevated);
  color: var(--sd-text);
  border: 1px solid var(--sd-border-strong);
  border-radius: 50%;
  width: 35px;
  height: 35px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.hidden {
  display: none;
}

#map {
  width: 100%;
  height: 420px;
  border-radius: var(--sd-r-sm);
}

@media (max-width: 700px) {
  #map {
    height: 280px;
  }
}
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--sd-elevated);
  color: var(--sd-text);
  border: 1px solid var(--sd-border);
  border-left: 4px solid var(--sd-info);
  border-radius: var(--sd-r-sm);
  padding: 10px 14px;
  font-family: var(--sd-font-body);
  font-size: 0.8rem;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--sd-bg) 50%, transparent);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--sd-t-content) var(--sd-ease), transform var(--sd-t-content) var(--sd-ease);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-enter {
  border-left-color: var(--sd-success);
}

.toast-exit {
  border-left-color: var(--sd-warning);
}

/* Gate-line labels on the map (Leaflet tooltip override). */
.geofence-label.leaflet-tooltip {
  background: color-mix(in srgb, var(--sd-bg) 90%, transparent);
  color: var(--sd-danger);
  border: 1px solid var(--sd-danger);
  border-radius: var(--sd-r-sm);
  font-family: var(--sd-font-mono);
  font-size: 0.65rem;
  padding: 1px 5px;
  box-shadow: none;
  white-space: nowrap;
}

/* Split gates are info-blue; official-timing gates keep the danger red. */
.geofence-label.split.leaflet-tooltip {
  color: var(--sd-info);
  border-color: var(--sd-info);
}

.geofence-label.leaflet-tooltip::before {
  display: none;
} /* hide the pointer arrow */
/* Geofence crossings + per-leg averages table. */
.splits-section {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-md);
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: auto; /* 6 columns can outgrow a narrow sidebar — scroll, don't clip */
}

.splits-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-family: var(--sd-font-body);
  font-size: 0.8rem;
}

.splits-table th, .splits-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--sd-border);
  white-space: nowrap;
}

.splits-table th {
  font-size: 0.68rem;
}

.splits-table td {
  color: var(--sd-text);
}

/* Every column but the gate name is a number → tabular mono. */
.splits-table td.predicted {
  color: var(--sd-text-dim);
  font-style: italic;
}

.athlete-marker-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sd-accent);
  border: 2px solid var(--sd-bg);
  box-shadow: 0 0 8px var(--sd-accent-glow);
}

.spectator-marker-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sd-success);
  border: 2px solid var(--sd-bg);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.chart-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--sd-text);
  min-width: 80px;
  text-align: right;
}

/* Each live value carries its channel colour — where the palette earns its keep. */
#val-hr {
  color: var(--sd-channel-hr);
}

#val-pace {
  color: var(--sd-channel-pace);
}

#val-cad {
  color: var(--sd-channel-cadence);
}

#val-elev {
  color: var(--sd-channel-elevation);
}

/* Course elevation profile — full-width card between the map and the splits
   table. Always-on course data, so no axis controls and no consent toggle. */
.elevation-section {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-md);
  padding: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}

.elevation-section .chart-canvas {
  height: 140px;
}

/* Header value + its "cumulative gain" caption, right-aligned as a unit. */
.chart-value-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chart-caption {
  color: var(--sd-text-dim);
  font-size: 0.62rem;
}

/* Fixed-height, full-width wrapper so the chart fills the window like #map.
   Chart.js (maintainAspectRatio:false) sizes the canvas to this box. */
.chart-canvas {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 100px;
  overflow: hidden;
}

/* Chart.js writes an inline pixel width on the canvas; cap it to the wrapper
   so a wide initial render can't force a horizontal scrollbar. */
.chart-canvas canvas {
  display: block;
  max-width: 100% !important;
}

@media (max-width: 700px) {
  .chart-canvas {
    height: 160px;
  }
}
.axis-tune {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.axis-input {
  width: 64px;
  background: var(--sd-surface-inset);
  border: 1px solid var(--sd-border);
  color: var(--sd-text);
  font-family: var(--sd-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: var(--sd-r-sm);
}

.axis-input:focus {
  outline: none;
  border-color: var(--sd-accent);
}

.axis-tune .sep, .range-tune .sep {
  color: var(--sd-text-dim);
  font-size: 0.75rem;
}

.axis-error {
  color: var(--sd-danger);
  font-size: 0.65rem;
  margin-left: 4px;
}

@media (max-width: 700px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
/* ---------------------------------------------------- */
/* Tabs (Live Timing Results / Athletes) */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--sd-border);
}

.tab-btn {
  background: transparent;
  color: var(--sd-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color var(--sd-t-feedback) var(--sd-ease);
}

.tab-btn:hover {
  color: var(--sd-text);
}

.tab-btn.active {
  color: var(--sd-accent);
  border-bottom-color: var(--sd-accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ---------------------------------------------------- */
/* Athletes tab: login + data-channel rights */
.athlete-panel {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-md);
  padding: 20px;
  max-width: 520px;
}

.athlete-login {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.panel-label {
  display: block;
}

.panel-hint {
  font-family: var(--sd-font-body);
  font-size: 0.75rem;
  color: var(--sd-text-muted);
  margin: 6px 0 16px;
  line-height: 1.5;
}

#athlete-login-select {
  background: var(--sd-surface-inset);
  color: var(--sd-text);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-sm);
  font-family: var(--sd-font-mono);
  font-size: 0.85em;
  padding: 4px 8px;
}

#athlete-login-select:focus {
  outline: none;
  border-color: var(--sd-border-strong);
}

.channel-rights {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--sd-surface-inset);
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-r-md);
}

/* Predicted-pace input sits below the channel toggles; reuses .axis-input for the
   field styling, just a touch wider for the "m:ss /km" placeholder. */
.predicted-pace-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 16px;
}

#predicted-pace-input {
  width: 88px;
}

.channel-name {
  font-family: var(--sd-font-body);
  font-size: 0.9rem;
  color: var(--sd-text);
}

/* ---------------------------------------------------- */
/* Circle on/off toggle — a round-knob variant of .x-toggle. A hidden checkbox
   drives a sliding dot: red + "Off" when unchecked, green + "On" when checked. */
.c-toggle {
  position: relative;
  display: inline-block;
  width: 88px;
  height: 30px;
}

.c-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.c-toggle-slider {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--sd-r-full);
  background-color: var(--sd-surface-inset);
  border: 1px solid var(--sd-border);
  transition: var(--sd-t-content) var(--sd-ease);
}

/* The dot (knob) — red when off. */
.c-toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  border-radius: 50%;
  background-color: var(--sd-danger);
  transition: var(--sd-t-content) var(--sd-ease);
}

/* On/Off label text, opposite the knob. */
.c-toggle-text {
  position: absolute;
  font-family: var(--sd-font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: opacity var(--sd-t-content);
}

.c-toggle-text.off {
  right: 12px;
  color: var(--sd-danger);
  opacity: 1;
}

.c-toggle-text.on {
  left: 12px;
  color: var(--sd-success);
  opacity: 0;
}

/* Checked = shared/on: knob slides right and turns green, labels swap. */
.c-toggle input:checked + .c-toggle-slider:before {
  transform: translateX(58px);
  background-color: var(--sd-success);
}

.c-toggle input:checked + .c-toggle-slider .off {
  opacity: 0;
}

.c-toggle input:checked + .c-toggle-slider .on {
  opacity: 1;
}

/* Disabled until an athlete is logged in. */
.c-toggle input:disabled + .c-toggle-slider {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Respect reduced-motion: instrument feedback shouldn't animate for everyone. */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0ms !important;
  }
}/*# sourceMappingURL=style.css.map */