:root {
  --bg: #0c0f14;
  --bg-2: #131820;
  --bg-3: #1c232e;
  --border: #2a3340;
  --text: #e8ecf2;
  --text-dim: #8b96a8;
  --text-faint: #5c6677;
  --accent: #ff6700;
  --accent-dim: #ff670033;
  --nat: #05c5ff;
  --velo: #ffd23f;
  --crse: #ff6700;
  --race:  #05c5ff;
  --elite: #ff6700;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2 { margin: 0 0 .6rem 0; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.lede { color: var(--text-dim); margin: 0.3rem 0 0; }

.page-head { margin: 0 0 2rem; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  max-width: 1100px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; }
.brand img { height: 40px; width: auto; display: block; }

/* ---- Hero stat cards ---- */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 0 0 2rem;
}
@media (max-width: 900px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .hero-stats { grid-template-columns: 1fr; } }
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
}
.stat-card .label {
  font-size: 0.75rem; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}
.stat-card .value {
  font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em;
}
.stat-card .sub { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.3rem; }

/* ---- Filters bar ---- */
.filters {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin: 0 0 1.5rem;
  padding: 1rem 1.2rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.filters .label {
  color: var(--text-dim); font-size: 0.85rem; font-weight: 500;
}
.pill-group {
  display: inline-flex; background: var(--bg-3); border-radius: 8px; padding: 3px;
}
.pill {
  border: none; background: transparent; color: var(--text-dim);
  padding: 0.35rem 0.85rem; font-size: 0.85rem; font-weight: 500;
  cursor: pointer; border-radius: 6px;
  font-family: inherit;
}
.pill:hover { color: var(--text); }
.pill.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 0 var(--accent) inset;
}
select {
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.4rem 0.7rem; font: inherit;
}
select:focus { outline: 1px solid var(--accent); }

/* ---- Disclaimer ---- */
.disclaimer {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.55;
}
.disclaimer p { margin: 0; }
.disclaimer p + p { margin-top: 0.5rem; }
.disclaimer a {
  color: var(--accent);
  font-weight: 500;
}
.disclaimer a:hover { text-decoration: underline; }

/* ---- Distribution / Funnel ---- */
.distribution-section { margin-bottom: 2rem; }
.discipline-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.discipline-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 0.6rem;
}
.discipline-header .title { font-weight: 700; font-size: 1.05rem; }
.discipline-header .title .icon { font-size: 1.2rem; margin-right: 0.4rem; }
.discipline-header .meta { color: var(--text-dim); font-size: 0.85rem; }

.block-note {
  color: var(--text-faint); font-size: 0.78rem;
  line-height: 1.5; margin: 0.2rem 0 0.7rem;
}

/* ---- Workout filter (velo block) ---- */
.velo-filter { display: inline-flex; align-items: center; gap: 0.6rem; }
.velo-filter-label {
  color: var(--text-dim); font-size: 0.8rem; font-weight: 500;
}
.workout-pills {
  display: inline-flex; background: var(--bg-3); border-radius: 8px; padding: 3px;
  gap: 2px;
}
.workout-pill {
  border: none; background: transparent; color: var(--text-dim);
  padding: 0.3rem 0.6rem; font-size: 0.78rem; font-weight: 500;
  cursor: pointer; border-radius: 6px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.workout-pill:hover { color: var(--text); }
.workout-pill.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 0 var(--velo) inset;
}

.funnel-wrap { position: relative; width: 100%; }
.funnel-svg { width: 100%; height: auto; display: block; }
.funnel-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.funnel-tick {
  font-size: 11px; fill: var(--text-faint);
  font-family: inherit; font-variant-numeric: tabular-nums;
}
.funnel-tick-y { text-anchor: end; }
.funnel-tick-x { text-anchor: middle; }
.funnel-tick-allure { font-size: 10px; fill: var(--text-faint); }
.funnel-axis-label {
  font-family: inherit;
  fill: var(--text-dim); font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.funnel-axis-label-x { font-size: 9px; fill: var(--text-faint); }
.funnel-axis-label-y { font-size: 10px; }
.funnel-area { fill: var(--accent); opacity: 0.18; }
.funnel-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.funnel-cursor { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.funnel-dot { fill: var(--accent); stroke: var(--bg-2); stroke-width: 2; }
.funnel-hit { cursor: crosshair; }
.funnel-zone { fill: var(--accent); }
.funnel-svg[data-discipline="natation"] .funnel-zone { fill: var(--nat); }
.funnel-svg[data-discipline="velo"]     .funnel-zone { fill: var(--velo); }
.funnel-svg[data-discipline="course"]   .funnel-zone { fill: var(--crse); }

.funnel-zone-label {
  font-size: 11px; font-family: inherit;
  fill: var(--text-dim); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.funnel-svg[data-discipline="natation"] .funnel-area { fill: var(--nat); }
.funnel-svg[data-discipline="natation"] .funnel-line { stroke: var(--nat); }
.funnel-svg[data-discipline="natation"] .funnel-dot  { fill: var(--nat); }
.funnel-svg[data-discipline="velo"] .funnel-area { fill: var(--velo); }
.funnel-svg[data-discipline="velo"] .funnel-line { stroke: var(--velo); }
.funnel-svg[data-discipline="velo"] .funnel-dot  { fill: var(--velo); }
.funnel-svg[data-discipline="course"] .funnel-area { fill: var(--crse); }
.funnel-svg[data-discipline="course"] .funnel-line { stroke: var(--crse); }
.funnel-svg[data-discipline="course"] .funnel-dot  { fill: var(--crse); }

.funnel-tooltip {
  position: absolute;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(12px, -50%);
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 10;
}
.funnel-tooltip.open { opacity: 1; }
.funnel-tooltip .t-head { font-weight: 700; margin-bottom: 0.15rem; }
.funnel-tooltip .t-allure { color: var(--text-dim); font-weight: 500; }
.funnel-tooltip .t-body b { color: var(--accent); }
.funnel-tooltip .t-dim { color: var(--text-faint); }
