:root {
  --bg: #0b0d10;
  --panel: #13161b;
  --line: #22262d;
  --text: #eef0f3;
  --muted: #8a919c;
  --accent: #c8ff3d;
  --accent-dim: rgba(200, 255, 61, .18);
  --warn: #ffb03d;
  --live: #ff3d5a;
  --radius: 16px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 2px 0 0; font-size: clamp(24px, 5vw, 36px); line-height: 1.1; letter-spacing: -.02em; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.badge i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.live { color: var(--live); border-color: rgba(255, 61, 90, .4); }
.badge.live i { animation: blink 1.4s infinite; }
.badge.done { color: var(--accent); border-color: var(--accent-dim); }
@keyframes blink { 50% { opacity: .25; } }

/* Countdown */
.countdown { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 14px; text-align: center; }
.countdown .big { font: 700 clamp(44px, 12vw, 88px)/1 var(--mono); letter-spacing: -.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.countdown .sub { color: var(--muted); margin-top: 8px; }

/* Stats */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.dist .big { font: 700 clamp(48px, 11vw, 84px)/1 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.dist .big small { font-size: .35em; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.bar { position: relative; height: 10px; border-radius: 99px; background: #1c2027; margin: 18px 0 8px; overflow: hidden; }
.bar b { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #7fbf1a, var(--accent)); border-radius: 99px; transition: width .8s ease; }
.bar .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bg); }
.bar-legend { display: flex; justify-content: space-between; color: var(--muted); font: 12px var(--mono); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.stat .label { color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.stat .value { font: 600 clamp(22px, 5vw, 30px)/1.15 var(--mono); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value small { color: var(--muted); font-size: .5em; margin-left: 3px; }

/* Map */
.map-card { padding: 0; overflow: hidden; position: relative; margin-bottom: 14px; }
#map { height: min(62vh, 560px); background: #0e1013; }
.map-meta { position: absolute; left: 12px; bottom: 12px; z-index: 500; display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: rgba(11, 13, 16, .82); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font: 12px var(--mono); color: var(--muted); }
.chip.warn { color: var(--warn); }
.leaflet-container { font-family: var(--sans); background: #0e1013 !important; }
.tiles { filter: var(--tile-filter, none); }
.leaflet-control-attribution { background: rgba(11, 13, 16, .7) !important; color: #666 !important; }
.leaflet-control-attribution a { color: #888 !important; }
.leaflet-bar a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; }
.runner-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 0 rgba(200, 255, 61, .7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 16px rgba(200, 255, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(200, 255, 61, 0); } }
.start-flag { font-size: 20px; line-height: 1; filter: drop-shadow(0 1px 2px #000); }

/* Lower */
.lower { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; align-items: start; }
h2 { margin: 0 0 12px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.splits { list-style: none; margin: 0; padding: 0; }
.splits li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.splits li:last-child { border-bottom: 0; }
.splits li.current { color: var(--accent); }
.splits li.pending { color: #4a505a; }

/* Comments */
.comment-form { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
.comment-form .row { display: flex; gap: 8px; }
input, textarea, button { font: inherit; color: var(--text); }
input, textarea { width: 100%; background: #0e1115; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 44px; }
button { background: var(--accent); color: #0b0d10; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; white-space: nowrap; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.as { color: var(--muted); font-size: 13px; }
.as a { cursor: pointer; }
.form-error { color: var(--warn); font-size: 13px; min-height: 1em; }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }
.comments li { background: #0e1115; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; animation: pop .35s ease; }
.comments .meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.comments .meta b { color: var(--text); font-size: 14px; }
.comments .meta .km { font-family: var(--mono); color: var(--accent); }
.comments .text { white-space: pre-wrap; word-wrap: break-word; }
.empty { color: var(--muted); font-size: 14px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

footer { color: #4a505a; font-size: 12px; text-align: center; margin-top: 28px; }

@media (max-width: 760px) {
  .hero, .lower { grid-template-columns: 1fr; }
  #map { height: 52vh; }
}

.lower.single { grid-template-columns: 1fr; }
.leaflet-tooltip.finish-label { background: rgba(11, 13, 16, .85); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: 600 12px var(--sans); box-shadow: none; }
.leaflet-tooltip.finish-label::before { display: none; }

/* Průběh kolem startu, fandění, cíl */
.passby { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--accent-dim); color: var(--accent); font-weight: 600; font-size: 14px; }
.passby b { font-family: var(--mono); }
.cheers { display: flex; gap: 8px; flex-wrap: wrap; }
.cheers button { background: #0e1115; border: 1px solid var(--line); font-size: 20px; padding: 6px 12px; line-height: 1.2; transition: transform .1s, border-color .2s; }
.cheers button:hover { border-color: var(--accent); }
.cheers button:active { transform: scale(.9); }
.comments li.cheer .text { font-size: 26px; line-height: 1.1; }
.finish-banner { background: linear-gradient(135deg, rgba(200,255,61,.16), rgba(200,255,61,.03)); border: 1px solid var(--accent-dim); border-radius: var(--radius); padding: 22px; margin-bottom: 14px; text-align: center; }
.finish-banner .big { font: 700 clamp(44px, 12vw, 88px)/1 var(--mono); color: var(--accent); letter-spacing: -.03em; margin: 6px 0 10px; }
.finish-banner a { font-weight: 600; }
