/* f1-tokens:start */
/* 由 f1/_design/sync.mjs 从 f1/_design/f1-tokens.css 生成，不要手改；改数值请改源文件后重新运行 sync.mjs。 */
:root {
  /* 间距：只用这六档（名字 × 4 = px） */
  --f1-space-1: 4px;
  --f1-space-2: 8px;
  --f1-space-3: 12px;
  --f1-space-4: 16px;
  --f1-space-6: 24px;
  --f1-space-8: 32px;

  /* 字号 */
  --f1-fs-xs: 11px;
  --f1-fs-sm: 12px;
  --f1-fs-md: 13px;
  --f1-fs-base: 14px;
  --f1-fs-lg: 16px;
  --f1-fs-xl: 18px;
  --f1-fs-2xl: 20px;
  --f1-fs-3xl: 24px;

  /* 控件高度 */
  --f1-control-h: 40px;
  --f1-control-h-sm: 32px;
  --f1-control-h-lg: 48px;

  /* 表格：行高只有紧凑 32 / 常规 40 两档；单元格左右 12；表头 12px + text-muted；行间用 divider，不用斑马纹 */
  --f1-row-h: 40px;
  --f1-row-h-sm: 32px;
  --f1-cell-pad-x: 12px;

  /* 圆角：控件 8，卡片/面板 16，小标签 6 */
  --f1-radius-xs: 6px;
  --f1-radius-sm: 8px;
  --f1-radius-card: 16px;
  --f1-radius-pill: 999px;

  /* 动效：缓出、不回弹，只动 transform / opacity */
  --f1-motion-ease: cubic-bezier(0.25, 1, 0.5, 1);
  --f1-motion-out-ease: cubic-bezier(0.4, 0, 1, 1);
  --f1-motion-dur: 120ms;
  --f1-motion-out-dur: 72ms;
  --f1-motion-panel-dur: 180ms;

  /* 字体 */
  --f1-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", "Noto Sans CJK SC", sans-serif;
  --f1-font-num: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* —— 浅色 —— */
  color-scheme: light;
  --f1-bg: #f5f5f7;
  --f1-surface: #ffffff;
  --f1-surface-2: #f0f0f3;
  --f1-surface-3: #e6e6eb;
  --f1-border: #dcdce3;
  --f1-border-strong: #85858f;
  --f1-divider: rgb(0 0 0 / 0.1);
  --f1-text: #16161a;
  --f1-text-muted: #55555f;
  --f1-text-faint: #686872;
  --f1-text-disabled: #686872; /* 禁用用专门的颜色，不用整体 opacity */
  --f1-icon-disabled: #85858f;

  --f1-accent: #b34e00;        /* 文字、描边、选中：对白底 5.2:1 */
  --f1-accent-fill: #d96200;   /* 实心按钮底色（不描边，对白 3.69 / bg 3.39 / surface-2 3.24），上面用 --f1-accent-ink */
  --f1-accent-fill-hover: #cc5c00;
  --f1-accent-ink: #1a0d02;    /* 橙底上的字：5.2:1 */
  --f1-accent-soft: #fff0e0;
  --f1-accent-soft-text: #8a3c00;
  --f1-focus: #1d5fd1;
  --f1-link: #1d5fd1;

  --f1-ok: #17602f;
  --f1-ok-soft: #e3f4e8;
  --f1-warn: #6d4700;
  --f1-warn-soft: #fff3d4;
  --f1-danger: #c81e1e;
  --f1-danger-soft: #fde8e8;

  /* 数据色（放在 surface 上的线、点、条：≥ 3:1） */
  --f1-driver-a: #c2570a;
  --f1-driver-b: #2563c9;
  --f1-pos: #17803d;           /* 更快 / 领先 / 增加 */
  --f1-neg: #c81e1e;           /* 更慢 / 落后 / 减少 */
  --f1-neutral: #686872;
  --f1-chart-1: #c2570a;
  --f1-chart-2: #2563c9;
  --f1-chart-3: #17803d;
  --f1-chart-4: #8a3fc0;
  --f1-chart-5: #b8206a;
  --f1-chart-6: #0b7c86;
  --f1-chart-grid: rgb(0 0 0 / 0.1);
  --f1-chart-axis: #686872;

  --f1-shadow: 0 1px 2px rgba(20, 24, 31, 0.06), 0 2px 8px rgba(20, 24, 31, 0.05);
}

@media (pointer: coarse) {
  :root { --f1-control-h: 44px; }
}

/* —— 深色 —— */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --f1-bg: #0e0e11;
    --f1-surface: #18181c;
    --f1-surface-2: #222228;
    --f1-surface-3: #2d2d34;
    --f1-border: #40404a;
    --f1-border-strong: #6c6c78;
    --f1-divider: rgb(255 255 255 / 0.1);
    --f1-text: #f1f1f4;
    --f1-text-muted: #a6a6b1;
    --f1-text-faint: #8e8e9a;
    --f1-text-disabled: #9494a0;
    --f1-icon-disabled: #767682;

    --f1-accent: #ff9d42;
    --f1-accent-fill: #ff8a1f;
    --f1-accent-fill-hover: #ff9d42;
    --f1-accent-ink: #1a0d02;
    --f1-accent-soft: #3a2410;
    --f1-accent-soft-text: #ffc58a;
    --f1-focus: #79a7ff;
    --f1-link: #8fb6ff;

    --f1-ok: #9fe0b3;
    --f1-ok-soft: #14301f;
    --f1-warn: #f5d38a;
    --f1-warn-soft: #36290e;
    --f1-danger: #f87171;
    --f1-danger-soft: #3a1717;

    --f1-driver-a: #ff8a1f;
    --f1-driver-b: #6ea8ff;
    --f1-pos: #4cc070;
    --f1-neg: #f87171;
    --f1-neutral: #8e8e9a;
    --f1-chart-1: #ff8a1f;
    --f1-chart-2: #6ea8ff;
    --f1-chart-3: #4cc070;
    --f1-chart-4: #c79bff;
    --f1-chart-5: #ff7ab8;
    --f1-chart-6: #3fd0dc;
    --f1-chart-grid: rgb(255 255 255 / 0.1);
    --f1-chart-axis: #8e8e9a;

    --f1-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --f1-bg: #0e0e11;
  --f1-surface: #18181c;
  --f1-surface-2: #222228;
  --f1-surface-3: #2d2d34;
  --f1-border: #40404a;
  --f1-border-strong: #6c6c78;
  --f1-divider: rgb(255 255 255 / 0.1);
  --f1-text: #f1f1f4;
  --f1-text-muted: #a6a6b1;
  --f1-text-faint: #8e8e9a;
  --f1-text-disabled: #9494a0;
  --f1-icon-disabled: #767682;

  --f1-accent: #ff9d42;
  --f1-accent-fill: #ff8a1f;
  --f1-accent-fill-hover: #ff9d42;
  --f1-accent-ink: #1a0d02;
  --f1-accent-soft: #3a2410;
  --f1-accent-soft-text: #ffc58a;
  --f1-focus: #79a7ff;
  --f1-link: #8fb6ff;

  --f1-ok: #9fe0b3;
  --f1-ok-soft: #14301f;
  --f1-warn: #f5d38a;
  --f1-warn-soft: #36290e;
  --f1-danger: #f87171;
  --f1-danger-soft: #3a1717;

  --f1-driver-a: #ff8a1f;
  --f1-driver-b: #6ea8ff;
  --f1-pos: #4cc070;
  --f1-neg: #f87171;
  --f1-neutral: #8e8e9a;
  --f1-chart-1: #ff8a1f;
  --f1-chart-2: #6ea8ff;
  --f1-chart-3: #4cc070;
  --f1-chart-4: #c79bff;
  --f1-chart-5: #ff7ab8;
  --f1-chart-6: #3fd0dc;
  --f1-chart-grid: rgb(255 255 255 / 0.1);
  --f1-chart-axis: #8e8e9a;

  --f1-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* 会跳动或要纵向对齐的数字：圈速、差距、计数、百分比、表格数值列 */
.f1-num,
[data-f1-num] {
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --f1-motion-dur: 0ms;
    --f1-motion-out-dur: 0ms;
    --f1-motion-panel-dur: 0ms;
  }
}
/* f1-tokens:end */

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

body {
    background: #e4e4e4;
    font-family: var(--font);
}

/* Typography */
.flex-title,
.flex-container-table,
.tab-button,
.comparison-header,
.loading-text {
    font-family: var(--font);
}

/* Partial notice banner */
.partial-notice {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: rgba(255, 193, 7, 0.95);
    color: #3d2e00;
    padding: var(--f1-space-3) var(--f1-space-4);
    border-radius: var(--f1-radius-xs);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    gap: var(--f1-space-3);
    align-items: center;
    z-index: 9999;
}

/* Flex containers */
.flex-container,
.flex-container-options,
.flex-container-table {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.flex-container {
    justify-content: space-around;
    flex-flow: row wrap;
}

.flex-container-options {
    justify-content: center;
    gap: var(--f1-space-3);
    padding: var(--f1-space-6) 0;
}

.flex-container-table {
    flex-direction: column;
    align-items: flex-start;
}

/* Center the race tables specifically in the Race tab */
#raceTables {
    align-items: center; /* override default flex-start for race section */
}

#race-content .comparison-table {
    margin: 0 auto 1em auto; /* center the table horizontally */
}

#race-content .comparison-table th,
#race-content .comparison-table td {
    text-align: center; /* ensure consistent centered alignment */
}

/* Center the data source explanation in Race tab */
#raceApiExplain {
    text-align: center;
    margin: 0 auto;
    width: 100%;
}

/* Title */
.flex-title {
    font-size: 50px;
    color: #333;
    text-align: center;
}

/* Form Controls */
.selector {
    padding: var(--f1-space-2) var(--f1-space-4);
    border-radius: var(--f1-radius-xs);
    font-size: var(--f1-fs-base);
    cursor: pointer;
    transition: background-color var(--f1-motion-dur) var(--f1-motion-ease), border-color var(--f1-motion-dur) var(--f1-motion-ease), color var(--f1-motion-dur) var(--f1-motion-ease);
}

select.selector {
    padding-right: var(--f1-space-8);
    border: 1px solid #ddd;
    background: white url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E") no-repeat right 10px center / 12px;
    appearance: none;
}

select.selector:hover {
    border-color: #999;
}

button.selector {
    background: #4a4a4a;
    color: white;
    border: none;
}

button.selector:hover {
    background: #666;
}

/* Tables */
table {
    border-collapse: collapse;
    background: #f5f5f5;
    margin: var(--f1-space-1);
    width: fit-content;
}

th, td {
    padding: var(--f1-space-2) var(--f1-space-2);
    text-align: center;
}

th {
    background: #404040;
    color: white;
}

td {
    border-bottom: 1px solid #ddd;
    border-right: 1px solid #ddd;
    color: #333;
}

/* Comparison table styles */
.flex-comparison-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

.driver-pairing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0 auto 40px auto;
    padding-bottom: var(--f1-space-6);
    border-bottom: 2px solid #ddd;
}

.driver-pairing-container:last-child {
    border-bottom: none;
}

.comparison-header-row {
    width: 100%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--f1-space-3);
}

.comparison-header {
    font-size: 2em;
    margin-bottom: 1em;
    text-align: center;
    width: 100%;
}

.explain-toggle-btn {
    display: block;
    margin: var(--f1-space-4) auto 0 auto; /* center horizontally at bottom of section */
    padding: var(--f1-space-3) var(--f1-space-4);
    border: none;
    border-radius: var(--f1-radius-xs);
    background: #3cb371;
    color: #fff;
    cursor: pointer;
    font-size: var(--f1-fs-base);
    line-height: 1.2;
    white-space: normal; /* allow wrapping */
    text-align: center;
    max-width: 320px; /* keep it tidy on wide screens */
}

.explain-toggle-btn:hover {
    background: #2e9b59;
}

.explain-panel {
    width: 100%;
    max-width: 1200px;
    margin: var(--f1-space-2) auto var(--f1-space-4) auto;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: var(--f1-radius-xs);
    padding: var(--f1-space-3) var(--f1-space-4);
    color: #333;
}

.explain-title {
    font-weight: 700;
    margin: var(--f1-space-1) 0 var(--f1-space-2) 0;
}

.explain-subtitle {
    font-weight: 600;
    margin: var(--f1-space-3) 0 var(--f1-space-2) 0;
}

.explain-list {
    margin: 0 0 var(--f1-space-1) var(--f1-space-4);
    padding: 0;
}

.explain-ol {
    margin: var(--f1-space-1) 0 var(--f1-space-2) var(--f1-space-4);
    padding: 0;
}

.comparison-table {
    border-collapse: collapse;
    width: fit-content;
    margin-bottom: 1em;
    background-color: #f5f5f5;
}

.summary-row .summary-label {
    padding: var(--f1-space-3) var(--f1-space-2);
    font-weight: bold;
    text-align: left;
}

.summary-row .summary-value {
    padding: var(--f1-space-3) var(--f1-space-2);
    font-weight: bold;
    text-align: center;
}

.time-difference {
    background-color: #808080;
    color: white;
}

.top-border {
    border-top: 4px solid #ddd;
}

/* Centered value with right-side note for summary rows */
.summary-value-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* left spacer, centered value, right note */
    align-items: center;
    width: 100%;
}
.summary-value .val-left {
    /* empty spacer to balance the right note */
}
.summary-value .val-center {
    justify-self: center;
}
.summary-value .val-note {
    justify-self: end;
    white-space: nowrap;
}

.quali-score {
    font-size: 1.1em;
}

.race-row {
    border-bottom: 1px solid var(--line);
}

/* Banner and Tabs */
.banner {
    display: flex;
    justify-content: center;
    background: #404040;
    padding: var(--f1-space-3) 0;
    margin-bottom: var(--f1-space-6);
}

.tab-button {
    padding: var(--f1-space-3) var(--f1-space-6);
    margin: 0 var(--f1-space-3);
    color: white;
    cursor: pointer;
    border-radius: var(--f1-radius-xs);
    transition: background-color var(--f1-motion-dur) var(--f1-motion-ease), color var(--f1-motion-dur) var(--f1-motion-ease);
}

.tab-button:hover,
.tab-button.active {
    background: #666;
}

/* History Table */
.history-table {
    width: auto; /* allow table to grow based on content */
    max-width: 1600px; /* allow a wider table */
    min-width: 1100px; /* avoid squeezing columns too much */
    margin: var(--f1-space-6) auto;
    border-collapse: collapse;
}

/* Ensure all cells stay on one line; horizontal scroll will appear if needed */
.history-table th,
.history-table td {
    white-space: nowrap;
}

.history-table tr:nth-child(even) {
    background: transparent;
}

/* Layout components */
.table-graph-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.table-container {
    display: block;
    margin-bottom: 2em;
    width: 100%;
    overflow-x: auto;
}

/* Generic wide scroll container for tables like 年份对比 */
.wide-scroll {
    width: 100%;
    overflow-x: auto;
}

.graph-container {
    width: 100%;
    max-width: 800px;
    margin: var(--f1-space-6) auto;
    padding: 0 var(--f1-space-3);
    box-sizing: border-box;
}

/* Chart control styles */
.chart-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--f1-space-6);
    margin: var(--f1-space-6) 0;
}

.control-group {
    display: flex;
    align-items: center;
    gap: var(--f1-space-2);
}

.button-group {
    display: flex;
    gap: var(--f1-space-3);
}

.chart-control-button {
    padding: var(--f1-space-2) var(--f1-space-4);
    background-color: #4a4a4a;
    color: white;
    border: none;
    border-radius: var(--f1-radius-xs);
    cursor: pointer;
    transition: background-color var(--f1-motion-dur) var(--f1-motion-ease);
}

.chart-control-button:hover {
    background-color: #666;
}

.chart-control-button.active-button {
    background-color: #3cb371;
}

.chart-control-select {
    background-color: white;
    color: #333;
    padding: var(--f1-space-1) var(--f1-space-3);
    border: 1px solid #ddd;
    border-radius: var(--f1-radius-xs);
}

.excluded-points {
    padding: var(--f1-space-3);
    background-color: #f5f5f5;
    border-radius: var(--f1-radius-xs);
    margin-top: var(--f1-space-3);
    text-align: center;
}

.trend-only-graph {
    width: 100%;
    height: 400px;
    margin-top: var(--f1-space-6);
}

.main-chart {
    width: 100%;
    height: 400px;
}

/* Modern loading animation */
.loading-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 40px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #4a4a4a;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: var(--f1-space-4);
}

.loading-text {
    font-size: var(--f1-fs-lg);
    color: #4a4a4a;
    margin-bottom: var(--f1-space-2);
}

.loading-subtitle {
    font-size: var(--f1-fs-base);
    color: #666;
    margin-top: var(--f1-space-1);
}

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

/* Media Queries */
@media screen and (max-width: 1024px) {
    .table-graph-wrapper {
        flex-direction: column;
    }
    
    .graph-container {
        max-width: 100%;
        margin-top: var(--f1-space-8);
    }

    .flex-title {
        font-size: 40px;
        text-align: center;
        padding: 0 var(--f1-space-3);
    }
}

@media screen and (max-width: 768px) {
    .table-container {
        margin: 0 var(--f1-space-3);
    }

    .flex-title {
        font-size: 32px;
    }

    .banner {
        flex-wrap: wrap;
    }

    .tab-button {
        margin: var(--f1-space-1);
    }
}

@media screen and (max-width: 480px) {
    .flex-title {
        font-size: 28px;
    }

    .flex-container-options {
        flex-direction: column;
        align-items: center;
    }

    .selector {
        width: 100%;
        max-width: 300px;
    }
}


/* F1 workbench refresh */
:root {
    /* 旧版语义色：改为引用共享 token；中性色、强调色以下面 2026-10-29 改版那组变量为准 */
    --panel: var(--f1-surface-2);
    --panel-strong: var(--f1-surface-3);
    --red: var(--f1-neg);
    --red-2: var(--f1-neg);
    --action-red: var(--f1-accent-fill);
    --green: var(--f1-pos);
    --sky: var(--f1-link);
    --amber: var(--f1-warn);
}

html {
    background: var(--surface);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 18px),
        linear-gradient(180deg, #0a0a0c 0%, #101015 46%, #08080a 100%);
    color: var(--text);
    font-family: var(--font);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent 0 18%, rgba(255, 39, 58, 0.2) 18% 18.35%, transparent 18.35% 100%),
        linear-gradient(180deg, rgba(255,255,255,0.055), transparent 34%);
}

.app-frame {
    position: relative;
    z-index: 1;
    width: min(100%, 1500px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px clamp(14px, 3vw, 34px) 30px;
    box-sizing: border-box;
}

.banner {
    position: sticky;
    top: 12px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--f1-space-2);
    margin: var(--f1-space-4) 0;
    padding: var(--f1-space-2);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: rgba(8, 8, 10, 0.82);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.32);
}

.tab-button {
    min-height: var(--f1-control-h);
    margin: 0;
    padding: 0 var(--f1-space-4);
    border: 1px solid transparent;
    border-radius: var(--f1-radius-xs);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
    transition: background-color var(--f1-motion-dur) var(--f1-motion-ease), color var(--f1-motion-dur) var(--f1-motion-ease), border-color var(--f1-motion-dur) var(--f1-motion-ease);
}

.tab-button:hover {
    color: var(--text);
    border-color: var(--line);
    background: rgba(255,255,255,0.08);
}

.tab-button.active {
    color: #fff;
    border-color: rgba(255,39,58,0.55);
    background: linear-gradient(135deg, var(--action-red), var(--red-2));
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--f1-space-4);
}

.view-panel {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: clamp(16px, 2.4vw, 28px);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.095), rgba(255,255,255,0.045)),
        rgba(16,16,21,0.84);
    box-shadow: var(--shadow);
}

.content-heading {
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-2);
    margin-bottom: var(--f1-space-4);
}

.flex-title {
    margin: 0;
    color: var(--text);
    text-align: left;
    font-size: clamp(30px, 5vw, 58px);
    line-height: 1;
    font-weight: 900;
}

.flex-container-options {
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--f1-space-3);
    margin: 0 0 var(--f1-space-6);
    padding: var(--f1-space-4);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: rgba(0,0,0,0.28);
}

.selector,
.chart-control-select,
.chart-control-button,
.explain-toggle-btn {
    min-height: var(--f1-control-h);
    max-width: 100%;
    border-radius: var(--f1-radius-xs);
    border: 1px solid var(--line);
    font-size: var(--f1-fs-base);
    line-height: 1.2;
    font-weight: 700;
}

button.selector,
label.selector,
.chart-control-button,
.explain-toggle-btn,
.tab-button,
.race-subtab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--f1-space-2);
    text-align: center;
}

.primary-action {
    min-width: 108px;
}

:where(#seasonList, #raceSeasonList, #startYearList, #endYearList, #yearOnlyList) {
    width: 104px;
}

:where(#constructorList, #raceConstructorList, #historyConstructorList) {
    width: 230px;
}

:where(#raceStartRound, #raceEndRound) {
    width: 88px;
}

:where(#lapDistRaceList) {
    width: 290px;
}

.panel-message {
    width: 100%;
    min-height: 80px;
    padding: var(--f1-space-6) var(--f1-space-4);
    line-height: 1.5;
    color: var(--muted);
}

.error-message {
    color: var(--f1-danger);
    background: var(--f1-danger-soft);
    border: 1px solid var(--f1-danger);
    border-radius: var(--f1-radius-sm);
}

select.selector,
.chart-control-select {
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.11), rgba(255,255,255,0.045)),
        #15161a;
    border-color: var(--line-strong);
}

select.selector:hover,
.chart-control-select:hover {
    border-color: rgba(255,255,255,0.42);
}

button.selector,
.chart-control-button,
.explain-toggle-btn {
    color: #fff;
    background: rgba(255,255,255,0.09);
    border-color: var(--line-strong);
}

button.selector:hover,
.chart-control-button:hover,
.explain-toggle-btn:hover {
    background: rgba(255,255,255,0.15);
}

.primary-action,
button.primary-action {
    border-color: rgba(255,39,58,0.7);
    background: linear-gradient(135deg, var(--action-red), var(--red-2));
    box-shadow: 0 12px 30px rgba(255,39,58,0.2);
}

.primary-action:hover,
button.primary-action:hover {
    background: linear-gradient(135deg, #d51c30, #b90e1f);
}

label.selector {
    color: var(--text);
    background: rgba(255,255,255,0.075);
    margin: 0;
}

input[type="checkbox"] {
    accent-color: var(--red);
}

.race-linked-controls {
    display: none;
}

.race-subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--f1-space-2);
    margin: var(--f1-space-4) 0;
    padding: var(--f1-space-2);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: rgba(8, 10, 14, 0.58);
}

.race-subtab {
    min-height: var(--f1-control-h);
    border: 1px solid transparent;
    border-radius: var(--f1-radius-xs);
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.race-subtab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.race-subtab.active {
    color: #fff;
    border-color: rgba(255, 45, 69, 0.78);
    background: linear-gradient(135deg, var(--action-red), #b70f25);
    box-shadow: 0 14px 30px rgba(255, 45, 69, 0.18);
}

.race-subpanel {
    display: none;
}

.race-subpanel.active {
    display: block;
}

.race-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--f1-space-3);
    flex-wrap: wrap;
    margin: 0 0 var(--f1-space-4);
}

/* 圈速图工具栏控件较多，换行后靠右排，不在整行里撒开 */
#race-lap-panel .race-panel-toolbar {
    justify-content: flex-end;
}

.race-panel-toolbar .race-progress-meta,
.race-panel-toolbar .lap-dist-meta {
    flex: 1 1 320px;
    margin: 0;
}

.race-note-shell {
    max-width: 1180px;
    margin: var(--f1-space-3) auto 0;
}

#raceApiExplain {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: var(--f1-space-3) var(--f1-space-4);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: rgba(255,255,255,0.06);
    color: var(--muted);
    text-align: left;
    font-size: var(--f1-fs-base);
}

.flex-container-table {
    width: 100%;
    align-items: stretch;
    min-width: 0;
    overflow-x: auto;
}

.table-graph-wrapper,
.flex-comparison-container,
.driver-pairing-container {
    color: var(--text);
}

.driver-pairing-container {
    margin-bottom: var(--f1-space-8);
    padding: var(--f1-space-4);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-2);
}

.comparison-header-row {
    max-width: 1240px;
}

.comparison-header {
    color: var(--text);
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1.15;
    font-weight: 900;
}

.table-container,
.wide-scroll {
    width: 100%;
    min-width: 0;
    border-radius: var(--f1-radius-sm);
}

table,
.comparison-table,
.history-table {
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    box-shadow: none;
}

th {
    background: rgba(20, 24, 33, 0.96);
    color: #eef3fb;
    border-bottom: 1px solid rgba(255,39,58,0.58);
    font-size: var(--f1-fs-sm);
    font-weight: 900;
}

td {
    border-bottom: 1px solid rgba(255,255,255,0.07);
    border-right: 1px solid rgba(255,255,255,0.055);
    color: #dce5f2;
    background: rgba(18, 23, 32, 0.9);
}

tr:nth-child(even) td {
    background: rgba(22, 28, 39, 0.9);
}

.summary-row .summary-label,
.summary-row .summary-value {
    background: var(--surface-3);
    color: var(--text);
}

.time-difference {
    background: var(--f1-accent-soft) !important;
    color: var(--text) !important;
}

.top-border {
    border-top: 4px solid var(--accent);
}

.graph-container,
.main-chart,
.trend-only-graph,
.explain-panel,
.excluded-points {
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-2);
    color: var(--text);
    box-shadow: none;
}

.graph-container {
    padding: var(--f1-space-3);
}

.main-chart,
.trend-only-graph {
    overflow: hidden;
}

.chart-controls {
    gap: var(--f1-space-3);
    margin: var(--f1-space-4) 0 var(--f1-space-4);
    padding: var(--f1-space-3);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: rgba(0,0,0,0.22);
}

.control-group {
    color: var(--muted);
    font-size: var(--f1-fs-md);
    font-weight: 800;
}

.chart-control-button.active-button {
    background: var(--f1-pos);
    color: var(--f1-accent-ink);
}

.loading-container {
    color: var(--text);
}

.loading-spinner {
    border-color: var(--line-strong);
    border-top-color: var(--accent);
}

.loading-text,
.loading-subtitle {
    color: var(--muted);
}

.partial-notice {
    border: 1px solid var(--f1-warn);
    background: var(--f1-warn-soft);
    color: var(--f1-warn);
    border-radius: var(--f1-radius-sm);
    width: min(680px, calc(100% - 24px));
    flex-wrap: wrap;
}

.comparison-table {
    min-width: 920px;
    /* 表格比卡片窄时居中，和上面的标题、下面的走势图同一条中线 */
    margin-inline: auto;
}

.comparison-table th {
    height: var(--f1-row-h);
    padding: var(--f1-space-3) var(--f1-space-3);
    white-space: nowrap;
}

.comparison-table td {
    height: var(--f1-row-h);
    padding: var(--f1-space-3) var(--f1-space-3);
    font-weight: 650;
    white-space: nowrap;
}

.comparison-table th:nth-child(2),
.comparison-table td:nth-child(2) {
    text-align: left;
}

.comparison-table .race-row td:nth-child(1),
.comparison-table .race-row td:nth-child(2) {
    position: relative;
    background: var(--surface-3);
    color: var(--text);
}

.comparison-table .race-row.driver-one-faster td:nth-child(1),
.comparison-table .race-row.driver-one-faster td:nth-child(2) {
    background: linear-gradient(90deg, color-mix(in srgb, var(--f1-pos) 22%, var(--surface-3)), var(--surface-3));
}

.comparison-table .race-row.driver-two-faster td:nth-child(1),
.comparison-table .race-row.driver-two-faster td:nth-child(2) {
    background: linear-gradient(90deg, color-mix(in srgb, var(--f1-neg) 24%, var(--surface-3)), var(--surface-3));
}

.comparison-table .race-row.driver-one-faster td:first-child::before,
.comparison-table .race-row.driver-two-faster td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 2px 2px 0;
}

.comparison-table .race-row.driver-one-faster td:first-child::before {
    background: var(--green);
}

.comparison-table .race-row.driver-two-faster td:first-child::before {
    background: var(--red);
}

.comparison-table .negative-delta {
    color: var(--f1-neg);
}

.comparison-table .positive-delta {
    color: var(--f1-pos);
}

.comparison-table .session-badge-cell {
    color: transparent;
    font-size: 0;
}

/* 严格同节模式下被剔除时间统计的跨节场次：整行降透明度以示区别 */
.comparison-table .race-row.strict-excluded-row td {
    color: var(--muted);
    background: var(--surface-3);
}

.comparison-table .session-q1::after,
.comparison-table .session-q2::after,
.comparison-table .session-q3::after {
    display: inline-flex;
    min-width: 34px;
    justify-content: center;
    padding: var(--f1-space-1) var(--f1-space-2);
    border-radius: var(--f1-radius-pill);
    font-size: var(--f1-fs-sm);
    line-height: 1;
    font-weight: 900;
    color: var(--f1-accent-ink);
}

.comparison-table .session-q1::after {
    content: "Q1";
    background: var(--surface-hover);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--control-border);
}

.comparison-table .session-q2::after {
    content: "Q2";
    background: var(--amber);
}

.comparison-table .session-q3::after {
    content: "Q3";
    background: var(--green);
}

.summary-value-content {
    align-items: baseline;
    color: inherit;
    display: inline-flex;
    gap: var(--f1-space-3);
    justify-content: center;
    width: 100%;
}

.summary-value .val-note {
    color: var(--muted);
    font-size: 0.94em;
    white-space: nowrap;
}

.quali-score {
    color: var(--text);
}

.lap-dist-meta {
    min-height: 22px;
    margin: -6px 0 var(--f1-space-4);
    color: var(--muted);
    font-size: var(--f1-fs-md);
    font-weight: 700;
}

.lap-dist-meta.ready {
    color: var(--muted);
}

.lap-dist-meta.error {
    color: var(--f1-danger);
}

.lap-dist-meta.loading {
    color: var(--amber);
}

.lap-dist-shell {
    position: relative;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-2);
    box-shadow: none;
    overflow: hidden;
}

.lap-tool-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-2);
    min-height: var(--f1-control-h);
    cursor: pointer;
    user-select: none;
}

.lap-tool-toggle input {
    accent-color: var(--accent);
}

.lap-mode-toggle[data-mode="box"] {
    border-color: var(--f1-pos);
    color: var(--text);
}

/* 自绘下拉菜单（utils.js 的 F1Dropdown）：触发按钮沿用 .selector，弹层用站内令牌，不用系统弹层 */
.f1-dropdown {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.f1-dropdown button.f1-dropdown-trigger {
    justify-content: space-between;
    width: 216px;
    height: var(--f1-control-h);
    padding: 0 var(--f1-space-3);
    text-align: left;
}

.f1-dropdown-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.f1-dropdown-chevron {
    flex: 0 0 12px;
    width: 12px;
    height: 12px;
    fill: none;
    stroke: var(--f1-text-faint);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--f1-motion-dur) var(--f1-motion-ease);
}

.f1-dropdown.is-open .f1-dropdown-trigger {
    border-color: var(--accent);
}

.f1-dropdown.is-open .f1-dropdown-chevron {
    transform: rotate(180deg);
}

.f1-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 40;
    min-width: 100%;
    margin: 0;
    padding: var(--f1-space-1);
    list-style: none;
    border: 1px solid var(--line-strong);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-3);
    box-shadow: var(--f1-shadow);
}

.f1-dropdown-menu[hidden] {
    display: none;
}

.f1-dropdown-menu:focus {
    outline: none;
}

.f1-dropdown-menu:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.f1-dropdown-option {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 0 var(--f1-space-3) 0 30px;
    border-radius: var(--f1-radius-xs);
    color: var(--text);
    font-size: var(--f1-fs-base);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.f1-dropdown-option.is-active {
    background: var(--surface-hover);
}

.f1-dropdown-option[aria-selected="true"] {
    color: var(--accent);
    font-weight: 700;
}

/* 选中项左侧的勾 */
.f1-dropdown-option[aria-selected="true"]::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 50%;
    width: 9px;
    height: 5px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-70%) rotate(-45deg);
}

@media (max-width: 640px) {
    .f1-dropdown,
    .f1-dropdown button.f1-dropdown-trigger {
        width: 100%;
    }

    .f1-dropdown-option {
        min-height: 44px;
    }
}

/* 圈速图：车手筛选条（在图表外壳顶部，位于图例栏之上） */
.lap-dist-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--f1-space-2);
    padding: var(--f1-space-3) var(--f1-space-4);
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.lap-filter-label {
    min-width: 76px;
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.lap-filter-label b {
    color: var(--text);
}

.lap-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--f1-space-2);
}

.lap-filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 58px;
    min-height: 30px;
    padding: 0 var(--f1-space-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--f1-radius-xs);
    background: var(--surface-3);
    color: var(--text);
    font: inherit;
    font-size: var(--f1-fs-sm);
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.lap-filter-chip i {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--driver-color);
}

.lap-filter-chip:hover {
    border-color: var(--text);
}

.lap-filter-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.lap-filter-chip[aria-pressed="false"] {
    background: transparent;
    color: var(--muted);
    border-style: dashed;
}

.lap-filter-chip[aria-pressed="false"] i {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--muted);
}

.lap-filter-quick {
    min-width: 52px;
    color: var(--muted);
}

@media (max-width: 640px) {
    .lap-dist-filter {
        padding: var(--f1-space-3);
    }

    .lap-filter-chip {
        min-height: 36px;
    }
}

.lap-dist-reviewbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--f1-space-4);
    padding: var(--f1-space-3) var(--f1-space-4);
    border-bottom: 1px solid var(--line);
    background: var(--surface-3);
}

.lap-dist-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--f1-space-3);
    color: var(--text);
    font-size: var(--f1-fs-md);
    font-weight: 800;
}

.lap-dist-legend span {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-2);
}

.lap-dist-legend em {
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    font-style: normal;
    font-weight: 700;
}

.lap-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid var(--control-border);
}

.lap-dot-fast {
    background: #ff3d43;
}

.lap-dot-regular {
    background: #ffd047;
}

.lap-dot-slow {
    background: #f2f4f8;
}

.lap-dist-readout {
    min-width: min(420px, 48%);
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lap-dist-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--chart-bg);
}

.lap-dist-empty {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--f1-space-8);
    color: var(--muted);
    font-size: var(--f1-fs-lg);
    font-weight: 800;
    text-align: center;
}

.lap-dist-svg {
    display: block;
    min-width: 100%;
    height: auto;
    font-family: var(--font);
}

.lap-chart-bg {
    fill: var(--chart-bg);
}

.lap-chart-title,
.lap-chart-subtitle {
    fill: var(--text);
    font-weight: 700;
}

.lap-chart-title {
    font-size: var(--f1-fs-3xl);
}

.lap-chart-subtitle {
    fill: var(--muted);
    font-size: var(--f1-fs-xl);
}

.lap-grid-line {
    stroke: var(--f1-chart-grid);
    stroke-width: 1;
}

.lap-axis-base {
    stroke: var(--f1-chart-axis);
    stroke-width: 1;
}

.lap-axis-label,
.lap-y-title,
.lap-x-title,
.lap-driver-code {
    fill: var(--muted);
    font-size: var(--f1-fs-base);
    font-weight: 700;
}

.lap-y-title,
.lap-x-title {
    fill: var(--text);
    font-size: var(--f1-fs-lg);
}

.lap-driver-code {
    font-size: var(--f1-fs-lg);
}

.lap-driver-stats {
    fill: var(--text);
    font-size: var(--f1-fs-md);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.lap-stat-key {
    fill: var(--muted);
    font-weight: 700;
}

.lap-violin {
    fill: color-mix(in srgb, var(--driver-color) 66%, var(--chart-bg) 34%);
    stroke: color-mix(in srgb, var(--driver-color) 76%, var(--f1-text) 16%);
    stroke-width: 1.6;
    opacity: 0.86;
}

.lap-driver-spine {
    stroke: var(--control-border);
    stroke-width: 1.2;
}

.lap-driver-median {
    stroke: var(--text);
    stroke-width: 2;
}

.lap-driver-hit {
    fill: transparent;
    cursor: crosshair;
}

/* 装饰图形不接收指针，悬停统一落到车手热区或散点上 */
.lap-violin,
.lap-driver-spine,
.lap-driver-median,
.lap-driver-code,
.lap-box-whisker,
.lap-box-cap,
.lap-box-rect,
.lap-box-median {
    pointer-events: none;
}

.lap-driver-group {
    transition: opacity var(--f1-motion-dur) var(--f1-motion-ease);
}

/* 悬停时只在 svg 根节点和当前车手上各切一个 class；不用 filter，避免整组重绘 */
.lap-dist-svg.has-hover .lap-driver-group:not(.is-hovered) {
    opacity: 0.28;
}

.lap-driver-group.is-hovered .lap-violin {
    opacity: 1;
}

.lap-point {
    stroke: var(--chart-bg);
    stroke-width: 0.8;
    opacity: 0.92;
    cursor: crosshair;
}

.lap-point-fast {
    fill: #ff3d43;
}

.lap-point-regular {
    fill: #ffd047;
}

.lap-point-slow {
    fill: #f2f4f8;
}

.lap-box-whisker,
.lap-box-cap {
    stroke: color-mix(in srgb, var(--driver-color) 70%, var(--f1-text) 20%);
    stroke-width: 2;
    stroke-linecap: round;
}

.lap-box-rect {
    fill: color-mix(in srgb, var(--driver-color) 54%, var(--chart-bg) 46%);
    stroke: color-mix(in srgb, var(--driver-color) 78%, var(--f1-text) 14%);
    stroke-width: 1.8;
    rx: 4px;
}

.lap-box-median {
    stroke: var(--text);
    stroke-width: 2.4;
    stroke-linecap: round;
}

.lap-dist-tooltip {
    position: absolute;
    z-index: 5;
    max-width: 230px;
    padding: var(--f1-space-2) var(--f1-space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-3);
    box-shadow: var(--f1-shadow);
    color: var(--text);
    font-size: var(--f1-fs-sm);
    font-weight: 800;
    line-height: 1.45;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    /* 位置由脚本写 transform；只对 opacity 做过渡，跟随指针时不拖影 */
    transform: translate3d(12px, 12px, 0);
    transition: opacity var(--f1-motion-dur) var(--f1-motion-ease);
    white-space: pre-line;
    will-change: transform;
}

.lap-dist-tooltip.visible {
    opacity: 1;
}

.race-progress-meta {
    min-height: 22px;
    margin: -6px 0 var(--f1-space-4);
    color: var(--muted);
    font-size: var(--f1-fs-md);
    font-weight: 700;
}

.race-progress-meta.ready {
    color: var(--muted);
}

.race-progress-meta.loading {
    color: var(--amber);
}

.race-progress-meta.error {
    color: var(--f1-danger);
}

.race-progress-shell {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-2);
    box-shadow: none;
    overflow: hidden;
}

.race-progress-empty {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--f1-space-8);
    color: var(--muted);
    font-size: var(--f1-fs-lg);
    font-weight: 800;
    text-align: center;
}

.race-progress-card {
    width: 100%;
    background: var(--chart-bg);
}

.rpe-chart {
    min-height: 400px;
}

.rpe-table-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--f1-space-2) var(--f1-space-4);
    padding: var(--f1-space-4) var(--f1-space-6) var(--f1-space-3);
    border-top: 1px solid var(--line);
}

.rpe-table-head h3 {
    margin: 0;
    color: var(--text);
    font-size: var(--f1-fs-lg);
    font-weight: 800;
}

.rpe-table-head span {
    color: var(--muted);
    font-size: var(--f1-fs-sm);
}

.rpe-table-wrap {
    max-height: 560px;
    overflow: auto;
    padding: 0 var(--f1-space-6) var(--f1-space-6);
}

#race-content .comparison-table.rpe-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    background: transparent;
    font-size: var(--f1-fs-md);
}

#race-content .rpe-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0;
    background: var(--chart-bg);
    border-bottom: 1px solid var(--line-strong);
    text-align: left;
    white-space: nowrap;
}

#race-content .rpe-table th.num {
    text-align: right;
}

.rpe-sort {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-1);
    min-height: var(--f1-control-h-sm);
    padding: 0 var(--f1-space-2);
    border: 0;
    background: none;
    color: var(--muted);
    box-shadow: inset 0 -2px 0 var(--series-color, transparent);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.rpe-sort:hover,
.rpe-sort:focus-visible {
    color: var(--text);
}

.rpe-sort::after {
    content: '';
    width: 10px;
    color: var(--text);
    font-size: var(--f1-fs-xs);
}

.rpe-sort[data-dir="asc"]::after { content: '▲'; }
.rpe-sort[data-dir="desc"]::after { content: '▼'; }

#race-content .rpe-table td {
    padding: var(--f1-space-2) var(--f1-space-2);
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    white-space: nowrap;
}

#race-content .rpe-table td:has(.pace-race-btn) {
    text-align: left;
}

#race-content .rpe-table .pace-race-btn {
    text-align: left;
}

#race-content .rpe-table td.num {
    padding-right: var(--f1-space-6);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#race-content .rpe-table td.is-dim {
    color: var(--muted);
}

#race-content .rpe-table td.is-thin {
    color: var(--amber);
}

#race-content .rpe-table tr.is-active td {
    background: var(--panel);
}

#race-content .rpe-table tr.is-selected td {
    background: var(--panel-strong);
}

.app-footer {
    margin-top: var(--f1-space-4);
    color: var(--muted);
}

#cache-controls {
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-2);
}

/* Final dark-theme hardening for dynamically generated legacy blocks. */
.warning-message,
#pointsExplainWrapper,
#pointsExplainContent,
#singlePairSummary,
#historyTable > .loading-text {
    color: var(--text) !important;
}

.warning-message {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--f1-warn) !important;
    border-radius: var(--f1-radius-sm) !important;
    background: var(--surface-2) !important;
    box-shadow: none;
}

#historyTable > .loading-text {
    border: 1px solid var(--line-strong) !important;
    background: var(--surface-2) !important;
    border-radius: var(--f1-radius-sm) !important;
    box-shadow: none;
}

.warning-message strong,
.warning-message span,
.warning-message li,
.warning-message div {
    color: inherit !important;
}

.warning-message table,
.warning-message tr,
.warning-message th,
.warning-message td,
#detailPointsTable,
#detailPointsTable tr,
#detailPointsTable th,
#detailPointsTable td {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--line) !important;
}

.warning-message th,
#detailPointsTable th {
    background: var(--surface-3) !important;
    color: var(--muted) !important;
}

#historyGraphDetails,
#historyGraphDetails div,
#historyGraphDetails span,
#historyGraphDetails strong,
#historyGraphDetails label {
    color: var(--text) !important;
}

#detailPointsTable tbody tr:nth-child(even) td {
    background: var(--surface-2) !important;
}

#detailPointsTable td:nth-child(7),
#detailPointsTable td:nth-child(8) {
    color: var(--text) !important;
}

#detailPointsTable td:nth-child(7) strong,
#detailPointsTable td:nth-child(8) strong,
#detailPointsTable strong {
    color: inherit !important;
}

#detailPointsTable td:nth-child(10) {
    background: var(--f1-warn-soft) !important;
    color: var(--f1-warn) !important;
}

.threshold-badge {
    color: var(--f1-warn) !important;
}

.help-hint {
    color: var(--muted) !important;
    text-decoration-color: var(--control-border);
}

#pointsExplainWrapper,
#historyGraphDetails {
    width: 100%;
    min-width: 0;
}

#clearCacheStatus {
    display: inline-block;
    min-width: 4em;
    min-height: 1.5em;
    visibility: hidden;
}

select.selector:focus,
button.selector:focus-visible,
.chart-control-button:focus-visible,
.chart-control-select:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

button.selector:disabled,
.chart-control-button:disabled,
button.primary-action:disabled {
    cursor: wait;
    border-color: var(--line-strong);
    background: var(--surface-3);
    color: var(--f1-text-disabled);
}

.highcharts-container,
.highcharts-root {
    border-radius: var(--f1-radius-sm);
}

@media screen and (max-width: 760px) {
    .app-frame {
        padding: var(--f1-space-3);
    }

    .banner {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .flex-container-options {
        flex-direction: column;
        align-items: stretch;
    }

    .lap-dist-reviewbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .lap-dist-readout {
        min-width: 100%;
        text-align: left;
        white-space: normal;
    }

    .selector,
    .chart-control-select,
    .chart-control-button {
        width: 100%;
        max-width: none;
    }

    .race-subtabs {
        grid-template-columns: 1fr;
    }

    .comparison-header-row,
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
}


/* ===== 2026-10-29 改版：细顶栏、带标签的筛选、正赛概览 / 条形对比表 / 单站详情 ===== */
:root {
    /* 项目变量 → 共享 token（本文件最前面的 f1-tokens 块，由 f1/_design/sync.mjs 生成） */
    --surface: var(--f1-bg);              /* 页面底色 */
    --surface-2: var(--f1-surface);       /* 卡片、面板、表格 */
    --surface-3: var(--f1-surface-2);     /* 控件底色、卡片里的小块、表头 */
    --surface-4: var(--f1-surface);
    --surface-hover: var(--f1-surface-3); /* 只做悬停、按下；上面只放 text / text-muted */
    --line: var(--f1-divider);
    --line-strong: var(--f1-border);
    --control-border: var(--f1-border-strong);
    --text: var(--f1-text);
    --muted: var(--f1-text-muted);
    --muted-2: var(--f1-text-faint);
    --accent: var(--f1-accent);           /* 文字、描边、选中 */
    --accent-fill: var(--f1-accent-fill); /* 实心按钮底色 */
    --accent-hover: var(--f1-accent-fill-hover);
    --accent-ink: var(--f1-accent-ink);
    --focus: var(--f1-focus);
    --chart-bg: var(--f1-surface);
    --driver-a: #ff8a1f;
    --driver-b: #6ea8ff;
    --chip-off: var(--f1-border);
    --danger-text: var(--f1-danger);
    --font: var(--f1-font);
    --font-num: var(--f1-font-num);
    --font-display: 'Barlow Condensed', 'DIN Condensed', 'Arial Narrow', 'Noto Sans SC', sans-serif;
    --shadow: none;
}

html,
body {
    background: var(--surface);
}

body::before {
    display: none;
}

.app-frame {
    width: min(100%, 1360px);
    padding: 0 var(--f1-space-6) var(--f1-space-8);
}

.app-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--f1-space-2) var(--f1-space-8);
    min-height: 64px;
    margin-bottom: var(--f1-space-8);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-3);
    min-height: var(--f1-control-h);
    color: var(--accent);
    text-decoration: none;
}

.brand span {
    color: var(--text);
    font-family: var(--font-display);
    font-size: var(--f1-fs-3xl);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.brand:focus-visible,
.tab-button:focus-visible,
.race-subtab:focus-visible,
.pace-race-btn:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.banner {
    position: static;
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    gap: var(--f1-space-1);
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    backdrop-filter: none;
    box-shadow: none;
}

.tab-button {
    min-height: var(--f1-control-h);
    padding: 0 var(--f1-space-4);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--muted);
    font-size: var(--f1-fs-base);
    font-weight: 500;
}

.tab-button:hover {
    color: var(--text);
    background: none;
    border-color: transparent;
    border-bottom-color: var(--line-strong);
}

.tab-button.active {
    color: var(--text);
    font-weight: 700;
    background: none;
    border-color: transparent;
    border-bottom-color: var(--accent);
}

.topbar-source {
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
}

.view-panel {
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.content-heading-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--f1-space-4);
    margin-bottom: var(--f1-space-6);
}

.content-heading {
    gap: var(--f1-space-3);
    margin-bottom: var(--f1-space-6);
}

.content-heading-row .content-heading {
    margin-bottom: 0;
}

.section-label {
    color: var(--muted-2);
    font-size: var(--f1-fs-md);
    font-weight: 500;
}

.flex-title {
    font-family: var(--font-display);
    line-height: 1.1;
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.race-subtabs {
    display: flex;
    gap: var(--f1-space-1);
    margin: 0;
    padding: var(--f1-space-1);
    border: 1px solid var(--line);
    border-radius: calc(var(--f1-radius-sm) + var(--f1-space-1)); /* 同心：里层页签 8 + 内边距 4 */
    background: var(--surface-2);
}

.race-subtab {
    min-height: var(--f1-control-h);
    padding: 0 var(--f1-space-4);
    border: 0;
    border-radius: var(--f1-radius-sm);
    color: var(--muted);
    font-weight: 500;
}

.race-subtab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.race-subtab.active {
    color: var(--f1-accent-soft-text);
    font-weight: 700;
    border-color: transparent;
    background: var(--f1-accent-soft);
    box-shadow: none;
}

.flex-container-options {
    align-items: flex-end;
    gap: var(--f1-space-3);
    margin: 0 0 var(--f1-space-6);
    padding: var(--f1-space-4);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-card);
    background: var(--surface-2);
}

.field {
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-2);
    min-width: 0;
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
    font-weight: 500;
}

.field-label {
    line-height: 1.2;
}

.selector,
.chart-control-select,
.chart-control-button,
.explain-toggle-btn {
    border-radius: var(--f1-radius-sm);
    font-weight: 500;
}

select.selector,
.chart-control-select {
    height: var(--f1-control-h);
    padding: 0 var(--f1-space-8) 0 var(--f1-space-3);
    border: 1px solid var(--control-border);
    color: var(--text);
    background: var(--surface-3) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%238e8e9a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center / 12px;
    appearance: none;
}

select.selector:hover,
.chart-control-select:hover {
    border-color: var(--f1-text-faint);
}

button.selector,
.chart-control-button,
.explain-toggle-btn,
label.selector {
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--control-border);
}

.pace-detail h3:focus {
    outline: none;
}

.pace-detail h3:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 4px;
}

button.selector:hover,
.chart-control-button:hover,
.explain-toggle-btn:hover {
    background: var(--surface-hover);
}

label.check-field {
    height: var(--f1-control-h);
    padding: 0 var(--f1-space-3);
    gap: var(--f1-space-2);
    font-size: var(--f1-fs-base);
    cursor: pointer;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

.primary-action,
button.primary-action {
    min-width: 96px;
    height: var(--f1-control-h);
    color: var(--accent-ink);
    font-weight: 700;
    border-color: var(--accent-fill);
    background: var(--accent-fill);
    box-shadow: none;
}

.primary-action:hover,
button.primary-action:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.comparison-table,
.history-table {
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-card);
    background: var(--surface-2);
    box-shadow: none;
}

th {
    color: var(--muted);
    background: var(--surface-3);
    border-bottom: 1px solid var(--line-strong);
    font-weight: 600;
}

td {
    color: var(--text);
    background: var(--surface-2);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}

/* 行间只用分隔线，不用斑马纹 */
tr:nth-child(even) td {
    background: var(--surface-2);
}

.race-note-shell {
    max-width: none;
    margin: 0;
}

#raceApiExplain {
    padding: var(--f1-space-4) 0 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: none;
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
    line-height: 1.7;
}

.app-footer {
    margin-top: var(--f1-space-8);
    border-top: 1px solid var(--line);
}

/* --- 正赛：每对队友一组 --- */
#raceTables {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 40px;
    overflow: visible;
}

.pace-group {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-6);
}

.pace-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
    gap: var(--f1-space-4);
}

.pace-card {
    min-width: 0;
    min-height: 168px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-3);
    padding: var(--f1-space-6);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-card);
    background: var(--surface-2);
}

.pace-card.is-b {
    align-items: flex-end;
    text-align: right;
}

.pace-card-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-2);
    color: var(--muted);
    font-size: var(--f1-fs-md);
}

.pace-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
}

.pace-dot.is-a,
.pace-legend .is-a,
.pace-strip .is-a,
.pace-bar-fill.is-a {
    background: var(--driver-a);
}

.pace-dot.is-b,
.pace-legend .is-b,
.pace-strip .is-b,
.pace-bar-fill.is-b {
    background: var(--driver-b);
}

/* B 车的圆点是空心的：同队两人不只靠颜色区分 */
.pace-dot.is-b {
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--driver-b);
}

.pace-driver {
    color: var(--text);
    font-family: var(--font-display);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.pace-card-stat {
    min-height: 20px;
    color: var(--muted);
    font-size: var(--f1-fs-base);
}

.pace-card-stat strong {
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
}

.pace-card.is-a .pace-card-stat strong { color: var(--driver-a-text, var(--driver-a)); }
.pace-card.is-b .pace-card-stat strong { color: var(--driver-b-text, var(--driver-b)); }

.pace-kpi {
    align-items: center;
    text-align: center;
    gap: var(--f1-space-2);
    border-color: var(--line-strong);
    background: var(--surface-4);
}

.pace-kpi-label,
.pace-kpi-sub {
    color: var(--muted);
    font-size: var(--f1-fs-md);
}

.pace-kpi-sub {
    min-height: 20px;
    font-size: var(--f1-fs-base);
}

.pace-kpi-sub b {
    color: var(--text);
    font-family: var(--font-num);
    font-weight: 500;
}

.pace-kpi-value {
    min-width: 8ch;
    color: var(--text);
    font-family: var(--font-num);
    font-size: clamp(36px, 4vw, 48px);
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.pace-kpi-value.is-a { color: var(--driver-a-text, var(--driver-a)); }
.pace-kpi-value.is-b { color: var(--driver-b-text, var(--driver-b)); }

.pace-kpi-value small {
    color: var(--muted);
    font-size: var(--f1-fs-2xl);
    font-weight: 500;
}

.pace-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--f1-space-1);
    width: 100%;
    min-height: 18px;
    margin-top: var(--f1-space-1);
}

.pace-strip span {
    height: 18px;
    border-radius: 3px;
    background: var(--chip-off);
}

.pace-strip-caption {
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
    line-height: 1.5;
}

.pace-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--f1-space-6);
}

.pace-ledger {
    flex: 999 1 640px;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-4);
    padding: var(--f1-space-6);
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-card);
    background: var(--surface-2);
}

.pace-ledger-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--f1-space-3);
}

.pace-ledger-head h3,
.pace-detail h3 {
    margin: 0;
    color: var(--text);
    font-size: var(--f1-fs-xl);
    font-weight: 700;
}

.pace-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--f1-space-4);
    color: var(--muted);
    font-size: var(--f1-fs-sm);
}

.pace-legend span {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-2);
}

.pace-legend i {
    display: inline-block;
    width: 14px;
    height: 8px;
    border-radius: 2px;
}

.pace-legend i.is-se {
    height: 2px;
    background: var(--text);
}

.pace-ledger .table-container {
    margin: 0;
    overflow-x: auto;
}

#race-content .comparison-table.pace-table {
    width: 100%;
    min-width: 760px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}

#race-content .pace-table th {
    height: auto;
    padding: var(--f1-space-2) var(--f1-space-3);
    color: var(--muted-2);
    background: none;
    border-bottom: 1px solid var(--line);
    font-size: var(--f1-fs-sm);
    font-weight: 500;
    text-align: left;
}

#race-content .pace-table td {
    height: var(--f1-row-h);
    padding: var(--f1-space-1) var(--f1-space-3);
    color: var(--text);
    background: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    font-weight: 400;
    text-align: left;
    white-space: nowrap;
}

#race-content .pace-table tr.is-selected td {
    background: var(--surface-3);
}

#race-content .pace-table .num {
    text-align: right;
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
}

#race-content .pace-table td.num.is-dim,
#race-content .pace-table td.pace-round {
    color: var(--muted);
}

#race-content .pace-table td.pace-round {
    width: 40px;
    font-family: var(--font-num);
}

#race-content .pace-table th.pace-bar-col {
    width: 300px;
}

.pace-race-btn {
    min-height: var(--f1-control-h-sm);
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: var(--f1-fs-base);
    text-align: left;
    white-space: normal;
    cursor: pointer;
}

.pace-race-btn:hover {
    color: var(--accent);
    text-decoration: underline;
}

.pace-bar {
    position: relative;
    min-width: 220px;
    height: 22px;
    border-radius: var(--f1-radius-xs);
    background: var(--surface);
}

.pace-bar::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--control-border);
}

.pace-bar-fill {
    position: absolute;
    top: 5px;
    height: 12px;
    border-radius: 2px;
}

.pace-bar-fill.is-thin {
    /* 不计入汇总：保留原色（对比度 ≥ 3:1），用斜纹区分，而不是整体变暗 */
    background-image: repeating-linear-gradient(135deg, rgba(11, 13, 17, 0.7) 0 2px, transparent 2px 5px);
    box-shadow: inset 0 0 0 1px rgba(238, 242, 248, 0.55);
}

.pace-bar.has-note::before {
    display: none;
}

.pace-strip .is-tie {
    background: var(--muted);
}

.pace-bar-se {
    position: absolute;
    top: 10px;
    height: 2px;
    background: var(--text);
}

.pace-bar-note {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--f1-space-2);
    overflow: hidden;
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pace-bar-note.is-error {
    color: var(--danger-text);
}

.pace-ledger-hint {
    margin: 0;
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
    line-height: 1.5;
}

/* 单站详情：点击大奖赛后在该行下方展开，占满表格可见宽度 */
#race-content .pace-table tr.pace-detail-row > td {
    height: auto;
    padding: 0 0 var(--f1-space-4);
    background: var(--surface-3);
    white-space: normal;
}

.pace-detail {
    position: sticky;
    left: 0;
    width: var(--pace-detail-w, 100%);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-4);
    padding: var(--f1-space-4) var(--f1-space-4) 0;
}

#race-content .pace-table tr.pace-empty-row > td {
    height: auto;
    white-space: normal;
}

.pace-race-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--f1-space-1) var(--f1-space-2);
    white-space: normal;
}

.pace-flag {
    flex: none;
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 var(--f1-space-2);
    border: 1px solid var(--f1-warn);
    border-radius: var(--f1-radius-pill);
    background: var(--f1-warn-soft);
    color: var(--f1-warn);
    font-size: var(--f1-fs-xs);
    line-height: 1;
    vertical-align: middle;
    cursor: help;
}

.pace-detail-kicker {
    display: block;
    min-height: 18px;
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
    line-height: 18px;
}

.pace-detail h3 {
    font-size: var(--f1-fs-3xl);
}

.pace-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--f1-space-3);
}

.pace-metric {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-1);
    padding: var(--f1-space-3);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-3);
}

.pace-metric span {
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
}

.pace-metric strong {
    color: var(--text);
    font-family: var(--font-num);
    font-size: var(--f1-fs-lg);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.pace-metric.is-a strong { color: var(--driver-a-text, var(--driver-a)); }
.pace-metric.is-b strong { color: var(--driver-b-text, var(--driver-b)); }

.pace-detail-chart {
    min-height: 440px;
    border-radius: var(--f1-radius-sm);
    background: var(--chart-bg);
    overflow: hidden;
}

.pace-detail-empty {
    min-height: 160px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--f1-space-4);
    border: 1px dashed var(--line-strong);
    border-radius: var(--f1-radius-sm);
    color: var(--muted-2);
    font-size: var(--f1-fs-md);
    text-align: center;
}

.pace-detail-note {
    min-height: 3.2em;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    line-height: 1.6;
    white-space: pre-line;
}

@media screen and (max-width: 900px) {
    .pace-overview {
        grid-template-columns: minmax(0, 1fr);
    }

    .pace-card.is-b {
        align-items: flex-start;
        text-align: left;
    }
}

@media screen and (max-width: 760px) {
    .app-frame {
        padding: 0 var(--f1-space-3) var(--f1-space-6);
    }

    .app-topbar {
        gap: var(--f1-space-1) var(--f1-space-4);
        margin-bottom: var(--f1-space-6);
    }

    .banner {
        order: 3;
        flex-basis: 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .tab-button {
        padding: 0 var(--f1-space-1);
    }

    .topbar-source {
        margin-left: auto;
    }

    .field,
    label.check-field {
        width: 100%;
    }

    .race-subtabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .pace-card,
    .pace-ledger {
        padding: var(--f1-space-4);
    }

    .pace-detail {
        padding: var(--f1-space-3) var(--f1-space-3) 0;
    }

    .pace-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pace-detail-chart {
        min-height: 320px;
    }
}

#race-content .pace-table td.num.is-warn {
    color: var(--amber);
}

.check-field.is-locked {
    color: var(--f1-text-disabled);
    cursor: not-allowed;
}

/* 页脚缓存按钮：原来写在 index.html 的行内样式，左右内边距为 0，手机上按钮贴着框 */
#cache-controls {
    justify-content: center;
    gap: var(--f1-space-2);
    padding: var(--f1-space-4);
}

/* 图表占位、出错提示（原来是 JS 里的行内样式） */
.chart-message {
    min-height: 80px; /* 与 .panel-message 同高；图表容器自己另有 min-height，占位换成图表时不跳 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--f1-space-6) var(--f1-space-4);
    text-align: center;
    overflow-wrap: anywhere;
}

.chart-message.is-error {
    color: var(--f1-danger);
}

/* 第 39 条：会变的数字用等宽数字（单站详情是 aria-live 区域，走势 / 圈速图说明行、悬停提示里的计数随筛选变化） */
.pace-detail,
.lap-dist-tooltip,
.race-progress-meta,
.lap-dist-meta {
    font-variant-numeric: tabular-nums;
}

/* 第 34 条：历史页的提示框是 history.js 生成的，行内写了 padding；这里统一成卡片内边距 */
.warning-message {
    padding: var(--f1-space-4) !important;
}

/* 历史页提示框：手机上内边距用 12（规则 34 手机下限），否则提示框里的分站明细表放不下，会压进内边距 */
@media screen and (max-width: 600px) {
    .warning-message {
        padding: var(--f1-space-3) !important;
    }
}

/* 历史页“加载完成 / 部分失败”状态条：提示条，内边距 12 / 16 */
#historyTable > .loading-text {
    padding: var(--f1-space-3) var(--f1-space-4) !important;
}

/* 禁用的按钮不响应悬停：悬停规则写在后面、优先级相同，会把禁用的灰字盖到橙色底上（1.45:1） */
button.selector:disabled:hover,
.chart-control-button:disabled:hover,
button.primary-action:disabled,
button.primary-action:disabled:hover {
    cursor: wait;
    border-color: var(--line-strong);
    background: var(--surface-3);
    color: var(--f1-text-disabled);
}

/* 标题与上方小标签左对齐：旧版窄屏规则给 .flex-title 加过左右内边距，平板、手机上标题比小标签多缩进 */
.content-heading .flex-title {
    padding: 0;
}

/* ===== 正赛筛选栏：① 范围（赛季 › 车队 › 分站）② 圈速口径；[data-views] 只在相关子视图显示（2026-11-22） ===== */
.race-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
}
.race-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--f1-space-3);
    padding: var(--f1-space-4);
    min-width: 0;
}
.race-filter-method {
    border-top: 1px solid var(--line);
    background: var(--surface);
    border-radius: 0 0 var(--f1-radius-card) var(--f1-radius-card);
}
.race-filter-step {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-2);
    width: 6.5em;
    min-height: var(--f1-control-h);
    color: var(--text);
    font-size: var(--f1-fs-sm);
    font-weight: 600;
    white-space: nowrap;
}
.race-filter-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--f1-accent-soft);
    color: var(--f1-accent-soft-text);
    font-size: var(--f1-fs-xs);
    font-variant-numeric: tabular-nums;
}
.race-filter-arrow {
    display: inline-flex;
    align-items: center;
    min-height: var(--f1-control-h);
    color: var(--muted);
    font-size: var(--f1-fs-lg);
    line-height: 1;
}
.race-range {
    display: inline-flex;
    align-items: flex-end;
    gap: var(--f1-space-2);
    min-width: 0;
}
.race-range-dash {
    display: inline-flex;
    align-items: center;
    min-height: var(--f1-control-h);
    color: var(--muted);
}
.race-range .selector { width: 11.5em; }
.race-field-team .selector { width: 13em; }
.race-field-race .selector { width: 20em; max-width: 100%; }
.race-filters #raceGo { margin-left: auto; }

#race-content[data-race-view="table"] .race-filters [data-views]:not([data-views~="table"]),
#race-content[data-race-view="progress"] .race-filters [data-views]:not([data-views~="progress"]),
#race-content[data-race-view="laps"] .race-filters [data-views]:not([data-views~="laps"]) {
    display: none;
}
/* 脚本未运行时默认按「逐站对比」显示 */
#race-content:not([data-race-view]) .race-filters [data-views]:not([data-views~="table"]) { display: none; }

@media screen and (max-width: 760px) {
    .race-filter-row { padding: var(--f1-space-3); gap: var(--f1-space-2) var(--f1-space-3); }
    .race-filter-step { width: 100%; min-height: 0; }
    .race-filter-arrow { display: none; }
    .race-filters .field,
    .race-range,
    .race-field-race { flex: 1 1 100%; }
    .race-range .field { flex: 1 1 0; }
    .race-range .selector,
    .race-field-team .selector,
    .race-field-race .selector,
    .race-filters .field .selector { width: 100%; max-width: none; }
    .race-filters #raceGo { margin-left: 0; flex: 1 1 100%; }
    .race-filter-method .check-field { flex: 1 1 100%; }
}

/* 正赛筛选栏的自绘下拉（race.js enhanceRaceFilterSelects 镜像原生 select）：宽度按字段固定，长列表可滚动 */
#raceFilters select.race-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
    clip-path: inset(50%);
    pointer-events: none;
}
.race-filters .field { position: relative; }
#raceFilters .f1-dropdown button.f1-dropdown-trigger {
    width: var(--race-dd-w, 10em);
    max-width: 100%;
    gap: var(--f1-space-2);
}
#raceFilters .f1-dropdown button.f1-dropdown-trigger:disabled { color: var(--f1-text-disabled); cursor: not-allowed; }
#raceFilters [data-for="raceSeasonList"] { --race-dd-w: 7.5em; }
#raceFilters [data-for="raceConstructorList"] { --race-dd-w: 14em; }
#raceFilters [data-for="raceStartRound"],
#raceFilters [data-for="raceEndRound"] { --race-dd-w: 12em; }
#raceFilters [data-for="lapDistRaceList"] { --race-dd-w: 21em; }
#raceFilters [data-for="raceThreshold"] { --race-dd-w: 8.5em; }
#raceFilters [data-for="raceCleanAir"] { --race-dd-w: 9.5em; }
#raceFilters [data-for="raceProgressBaseline"] { --race-dd-w: 10.5em; }
#raceFilters .f1-dropdown-menu {
    max-height: min(360px, 60vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}
#raceFilters .f1-dropdown-option[aria-disabled="true"] { color: var(--f1-text-disabled); cursor: not-allowed; }

@media screen and (max-width: 760px) {
    #raceFilters .f1-dropdown,
    #raceFilters .f1-dropdown button.f1-dropdown-trigger { width: 100%; }
}

/* ===== 2026-11-23 圈速图：按 Stint 拆分 + 两人 Stint 对比 / 轮胎衰减 ===== */
:root {
    --tyre-soft: #e8002d;
    --tyre-medium: #ffc906;
    --tyre-hard: #f2f2f2;
    --tyre-inter: #39b54a;
    --tyre-wet: #0072c6;
    --tyre-unknown: #8c8c96;
    --tyre-edge: var(--f1-border-strong); /* 白色硬胎在浅底上靠描边分辨（≥3:1） */
}
.tyre-soft { --tyre: var(--tyre-soft); --tyre-ink: #ffffff; }
.tyre-medium { --tyre: var(--tyre-medium); --tyre-ink: #16161a; }
.tyre-hard { --tyre: var(--tyre-hard); --tyre-ink: #16161a; }
.tyre-intermediate { --tyre: var(--tyre-inter); --tyre-ink: #16161a; }
.tyre-wet { --tyre: var(--tyre-wet); --tyre-ink: #ffffff; }
.tyre-unknown { --tyre: var(--tyre-unknown); --tyre-ink: #16161a; }

/* 分布图里的 stint 标签 */
.lap-stint-label text {
    fill: var(--text);
    font-size: var(--f1-fs-md);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.lap-stint-dot,
.stint-tag-dot {
    fill: var(--tyre);
    stroke: var(--tyre-edge);
    stroke-width: 1;
}
.lap-stint-label { pointer-events: none; }
.lap-driver-sep {
    stroke: var(--line-strong);
    stroke-width: 1;
    stroke-dasharray: 3 4;
    pointer-events: none;
}

/* 两人对比面板 */
.stint-cmp {
    margin-top: var(--f1-space-4, 16px);
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--f1-radius-sm);
    background: var(--surface-2);
    color: var(--text);
}
.stint-cmp[hidden] { display: none; }
.stint-cmp-hint {
    min-height: 24px;
    color: var(--muted);
    font-size: var(--f1-fs-md);
    line-height: 24px;
}
.stint-cmp-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 14px;
}
.stint-cmp-title {
    margin: 0;
    font-size: var(--f1-fs-xl);
    font-weight: 800;
    line-height: 1.3;
}
.stint-cmp-title span,
.stint-tag-code,
.stint-tl-code {
    color: var(--driver-color);
    fill: var(--driver-color);
}
.stint-cmp-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.stint-cmp-controls .selector { min-width: 172px; }
.stint-cmp-block {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--line);
}
.stint-block-title {
    margin-bottom: 10px;
    font-size: var(--f1-fs-base);
    font-weight: 800;
}
.stint-block-title small {
    margin-left: 8px;
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    font-weight: 500;
}
.stint-cmp-empty {
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--f1-radius-xs);
    color: var(--muted);
    font-size: var(--f1-fs-md);
    line-height: 1.5;
}
.stint-cmp-empty.is-error { color: var(--danger-text); }

.stint-tl-svg,
.stint-deg-svg {
    display: block;
    width: 100%;
    height: auto;
    font-family: var(--font);
}
.stint-tl-block {
    fill: var(--tyre);
    stroke: var(--tyre-edge);
    stroke-width: 1;
}
.stint-tl-seg:not(.is-paired) .stint-tl-block { opacity: 0.55; }
.stint-tl-label {
    fill: var(--tyre-ink);
    font-size: 13px;
    font-weight: 800;
    pointer-events: none;
}
.stint-tl-code {
    font-size: 15px;
    font-weight: 800;
}
.stint-tl-tick,
.stint-axis {
    fill: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.stint-tl-neutral {
    fill: var(--muted);
    opacity: 0.16;
}
.stint-tl-overlap {
    fill: var(--text);
    opacity: 0.28;
}
.stint-tl-overlap.is-active {
    fill: var(--accent);
    opacity: 0.9;
}

.stint-views {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.lap-filter-chip i.stint-dot,
.stint-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tyre);
    box-shadow: 0 0 0 1px var(--tyre-edge);
}
.stint-deg-bg { fill: var(--chart-bg); }
.stint-grid { stroke: var(--line); stroke-width: 1; }
.stint-axis-base { stroke: var(--line-strong); stroke-width: 1; }
.stint-axis-title {
    fill: var(--text);
    font-size: 14px;
    font-weight: 700;
}
.stint-pt {
    fill: var(--driver-color);
    fill-opacity: 0.7;
    stroke: var(--chart-bg);
    stroke-width: 1;
}
.stint-fit {
    stroke: var(--driver-color);
    stroke-width: 3;
    stroke-linecap: round;
}
.tyre-medium-line { stroke-dasharray: 10 6; }
.tyre-hard-line { stroke-dasharray: 3 5; }
.stint-tag-lead {
    stroke: var(--line-strong);
    stroke-width: 1;
}
.stint-tag {
    fill: var(--text);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.stint-tag-code { font-weight: 800; }

.stint-table-wrap {
    width: 100%;
    overflow-x: auto;
}
.stint-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    font-size: var(--f1-fs-md);
    font-variant-numeric: tabular-nums;
}
.stint-table th,
.stint-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.stint-table th {
    background: var(--surface-3);
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    font-weight: 800;
    white-space: nowrap;
}
.stint-table .num {
    text-align: right;
    white-space: nowrap;
}
.stint-table .muted { color: var(--muted); }
.stint-table small {
    display: block;
    color: var(--muted);
    font-size: var(--f1-fs-xs);
}
.stint-table tr.is-active td { background: var(--surface-3); }
.stint-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
}
.stint-sub {
    display: block;
    color: var(--muted);
    font-size: var(--f1-fs-sm);
}
.stint-pair-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}
.stint-pair-link:hover { text-decoration: underline; }
.stint-pair-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.stint-unmatched {
    margin-top: 14px;
    font-size: var(--f1-fs-md);
}
.stint-unmatched-title {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-weight: 800;
}
.stint-unmatched ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.stint-unmatched li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
}
.stint-unmatched .stint-sub { display: inline; }
.stint-why { color: var(--muted); }
.stint-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    line-height: 1.6;
}
.stint-note.is-warn { color: var(--danger-text); }

@media (max-width: 640px) {
    .stint-cmp { padding: 12px; }
    .stint-cmp-controls,
    .stint-cmp-controls .field { width: 100%; }
    .stint-cmp-controls .selector { width: 100%; min-width: 0; }
    .stint-block-title small { display: block; margin: 4px 0 0; }
}

/* 两人对比固定用 A / B 两色（同队车手的车队色几乎一样，无法区分）；浅色下加深到 ≥ 4.4:1 */
.stint-cmp { --cmp-a: #c25a00; --cmp-b: #2563eb; }
:root[data-theme="dark"] .stint-cmp { --cmp-a: #ff8a1f; --cmp-b: #6ea8ff; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .stint-cmp { --cmp-a: #ff8a1f; --cmp-b: #6ea8ff; }
}
.stint-pt-sq {
    fill: var(--driver-color);
    fill-opacity: 0.7;
    stroke: var(--chart-bg);
    stroke-width: 1;
}
.stint-legend {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font-size: var(--f1-fs-md);
    font-variant-numeric: tabular-nums;
}
.stint-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
}
.stint-legend b { color: var(--driver-color); }

/* 单站详情图（paceDetail.js）：stint 筛选、结果行、悬停读数行、图 */
.pace-detail-chart.pd {
    display: flex;
    flex-direction: column;
    gap: var(--f1-space-3);
    padding: var(--f1-space-3);
    overflow: visible;
}

.pd-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--f1-space-2) var(--f1-space-4);
    min-height: var(--f1-control-h-sm);
}

.pd-chip-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--f1-space-2);
}

.pd-chip-driver {
    min-width: 3em;
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    font-weight: 700;
}

.pd-chip-driver.is-a { color: var(--driver-a-text, var(--driver-a)); }
.pd-chip-driver.is-b { color: var(--driver-b-text, var(--driver-b)); }

.pd-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--f1-space-2);
    height: var(--f1-control-h-sm);
    box-sizing: border-box;
    padding: 0 var(--f1-space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--f1-radius-pill);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-family: var(--font-num);
    font-size: var(--f1-fs-sm);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.pd-chip:hover { border-color: var(--accent); }
.pd-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pd-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-3); }
.pd-chip.is-off { color: var(--muted-2); }
.pd-chip-all { font-family: inherit; }

.pd-tyre-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--line-strong);
}

.pd-filter-note {
    color: var(--muted-2);
    font-size: var(--f1-fs-sm);
}

.pd-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--f1-space-1) var(--f1-space-3);
    min-height: 1.6em;
    font-size: var(--f1-fs-sm);
}

.pd-summary-label { color: var(--muted); }
.pd-summary-value {
    color: var(--text);
    font-family: var(--font-num);
    font-size: var(--f1-fs-lg);
    font-variant-numeric: tabular-nums;
}
.pd-summary-detail { color: var(--muted-2); }

.pd-readout {
    min-height: 1.5em;
    overflow: hidden;
    color: var(--muted);
    font-size: var(--f1-fs-sm);
    line-height: 1.5;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pd-chart {
    min-height: 360px;
}

@media screen and (max-width: 760px) {
    .pd-readout {
        min-height: 3em;
        white-space: normal;
    }
}

/* 折叠不计入赛季汇总的站 */
.pace-head-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--f1-space-3) var(--f1-space-4);
}

.pace-fold-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 11em;
    height: var(--f1-control-h-sm);
    box-sizing: border-box;
    padding: 0 var(--f1-space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--f1-radius-pill);
    background: var(--surface-3);
    color: var(--text);
    font: inherit;
    font-size: var(--f1-fs-sm);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.pace-fold-btn:hover:not(:disabled) { border-color: var(--accent); }
.pace-fold-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pace-fold-btn[aria-pressed="true"] { border-color: var(--accent); }
.pace-fold-btn:disabled {
    color: var(--f1-text-disabled);
    cursor: default;
}

#race-content .pace-table.hide-ineligible tr.is-ineligible {
    display: none;
}

/* ===== 2026-11-30 全站下拉统一外观（select-menu.js 把可见原生 select 增强为 F1Dropdown）===== */
/* 原生 select 保留为数据源，只做视觉隐藏（不 display:none，以免影响表单与脚本读取） */
select.f1-native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
    clip-path: inset(50%);
    pointer-events: none;
    top: 0;
    left: 0;
}
/* 给视觉隐藏的原生 select 一个就近的定位容器，避免它按静态位置挂到视口外撑出横向滚动 */
:has(> select.f1-native-select) {
    position: relative;
}

/* 触发按钮宽度按字段固定，值变化（短→长）不推动相邻控件 */
.f1-select-menu button.f1-dropdown-trigger {
    width: var(--dd-w, 216px);
    max-width: 100%;
    gap: var(--f1-space-2);
}
.f1-dropdown button.f1-dropdown-trigger:disabled {
    cursor: not-allowed;
}
.f1-select-menu:is([data-for="seasonList"], [data-for="startYearList"], [data-for="endYearList"], [data-for="yearOnlyList"], [data-for="practiceSeasonList"]) { --dd-w: 7.5em; }
.f1-select-menu:is([data-for="constructorList"], [data-for="historyConstructorList"]) { --dd-w: 15em; }
.f1-select-menu[data-for="practiceRoundList"] { --dd-w: 17em; }
.f1-select-menu:is([data-for="practiceSession"], [data-for="practiceBasis"]) { --dd-w: 9.5em; }
.f1-select-menu:is([data-for="practiceMinLaps"], [data-for="practiceCompound"], [data-for="practiceCleanGap"]) { --dd-w: 7.5em; }
.f1-select-menu[data-for="stintCmpMode"] { --dd-w: 15em; }
.f1-select-menu[data-for="stintCmpFuel"] { --dd-w: 9em; }
.chart-controls .f1-select-menu { --dd-w: 8.5em; }
.stint-cmp-controls .f1-select-menu .selector { min-width: 0; }
.lr-options .lr-field-round .f1-select-menu .selector { min-width: 0; }

/* 弹层：长列表（赛季回溯数十年）限高滚动；空间不足时向上展开 */
.f1-dropdown-menu {
    max-height: min(360px, 60vh);
    max-width: calc(100vw - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}
.f1-dropdown.is-up .f1-dropdown-menu {
    top: auto;
    bottom: calc(100% + 6px);
}
.f1-dropdown-option[aria-disabled="true"] {
    color: var(--f1-text-disabled);
    cursor: not-allowed;
}
.f1-dropdown-option {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .flex-container-options .f1-select-menu,
    .lr-options .f1-select-menu,
    .stint-cmp-controls .f1-select-menu,
    .f1-select-menu button.f1-dropdown-trigger {
        width: 100%;
    }
    .flex-container-options .f1-select-menu button.f1-dropdown-trigger { max-width: none; }
}

@media (max-width: 640px) {
    /* 窄屏长选项换行，不让弹层横向溢出 */
    .f1-dropdown-option {
        white-space: normal;
        padding-top: var(--f1-space-2);
        padding-bottom: var(--f1-space-2);
        line-height: 1.3;
    }
}
/* 选中项处于悬停/键盘高亮时，--accent 落在 --surface-hover 上浅色仅 4.2:1，改用专供文字的 soft-text 令牌（浅 #8a3c00 / 深 #ffc58a） */
.f1-dropdown-option[aria-selected="true"].is-active {
    color: var(--f1-accent-soft-text);
}
/* 排位趋势图工具条：标题和下拉同一行，窄屏不套用整宽规则，避免挤出卡片 */
.chart-controls .f1-dropdown.f1-select-menu,
.chart-controls .f1-select-menu button.f1-dropdown-trigger {
    width: var(--dd-w);
    max-width: 100%;
}
.chart-controls .control-group { min-width: 0; flex-wrap: wrap; }

/* 队友速度 tab：每对队友一块，左列正赛、右列排位；SVG 由 teammateView.js 按容器宽度绘制 */
.tm-status {
  min-height: 2.6em;
  margin: var(--f1-space-3, 12px) 0;
  color: var(--f1-text-muted);
  font-variant-numeric: tabular-nums;
}
.tm-status[data-kind="warn"] { color: var(--f1-warn); }
.tm-status[data-kind="error"] { color: var(--f1-danger); }
.tm-out { display: grid; gap: 18px; min-width: 0; }
.tm-pair {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--f1-border);
  border-radius: 10px;
  background: var(--f1-surface);
}
.tm-pair-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tm-pair-title { margin: 0; font-size: 17px; color: var(--f1-text); }
.tm-pair-sub { font-size: 13px; font-weight: 400; color: var(--f1-text-muted); margin-left: 6px; }
.tm-swap { flex: none; width: auto; min-width: 0; padding-inline: 14px; }
.tm-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 28px; }
.tm-col { min-width: 0; }
.tm-sum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-height: 2.2em; font-variant-numeric: tabular-nums; }
.tm-sum-k { font-weight: 700; color: var(--f1-text); }
.tm-sum-v { font-weight: 700; color: var(--f1-text); min-width: 10ch; }
.tm-sum-n { color: var(--f1-text-muted); font-size: 13px; }
.tm-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.tm-svg text { font-family: inherit; font-variant-numeric: tabular-nums; }
.tm-grid { stroke: var(--f1-chart-grid); stroke-width: 1; }
.tm-zero { stroke: var(--f1-text-faint); stroke-width: 1.5; }
.tm-tick { font-size: 11px; fill: var(--f1-text-faint); }
.tm-head { font-size: 13px; font-weight: 700; fill: var(--f1-text); }
.tm-side { font-size: 11px; fill: var(--f1-text-muted); }
.tm-row { font-size: 11.5px; fill: var(--f1-text-muted); }
.tm-off { fill: var(--f1-text-faint); }
.tm-wait { font-size: 11px; fill: var(--f1-text-faint); }
.tm-dot-a { fill: var(--f1-driver-a); stroke: var(--f1-surface); stroke-width: 2; }
.tm-dot-b { fill: var(--f1-surface); stroke: var(--f1-driver-b); stroke-width: 2.5; }
.tm-dot-tie { fill: var(--f1-neutral); stroke: var(--f1-surface); stroke-width: 2; }
.tm-arrow { fill: var(--f1-text-muted); }
.tm-median { stroke: var(--f1-text); stroke-width: 2; stroke-dasharray: 4 3; }
.tm-off-list { margin-top: 10px; color: var(--f1-text-muted); font-size: 13px; }
.tm-off-list summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.tm-off-list ul { margin: 6px 0 0; padding-left: 20px; }
@media (max-width: 759px) {
  .tm-cols { grid-template-columns: minmax(0, 1fr); }
  .tm-pair { padding: 14px; }
}
