:root {
    color-scheme: dark;
    --bg: #070910;
    --bg-elevated: #0d111b;
    --surface: rgba(18, 23, 35, 0.86);
    --surface-solid: #121723;
    --surface-strong: #181e2c;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f5f7fb;
    --text-soft: #b8c0d0;
    --muted: #818b9e;
    --accent: #ff183b;
    --accent-soft: rgba(255, 24, 59, 0.16);
    --accent-glow: rgba(255, 24, 59, 0.28);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html[data-lang="zh"] .en,
html[data-lang="en"] .zh { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 88% 4%, var(--accent-soft), transparent 28rem),
        radial-gradient(circle at 5% 45%, rgba(67, 95, 255, 0.09), transparent 30rem),
        linear-gradient(145deg, #070910 0%, #090c14 52%, #05070c 100%);
    font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 72%);
}

a { color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
    position: fixed;
    left: 18px;
    top: -80px;
    z-index: 1000;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.skip-link:focus { top: 18px; }

.page-wrap {
    position: relative;
    z-index: 1;
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
    padding: 22px 0 54px;
}

.topbar {
    position: sticky;
    top: 14px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 66px;
    margin-bottom: 20px;
    padding: 10px 12px 10px 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(9, 12, 19, 0.78);
    box-shadow: 0 16px 50px rgba(0,0,0,0.2);
    backdrop-filter: blur(22px) saturate(140%);
}

.brand-row,
.topbar-actions,
.breadcrumb {
    display: flex;
    align-items: center;
}

.brand-row { gap: 16px; min-width: 0; }

.brand {
    flex-shrink: 0;
    font-size: 0.91rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.brand b { color: var(--accent); }

.breadcrumb {
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.breadcrumb strong {
    max-width: 240px;
    overflow: hidden;
    color: var(--text-soft);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions { gap: 10px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--text-soft);
    background: rgba(255,255,255,0.035);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    transition: 180ms ease;
}

.back-link:hover {
    border-color: var(--border-strong);
    color: #fff;
    background: rgba(255,255,255,0.075);
    transform: translateX(-2px);
}

.language-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-width: 126px;
    padding: 4px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #0c1019;
}

.language-switcher button {
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    transition: 180ms ease;
}

.language-switcher button[aria-pressed="true"] {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 22px var(--accent-glow);
}

.hero-panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    gap: 30px;
    align-items: center;
    min-height: 420px;
    overflow: hidden;
    padding: clamp(34px, 6vw, 74px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(120deg, rgba(255,255,255,0.04), transparent 46%),
        linear-gradient(145deg, rgba(16,21,33,0.95), rgba(8,11,18,0.92));
    box-shadow: var(--shadow);
    isolation: isolate;
}

.hero-panel::before {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    right: -140px;
    top: -180px;
    z-index: -1;
    border-radius: 50%;
    background: var(--accent);
    filter: blur(120px);
    opacity: 0.22;
}

.hero-panel::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent 68%);
}

.eyebrow,
.status-pill,
.meta-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    font-weight: 800;
}

.eyebrow {
    gap: 8px;
    margin-bottom: 18px;
    color: var(--accent);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 24px;
    height: 2px;
    background: currentColor;
}

.hero-copy h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(2.7rem, 7vw, 5.7rem);
    line-height: 0.97;
    letter-spacing: -0.065em;
}

.hero-copy h1 .en-name {
    display: block;
    margin-top: 12px;
    color: var(--text-soft);
    font-size: clamp(1rem, 2vw, 1.45rem);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.hero-lead {
    max-width: 700px;
    margin: 22px 0 0;
    color: var(--text-soft);
    font-size: clamp(1rem, 1.5vw, 1.12rem);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.track-map-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.track-map-link {
    display: inline-grid;
    grid-template-columns: 40px minmax(0, 1fr) 26px;
    align-items: center;
    gap: 11px;
    min-width: min(100%, 290px);
    min-height: 58px;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
    border-radius: 16px;
    color: var(--text);
    background:
        linear-gradient(120deg, color-mix(in srgb, var(--accent) 13%, transparent), rgba(255,255,255,.025));
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 12px 28px rgba(0,0,0,.16);
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.track-map-link:hover,
.track-map-link:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 72%, white 8%);
    background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 21%, transparent), rgba(255,255,255,.04));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.065), 0 16px 36px rgba(0,0,0,.24), 0 0 26px var(--accent-soft);
    transform: translateY(-2px);
}

.track-map-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.track-map-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid color-mix(in srgb, var(--accent) 44%, transparent);
    border-radius: 13px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 11%, transparent);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.track-map-copy { min-width: 0; line-height: 1.25; }
.track-map-copy strong { display: block; font-size: .82rem; }
.track-map-copy small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.track-map-arrow { color: var(--accent); font-size: 1rem; font-weight: 900; text-align: center; transition: transform 180ms ease; }
.track-map-link:hover .track-map-arrow { transform: translate(2px, -2px); }

.map-service-google .track-map-icon {
    border-color: rgba(66,133,244,.48);
    color: #fff;
    background: linear-gradient(135deg, #4285f4 0 48%, #34a853 48% 70%, #fbbc05 70% 84%, #ea4335 84%);
    box-shadow: 0 8px 20px rgba(66,133,244,.18);
}

.track-map-link.map-service-amap {
    border-color: rgba(22,119,255,.42);
    background: linear-gradient(120deg, rgba(22,119,255,.14), rgba(255,255,255,.025));
}

.track-map-link.map-service-amap:hover,
.track-map-link.map-service-amap:focus-visible {
    border-color: rgba(85,158,255,.82);
    background: linear-gradient(120deg, rgba(22,119,255,.23), rgba(255,255,255,.04));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.065), 0 16px 36px rgba(0,0,0,.24), 0 0 26px rgba(22,119,255,.18);
}

.map-service-amap .track-map-icon {
    border-color: rgba(85,158,255,.55);
    color: #fff;
    background: linear-gradient(145deg, #2589ff, #075fd9);
    box-shadow: 0 8px 20px rgba(22,119,255,.22);
}

.map-service-amap .track-map-arrow { color: #55a0ff; }

.status-pill,
.meta-pill {
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    color: var(--text-soft);
    background: rgba(255,255,255,0.045);
    font-size: 0.75rem;
}

.status-pill {
    border-color: var(--accent-glow);
    color: #fff;
    background: var(--accent-soft);
}

.hero-art {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 260px;
}

.hero-art::before {
    content: "";
    position: absolute;
    width: min(320px, 85%);
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 32% 68% 59% 41% / 43% 38% 62% 57%;
    background:
        radial-gradient(circle at 50% 42%, var(--accent-soft), transparent 68%),
        linear-gradient(145deg, rgba(255,255,255,0.035), rgba(255,255,255,0));
    box-shadow: inset 0 0 70px rgba(255,255,255,0.025), 0 26px 70px rgba(0,0,0,0.22);
    transform: rotate(-5deg);
}

.hero-logo {
    position: relative;
    z-index: 1;
    width: min(250px, 74%);
    max-height: 200px;
    padding: 18px;
    object-fit: contain;
    filter: drop-shadow(0 18px 26px rgba(0,0,0,0.42));
}

.hero-portrait {
    position: relative;
    z-index: 1;
    width: min(270px, 78%);
    aspect-ratio: 1;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 38% 62% 42% 58% / 55% 36% 64% 45%;
    object-fit: cover;
    object-position: top center;
    box-shadow: 0 26px 70px rgba(0,0,0,0.44), 0 0 0 12px rgba(255,255,255,0.025);
}

.hero-track {
    position: relative;
    z-index: 1;
    width: min(390px, 96%);
    max-height: 260px;
    object-fit: contain;
    filter: brightness(0) invert(1) drop-shadow(0 16px 24px var(--accent-glow));
    opacity: 0.92;
}

.track-monogram {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: min(230px, 78%);
    aspect-ratio: 1;
    border: 1px solid var(--border-strong);
    border-radius: 38px;
    color: var(--accent);
    background: rgba(255,255,255,0.035);
    font-size: clamp(2rem, 6vw, 4.4rem);
    font-weight: 950;
    letter-spacing: -0.08em;
    transform: rotate(-4deg);
}

.content-grid {
    display: grid;
    gap: 22px;
    margin-top: 22px;
}

.panel {
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 18px 50px rgba(0,0,0,0.18);
    backdrop-filter: blur(16px);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2.2rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.section-heading p {
    max-width: 520px;
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    min-height: 132px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0.018));
    transition: 180ms ease;
}

.stat-card:hover {
    border-color: var(--accent-glow);
    background: linear-gradient(145deg, var(--accent-soft), rgba(255,255,255,0.02));
    transform: translateY(-3px);
}

.stat-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-value {
    margin-top: 12px;
    color: #fff;
    font-size: clamp(1.05rem, 2vw, 1.45rem);
    font-weight: 850;
    line-height: 1.25;
}

.stat-value.accent { color: var(--accent); }

.flag-inline {
    width: 26px;
    height: 17px;
    margin-right: 8px;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 3px;
    object-fit: cover;
    vertical-align: -2px;
}

.driver-grid,
.story-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.driver-card {
    display: grid;
    grid-template-columns: 74px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: inherit;
    background: rgba(255,255,255,0.025);
    text-decoration: none;
    transition: 180ms ease;
}

.driver-card:hover {
    border-color: var(--accent-glow);
    background: var(--accent-soft);
    transform: translateY(-3px);
}

.driver-card img.avatar {
    width: 74px;
    height: 74px;
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    object-fit: cover;
    object-position: top;
}

.driver-card-name { font-size: 1.05rem; font-weight: 850; }
.driver-card-meta { margin-top: 3px; color: var(--muted); font-size: 0.82rem; }
.driver-card-number { color: var(--accent); font-size: 1.8rem; font-weight: 950; }

.story-card {
    position: relative;
    overflow: hidden;
    min-height: 210px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.026);
}

.story-card.wide { grid-column: 1 / -1; }

.story-card h3 {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.story-card p {
    margin: 0;
    color: var(--text-soft);
}

.story-card + .story-card::after {
    content: "";
    position: absolute;
    width: 80px;
    height: 80px;
    right: -34px;
    bottom: -34px;
    border: 18px solid var(--accent-soft);
    border-radius: 50%;
}

.season-banner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 22px;
    align-items: center;
    padding: 24px;
    border: 1px solid var(--accent-glow);
    border-radius: var(--radius-md);
    background: linear-gradient(115deg, var(--accent-soft), rgba(255,255,255,0.02));
}

.season-rank {
    min-width: 98px;
    color: var(--accent);
    font-size: clamp(2.3rem, 5vw, 4rem);
    font-weight: 950;
    line-height: 1;
    letter-spacing: -0.08em;
}

.season-banner h3 { margin: 0 0 5px; font-size: 1.1rem; }
.season-banner p { margin: 0; color: var(--text-soft); }

.layout-stage {
    display: grid;
    place-items: center;
    min-height: 360px;
    overflow: hidden;
    padding: clamp(24px, 6vw, 60px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background:
        radial-gradient(circle at center, var(--accent-soft), transparent 58%),
        rgba(4, 7, 12, 0.64);
}

.layout-stage img {
    width: min(680px, 92%);
    max-height: 420px;
    object-fit: contain;
    filter: brightness(0) invert(1) drop-shadow(0 18px 30px var(--accent-glow));
}

.hero-track.official-track-map,
.layout-stage img.official-track-map {
    filter: drop-shadow(0 18px 30px var(--accent-glow));
}

.source-note {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding: 0 6px;
    color: var(--muted);
    font-size: 0.76rem;
}

.source-note a { color: var(--text-soft); text-underline-offset: 3px; }

.footer {
    margin-top: 32px;
    padding: 24px 8px 4px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 900px) {
    .hero-panel { grid-template-columns: 1fr; min-height: auto; }
    .hero-art { min-height: 230px; order: -1; }
    .hero-logo { width: min(200px, 58%); }
    .hero-portrait { width: min(230px, 62%); }
    .hero-track { width: min(410px, 85%); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .page-wrap { width: min(100% - 22px, 1240px); padding-top: 11px; }
    .topbar { top: 8px; min-height: 58px; margin-bottom: 11px; padding: 7px 8px 7px 12px; border-radius: 16px; }
    .brand { font-size: 0.82rem; }
    .breadcrumb, .back-link .back-text { display: none; }
    .back-link { min-width: 42px; justify-content: center; padding: 0 12px; }
    .language-switcher { min-width: 112px; }
    .language-switcher button { padding: 0 11px; }
    .hero-panel { gap: 16px; padding: 26px 22px 30px; border-radius: 22px; }
    .hero-art { min-height: 190px; }
    .hero-copy h1 { font-size: clamp(2.25rem, 13vw, 3.6rem); }
    .track-map-link { width: 100%; min-width: 0; }
    .panel { padding: 23px 18px; border-radius: 19px; }
    .section-heading { display: block; }
    .section-heading p { margin-top: 8px; }
    .stats-grid, .driver-grid, .story-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 112px; }
    .story-card.wide { grid-column: auto; }
    .driver-card { grid-template-columns: 62px 1fr auto; gap: 12px; }
    .driver-card img.avatar { width: 62px; height: 62px; border-radius: 18px; }
    .season-banner { grid-template-columns: 1fr; gap: 12px; }
    .layout-stage { min-height: 250px; padding: 24px; }
    .source-note { display: block; }
    .source-note span { display: block; margin-top: 4px; }
}

/* Driver recent form and F1 team journey */
.driver-history-root {
    margin-top: 22px;
}

.driver-archive {
    position: relative;
    overflow: hidden;
    padding: clamp(24px, 3.5vw, 44px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 92% 4%, var(--accent-soft), transparent 31rem),
        linear-gradient(145deg, rgba(18,24,36,.98), rgba(8,12,19,.98));
    box-shadow: var(--shadow);
}

.driver-archive::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 0 56%, rgba(255,255,255,.018) 56% 57%, transparent 57%);
}

.archive-heading {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr);
    gap: 36px;
    align-items: end;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border);
}

.archive-kicker,
.archive-panel-head > div > span {
    display: block;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .14em;
}

.archive-heading h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.6rem, 2.8vw, 2.55rem);
    letter-spacing: -.045em;
    line-height: 1.12;
}

.archive-heading > p {
    margin: 0;
    color: var(--text-soft);
    font-size: .84rem;
    line-height: 1.72;
}

.archive-metrics {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.archive-metrics > div {
    min-height: 90px;
    padding: 17px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(7,11,18,.6);
}

.archive-metrics span {
    display: block;
    min-height: 28px;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 700;
    line-height: 1.35;
}

.archive-metrics strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: -.045em;
}

.archive-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.42fr) minmax(300px, .58fr);
    gap: 16px;
    align-items: start;
}

.archive-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(9,13,21,.75);
}

.archive-panel-head {
    display: flex;
    min-height: 94px;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.018);
}

.archive-panel-head > div > span { margin-bottom: 4px; font-size: .58rem; }

.archive-panel-head h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.12rem;
    letter-spacing: -.02em;
}

.archive-panel-head > p {
    max-width: 370px;
    margin: 0;
    color: var(--muted);
    font-size: .69rem;
    line-height: 1.55;
    text-align: right;
}

.archive-scroll-hint { display: none; }

.recent-results-scroll {
    max-height: 690px;
    overflow: auto;
    scrollbar-color: var(--accent) #111722;
    scrollbar-width: thin;
}

.recent-results-scroll:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -3px;
}

.recent-race-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.recent-race-table thead th {
    position: sticky;
    z-index: 2;
    top: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: #171e2b;
    color: #7f8a9d;
    font-size: .61rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase;
}

.recent-race-table thead th:last-child,
.recent-race-table tbody td:last-child { text-align: right; }

.recent-race-row td {
    height: 54px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255,255,255,.055);
    color: var(--text-soft);
    font-size: .74rem;
    vertical-align: middle;
}

.recent-race-row:last-child td { border-bottom: 0; }
.recent-race-row:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.recent-race-row td:nth-child(2) strong {
    display: block;
    color: var(--text);
    font-size: .75rem;
}

.recent-race-row td:nth-child(2) small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: .58rem;
}

.recent-race-row td:nth-child(3) a {
    color: var(--text);
    font-weight: 760;
    text-decoration: none;
}

.recent-race-row td:nth-child(3) a:hover { color: var(--accent); }

.race-order {
    width: 34px;
    color: #596579 !important;
    font-size: .6rem !important;
    font-weight: 850;
}

.race-points {
    color: var(--text) !important;
    font-weight: 850;
}

.finish-badge {
    display: inline-grid;
    min-width: 42px;
    min-height: 28px;
    place-items: center;
    padding: 3px 7px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 9px;
    background: rgba(255,255,255,.045);
    color: #aeb7c6;
    font-size: .66rem;
    font-weight: 900;
}

.finish-win {
    border-color: rgba(255,204,74,.35);
    background: rgba(255,204,74,.13);
    color: #ffd65e;
    box-shadow: 0 0 18px rgba(255,204,74,.08);
}

.finish-podium { border-color: var(--accent-soft); background: var(--accent-soft); color: var(--accent); }
.finish-points { border-color: rgba(78,156,255,.22); background: rgba(78,156,255,.1); color: #8fc2ff; }
.finish-out { border-color: rgba(255,61,91,.25); background: rgba(255,61,91,.1); color: #ff7188; }

.team-history-panel { min-height: 100%; }

.team-history-list {
    margin: 0;
    padding: 19px 22px 15px;
    list-style: none;
}

.team-stop {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    min-height: 74px;
}

.team-stop-marker {
    position: relative;
    display: flex;
    justify-content: center;
}

.team-stop-marker span {
    position: relative;
    z-index: 2;
    width: 10px;
    height: 10px;
    margin-top: 8px;
    border: 2px solid #737f92;
    border-radius: 50%;
    background: #111722;
}

.team-stop-marker i {
    position: absolute;
    top: 18px;
    bottom: -8px;
    width: 1px;
    background: linear-gradient(#394456, #222a38);
}

.team-stop.is-current .team-stop-marker span {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 6px var(--accent-soft), 0 0 20px var(--accent-glow);
}

.team-stop-copy {
    position: relative;
    padding: 0 54px 20px 0;
}

.team-stop-copy time {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: .61rem;
    font-weight: 850;
    letter-spacing: .05em;
}

.team-stop-copy strong,
.team-stop-copy a {
    color: var(--text);
    font-size: .84rem;
    font-weight: 800;
    text-decoration: none;
}

.team-stop-copy a:hover { color: var(--accent); }

.team-stop-copy small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .63rem;
    line-height: 1.45;
}

.team-stop-copy em {
    position: absolute;
    top: 4px;
    right: 0;
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .5rem;
    font-style: normal;
    font-weight: 900;
    letter-spacing: .05em;
}

.team-history-note {
    margin: 0 22px 20px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
    color: var(--muted);
    font-size: .62rem;
    line-height: 1.55;
}

.archive-sources {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 11px;
    align-items: center;
    padding: 17px 3px 0;
    color: var(--muted);
    font-size: .64rem;
}

.archive-sources > span { font-weight: 800; }
.archive-sources a { color: var(--text-soft); text-underline-offset: 3px; }
.archive-error { padding: 20px; color: #ff7188; }

@media (max-width: 1050px) {
    .archive-layout { grid-template-columns: 1fr; }
    .archive-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .team-history-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
}

@media (max-width: 680px) {
    .driver-archive { padding: 19px 14px; border-radius: 20px; }
    .archive-heading { grid-template-columns: 1fr; gap: 12px; }
    .archive-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .archive-metrics > div { min-height: 82px; padding: 14px; }
    .archive-metrics > div:last-child { grid-column: 1 / -1; }
    .archive-panel { border-radius: 16px; }
    .archive-panel-head { display: block; min-height: 0; padding: 18px; }
    .archive-panel-head > p { max-width: none; margin-top: 8px; text-align: left; }
    .recent-results-scroll { max-height: none; overflow-y: visible; }
    .archive-scroll-hint { display: block; margin-top: 6px; color: var(--accent); font-size: .6rem; font-weight: 800; }
    .team-history-list { display: block; padding-right: 17px; padding-left: 17px; }
    .team-history-note { margin-right: 17px; margin-left: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
