:root {
  --bg: #0b0b0c;
  --bg-2: #121214;
  --panel: #17171a;
  --line: #26262b;
  --line-2: #333339;
  --ink: #f4f4f5;
  --ink-2: #a1a1aa;
  --ink-3: #6b6b74;
  --red: #e5213d;
  --red-ink: #ff4d63;
  --swim: #0b8fd9;
  --bike: #c47c05;
  --run: #1ea34e;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: "Barlow", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.num, td.t { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 24px;
  background: #000; border-bottom: 2px solid var(--red);
}
.brand { font-family: var(--cond); font-weight: 900; font-style: italic; font-size: 26px; letter-spacing: .02em; }
.brand-slash { color: var(--red); margin: 0 1px; }
.brand-data { color: var(--ink-2); }
.nav { display: flex; gap: 4px; }
.nav a {
  font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent;
}
.nav a.on, .nav a:hover { color: var(--ink); border-bottom-color: var(--red); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; background: var(--red); color: #fff; font-family: var(--mono); font-size: 11px; line-height: 18px; text-align: center; }
.badge:empty { display: none; }

main { min-height: calc(100vh - 56px); }
.wrap { max-width: 1440px; margin: 0 auto; padding: 28px 24px 80px; }

/* ------------------------------------------------------------- type */
.kicker { font-family: var(--cond); font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--red-ink); }
.h1 { font-family: var(--cond); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: clamp(40px, 6vw, 84px); line-height: .9; margin: 6px 0 0; letter-spacing: -.01em; }
.h2 { font-family: var(--cond); font-weight: 800; text-transform: uppercase; font-size: 22px; letter-spacing: .04em; margin: 0 0 12px; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }

/* ------------------------------------------------------------- home */
.hero { padding: 48px 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.hero p { max-width: 640px; color: var(--ink-2); font-size: 17px; line-height: 1.5; }
.race-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--red); padding: 24px; margin-bottom: 20px; }
.race-card .race-title { font-family: var(--cond); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 40px; line-height: 1; }
.race-meta { display: flex; gap: 18px; margin: 10px 0 20px; color: var(--ink-2); font-family: var(--cond); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.dist-chip { display: inline-flex; gap: 6px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px; background: var(--line); border: 1px solid var(--line); }
.ed { background: var(--bg-2); padding: 18px; transition: background .15s; }
.ed:hover { background: #1d1d21; }
.ed .yr { font-family: var(--cond); font-weight: 900; font-size: 44px; line-height: 1; }
.ed .cnt { font-family: var(--mono); font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tag { font-family: var(--cond); font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 2px 6px; border: 1px solid var(--line-2); color: var(--ink-2); }
.tag.hot { border-color: var(--red); color: var(--red-ink); }

/* ------------------------------------------------------------- results */
.ed-tabs { display: flex; gap: 2px; margin: 22px 0 0; }
.ed-tabs a { font-family: var(--cond); font-weight: 800; font-size: 20px; padding: 8px 18px; background: var(--panel); color: var(--ink-3); border-top: 3px solid transparent; }
.ed-tabs a.on { color: var(--ink); border-top-color: var(--red); background: var(--bg-2); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 2px; background: var(--line); border: 1px solid var(--line); margin: 0 0 24px; }
.stat { background: var(--bg-2); padding: 14px 16px; }
.stat .lbl { font-family: var(--cond); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.stat .val { font-family: var(--mono); font-weight: 700; font-size: 24px; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.inp, .sel { background: var(--panel); border: 1px solid var(--line-2); padding: 9px 12px; outline: none; min-width: 0; }
.inp:focus, .sel:focus { border-color: var(--red); }
.inp.search { flex: 1 1 260px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); }
.seg button { background: var(--panel); border: 0; padding: 9px 14px; cursor: pointer; font-family: var(--cond); font-weight: 700; letter-spacing: .08em; color: var(--ink-2); }
.seg button.on { background: var(--red); color: #fff; }
.count { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--ink-2); }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); }
table.res { width: 100%; border-collapse: collapse; }
table.res th {
  position: sticky; top: 0; background: #000; text-align: left;
  font-family: var(--cond); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
  padding: 10px 10px; border-bottom: 1px solid var(--line-2); cursor: pointer; white-space: nowrap; user-select: none;
}
table.res th.r, table.res td.r { text-align: right; }
table.res th.sorted { color: var(--ink); }
table.res th.sorted::after { content: " ▾"; color: var(--red-ink); }
table.res th.sorted.asc::after { content: " ▴"; }
table.res td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.res tbody tr { cursor: pointer; }
table.res tbody tr:hover td { background: #18181c; }
td.rk { font-family: var(--cond); font-weight: 900; font-size: 18px; color: var(--ink-2); width: 48px; }
tr.podium td.rk { color: var(--red-ink); }
td.nm .n { font-weight: 600; }
td.nm .c { font-size: 12px; color: var(--ink-3); margin-left: 6px; }
td.t { font-size: 13px; }
td.t.fin { font-weight: 700; font-size: 14px; }
td.t .rkx { font-size: 10px; color: var(--ink-3); margin-left: 4px; }
td.t.best { color: var(--red-ink); }
.st { font-family: var(--cond); font-weight: 800; letter-spacing: .1em; color: var(--ink-3); }
.splitbar { display: flex; gap: 2px; width: 180px; height: 8px; }
.splitbar i { display: block; height: 100%; }
.splitbar i:first-child { border-radius: 4px 0 0 4px; }
.splitbar i:last-child { border-radius: 0 4px 4px 0; }
.addbtn { background: none; border: 1px solid var(--line-2); width: 28px; height: 28px; cursor: pointer; color: var(--ink-2); font-weight: 700; }
.addbtn:hover { border-color: var(--red); color: var(--red-ink); }
.addbtn.on { background: var(--red); border-color: var(--red); color: #fff; }
.more { display: block; width: 100%; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-top: 0; cursor: pointer; font-family: var(--cond); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.more:hover { color: var(--ink); }

/* ------------------------------------------------------------- athlete drawer */
.drawer-bg { position: fixed; inset: 56px 0 0 0; background: rgba(0,0,0,.6); z-index: 30; }
.drawer { position: fixed; top: 56px; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg-2); border-left: 2px solid var(--red); z-index: 31; overflow-y: auto; padding: 26px 28px 60px; }
.drawer .close { position: absolute; top: 14px; right: 16px; background: none; border: 1px solid var(--line-2); width: 34px; height: 34px; cursor: pointer; font-size: 18px; color: var(--ink-2); }
.ath-name { font-family: var(--cond); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 44px; line-height: .95; margin: 6px 0 8px; }
.ath-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.bigtime { font-family: var(--mono); font-weight: 700; font-size: 56px; letter-spacing: -.02em; margin: 18px 0 4px; }
.ranks { display: flex; gap: 24px; margin-bottom: 22px; }
.ranks div { font-family: var(--cond); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; font-size: 12px; color: var(--ink-3); }
.ranks b { display: block; font-family: var(--mono); font-size: 22px; color: var(--ink); letter-spacing: 0; }
.disc { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; background: var(--line); border: 1px solid var(--line); margin-bottom: 26px; }
.disc.three { grid-template-columns: repeat(3, 1fr); }
.disc > div { background: var(--panel); padding: 12px; border-top: 3px solid var(--line-2); }
.disc .lbl { font-family: var(--cond); font-weight: 800; letter-spacing: .14em; font-size: 12px; text-transform: uppercase; color: var(--ink-2); }
.disc .v { font-family: var(--mono); font-weight: 700; font-size: 18px; margin: 4px 0; }
.disc .p { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.disc .pct { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; background: var(--red); border: 0; color: #fff; cursor: pointer; font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; }
.btn.ghost { background: transparent; border: 1px solid var(--line-2); color: var(--ink); }
.btn:hover { filter: brightness(1.1); }
.section { margin-top: 28px; }
table.sp { width: 100%; border-collapse: collapse; font-size: 13px; }
table.sp th { text-align: left; font-family: var(--cond); font-weight: 700; letter-spacing: .12em; font-size: 11px; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
table.sp td { padding: 6px 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); }
table.sp td:first-child { font-family: var(--sans); }
table.sp th.r, table.sp td.r { text-align: right; }
.delta-up { color: #3ddc84; }
.delta-dn { color: var(--red-ink); }

.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--ink-3); font-family: var(--mono); font-size: 10px; }
.tip { position: absolute; pointer-events: none; background: #000; border: 1px solid var(--line-2); padding: 8px 10px; font-size: 12px; white-space: nowrap; z-index: 5; display: none; }
.tip b { font-family: var(--mono); }

/* ------------------------------------------------------------- replay */
.replay { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 56px); }
.rp-side { border-right: 1px solid var(--line); overflow-y: auto; background: var(--bg-2); display: flex; flex-direction: column; }
.rp-side .blk { padding: 18px; border-bottom: 1px solid var(--line); }
.rp-main { position: relative; display: grid; grid-template-rows: 1fr auto; min-height: 0; }
#map { width: 100%; height: 100%; min-height: 300px; background: #0e0e10; }
.clock { position: absolute; top: 16px; left: 16px; z-index: 5; background: rgba(0,0,0,.82); border-left: 4px solid var(--red); padding: 10px 16px; }
.clock .lbl { font-family: var(--cond); font-weight: 700; font-size: 11px; letter-spacing: .2em; color: var(--ink-3); }
.clock .t { font-family: var(--mono); font-weight: 700; font-size: 38px; line-height: 1; }
.legend-map { position: absolute; top: 16px; right: 16px; z-index: 5; background: rgba(0,0,0,.82); padding: 8px 12px; display: flex; gap: 12px; font-family: var(--cond); font-weight: 700; letter-spacing: .12em; font-size: 12px; }
.legend-map span { display: inline-flex; align-items: center; gap: 6px; }
.legend-map i { width: 16px; height: 3px; display: inline-block; }
.transport { background: #000; border-top: 1px solid var(--line-2); padding: 12px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.play { width: 46px; height: 46px; background: var(--red); border: 0; color: #fff; font-size: 18px; cursor: pointer; }
.scrub { width: 100%; accent-color: var(--red); }
.speeds { display: flex; }
.speeds button { background: var(--panel); border: 1px solid var(--line-2); margin-left: -1px; padding: 8px 10px; cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.speeds button.on { background: var(--ink); color: #000; }
.track { position: relative; height: 26px; margin-top: 6px; }
.track .segbar { position: absolute; top: 10px; height: 4px; }
.track .pip { position: absolute; top: 4px; width: 4px; height: 16px; margin-left: -2px; }

.lb-row { display: grid; grid-template-columns: 22px 10px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lb-row .p { font-family: var(--cond); font-weight: 900; font-size: 18px; color: var(--ink-2); }
.lb-row .sw { width: 10px; height: 10px; border-radius: 50%; }
.lb-row .nm { font-weight: 600; font-size: 14px; line-height: 1.2; }
.lb-row .nm small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; font-family: var(--mono); }
.lb-row .gap { font-family: var(--mono); font-size: 13px; text-align: right; }
.lb-row .gap small { display: block; font-size: 10px; color: var(--ink-3); }
.lb-row .x { background: none; border: 0; color: var(--ink-3); cursor: pointer; }
.lb-row .x:hover { color: var(--red-ink); }
.disc-pill { font-family: var(--cond); font-weight: 800; font-size: 10px; letter-spacing: .12em; padding: 1px 5px; color: #fff; }
.picker { position: relative; }
.picker .res-list { position: absolute; left: 0; right: 0; top: 100%; background: #000; border: 1px solid var(--line-2); max-height: 320px; overflow-y: auto; z-index: 10; }
.picker .res-list div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px; }
.picker .res-list div:hover { background: #1b1b1f; }
.picker .res-list small { color: var(--ink-3); font-family: var(--mono); }
.empty { padding: 30px 18px; color: var(--ink-2); line-height: 1.5; }

.mk { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.mk .lab { font-family: var(--cond); font-weight: 800; font-size: 12px; letter-spacing: .04em; padding: 1px 6px; color: #fff; white-space: nowrap; margin-bottom: 3px; text-transform: uppercase; }
.mk .pt { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #0b0b0c; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }

@media (max-width: 900px) {
  .wrap { padding: 20px 16px 60px; }
  .topbar { padding: 0 16px; }
  .replay { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; }
  .rp-main { order: -1; }
  .disc { grid-template-columns: repeat(2, 1fr); }
  .splitbar { width: 100px; }
}
.mk .lab .lap:not(:empty) { margin-left: 5px; padding-left: 5px; border-left: 1px solid rgba(255,255,255,.5); font-family: var(--mono); font-size: 11px; }

/* ------------------------------------------------------------- ediciones / tabs */
.yr-l { display: block; font-size: 15px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-top: 2px; }
.ed-tabs { flex-wrap: wrap; }
.ed-tabs a small { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; line-height: 1; }
.sub-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 0 0 22px; }
.sub-tabs a { font-family: var(--cond); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 12px 0; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sub-tabs a.on { color: var(--ink); border-bottom-color: var(--red); }

/* ------------------------------------------------------------- análisis */
.an-block { margin-bottom: 40px; }
.an-note { font-size: 13px; margin: -4px 0 14px; max-width: 760px; line-height: 1.45; }
.an-tbl tr.cur td { background: #1a1a1f; }
.an-tbl tr { cursor: pointer; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.an-sub { font-family: var(--cond); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 14px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.an-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2px; background: var(--line); border: 1px solid var(--line); }
.an-list { background: var(--bg-2); padding: 16px; }
.an-row { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.an-row:hover { background: #18181c; }
.an-row .p { font-family: var(--cond); font-weight: 900; color: var(--ink-3); }
.an-row .nm { font-weight: 600; font-size: 14px; }
.an-row .nm small { display: block; color: var(--ink-3); font-weight: 400; font-size: 11px; font-family: var(--mono); }
.an-row b { color: var(--ink); }
.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); border: 1px solid var(--line); }
.halves > div { background: var(--panel); padding: 12px; border-left: 3px solid; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.halves .lbl { font-family: var(--cond); font-weight: 800; letter-spacing: .14em; font-size: 12px; color: var(--ink-2); }
.halves b { font-size: 20px; }
.halves small { color: var(--ink-3); font-family: var(--cond); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }

/* ------------------------------------------------------------- perfil */
.legend-row { display: flex; gap: 16px; font-family: var(--cond); font-weight: 700; letter-spacing: .1em; font-size: 12px; margin-bottom: 6px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 16px; height: 3px; display: inline-block; }
table.prof td a:hover { color: var(--red-ink); }
.dlt { display: block; font-size: 10px; }

/* ------------------------------------------------------------- inputs por disciplina */
.legs { display: flex; flex-direction: column; gap: 2px; }
.leg { display: grid; grid-template-columns: 52px auto 1fr 110px; gap: 8px; align-items: center; background: var(--panel); border-left: 3px solid; padding: 6px 8px; }
.leg.total { border-left-color: var(--red); background: #000; }
.leg-l { font-family: var(--cond); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 13px; }
.leg .inp { padding: 7px 10px; font-family: var(--mono); width: 100%; }
.leg-x { font-size: 12px; color: var(--ink-2); text-align: right; }
#leg-total { font-weight: 700; font-size: 18px; }
.seg.mini button { padding: 5px 8px; font-size: 11px; }
.lbl-f { display: block; font-family: var(--cond); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; color: var(--ink-3); margin: 16px 0 6px; }

/* ------------------------------------------------------------- calculadora */
.calc { display: grid; grid-template-columns: 420px 1fr; gap: 32px; align-items: start; }
.calc-form .sel { width: 100%; }
.calc-row { display: flex; gap: 12px; }
.calc-total { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; }
.calc-total .lbl { font-family: var(--cond); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.calc-total .num { font-weight: 700; font-size: 42px; }
.calc-tbl tr[data-href] { cursor: pointer; }

/* ------------------------------------------------------------- replay extras */
.rp-actions { display: flex; gap: 6px; margin-top: 10px; }
.btn.sm { padding: 7px 10px; font-size: 13px; }
.gf { margin-top: 6px; padding: 4px 0 6px; }
.gf .leg { grid-template-columns: 40px auto 1fr; }
.gf .leg-x { grid-column: 3; text-align: left; }
.gf-pre { display: flex; gap: 4px; }
.gf-pre .sel { padding: 7px 6px; flex: 1; min-width: 0; }
.mk.ghost .pt { background: transparent !important; border: 2px dashed #fff; box-shadow: none; }
.mk.ghost .lab { opacity: .85; }

@media (max-width: 900px) {
  .calc { grid-template-columns: 1fr; }
  .leg { grid-template-columns: 44px auto 1fr; }
  .leg-x { grid-column: 3; text-align: left; }
}
.disc-pill { white-space: nowrap; display: inline-block; }
.an-grid .chart { max-width: 560px; }
.section .chart svg { max-height: 260px; }

/* ------------------------------------------------------------- campos segmentados (tiempo / ritmo) */
.leg { grid-template-columns: 52px auto auto 1fr; row-gap: 4px; }
.leg-l small { display: block; font-size: 9px; letter-spacing: .14em; color: var(--ink-3); font-weight: 700; }
.tf { display: inline-flex; align-items: center; background: var(--bg); border: 1px solid var(--line-2); padding: 0 8px; height: 36px; }
.tf:focus-within { border-color: var(--ink-2); }
.tf input { background: none; border: 0; outline: none; padding: 0; font-family: var(--mono); font-size: 15px; text-align: center; color: var(--ink); }
.tf input::placeholder { color: var(--ink-3); }
.tf input:focus { background: #222228; }
.tf .tf-1 { width: 1.4ch; }
.tf .tf-2 { width: 2.4ch; }
.tf .tf-kmh { width: 4.5ch; }
.tf-sep { font-family: var(--mono); color: var(--ink-3); padding: 0 1px; }
.tf-u { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 6px; }
.leg-x { text-align: right; }
.leg.bad .tf { border-color: var(--red); }
.leg.bad .leg-x { color: var(--red-ink); }
.leg-x { min-height: 15px; line-height: 15px; }
.btn.disabled { opacity: .45; }
.gf .leg { grid-template-columns: 40px auto 1fr; }
.gf .leg-f { grid-column: 3; }
.gf .leg-x { grid-column: 2 / -1; text-align: left; font-size: 11px; }
.leg-x { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf .tf-in { width: 8ch; text-align: left; }
.tf .tf-in.kmh { width: 5ch; }
.tf .tf-in[data-fmt="ms"] { width: 5.5ch; }
.leg-f { min-width: 0; }

/* ------------------------------------------------------------- calculadora v2 */
.dist-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: var(--line); border: 1px solid var(--line); margin-bottom: 24px; max-width: 760px; }
.dist-tabs button { background: var(--panel); border: 0; border-top: 3px solid transparent; padding: 12px 14px; text-align: left; cursor: pointer; color: var(--ink-2); }
.dist-tabs button b { display: block; font-family: var(--cond); font-weight: 900; font-style: italic; font-size: 28px; line-height: 1; color: var(--ink); }
.dist-tabs button span { font-family: var(--cond); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; }
.dist-tabs button.on { background: var(--bg-2); border-top-color: var(--red); }
.dist-tabs button:not(.on) b { color: var(--ink-3); }
.calc2 { display: grid; grid-template-columns: minmax(340px, 460px) 1fr; gap: 32px; align-items: start; }
.k-total { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--red); padding: 18px 20px; margin-bottom: 24px; }
.k-total .lbl { display: block; font-family: var(--cond); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); font-size: 12px; }
.k-total .num { display: block; font-weight: 700; font-size: 56px; line-height: 1.05; letter-spacing: -.02em; }
.k-total.empty-t .num { color: var(--ink-3); }
.k-bar { display: flex; gap: 2px; height: 10px; margin: 14px 0 8px; }
.k-bar i:first-child { border-radius: 4px 0 0 4px; }
.k-bar i:last-child { border-radius: 0 4px 4px 0; }
.k-legend { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--cond); font-weight: 700; letter-spacing: .08em; font-size: 12px; text-transform: uppercase; color: var(--ink-2); }
.k-legend span { display: inline-flex; align-items: center; gap: 6px; }
.k-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.k-ghost { margin-top: 26px; padding-top: 6px; border-top: 1px solid var(--line); }
.k-ghost-row { display: flex; gap: 8px; flex-wrap: wrap; }
.k-ghost-row .sel, .k-ghost-row .inp { flex: 1 1 160px; }

/* ------------------------------------------------------------- legform */
.lf { display: flex; flex-direction: column; gap: 8px; }
.lf-leg { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); padding: 12px 14px 8px; }
.lf-leg.trans { padding-top: 8px; }
.lf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.lf-name { font-family: var(--cond); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 20px; letter-spacing: .02em; }
.lf-name small { font-family: var(--mono); font-style: normal; font-weight: 400; font-size: 12px; color: var(--ink-3); margin-left: 8px; letter-spacing: 0; text-transform: none; }
.lf-units { display: inline-flex; border: 1px solid var(--line-2); }
.lf-units button { background: none; border: 0; padding: 5px 10px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); cursor: pointer; }
.lf-units button.on { background: var(--ink); color: #000; font-weight: 700; }
.lf-row { display: flex; align-items: center; gap: 6px; }
.lf-step { width: 38px; height: 42px; background: var(--bg); border: 1px solid var(--line-2); color: var(--ink); font-size: 20px; cursor: pointer; flex: none; }
.lf-step:hover { border-color: var(--ink-2); }
.lf-step:active { background: var(--line); }
.lf-field { position: relative; flex: 0 1 150px; }
.lf-in { width: 100%; height: 42px; background: var(--bg); border: 1px solid var(--line-2); color: var(--ink); font-family: var(--mono); font-size: 20px; font-weight: 700; padding: 0 10px 0 10px; outline: none; text-align: center; }
.lf-in:focus { border-color: var(--ink-2); background: #141417; }
.lf-in::placeholder { color: var(--ink-3); font-weight: 400; font-size: 16px; }
.lf-fmt { position: absolute; left: 0; right: 0; bottom: -15px; text-align: center; font-family: var(--mono); font-size: 9px; color: var(--ink-3); letter-spacing: .1em; pointer-events: none; }
.lf-eq { margin-left: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.lf-slide { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-family: var(--cond); font-weight: 700; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.lf-range { flex: 1; accent-color: var(--c); }
.lf-leg.empty .lf-range { opacity: .35; }
.lf-msg { min-height: 16px; line-height: 16px; font-size: 12px; color: var(--red-ink); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lf-leg.trans .lf-msg { margin-top: 16px; }
.lf-leg.bad { border-color: var(--red); border-left-color: var(--red); }
.lf-leg.bad .lf-in { border-color: var(--red); }

/* ------------------------------------------------------------- fueling */
.fu-form { display: flex; flex-direction: column; gap: 8px; }
.fu-card { background: var(--panel); border: 1px solid var(--line); padding: 14px; }
.fu-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fu-row .tf { height: 42px; }
.fu-row .tf .tf-in { font-size: 18px; font-weight: 700; text-align: center; }
.fu-big { font-size: 24px; font-weight: 700; min-width: 2ch; text-align: center; }
.fu-note { font-size: 12px; margin: 8px 0 0; line-height: 1.45; }
.fu-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: var(--bg); border: 1px solid var(--line-2); padding: 7px 12px; cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.fu-res { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--line); border: 1px solid var(--line); }
.fu-res > div { background: var(--panel); padding: 14px; border-top: 3px solid; }
.fu-res .lbl { font-family: var(--cond); font-weight: 800; letter-spacing: .14em; font-size: 12px; text-transform: uppercase; color: var(--ink-2); }
.fu-res .v { font-family: var(--mono); font-weight: 700; font-size: 30px; margin: 4px 0; }
.fu-res .p { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

/* ------------------------------------------------------------- replay: recorrido */
.rp-compat { font-size: 12px; margin: 6px 0 12px; line-height: 1.4; }
.skip-note { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--bike); background: rgba(196,124,5,.08); font-size: 13px; line-height: 1.45; color: var(--ink); }
.skip-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.gf-ref { margin: 12px 0; }
.gf-ref summary { cursor: pointer; font-family: var(--cond); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; color: var(--ink-2); }
.gf-ref[open] summary { margin-bottom: 8px; }
.gf-ref .gf-pre { margin-top: 6px; }
.gf .lf-leg { padding: 10px 10px 6px; }
.gf .lf-name { font-size: 17px; }
.gf .lf-field { flex: 1 1 110px; }
.gf .lf-in { font-size: 17px; }
.gf .lf-row { flex-wrap: wrap; }
.gf .lf-eq { flex-basis: 100%; margin: 16px 0 0; font-size: 12px; }
.gf .lf-step { width: 32px; }

@media (max-width: 900px) {
  .calc2 { grid-template-columns: 1fr; }
  .dist-tabs { grid-template-columns: repeat(2, 1fr); }
  .fu-res { grid-template-columns: 1fr; }
}
[hidden] { display: none !important; }
.lf-in:placeholder-shown + .lf-fmt { visibility: hidden; }

/* ------------------------------------------------------------- inicio: buscador y filtros */
.home-search { position: sticky; top: 56px; z-index: 10; background: var(--bg); padding: 14px 0 12px; margin: -12px 0 18px; border-bottom: 1px solid var(--line); }
.hs-box { position: relative; }
.hs-box .inp { width: 100%; padding: 16px 44px 16px 46px; font-size: 18px; background: var(--panel); }
.hs-ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--ink-3); pointer-events: none; }
.hs-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--ink-3); font-size: 16px; cursor: pointer; padding: 6px; }
.hs-clear:hover { color: var(--ink); }
.hs-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.hs-check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-family: var(--cond); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; color: var(--ink-2); }
.hs-check input { accent-color: var(--red); }
#hs-athletes:not(:empty) { margin-bottom: 28px; }
.ath-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px; background: var(--line); border: 1px solid var(--line); }
.ath-card { background: var(--bg-2); padding: 14px 16px; border-left: 3px solid transparent; }
.ath-card:hover { background: #1b1b1f; border-left-color: var(--red); }
.ath-n { font-family: var(--cond); font-weight: 800; font-size: 20px; text-transform: uppercase; font-style: italic; }
.ath-runs { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 12px; color: var(--ink-2); font-family: var(--mono); }
.ath-runs b { color: var(--ink); }
@media (max-width: 900px) { .home-search { position: static; } }
.ath-grid { background: none; border: 0; gap: 6px; }
.ath-card { border: 1px solid var(--line); border-left-width: 3px; }

/* ------------------------------------------------------------- fantasma: referencia destacada */
.gf-ref { margin: 12px 0 4px; padding: 14px; background: linear-gradient(180deg, rgba(229,33,61,.12), rgba(229,33,61,.03)); border: 1px solid var(--red); }
.gf-ref-t { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.gf-ref-i { font-size: 20px; line-height: 1; }
.gf-ref-t b { display: block; font-family: var(--cond); font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 18px; letter-spacing: .02em; }
.gf-ref-t small { display: block; color: var(--ink-2); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.gf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 6px; }
.gf-stats button { background: var(--bg); border: 1px solid var(--line-2); padding: 8px 10px; text-align: left; cursor: pointer; color: var(--ink-2); }
.gf-stats button b { display: block; font-family: var(--cond); font-weight: 800; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }
.gf-stats button small { font-size: 11px; color: var(--ink-3); }
.gf-stats button.on { border-color: var(--red); background: rgba(229,33,61,.18); }
.gf-stats button.on small { color: var(--ink-2); }
.gf-ref .gf-pre { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.gf-ok { margin: 8px 0 0; font-size: 12px; color: #3ddc84; line-height: 1.4; }
.gf-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; color: var(--ink-3); font-family: var(--cond); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }
.gf-or::before, .gf-or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.gf-ok.warn { color: var(--bike); }

/* =============================================================
   v3 · pulido de diseño y UX
   ============================================================= */
body { -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--red-ink); outline-offset: 2px; }
a, button { -webkit-tap-highlight-color: transparent; }

/* entrada suave entre vistas */
#app.enter > * { animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #app.enter > * { animation: none; } }

/* barra de carga */
.loadbar { position: fixed; top: 56px; left: 0; right: 0; height: 3px; z-index: 40; overflow: hidden; background: rgba(229,33,61,.15); }
.loadbar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--red); animation: load 1s ease-in-out infinite; }
@keyframes load { from { left: -30%; } to { left: 100%; } }

/* grillas: celdas con borde propio (sin relleno gris en huecos vacíos) */
.stats, .ed-grid, .disc, .an-lists, .halves, .fu-res, .dist-tabs, .ath-grid { background: none; border: 0; gap: 6px; }
.stat, .ed, .disc > div, .an-list, .halves > div, .fu-res > div, .dist-tabs button, .ath-card { border: 1px solid var(--line); }
.disc > div { border-top-width: 3px; }
.fu-res > div { border-top-width: 3px; }
.halves > div { border-left-width: 3px; }
.dist-tabs button { border-top-width: 3px; }
.dist-tabs button.on { border-color: var(--line-2); border-top-color: var(--red); }

/* inicio compacto */
.hero-c { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; padding: 36px 0 26px; margin-bottom: 0; border-bottom: 0; }
.hero-c .h1 { font-size: clamp(38px, 5vw, 64px); }
.hero-c p { margin: 12px 0 0; font-size: 16px; }
.totals { display: grid; grid-template-columns: repeat(4, auto); gap: 0; margin: 0; border: 1px solid var(--line); }
.totals div { padding: 12px 18px; border-left: 1px solid var(--line); }
.totals div:first-child { border-left: 0; }
.totals dt { font-family: var(--cond); font-weight: 700; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.totals dd { margin: 2px 0 0; font-family: var(--mono); font-weight: 700; font-size: 26px; }
.race-card { padding: 20px 22px; }
.rc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.rc-head .race-title { display: inline-block; font-size: 34px; margin-top: 2px; }
.rc-head .race-title:hover { color: var(--red-ink); }
.rc-head .race-meta { margin: 8px 0 0; gap: 12px; align-items: center; flex-wrap: wrap; }
.prof-tag { font-family: var(--cond); font-weight: 800; font-size: 11px; letter-spacing: .14em; padding: 2px 7px; background: var(--ink); color: #000; }
.rc-cta { flex: none; }
.rc-soon { flex: none; font-family: var(--cond); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); border: 1px dashed var(--line-2); padding: 7px 10px; }
.ed { padding: 14px 16px; }
.ed .yr { font-size: 36px; }
.ed-nums { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.ed-nums b { color: var(--ink); font-weight: 600; }
.ed:hover .yr { color: var(--red-ink); }

/* barra de pestañas (celular) */
.tabbar { display: none; }
.badge:empty { display: none; }

/* replay: barra de tiempo con etiquetas */
.scrub-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scrub-t { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

@media (max-width: 900px) {
  /* navegación: marca arriba, pestañas abajo */
  .topbar .nav { display: none; }
  .topbar { justify-content: center; height: 50px; }
  .loadbar { top: 50px; }
  main { min-height: calc(100vh - 50px - 64px); padding-bottom: 64px; }
  .tabbar { display: grid; grid-template-columns: repeat(2, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #000; border-top: 1px solid var(--line-2); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; color: var(--ink-3);
    font-family: var(--cond); font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; border-top: 2px solid transparent; margin-top: -1px; }
  .tabbar a svg { width: 22px; height: 22px; fill: currentColor; }
  .tabbar a.on { color: var(--ink); border-top-color: var(--red); }
  .tabbar .badge { position: absolute; top: 4px; left: calc(50% + 8px); font-style: normal; }
  .drawer-bg, .drawer { top: 50px; bottom: 64px; }
  .home-search { top: 50px; }

  /* inicio */
  .hero-c { grid-template-columns: 1fr; gap: 18px; padding: 22px 0 16px; }
  .totals { grid-template-columns: repeat(4, 1fr); }
  .totals div { padding: 8px 10px; }
  .totals dd { font-size: 18px; }
  .rc-head { flex-direction: column; gap: 10px; }
  .rc-head .race-title { font-size: 26px; }
  .race-card { padding: 16px; }
  .ed-grid { grid-template-columns: repeat(3, 1fr); }
  .ed { padding: 10px; }
  .ed .yr { font-size: 26px; }
  .ed .tags { display: none; }

  /* resultados: estadísticas en carrusel horizontal */
  .stats { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 18px; padding: 0 16px; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .stat { flex: 0 0 auto; min-width: 150px; scroll-snap-align: start; }
  /* tabla: solo lo esencial */
  .res.results.tri th:nth-child(3), .res.results.tri td:nth-child(3),
  .res.results.tri th:nth-child(5), .res.results.tri td:nth-child(5),
  .res.results.tri th:nth-child(7), .res.results.tri td:nth-child(7),
  .res.results.tri th:nth-child(10), .res.results.tri td:nth-child(10) { display: none; }
  .res.results td, .res.results th { padding: 8px 6px; }
  .res.results td.nm .c { display: block; margin: 2px 0 0; }
  .res.results td.t .rkx { display: none; }
  .res.results td.rk { width: 30px; font-size: 15px; }
  .filters .inp.search { flex-basis: 100%; }
  .count { margin-left: 0; }

  /* replay: mapa → controles → posiciones → formulario */
  .rp-side { display: flex; flex-direction: column; }
  .rp-side #board { order: -1; border-bottom: 1px solid var(--line); }
  .replay { grid-template-rows: auto; }
  .rp-main { grid-template-rows: 48vh auto; }
  .transport { grid-template-columns: auto 1fr; padding: 10px 12px; gap: 10px; }
  .transport .speeds { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); }
  .transport .speeds button { margin-left: 0; }
  .clock { top: 10px; left: 10px; padding: 6px 10px; }
  .clock .t { font-size: 26px; }
  .legend-map { top: 10px; right: 10px; padding: 6px 8px; gap: 8px; font-size: 10px; }
  .h1 { font-size: clamp(34px, 10vw, 52px); }
}
@media (max-width: 420px) {
  .ed-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .ed-nums span:last-child { display: none; }
}
@media (max-width: 600px) {
  .res.results.tri th:nth-child(4), .res.results.tri td:nth-child(4),
  .res.results.tri th:nth-child(6), .res.results.tri td:nth-child(6),
  .res.results.tri th:nth-child(8), .res.results.tri td:nth-child(8) { display: none; }
  .res.results td.nm { white-space: normal; }
  .tbl-wrap { margin: 0 -16px; border-left: 0; border-right: 0; }
}

/* selector Tiempo | Ritmo */
.seg.units button { min-width: 70px; }
th .u { font-family: var(--mono); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-3); font-size: 10px; }
.prof-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.an-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.an-head .an-note { margin: 0; }
