/* ============================================================
   STYLE.CSS — historique.nidamour.ch (même thème que l'app 35 ans)
   ============================================================ */
:root {
  --bg:        #0F1923;
  --surface:   #1A2636;
  --surface2:  #14202D;
  --border:    #2A3F55;
  --accent:    #F0C040;
  --accent2:   #4ECDC4;
  --text:      #E8EDF2;
  --muted:     #6B8AA8;
  --danger:    #FF6B6B;
  --success:   #4ADE80;
  --font-head: 'Space Grotesk', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --top-h: 60px;
  --ctrl-h: 82px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; background: var(--bg); overscroll-behavior: none; }
body {
  color: var(--text);
  font-family: var(--font-head);
  display: flex;
  flex-direction: column;
}

/* ── Gate (écran de code) ───────────────────────────────── */
.gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 28px;
  text-align: center;
}
.gate-icon { font-size: 40px; margin-bottom: 10px; }
.gate-card h1 { font-size: 22px; margin-bottom: 8px; }
.gate-card p { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 20px; }
#gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-card input {
  width: 100%;
  padding: 13px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: center;
  letter-spacing: 0.05em;
}
.gate-card input:focus { outline: none; border-color: var(--accent); }
.gate-card button {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #14202D;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.gate-error { color: var(--danger); font-size: 12px; min-height: 16px; margin-top: 10px !important; margin-bottom: 0 !important; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--top-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 20;
}
.topbar-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
}
.topbar-title h1 { font-size: 17px; font-weight: 700; }
.topbar-date { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ── Layout principal ───────────────────────────────────── */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}
.map-pane { flex: 1 1 62%; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

.side-pane {
  flex: 1 1 38%;
  max-width: 420px;
  min-width: 280px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ── Classement ─────────────────────────────────────────── */
.leaderboard { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: transform 0.35s ease;
}
.lb-rank {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  width: 16px;
  flex-shrink: 0;
}
.lb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
.lb-name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--accent); }
.lb-row.trail-off { opacity: 0.45; }
.lb-toggle {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.lb-row:not(.trail-off) .lb-toggle { border-color: var(--accent2); color: var(--accent2); }

/* ── Légende + graphique ────────────────────────────────── */
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 10px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.chart-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
#chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-gridline { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.chart-cursor { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: 0.8; }
.chart-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }

/* ── Contrôles de lecture ───────────────────────────────── */
.controls {
  height: var(--ctrl-h);
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.play-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: rgba(240,192,64,0.1);
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scrub { flex: 1; min-width: 0; }
.scrub input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
.scrub-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
#time-current { color: var(--accent); font-weight: 700; }
.speed-select { display: flex; gap: 4px; flex-shrink: 0; }
.speed-select button {
  padding: 7px 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.speed-select button.active { border-color: var(--accent); color: var(--accent); }

/* ── Marqueurs Leaflet équipes ──────────────────────────── */
.team-marker {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.checkpoint-marker {
  width: 18px; height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.9)) drop-shadow(0 0 2px rgba(0,0,0,0.9));
}
.petit-point-marker {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6);
}

/* ── Bouton toggle des postes (flottant sur la carte) ───── */
.map-toggle-btn {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 500;
  padding: 7px 11px;
  background: rgba(26,38,54,0.9);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.map-toggle-btn.active { border-color: var(--accent); color: var(--accent); }

/* ── Responsive : empilé sur mobile ─────────────────────── */
@media (max-width: 760px) {
  .layout { flex-direction: column; overflow-y: auto; }
  .map-pane { flex: 0 0 42vh; }
  .side-pane { max-width: none; border-left: none; border-top: 1px solid var(--border); overflow-y: visible; }
  .controls { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px 14px; }
  .scrub { flex-basis: 100%; order: 3; }
  .speed-select button { padding: 6px 7px; font-size: 10px; }
}
