/* F1 — Design System
   Luxury dark theme, gold accent, typography-driven.
   Follows DX / Arc design standards. */

:root {
    --bg-primary: #09090b;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #111116;
    --bg-card: #0d0d0d;
    --bg-elevated: #16161d;
    --bg-hover: #1a1a22;

    --text-primary: #ededef;
    --text-secondary: #8b8b94;
    --text-muted: #4a4a54;

    --border: rgba(255,255,255,.08);
    --border-strong: rgba(255,255,255,.12);

    --gold: #D4AF78;
    --gold-dim: #B8956A;
    --gold-bright: #E8D5B0;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

/* ─── Header / Top Bar ─── */

header {
    height: 52px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    filter: drop-shadow(0 0 6px rgba(212,175,120,.15));
}

.wordmark {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #e8d5b0, #c9a96e, #b8956a, #d4af78);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.nav-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

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

/* ─── Buttons ─── */

.btn-secondary {
    background: rgba(255,255,255,.04);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 14px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.02em;
}

.btn-secondary:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 7px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: rgba(255,255,255,.06);
    color: var(--text-secondary);
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.btn-back:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,.04);
}

.btn-search-trigger {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.15s;
}

.btn-search-trigger:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.search-shortcut {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,.06);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.btn-section-refresh {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.btn-section-refresh:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,.06);
}

.btn-section-refresh.loading svg {
    animation: spin 0.7s linear infinite;
}

/* ─── Main ─── */

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 24px 60px;
    position: relative;
}

/* ─── Race Banner ─── */

.race-banner {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold-dim);
    border-radius: 0 10px 10px 0;
}

.race-banner-loading {
    font-size: 12px;
    color: var(--text-muted);
}

.race-banner-content {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.race-banner .race-round {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.03em;
}

.race-banner .race-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.race-banner .race-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

.race-banner .race-meta .race-circuit {
    font-weight: 500;
    color: var(--text-secondary);
}

.race-banner .race-countdown {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold-dim);
    background: rgba(212,175,120,.08);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: auto;
}

/* ─── Command Bar ─── */

.command-bar {
    margin-bottom: 24px;
}

.command-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    transition: border-color 0.15s;
}

.command-input-wrapper:focus-within {
    border-color: rgba(212,175,120,.3);
}

.command-icon { color: var(--text-muted); flex-shrink: 0; }

.command-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.command-input::placeholder { color: var(--text-muted); }

.command-submit {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.command-submit:hover {
    color: var(--gold);
    background: rgba(212,175,120,.08);
}

.ai-response {
    margin-top: 12px;
    padding: 16px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold-dim);
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    animation: fadeIn 0.2s ease-out;
}

.ai-response .ai-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--gold-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    display: block;
}

/* ─── Section Cards (Overview) ─── */

.section-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
}

.section-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-tertiary);
}

.section-card.disabled {
    cursor: default;
    opacity: 0.7;
}

.section-card.disabled:hover {
    border-color: var(--border);
    background: var(--bg-card);
}

.section-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
}

.section-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold-dim);
    letter-spacing: 0.02em;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    flex: 1;
}

.section-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.section-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255,255,255,.04);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.section-arrow {
    color: var(--text-muted);
    transition: transform 0.15s;
}

.section-card:hover .section-arrow {
    color: var(--text-secondary);
    transform: translateX(2px);
}

.section-desc {
    padding: 0 18px 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.section-preview {
    padding: 0 18px 14px;
}

.preview-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 0;
}

.preview-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-item-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.preview-more {
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 6px;
}

/* ─── Section Group Headers ─── */

.section-group-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 28px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.section-group-header:first-child {
    margin-top: 0;
}

.section-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.section-group-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ─── Section Meta Pills (on cards) ─── */

.section-meta {
    display: flex;
    gap: 6px;
    padding: 0 18px 10px;
    flex-wrap: wrap;
}

.meta-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255,255,255,.04);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.01em;
}

/* ─── Detail Info Banner ─── */

.detail-info-banner {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold-dim);
    border-radius: 0 10px 10px 0;
}

.detail-info-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.detail-info-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Detail Panel (二级页面) ─── */

#detail-panel {
    animation: fadeIn 0.2s ease-out;
}

.detail-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.detail-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── News Detail (Driver Chips + Source Tabs + List) ─── */

.driver-chips {
    display: flex;
    gap: 6px;
    padding-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.driver-chips::-webkit-scrollbar { display: none; }

.chip {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255,255,255,.04);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.chip:hover {
    background: rgba(255,255,255,.08);
    color: var(--text-secondary);
}

.chip.active {
    color: var(--gold);
    background: rgba(212,175,120,.1);
    border-color: rgba(212,175,120,.25);
}

.chip .chip-count { margin-left: 4px; opacity: 0.6; }

.source-tabs {
    display: flex;
    gap: 4px;
    padding-bottom: 14px;
    overflow-x: auto;
    scrollbar-width: none;
}

.source-tabs::-webkit-scrollbar { display: none; }

.source-tab {
    flex-shrink: 0;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.source-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,.04); }
.source-tab.active { color: var(--text-primary); background: rgba(255,255,255,.08); }

.news-list {
    display: flex;
    flex-direction: column;
}

.news-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.news-item:last-child { border-bottom: none; }

.news-item .news-title-zh {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;
    margin-bottom: 3px;
    letter-spacing: -0.01em;
}

.news-item .news-title-en {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 8px;
}

.news-item .news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.news-item .news-meta a {
    color: var(--gold-dim);
    text-decoration: none;
    transition: color 0.15s;
}

.news-item .news-meta a:hover { color: var(--gold-bright); }

.news-driver-tags { display: flex; gap: 4px; margin-top: 6px; }

.news-driver-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,.04);
}

.source-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,.04);
}

.btn-load-more {
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-load-more:hover {
    background: rgba(255,255,255,.06);
    color: var(--text-secondary);
}

/* ─── Content Detail (板块 02/03/04) ─── */

.content-race-info {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.content-race-info .race-round {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold-dim);
    letter-spacing: 0.03em;
}

.content-race-info .race-name {
    font-size: 14px;
    font-weight: 600;
}

.content-race-info .race-detail {
    font-size: 12px;
    color: var(--text-muted);
}

.content-empty {
    text-align: center;
    padding: 48px 24px;
}

.content-empty-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.content-empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.btn-empty-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: rgba(212,175,120,.1);
    color: var(--gold);
    border: 1px solid rgba(212,175,120,.25);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.01em;
}

.btn-empty-refresh:hover {
    background: rgba(212,175,120,.18);
    border-color: rgba(212,175,120,.4);
    color: var(--gold-bright);
}

.content-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gold-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 20px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.content-section-label:first-child {
    margin-top: 0;
}

.content-list {
    display: flex;
    flex-direction: column;
}

.content-item {
    border-bottom: 1px solid var(--border);
}

.content-item:last-child {
    border-bottom: none;
}

.content-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    cursor: pointer;
    transition: background 0.1s;
}

.content-item-header:hover {
    color: var(--text-primary);
}

.content-item-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

.content-lang-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.content-lang-tag.cn {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.content-lang-tag.en {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.content-expand-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.15s;
}

.content-item.expanded .content-expand-icon {
    transform: rotate(180deg);
}

.content-item-body {
    display: none;
    padding: 0 0 14px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.content-item.expanded .content-item-body {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

/* ─── Home Standings Card ─── */

.standings-home-card {
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold-dim);
    border-radius: 0 12px 12px 0;
    background: var(--bg-card);
    padding: 4px 24px 20px;
    margin-bottom: 10px;
}

.standings-home-content {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Two-column layout for driver + constructor tables */
.standings-home-content .standings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 640px) {
    .standings-home-content .standings-grid {
        grid-template-columns: 1fr;
    }
}

.standings-home-content h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    margin: 16px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}

.standings-home-content h2:first-child {
    margin-top: 8px;
}

.standings-home-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0 12px;
    font-size: 12px;
}

.standings-home-content th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-strong);
    background: rgba(255,255,255,.02);
}

.standings-home-content td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.standings-home-content tr:hover td {
    background: rgba(255,255,255,.02);
}

.standings-home-content ul {
    padding-left: 18px;
    margin: 6px 0 0;
}

.standings-home-content li {
    margin-bottom: 5px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 12px;
}

.standings-home-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.standings-home-content p {
    margin: 6px 0;
    line-height: 1.6;
    font-size: 12px;
}

.standings-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 0;
}

.standings-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    gap: 24px;
}

.standings-empty-fact {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 400px;
}

/* ─── Race Weekend Schedule ─── */

.race-schedule {
    display: flex;
    gap: 2px;
    margin-top: 14px;
    background: rgba(255,255,255,.03);
    border-radius: 8px;
    overflow: hidden;
}

.schedule-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    gap: 3px;
}

.schedule-item.schedule-race {
    background: rgba(212,175,120,.08);
}

.schedule-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.schedule-race .schedule-name {
    color: var(--gold);
}

.schedule-time {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.schedule-race .schedule-time {
    color: var(--text-primary);
    font-weight: 600;
}

/* ─── Next Race Preview ─── */

.race-card-preview {
    margin-top: 10px;
}

.next-race-preview-item {
    font-size: 11px;
    color: var(--text-muted);
    padding: 3px 0;
    border-left: 2px solid rgba(212,175,120,.2);
    padding-left: 8px;
    margin-top: 4px;
}

/* ─── Homepage News Section ─── */

.home-news-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    min-height: 48px;
}

.home-news-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}

@media (max-width: 640px) {
    .home-news-list {
        grid-template-columns: 1fr;
    }
    .race-schedule {
        flex-wrap: wrap;
    }
    .schedule-item {
        min-width: 60px;
    }
}

.home-news-item {
    display: block;
    padding: 14px 16px;
    background: var(--bg-card);
    text-decoration: none;
    transition: background 0.12s;
}

.home-news-item:hover {
    background: var(--bg-hover);
}

.home-news-title {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-news-meta {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-muted);
}

/* ─── Markdown Content (race_results AI summary) ─── */

.content-item-markdown .content-item-body {
    padding: 4px 0 18px;
}

.content-item-markdown .content-item-body h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gold);
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.content-item-markdown .content-item-body h2:first-child {
    margin-top: 4px;
}

.content-item-markdown .content-item-body h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 0 8px;
}

.content-item-markdown .content-item-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 16px;
    font-size: 12px;
}

.content-item-markdown .content-item-body th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-strong);
    background: rgba(255,255,255,.02);
}

.content-item-markdown .content-item-body td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.content-item-markdown .content-item-body tr:hover td {
    background: rgba(255,255,255,.02);
}

.content-item-markdown .content-item-body ul,
.content-item-markdown .content-item-body ol {
    padding-left: 20px;
    margin: 8px 0;
}

.content-item-markdown .content-item-body li {
    margin-bottom: 6px;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 13px;
}

.content-item-markdown .content-item-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

.content-item-markdown .content-item-body p {
    margin: 8px 0;
    line-height: 1.7;
}

/* ─── Search Overlay ─── */

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
}

.search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
}

.search-dialog {
    position: relative;
    width: 520px;
    max-width: calc(100vw - 48px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    animation: searchIn 0.15s ease-out;
}

@keyframes searchIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

.search-input-wrapper svg { flex-shrink: 0; }

#search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

#search-input::placeholder { color: var(--text-muted); }

.search-esc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,.06);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.search-results { max-height: 400px; overflow-y: auto; }

.search-result-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.1s;
}

.search-result-item:hover { background: rgba(255,255,255,.04); }
.search-result-item:last-child { border-bottom: none; }

.search-result-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.search-result-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.search-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ─── Panel (Dashboard overlay) ─── */

.panel {
    position: absolute;
    top: 0; left: 0; right: 0;
    min-height: calc(100vh - 52px);
    background: var(--bg-primary);
    padding: 0 24px 60px;
    z-index: 50;
    animation: fadeIn 0.2s ease-out;
}

.panel-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ─── Dashboard ─── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.stat-card .stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 6px;
}

.dash-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.log-table { width: 100%; border-collapse: collapse; }

.log-table th, .log-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.log-table th {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-table td {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

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

.status-dot.success { background: var(--success); }
.status-dot.error { background: var(--danger); }
.status-dot.running { background: var(--warning); }

/* ─── Toast ─── */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    z-index: 200;
    animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── States ─── */

.hidden { display: none !important; }

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 1.5px solid var(--text-muted);
    border-top-color: var(--gold-dim);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Home Page: Race Cards ─── */

.home-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.race-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    padding: 16px 20px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.race-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-tertiary);
}

.race-card-next {
    border-left: 3px solid var(--gold-dim);
    border-radius: 0 12px 12px 0;
}

.race-card-next:hover {
    border-left-color: var(--gold);
}

.race-card-past {
    opacity: 0.85;
}

.race-card-past:hover {
    opacity: 1;
}

.race-card-upcoming {
    opacity: 0.6;
}

.race-card-upcoming:hover {
    opacity: 0.85;
}

.race-card-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.race-card-header .race-round {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.03em;
}

.race-card-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
}

.race-card-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.race-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

.race-card-meta .race-circuit {
    font-weight: 500;
    color: var(--text-secondary);
}

.race-card-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ─── Race Detail Navigation ─── */

.race-detail-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.nav-breadcrumb {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

/* ─── Responsive ─── */

@media (max-width: 768px) {
    main { padding: 16px 16px 40px; }
    .search-dialog { width: calc(100vw - 32px); }
}
