/* RunTrack public site — design tokens first, components after. */

:root {
    --accent: #ea580c;
    --accent-2: #f97316;
    --accent-soft: rgba(234, 88, 12, .12);
    --live: #ef4444;

    --bg: #f7f5f2;
    --surface: #ffffff;
    --surface-2: #f1eee9;
    --fg: #1c1917;
    --muted: #6b635d;
    --border: #e7e2dc;
    --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 8px 24px rgba(28, 25, 23, .06);
    --shadow-lg: 0 2px 4px rgba(28, 25, 23, .06), 0 20px 48px rgba(28, 25, 23, .12);

    /* The hero is dark in both themes. */
    --hero-bg: #12100e;
    --hero-fg: #fafaf9;
    --hero-muted: #a8a29e;

    --radius: 16px;
    --radius-sm: 10px;
    --font-display: "Unbounded", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c0a09;
        --surface: #171412;
        --surface-2: #211d1a;
        --fg: #f5f5f4;
        --muted: #a8a29e;
        --border: #2c2724;
        --accent-soft: rgba(249, 115, 22, .16);
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
        --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 20px 48px rgba(0, 0, 0, .5);
        --hero-bg: #0a0807;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
img, svg { display: block; max-width: 100%; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -.01em; line-height: 1.15; }

/* ---------- Header ---------- */

.site-header {
    position: sticky; top: 0; z-index: 1000;
    background: color-mix(in srgb, var(--hero-bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    color: var(--hero-fg);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--hero-fg); font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.brand-name span { color: var(--accent-2); }
.brand-mark { width: 30px; height: 30px; flex: none; }

.nav { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons & chips ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 999px;
    font: 600 .95rem/1 var(--font-body); text-decoration: none; white-space: nowrap;
    border: 1px solid transparent; cursor: pointer;
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(234, 88, 12, .35); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { color: inherit; border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .04); }
.btn-ghost:hover { border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); }
.btn-outline { color: var(--fg); border-color: var(--border); background: var(--surface); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: .85rem; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    font-size: .85rem; font-weight: 500;
    background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); color: var(--hero-fg);
}
.chip svg { width: 16px; height: 16px; opacity: .8; }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    font: 700 .7rem/1.2 var(--font-body); letter-spacing: .06em; text-transform: uppercase;
    background: var(--surface-2); color: var(--muted);
}
.badge-live { background: var(--live); color: #fff; }
.badge-live::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff;
    animation: pulse 1.6s ease-in-out infinite;
}
.badge-soon { background: var(--accent-soft); color: var(--accent); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }
    50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0); }
}

/* ---------- Hero ---------- */

.hero {
    position: relative; overflow: hidden; isolation: isolate;
    background: var(--hero-bg); color: var(--hero-fg);
}
.hero::before { /* warm glow */
    content: ""; position: absolute; inset: -40% -10% auto auto; width: 70%; aspect-ratio: 1;
    background: radial-gradient(closest-side, rgba(234, 88, 12, .35), transparent 70%);
    z-index: -1; pointer-events: none;
}
.hero-topo { position: absolute; inset: 0; z-index: -1; opacity: .5; pointer-events: none; }
.hero-topo path { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 1.2; }
.hero-topo .route {
    stroke: var(--accent-2); stroke-width: 3; stroke-linecap: round; opacity: .9;
    stroke-dasharray: 2600; stroke-dashoffset: 2600;
    animation: draw 4s cubic-bezier(.6, 0, .2, 1) .3s forwards;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, .8));
}
.hero-topo .runner { fill: #fff; opacity: 0; animation: appear .3s ease 4.2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

.hero-inner { padding: 72px 0 64px; max-width: 760px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.6rem); font-weight: 800; margin: 16px 0; }
.hero h1 em { font-style: normal; color: var(--accent-2); }
.hero .lead { color: var(--hero-muted); font-size: clamp(1rem, 2.2vw, 1.2rem); max-width: 600px; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* One translucent strip with dividers, so the numbers belong to the hero. */
.stats-row {
    display: inline-flex; flex-wrap: wrap; margin-top: 40px;
    border-radius: var(--radius); background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(6px);
}
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 26px; }
.stat + .stat { border-left: 1px solid rgba(255, 255, 255, .1); }
.stat-icon {
    flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    background: rgba(249, 115, 22, .14); color: var(--accent-2);
}
.stat-icon svg { width: 21px; height: 21px; }
.stat-num { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-num small { font-family: var(--font-body); font-size: .85rem; font-weight: 600; color: var(--hero-muted); margin-left: 4px; }
.stat-label { color: var(--hero-muted); font-size: .8rem; margin-top: 5px; white-space: nowrap; }

/* ---------- Sections ---------- */

.section { padding: 56px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { font: 700 .75rem/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

.empty {
    padding: 40px 24px; text-align: center; color: var(--muted);
    background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ---------- Event cards ---------- */

.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 20px; }

.event-card {
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none; color: inherit; box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.event-card:hover .preview .route-line { stroke-width: 3.5; }

.preview {
    position: relative; aspect-ratio: 16 / 9;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(234, 88, 12, .25), transparent 60%),
        linear-gradient(160deg, #1f1a17, #0f0d0c);
}
.preview svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview .route-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke-width .2s ease; filter: drop-shadow(0 0 6px rgba(0, 0, 0, .6)); }
.preview .grid-line { stroke: rgba(255, 255, 255, .05); }
.preview-top { position: absolute; inset: 12px 12px auto 12px; display: flex; justify-content: space-between; align-items: start; gap: 8px; }

.date-block {
    display: grid; place-items: center; min-width: 54px; padding: 6px 8px;
    background: rgba(255, 255, 255, .92); color: #1c1917; border-radius: 12px; text-align: center; line-height: 1.05;
}
.date-block .d { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; }
.date-block .m { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

.event-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.event-body h3 { font-size: 1.05rem; margin: 0; }
.event-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .9rem; }
.event-meta span { display: inline-flex; align-items: center; gap: 5px; }
.event-meta svg { width: 15px; height: 15px; }
.course-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.course-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
    background: var(--surface-2); color: var(--fg);
}
.course-pill i { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Steps ---------- */

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 20px; counter-reset: step; }
.step {
    position: relative; padding: 24px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
}
.step::before {
    counter-increment: step; content: counter(step, decimal-leading-zero);
    display: block; font-family: var(--font-display); font-weight: 800; font-size: 2rem; line-height: 1;
    color: transparent; -webkit-text-stroke: 1.5px var(--accent); margin-bottom: 14px;
}
.step h3 { font-size: 1rem; margin: 0 0 6px; }
.step p { margin: 0; color: var(--muted); }

/* ---------- Changelog ---------- */

.changelog { list-style: none; margin: 0; padding: 0; position: relative; }
.changelog::before {
    content: ''; position: absolute; left: 21px; top: 8px; bottom: 8px; width: 2px;
    background: linear-gradient(var(--accent), var(--border) 70%);
}
.changelog-item { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 18px; padding-bottom: 16px; }
.changelog-dot {
    position: relative; z-index: 1; width: 44px; height: 44px; display: grid; place-items: center;
    border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); color: var(--accent);
}
.changelog-dot svg { width: 20px; height: 20px; }
.changelog-card {
    padding: 18px 22px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow); transition: border-color .2s, transform .2s;
}
.changelog-card:hover { border-color: var(--accent); transform: translateX(3px); }
.changelog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; font-size: .82rem; color: var(--muted); }
.changelog-tag { padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.changelog-tag-new { background: var(--accent-soft); color: var(--accent); }
.changelog-tag-improved { background: rgba(37, 99, 235, .12); color: #3b82f6; }
.changelog-tag-fixed { background: rgba(22, 163, 74, .12); color: #22a355; }
.changelog-card h3 { font-size: 1.05rem; margin: 0 0 6px; }
.changelog-card p { margin: 0; color: var(--muted); }
.changelog-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 600; font-size: .9rem; text-decoration: none; }
.changelog-link svg { width: 16px; height: 16px; }
.changelog-more summary {
    display: inline-flex; align-items: center; gap: 8px; margin-left: 62px; padding: 8px 16px; cursor: pointer; list-style: none;
    border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: .9rem;
}
.changelog-more summary::-webkit-details-marker { display: none; }
.changelog-more summary::after { content: '▾'; color: var(--accent); }
.changelog-more summary:hover { border-color: var(--accent); color: var(--accent); }
.changelog-more[open] summary { display: none; }
.changelog-more .changelog::before { top: -8px; background: var(--border); }
@media (max-width: 560px) {
    .changelog::before { left: 17px; }
    .changelog-item { grid-template-columns: 36px 1fr; gap: 12px; }
    .changelog-dot { width: 36px; height: 36px; }
    .changelog-dot svg { width: 17px; height: 17px; }
    .changelog-card { padding: 16px; }
    .changelog-card:hover { transform: none; }
    .changelog-more summary { margin-left: 48px; }
}

.video-embed {
    position: relative; aspect-ratio: 16 / 9; margin-bottom: 20px; overflow: hidden;
    border-radius: var(--radius); border: 1px solid var(--border); background: #000; scroll-margin-top: 90px;
}
.video-embed video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; }
.video-play { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; cursor: pointer; background: none; }
.video-play img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .2s; }
.video-play:hover img { filter: brightness(.85); }
.video-play-icon {
    position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px;
    display: grid; place-items: center; border-radius: 50%;
    background: var(--accent); box-shadow: 0 10px 30px rgba(234, 88, 12, .45); transition: transform .2s;
}
.video-play:hover .video-play-icon, .video-play:focus-visible .video-play-icon { transform: scale(1.08); }
.video-play-icon svg { width: 34px; height: 34px; fill: #fff; margin-left: 4px; }
.video-caption {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 16px 12px;
    font-size: .85rem; font-weight: 600; color: #fff; text-align: left;
    background: linear-gradient(transparent, rgba(0, 0, 0, .7));
}
@media (max-width: 560px) {
    .video-play-icon { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
    .video-play-icon svg { width: 26px; height: 26px; }
    .video-caption { font-size: .75rem; }
}

/* ---------- Event page ---------- */

.event-hero .hero-inner { padding: 40px 0 32px; max-width: none; }
.event-hero h1 { font-size: clamp(1.7rem, 5vw, 3rem); margin: 12px 0 16px; }
.event-hero .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.event-hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 24px 40px; align-items: end; }
@media (max-width: 860px) { .event-hero-grid { grid-template-columns: 1fr; } }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--hero-muted); text-decoration: none; font-size: .9rem; }
.back-link:hover { color: var(--hero-fg); }

.countdown { display: flex; gap: 8px; }
.countdown div {
    min-width: 68px; padding: 10px 8px; text-align: center; border-radius: 12px;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
}
.countdown b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.countdown small { display: block; margin-top: 6px; color: var(--hero-muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.countdown-label { color: var(--hero-muted); font-size: .8rem; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .1em; }
.event-hero .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.map-shell {
    position: relative; margin-top: -1px;
    height: clamp(380px, 62vh, 680px);
    background: var(--surface-2);
}
#map { position: absolute; inset: 0; }
.map-courses {
    position: absolute; z-index: 500; left: 16px; bottom: 16px; right: 16px;
    display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none;
}
.map-courses button {
    pointer-events: auto;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px; cursor: pointer;
    font: 600 .85rem/1 var(--font-body); color: #1c1917;
    background: rgba(255, 255, 255, .94); border: 2px solid transparent;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    transition: opacity .15s ease, border-color .15s ease, transform .15s ease;
}
.map-courses button:hover { transform: translateY(-1px); }
.map-courses button i { width: 10px; height: 10px; border-radius: 50%; }
.map-courses button[aria-pressed="false"] { opacity: .55; }
.map-courses button.active { border-color: var(--c); }

.course-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.course-tabs::-webkit-scrollbar { display: none; }
.course-tab {
    flex: none; display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: 999px; cursor: pointer;
    font: 600 .9rem/1 var(--font-body); color: var(--fg);
    background: var(--surface); border: 1px solid var(--border);
}
.course-tab i { width: 10px; height: 10px; border-radius: 50%; }
.course-tab[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.course-panel {
    margin-top: 16px; padding: 20px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.course-panel[hidden] { display: none; }
.course-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.course-panel-head h3 { margin: 0; font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
.course-panel-head h3 i { width: 14px; height: 14px; border-radius: 4px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.metric { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.metric small { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.metric b { display: block; margin-top: 4px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric b span { font-family: var(--font-body); font-size: .85rem; font-weight: 600; color: var(--muted); margin-left: 2px; }

.profile { position: relative; height: 200px; user-select: none; touch-action: pan-y; }
.profile svg { width: 100%; height: 100%; overflow: visible; }
.profile .axis text { font: 500 11px var(--font-body); fill: var(--muted); }
.profile .axis line { stroke: var(--border); }
.profile .cursor { stroke: var(--fg); stroke-width: 1; stroke-dasharray: 3 3; }
.profile-tip {
    position: absolute; top: 0; transform: translateX(-50%);
    padding: 5px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none;
    font: 600 .8rem/1.3 var(--font-body); background: var(--fg); color: var(--bg);
}
.profile-empty { color: var(--muted); padding: 24px 0; }

.description { white-space: pre-line; max-width: 760px; color: var(--fg); }

/* ---------- Leaflet tweaks ---------- */

.leaflet-container { font-family: var(--font-body); background: var(--surface-2); }
.leaflet-control-layers, .leaflet-bar { border: 0 !important; border-radius: 12px !important; box-shadow: 0 4px 14px rgba(0, 0, 0, .18) !important; overflow: hidden; }
.leaflet-tooltip { font-weight: 600; border-radius: 8px; }

/* ---------- Footer ---------- */

.site-footer { margin-top: 40px; padding: 32px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 640px) {
    /* Keep both "Вход" and "Регистрация" visible on phones, just more compact. */
    .nav { gap: 6px; }
    .hero-inner { padding: 48px 0 44px; }
    .countdown div { min-width: 0; flex: 1; }
    .stats-row { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
    .stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 12px; }
    .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
    .stat-num { font-size: 1.3rem; }
    .stat-label { white-space: normal; }
}
@media (max-width: 380px) {
    .brand { font-size: 1rem; gap: 8px; }
    .brand-mark { width: 26px; height: 26px; }
    .nav .btn-sm { padding: 6px 10px; font-size: .8rem; }
}
/* Very narrow phones: logo mark only, so the buttons still fit. */
@media (max-width: 340px) {
    .brand { font-size: 0; gap: 0; }
}

/* ---------- Live ranking, runners, follow card, replay ---------- */

[hidden] { display: none !important; }
.rt-rank-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rt-search {
    width: min(260px, 100%); padding: 9px 14px; border-radius: 999px;
    font: 500 .9rem/1.2 var(--font-body); color: var(--fg);
    background: var(--surface); border: 1px solid var(--border);
}
.rt-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.rt-updated { color: var(--muted); font-size: .85rem; }
.rt-updated:not(:empty)::before { content: "· "; }
.course-tab small { opacity: .6; font-weight: 600; }

.rt-table-wrap {
    margin-top: 16px; overflow-x: auto; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.rt-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.rt-table th {
    text-align: left; padding: 12px 14px; white-space: nowrap;
    font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700;
    border-bottom: 1px solid var(--border);
}
.rt-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rt-table tbody tr:last-child td { border-bottom: 0; }
.rt-table tbody tr[data-id] { cursor: pointer; transition: background-color .12s ease; }
.rt-table tbody tr[data-id]:hover, .rt-table tbody tr[data-id]:focus-visible { background: var(--surface-2); outline: none; }
.rt-table tr.is-following { background: var(--accent-soft) !important; }
.rt-table tr.is-waiting { color: var(--muted); }
.rt-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rt-table td small { color: var(--muted); }
.rt-empty { text-align: center; color: var(--muted); padding: 28px 14px !important; white-space: normal !important; }
.rt-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.rt-name i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.rt-status {
    display: inline-block; padding: 2px 8px; border-radius: 999px; margin-left: 4px;
    font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.rt-status.is-finished { background: rgba(22, 163, 74, .14); color: #16a34a; margin-left: 0; }
.rt-status.is-stale { background: rgba(234, 179, 8, .16); color: #a16207; }
.rt-status.is-alert { background: rgba(239, 68, 68, .14); color: #dc2626; }
@media (max-width: 640px) {
    .rt-table .hide-sm { display: none; }
    .rt-table th, .rt-table td { padding: 10px 8px; }
}

/* Runner markers: a dot in the course colour, the name tag when zoomed in or followed. */
.rt-runner { position: relative; width: 16px; height: 16px; }
.rt-runner .dot {
    position: absolute; inset: 0; border-radius: 50%;
    background: var(--c); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .45);
}
.rt-runner .tag {
    position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
    padding: 2px 7px; border-radius: 6px; white-space: nowrap;
    font: 700 11px/1.4 var(--font-body); color: #1c1917; background: rgba(255, 255, 255, .95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25); display: none;
}
.rt-show-tags .rt-runner .tag, .rt-runner.is-followed .tag { display: block; }
.rt-runner.is-followed { z-index: 2; }
.rt-runner.is-followed .dot { inset: -5px; border-width: 4px; box-shadow: 0 0 0 4px rgba(234, 88, 12, .35), 0 2px 10px rgba(0, 0, 0, .5); }
.rt-runner.is-faded { opacity: .55; }
.rt-runner.is-alert .dot { box-shadow: 0 0 0 3px #ef4444, 0 1px 6px rgba(0, 0, 0, .45); }
.rt-runner.is-finished .dot { background: #1c1917; border-color: var(--c); }
/* Runners who chose to show their photo */
.rt-runner.has-photo { width: 34px; height: 34px; }
.rt-runner.has-photo .dot { overflow: hidden; border: 3px solid var(--c); background: #fff; }
.rt-runner.has-photo .dot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rt-runner.has-photo .tag { left: 38px; }
.rt-runner.has-photo.is-followed .dot { inset: -4px; border-width: 4px; }
.rt-runner.has-photo.is-finished .dot { background: #fff; }
.rt-avatar { width: 24px; height: 24px; flex: none; border-radius: 50%; object-fit: cover; border: 2px solid var(--c); background: var(--surface-2); }
.rt-avatar.is-big { width: 40px; height: 40px; border-width: 3px; }
.rt-checkpoint {
    width: 14px; height: 14px; transform: rotate(45deg); border-radius: 3px;
    background: #fff; border: 3px solid var(--c); box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}

.rt-follow-card {
    position: absolute; z-index: 600; left: 16px; top: 16px; width: min(320px, calc(100% - 80px));
    padding: 14px 16px; border-radius: var(--radius);
    background: var(--surface); color: var(--fg); box-shadow: var(--shadow-lg);
}
.rt-follow-card[hidden] { display: none; }
.rt-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding-right: 28px; position: relative; }
.rt-card-head small { color: var(--muted); }
.rt-x {
    position: absolute; right: -6px; top: -6px; width: 30px; height: 30px; border-radius: 50%;
    border: 0; background: var(--surface-2); color: var(--fg); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.rt-card-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 8px; }
.rt-card-stats small { display: block; font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.rt-card-stats b { font-family: var(--font-display); font-size: .95rem; font-variant-numeric: tabular-nums; }
.rt-card-note { margin: 0 0 10px; font-size: .88rem; color: var(--muted); }
.rt-card-alert { margin: 0 0 6px; font-size: .85rem; font-weight: 700; color: #dc2626; }
@media (max-width: 640px) {
    .rt-follow-card { top: auto; bottom: 64px; left: 10px; width: calc(100% - 20px); }
}

.rt-replay-bar {
    position: absolute; z-index: 600; left: 50%; bottom: 16px; transform: translateX(-50%);
    width: min(640px, calc(100% - 32px)); display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 999px; background: rgba(28, 25, 23, .92); color: #fff;
    box-shadow: var(--shadow-lg);
}
.rt-replay-bar[hidden] { display: none; }
.rt-replay-bar input[type=range] { flex: 1; min-width: 60px; accent-color: var(--accent); }
.rt-replay-bar select { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; padding: 4px 6px; font: 600 .8rem var(--font-body); }
.rt-replay-bar select option { color: #1c1917; }
.rt-replay-clock { font: 600 .8rem var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-replay-btn {
    flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--accent); color: #fff; font-size: .9rem; line-height: 1;
}
.rt-replay-btn[data-replay-close] { background: rgba(255, 255, 255, .15); font-size: 1.2rem; }
@media (max-width: 640px) { .rt-replay-clock { display: none; } }

/* ---------- Footer links, legal pages, contact ---------- */

.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

.legal { max-width: 760px; padding: 48px 0 24px; }
.legal h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 6px 0 8px; }
.legal h2 { font-size: 1.15rem; margin: 32px 0 10px; }
.legal p, .legal li { color: var(--fg); }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: 6px; }
.legal-updated { color: var(--muted) !important; font-size: .9rem; margin-top: 0; }
.legal-callout { padding: 4px 18px; border-left: 4px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); }

.contact { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; padding: 40px 0 24px; align-items: start; }
.contact-card { padding: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.contact-form { display: grid; gap: 20px; }
.contact-form label { display: grid; gap: 6px; }
.contact-form label > span, .topic-pills legend { font-weight: 600; font-size: .9rem; }
.contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-form input[type=text], .contact-form input[type=email], .contact-form textarea {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    font: 400 1rem/1.4 var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--border);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.contact-form textarea { resize: vertical; min-height: 160px; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.contact-form .err { color: #dc2626; font-size: .85rem; }

.topic-pills { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.topic-pills legend { margin-bottom: 10px; padding: 0; }
.topic-pill { cursor: pointer; }
.topic-pill input { position: absolute; opacity: 0; pointer-events: none; }
.topic-pill span {
    display: inline-block; padding: 8px 14px; border-radius: 999px;
    font: 600 .88rem/1.2 var(--font-body); color: var(--fg);
    background: var(--surface); border: 1px solid var(--border);
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.topic-pill:hover span { border-color: var(--accent); }
.topic-pill input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.topic-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.contact-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.contact-submit small { color: var(--muted); font-size: .85rem; }
.contact-sent {
    display: flex; gap: 12px; align-items: center; margin-bottom: 22px; padding: 14px 16px;
    border-radius: var(--radius-sm); background: rgba(22, 163, 74, .12); color: #15803d;
}
.contact-sent div { display: grid; }
.contact-sent svg { flex: none; }

.contact-aside { display: grid; gap: 12px; }
.contact-tip {
    display: flex; gap: 14px; align-items: flex-start; width: 100%; padding: 18px; text-align: left; cursor: pointer;
    font: inherit; color: var(--fg); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    transition: border-color .15s ease, transform .15s ease;
}
.contact-tip:hover { border-color: var(--accent); transform: translateY(-1px); }
.contact-tip b { display: block; margin-bottom: 2px; }
.contact-tip small { display: block; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.contact-tip-icon {
    flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    background: var(--accent-soft); color: var(--accent);
}
.contact-tip-icon svg { width: 22px; height: 22px; }
.contact-form .form-section { margin: 4px 0 -6px; font-size: 1rem; }
.contact-form .form-section ~ .form-section { margin-top: 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.contact-form label > span em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .8rem; margin-left: 4px; }
.contact-form .hint { color: var(--muted); font-size: .82rem; }
.contact-form input[type=datetime-local], .contact-form input[type=url] {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    font: 400 1rem/1.4 var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--border);
}
.contact-form input[type=datetime-local]:focus, .contact-form input[type=url]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.contact-form label.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.contact-form label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.contact-form label.check span { font-weight: 500; }
.contact-tip.is-static { cursor: default; }
.contact-tip.is-static:hover { border-color: var(--border); transform: none; }
.contact-tip-icon b { font-family: var(--font-display); font-size: 1rem; }
.contact-aside-note { margin: 4px 4px 0; color: var(--muted); font-size: .85rem; }
.community-note {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 12px; border-radius: 999px;
    font-size: .82rem; color: var(--hero-muted); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1);
}
.community-note svg { width: 16px; height: 16px; flex: none; }
.unsubscribe { max-width: 560px; margin: 64px auto 24px; padding: 32px; text-align: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.unsubscribe .contact-tip-icon { margin: 0 auto 12px; width: 52px; height: 52px; }
.unsubscribe h1 { font-size: 1.5rem; margin: 0 0 10px; }
.unsubscribe p { color: var(--muted); margin: 0 0 20px; }
.contact .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 860px) {
    .contact { grid-template-columns: 1fr; gap: 16px; padding-top: 24px; }
    .contact-aside { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .contact-card { padding: 20px; }
    .contact-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

