/* covtsp - Minimal & Elegant Redesign */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Theme variables ──────────────────────────────────────────── */

:root {
    --bg: #E8E4DF;
    --bg-alt: #DED9D4;
    --white: #F0ECE7;
    --text: #1C1917;
    --muted: #78716C;
    --border: #D6D0CA;
    --accent: #F43F5E;
    --accent-hover: #E11D48;
    --accent-glow: rgba(244, 63, 94, 0.12);
    --accent-secondary: #FB7185;
    --accent-secondary-glow: rgba(251, 113, 133, 0.10);
    --row-hover: #F4F4F5;
    --card-bg: #F0ECE7;
    --nav-bg: rgba(232, 228, 223, 0.85);
    --code-bg: rgba(244, 63, 94, 0.06);
}

[data-theme="dark"] {
    --bg: #0C0C0F;
    --bg-alt: #18181B;
    --white: #1E1E22;
    --text: #FAFAFA;
    --muted: #A1A1AA;
    --border: #2E2E35;
    --accent: #FB7185;
    --accent-hover: #FDA4AF;
    --accent-glow: rgba(251, 113, 133, 0.14);
    --accent-secondary: #F43F5E;
    --accent-secondary-glow: rgba(244, 63, 94, 0.12);
    --row-hover: #222228;
    --card-bg: #1E1E22;
    --nav-bg: rgba(12, 12, 15, 0.92);
    --code-bg: rgba(251, 113, 133, 0.08);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    position: relative;
}

.hidden { display: none !important; }
.accent { color: var(--accent); }
.muted { color: var(--muted); }

/* ── Nav ──────────────────────────────────────────────────────── */

.nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 56px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.nav.nav-scrolled {
    border-bottom-color: var(--border);
}

.nav-brand {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

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

.nav-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}

.nav-link:hover {
    color: var(--text);
}

.nav-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--muted);
}

.nav-sep {
    font-size: 12px;
    color: var(--border);
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.theme-btn:hover {
    color: var(--text);
    border-color: var(--muted);
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun,
:root .icon-sun { display: none; }
[data-theme="light"] .icon-moon,
:root .icon-moon { display: block; }

/* ── Buttons ──────────────────────────────────────────────────── */

.btn-primary {
    display: inline-block;
    padding: 12px 28px;
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
    display: inline-block;
    padding: 12px 28px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.btn-secondary:hover {
    border-color: var(--muted);
    transform: translateY(-1px);
}

.btn-export {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-export:hover { opacity: 0.8; }

/* ── ASCII Background ────────────────────────────────────────── */

#ascii-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero-wrapper {
    position: relative;
}

.hero-wrapper, .section, .blog-callout, footer {
    position: relative;
    z-index: 1;
}

/* ── Hero ─────────────────────────────────────────────────────── */

.hero-compact {
    max-width: 780px;
    margin: 0 auto;
    padding: 180px 32px 60px;
    text-align: center;
    position: relative;
}

.hero-tag {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 24px;
    padding: 6px 14px;
    border: 1px solid var(--accent-glow);
    border-radius: 100px;
    background: var(--accent-glow);
}

.hero-title {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -0.04em;
}

.hero-desc {
    font-size: 18px;
    font-weight: 400;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 36px;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 48px;
}

.hero-stats {
    display: flex;
    gap: 0;
    justify-content: center;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.hero-stat {
    display: flex;
    flex-direction: column;
    padding: 0 32px;
    position: relative;
}

.hero-stat:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 28px;
    background: var(--border);
}

.hero-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.hero-stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* ── Sections ─────────────────────────────────────────────────── */

.section {
    max-width: 1080px;
    margin: 0 auto;
    padding: 120px 32px;
    border-top: 1px solid var(--border);
}

.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 14px;
}

.section-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 18px;
    letter-spacing: -0.03em;
}

.section-desc {
    font-size: 17px;
    color: var(--muted);
    line-height: 1.7;
    max-width: 640px;
    margin-bottom: 8px;
}

.section-desc strong {
    color: var(--text);
    font-weight: 600;
}

.section p {
    font-size: 16px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 12px;
}

.section p strong {
    color: var(--text);
    font-weight: 500;
}

/* ── Best Day to Attempt ─────────────────────────────────────── */

.bd-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    margin-top: 24px;
}

.bd-tab {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.bd-tab:hover {
    color: var(--text);
    border-color: var(--text);
}

.bd-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.bd-hero-card {
    padding: 28px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 16px;
    margin-bottom: 28px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .bd-hero-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.bd-recommended {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bd-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.bd-date {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.bd-score-wrap {
    margin-left: auto;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.bd-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.bd-score-label {
    font-size: 13px;
    color: var(--muted);
}

.bd-factors {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.bd-factor {
    display: grid;
    grid-template-columns: 100px 1fr 48px;
    align-items: center;
    gap: 12px;
}

.bd-factor-label {
    font-size: 13px;
    color: var(--muted);
}

.bd-factor-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.bd-factor-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    background: var(--accent);
}

.bd-factor-fill.good { background: #22C55E; }
.bd-factor-fill.ok { background: #F59E0B; }
.bd-factor-fill.bad { background: #EF4444; }

.bd-factor-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--muted);
    text-align: right;
}

.bd-recommendation {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.bd-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.bd-day {
    padding: 12px 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.bd-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .bd-day:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bd-day.best {
    border-color: var(--accent);
    border-width: 2px;
}

.bd-day-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.bd-day-num {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.bd-day-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
}

.bd-day-score.score-high { color: #22C55E; }
.bd-day-score.score-mid { color: #F59E0B; }
.bd-day-score.score-low { color: #EF4444; }

.bd-day-detail {
    display: none;
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.4;
    text-align: left;
}

.bd-day.expanded .bd-day-detail {
    display: block;
}

.bd-day.expanded {
    grid-column: span 2;
}

.bd-footnote {
    font-size: 12px;
    margin-top: 8px;
}

.bd-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
    font-size: 14px;
}

.bd-empty code {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    background: var(--code-bg);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

@media (max-width: 900px) {
    .bd-calendar {
        grid-template-columns: repeat(4, 1fr);
    }
    .bd-day.expanded {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .bd-calendar {
        grid-template-columns: repeat(3, 1fr);
    }
    .bd-recommended {
        flex-direction: column;
        gap: 8px;
    }
    .bd-score-wrap {
        margin-left: 0;
    }
    .bd-factor {
        grid-template-columns: 80px 1fr 40px;
    }
    .bd-day.expanded {
        grid-column: span 3;
    }
}

/* ── Record Comparison ────────────────────────────────────────── */

.record-bars {
    margin: 48px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 640px;
}

.record-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.record-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.record-name {
    font-size: 15px;
    font-weight: 500;
}

.record-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
}

.record-time.accent {
    color: var(--accent);
}

.record-bar {
    height: 20px;
    background: var(--bg-alt);
    border-radius: 10px;
    overflow: hidden;
}

.record-bar-fill {
    height: 100%;
    border-radius: 10px;
    width: 0;
    transition: width 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.record-bar-fill.charles {
    background: var(--accent);
}

.record-bar-fill.world-record {
    background: var(--muted);
}

.record-bar-fill.solver {
    background: var(--accent);
}

.record-gap-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 4px 12px;
    border-radius: 100px;
    margin-top: 8px;
}

.record-footnote {
    font-size: 14px;
    color: var(--muted);
    margin-top: 8px;
    font-style: italic;
}

/* ── Pipeline (Vertical Timeline) ─────────────────────────────── */

.pipeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 48px;
    max-width: 680px;
}

.pipeline-arrow { display: none; }

.pipeline-step {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 24px;
    padding: 32px 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.pipeline-step:last-child {
    border-bottom: none;
}

.pipeline-step:hover .step-num {
    color: var(--accent);
}

.step-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 600;
    color: var(--border);
    transition: color 0.2s ease;
    line-height: 1;
    padding-top: 2px;
}

.step-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.step-content p {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.7;
    margin: 0 0 12px;
}

.step-stat {
    display: inline-block;
    padding: 5px 12px;
    background: var(--code-bg);
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
}

/* ── Tech Grid ────────────────────────────────────────────────── */

.tech-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 48px;
}

.tech-card {
    padding: 32px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    border-top: 2px solid var(--accent);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .tech-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.tech-card:nth-child(2) { border-top-color: var(--accent-secondary); }
.tech-card:nth-child(3) { border-top-color: var(--accent-secondary); }
.tech-card:nth-child(4) { border-top-color: var(--accent); }

.tech-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .tech-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.tech-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.tech-card p {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.7;
    margin: 0;
}

/* ── City Grid ────────────────────────────────────────────────── */

.cities-section {
    padding-top: 24px !important;
    padding-bottom: 60px !important;
    border-top: none !important;
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 1080px;
    margin: 0 auto;
}

.city-card {
    padding: 28px 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 16px;
    text-align: left;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .city-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.city-card:nth-child(1) { border-left-color: var(--accent); }
.city-card:nth-child(2) { border-left-color: var(--accent-secondary); }
.city-card:nth-child(3) { border-left-color: var(--muted); }

.city-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .city-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.city-card .card-arrow {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-size: 18px;
}

.city-card:hover .card-arrow {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

.city-card.upcoming {
    opacity: 0.5;
    cursor: default;
}

.city-card.upcoming:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
}

.city-card h3 {
    font-size: 16px;
    font-weight: 600;
}

.city-stat {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--muted);
}

.city-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 600;
}

.city-status.solved {
    color: var(--accent);
}

.city-status.pending {
    color: var(--muted);
    font-weight: 400;
    font-size: 13px;
}

/* ── Footer ───────────────────────────────────────────────────── */

footer {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--muted);
}

.footer-links {
    display: flex;
    gap: 20px;
}

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

.footer-brand {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text);
}

.footer-sep {
    color: var(--border);
}

footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s;
}

footer a:hover { color: var(--text); }

/* ── Blog Callout ─────────────────────────────────────────────── */

.blog-callout {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 32px;
}

.blog-callout a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-callout a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .blog-callout a:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.blog-callout .callout-arrow {
    color: var(--accent);
    font-size: 18px;
    transition: transform 0.2s ease;
}

.blog-callout a:hover .callout-arrow {
    transform: translateX(4px);
}

/* ── Scroll Reveal ────────────────────────────────────────────── */

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.reveal.visible .stagger-child {
    opacity: 1;
    transform: translateY(0);
}

.stagger-child {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* ── Reduced Motion ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .stagger-child,
    .record-bar-fill,
    .city-card,
    .tech-card,
    .blog-callout a {
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 900px) {
    .tech-grid {
        grid-template-columns: 1fr;
    }

    .pipeline-step {
        grid-template-columns: 40px 1fr;
        gap: 16px;
    }

    .step-num {
        font-size: 22px;
    }
}

@media (max-width: 640px) {
    .hero-compact {
        padding: 140px 20px 40px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-desc {
        font-size: 16px;
    }

    .section-title {
        font-size: 28px;
    }

    .hero-stats {
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }

    .hero-stat::after {
        display: none;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .city-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .section {
        padding: 80px 20px;
    }

    footer {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .blog-callout {
        padding: 0 20px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 30px;
    }

    .nav {
        padding: 0 16px;
    }

    .nav-right {
        gap: 10px;
    }

    .pipeline-step {
        grid-template-columns: 32px 1fr;
        gap: 12px;
        padding: 24px 0;
    }

    .step-num {
        font-size: 18px;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Results page styles (results.html)
   ══════════════════════════════════════════════════════════════════ */

/* ── Loader ───────────────────────────────────────────────────── */

.loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 40;
}

.loader-inner {
    text-align: center;
    max-width: 400px;
    padding: 0 24px;
}

.loader-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.loader-hint {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 24px;
}

.loader-hint code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ── Map ──────────────────────────────────────────────────────── */

#map {
    width: 100%;
    height: 60vh;
    min-height: 350px;
    margin-top: 56px;
}

.leaflet-control-attribution { font-size: 9px !important; opacity: 0.6; }

/* ── Stats bar ────────────────────────────────────────────────── */

.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 16px 24px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 28px;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 26px;
    font-weight: 600;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

/* ── Watermark (export only) ──────────────────────────────────── */

.watermark {
    padding: 8px 16px;
    text-align: center;
    background: var(--white);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted);
}

.watermark-sep {
    margin: 0 8px;
    color: var(--border);
}

/* ── Animation controls ───────────────────────────────────────── */

.anim-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.btn-play {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 16px;
    min-width: 64px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-play:hover { background: var(--accent-hover); }

.anim-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.anim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.anim-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text);
    min-width: 24px;
}

/* ── Meta bar ─────────────────────────────────────────────────── */

.meta-bar {
    display: flex;
    gap: 24px;
    padding: 8px 20px;
    font-size: 12px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.meta-bar strong {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    font-weight: 500;
}

/* ── Timeline ─────────────────────────────────────────────────── */

.timeline-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.timeline-header {
    display: grid;
    grid-template-columns: 40px 64px 1fr 140px;
    gap: 8px;
    padding: 12px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.timeline-list {
    max-height: 50vh;
    overflow-y: auto;
}

.timeline-row {
    display: grid;
    grid-template-columns: 40px 64px 1fr 140px;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    cursor: default;
    transition: background 0.1s;
}

.timeline-row:hover {
    background: var(--row-hover);
}

.timeline-row.active {
    background: var(--accent-glow);
}

.timeline-row.walk-row {
    color: var(--muted);
    font-style: italic;
    font-size: 12px;
}

.tr-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted);
}

.tr-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.tr-station {
    font-weight: 500;
}

.tr-line {
    font-size: 12px;
    color: var(--muted);
}

.line-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* ── Map markers ──────────────────────────────────────────────── */

.station-dot {
    width: 6px;
    height: 6px;
    background: #bbb;
    border-radius: 50%;
    border: 1px solid white;
}

.station-start {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}

.station-end {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 4px var(--accent-glow);
}

.anim-head {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse-head 1s ease-in-out infinite;
}

@keyframes pulse-head {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ── Scrollbar ────────────────────────────────────────────────── */

.timeline-list::-webkit-scrollbar { width: 4px; }
.timeline-list::-webkit-scrollbar-track { background: transparent; }
.timeline-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Results page responsive ──────────────────────────────────── */

@media (max-width: 640px) {
    .stats-bar { flex-wrap: wrap; gap: 8px; }
    .stat { padding: 4px 16px; }
    .stat-value { font-size: 18px; }
    .stat-divider { display: none; }
    .timeline-header, .timeline-row {
        grid-template-columns: 32px 56px 1fr 100px;
    }
}
