/* 练习赛长距离 tab。只用共享 token（style.css 顶部 f1-tokens），浅/深色由 token 自动切换。 */
.lr-options .lr-field-round .selector { min-width: 15em; }
.lr-options .selector { min-height: var(--f1-control-h, 36px); }

.lr-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 状态条：固定最小高度，加载 → 完成 / 失败 时不推动下方内容 */
.lr-status {
    display: flex; align-items: center; justify-content: space-between; gap: var(--f1-space-3);
    min-height: 56px; margin: 0 0 var(--f1-space-6); padding: var(--f1-space-3) var(--f1-space-4);
    border: 1px solid var(--line); border-radius: var(--f1-radius-card);
    background: var(--surface-2); color: var(--muted); font-size: var(--f1-fs-md); line-height: 1.5;
}
.lr-status[hidden] { display: none; }
.lr-status-error { border-color: var(--f1-danger); background: var(--f1-danger-soft); color: var(--text); }
.lr-status-loading { color: var(--text); }
.lr-status-loading::before {
    content: ''; flex: none; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--line-strong); border-top-color: var(--accent);
    animation: lr-spin 0.9s linear infinite;
}
.lr-status-loading span { flex: 1; }
@keyframes lr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lr-status-loading::before { animation: none; } }

.lr-results[aria-busy="true"] { opacity: 0.55; }

.lr-summary {
    display: grid; grid-template-columns: repeat(2, minmax(150px, max-content)) minmax(0, 1fr);
    gap: var(--f1-space-3); margin-bottom: var(--f1-space-4);
}
.lr-stat {
    display: flex; flex-direction: column; justify-content: center; gap: var(--f1-space-1);
    min-height: 76px; padding: var(--f1-space-3) var(--f1-space-4);
    border: 1px solid var(--line); border-radius: var(--f1-radius-card); background: var(--surface-2);
}
.lr-stat-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--f1-fs-xl); font-weight: 700; color: var(--text); }
.lr-stat-num small { font-size: var(--f1-fs-md); font-weight: 500; color: var(--muted); }
.lr-stat-label { color: var(--muted); font-size: var(--f1-fs-sm); }
.lr-stat-wide .lr-stat-label { color: var(--text); font-weight: 600; font-size: var(--f1-fs-md); }
.lr-stat-note { color: var(--muted); font-size: var(--f1-fs-xs); line-height: 1.5; }

.lr-h {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--f1-space-2);
    margin: var(--f1-space-6) 0 var(--f1-space-3); font-size: var(--f1-fs-lg); color: var(--text);
}
.lr-h-note { font-size: var(--f1-fs-sm); font-weight: 400; color: var(--muted); }
.lr-note { margin: var(--f1-space-3) 0; color: var(--muted); font-size: var(--f1-fs-sm); line-height: 1.6; }

.lr-empty {
    display: flex; align-items: center; justify-content: center; min-height: 120px; padding: var(--f1-space-6) var(--f1-space-4);
    border: 1px dashed var(--line-strong); border-radius: var(--f1-radius-card); color: var(--muted); font-size: var(--f1-fs-md); text-align: center;
}

/* 表格：表内横向滚动，页面不横向滚动 */
.lr-table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--f1-radius-card); background: var(--surface-2); }
.lr-table { width: 100%; border-collapse: collapse; font-size: var(--f1-fs-md); color: var(--text); }
.lr-table th, .lr-table td { padding: var(--f1-space-2) var(--f1-space-3); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.lr-table thead th { background: var(--surface-3); color: var(--muted); font-size: var(--f1-fs-sm); font-weight: 600; }
.lr-table th:first-child, .lr-table td:first-child { padding-left: var(--f1-space-4); }
.lr-table th:last-child, .lr-table td:last-child { padding-right: var(--f1-space-4); }
.lr-table tbody tr:last-child td { border-bottom: 0; }
.lr-table tbody tr:not(.lr-group):hover td { background: var(--surface-hover); }
.lr-table .lr-num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.lr-table .lr-strong { font-weight: 700; }
.lr-group th { background: var(--surface-3); color: var(--text); font-weight: 600; }
.lr-pick { width: 1%; }
.lr-pick input { width: 16px; height: 16px; margin: 0; vertical-align: middle; accent-color: var(--accent-fill); }
.lr-pick input:disabled { opacity: 0.45; }
.lr-driver { display: flex; align-items: center; gap: var(--f1-space-2); }
.lr-swatch { flex: none; width: 4px; height: 18px; border-radius: 2px; }
.lr-team { color: var(--muted); font-size: var(--f1-fs-sm); max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.lr-sub { margin-left: 2px; color: var(--muted); font-size: var(--f1-fs-xs); }
.lr-best { color: var(--f1-pos); font-weight: 600; }
.lr-tyre {
    display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: var(--f1-space-2);
    border-radius: 50%; border: 2px solid var(--tyre-edge); background: var(--tyre); color: var(--tyre-ink);
    font-size: 11px; font-weight: 700; line-height: 1; vertical-align: middle;
}

.lr-idle { display: flex; flex-wrap: wrap; align-items: center; gap: var(--f1-space-2); margin: var(--f1-space-3) 0 0; }
.lr-idle-label { color: var(--muted); font-size: var(--f1-fs-sm); }
.lr-chip {
    display: inline-flex; align-items: center; min-height: 24px; padding: 0 var(--f1-space-2);
    border: 1px solid var(--line-strong); border-radius: var(--f1-radius-pill); color: var(--text);
    font-family: var(--font-num); font-size: var(--f1-fs-sm);
}

.lr-chart { min-height: 360px; border: 1px solid var(--line); border-radius: var(--f1-radius-card); background: var(--chart-bg); overflow: hidden; }
.lr-chart > .lr-empty { min-height: 358px; border: 0; }

/* 出场程序时间线：每格一圈 */
.lr-legend { display: flex; flex-wrap: wrap; gap: var(--f1-space-2) var(--f1-space-4); margin-bottom: var(--f1-space-3); color: var(--muted); font-size: var(--f1-fs-sm); }
.lr-legend-item { display: inline-flex; align-items: center; gap: var(--f1-space-1); }
.lr-cell { display: inline-block; flex: none; width: 8px; height: 16px; border-radius: 2px; background: var(--line); }
.lr-k-push { background: var(--f1-pos); }
.lr-k-quali { background: #b45cff; }
.lr-k-slow { background: var(--muted-2); }
.lr-k-out, .lr-k-in { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }
.lr-k-neutral { background: var(--f1-warn); }
.lr-k-invalid, .lr-k-other { background: var(--line-strong); }
.lr-k-none { background: transparent; }
.lr-cell.lr-in-run { box-shadow: 0 -3px 0 0 var(--accent); }

.lr-tl { margin-bottom: var(--f1-space-3); border: 1px solid var(--line); border-radius: var(--f1-radius-card); background: var(--surface-2); }
.lr-tl summary { min-height: 44px; display: flex; align-items: center; padding: 0 var(--f1-space-4); cursor: pointer; color: var(--text); font-weight: 600; font-size: var(--f1-fs-md); }
.lr-tl summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: var(--f1-radius-card); }
.lr-tl-scroll { overflow-x: auto; padding: var(--f1-space-2) var(--f1-space-4) var(--f1-space-4); }
.lr-tl-row { display: grid; grid-template-columns: 3.5em max-content 3.5em; align-items: center; gap: var(--f1-space-3); min-height: 22px; }
.lr-tl-name { font-family: var(--font-num); font-weight: 600; color: var(--text); font-size: var(--f1-fs-sm); }
.lr-tl-cells { display: flex; gap: 2px; }
.lr-tl-count { min-width: 3.5em; white-space: nowrap; color: var(--muted); font-size: var(--f1-fs-xs); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
    .lr-summary { grid-template-columns: 1fr 1fr; }
    .lr-stat-wide { grid-column: 1 / -1; }
    .lr-options .lr-field-round .selector { min-width: 0; }
    .lr-status { flex-direction: column; align-items: flex-start; }
}
.lr-chip-sub { margin-left: var(--f1-space-1); color: var(--muted); font-family: var(--font); font-size: var(--f1-fs-xs); }

/* ---- 干净圈列、单段分析 ---- */
.lr-h-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--f1-space-3); margin: var(--f1-space-6) 0 var(--f1-space-3); }
.lr-h-row .lr-h { margin: 0; }
.lr-csv { display: inline-flex; align-items: center; justify-content: center; min-height: var(--f1-control-h, 40px); padding: 0 var(--f1-space-4); white-space: nowrap; }
.lr-table .lr-sep { border-left: 1px solid var(--line); }
.lr-table .lr-head-group th { padding-top: var(--f1-space-2); padding-bottom: 0; border-bottom: 0; color: var(--text); font-size: var(--f1-fs-xs); text-align: center; }
.lr-muted { color: var(--muted); }
.lr-act { width: 1%; }
.lr-detail-btn {
    display: inline-flex; align-items: center; justify-content: center; min-width: 4em; min-height: 28px; padding: 0 var(--f1-space-3);
    border: 1px solid var(--control-border); border-radius: var(--f1-radius-sm); background: var(--surface-3);
    color: var(--text); font: inherit; font-size: var(--f1-fs-sm); line-height: 1; cursor: pointer;
}
.lr-detail-btn:hover { background: var(--surface-hover); }
.lr-detail-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lr-detail-btn.is-active { min-width: 4em; white-space: nowrap; border-color: transparent; background: var(--f1-accent-soft); color: var(--f1-accent-soft-text); font-weight: 700; }
.lr-table tbody tr.lr-row-active td { background: var(--surface-3); }

.lr-detail { margin-top: var(--f1-space-6); padding: var(--f1-space-4); border: 1px solid var(--line); border-radius: var(--f1-radius-card); background: var(--surface-2); }
.lr-detail[hidden] { display: none; }
.lr-detail .lr-h-row { margin-top: 0; }
.lr-dstats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--f1-space-2); margin-bottom: var(--f1-space-4); }
.lr-dstat { display: flex; flex-direction: column; gap: 2px; min-height: 72px; padding: var(--f1-space-2) var(--f1-space-3); border: 1px solid var(--line); border-radius: var(--f1-radius-sm); background: var(--surface); }
.lr-dstat-label { color: var(--muted); font-size: var(--f1-fs-xs); }
.lr-dstat-num { color: var(--text); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--f1-fs-lg); font-weight: 700; white-space: nowrap; }
.lr-dstat-num small { color: var(--muted); font-size: var(--f1-fs-sm); font-weight: 500; }
.lr-dstat-note { color: var(--muted); font-size: var(--f1-fs-xs); font-family: var(--font-num); line-height: 1.4; overflow-wrap: anywhere; }
.lr-detail-chart { min-height: 340px; margin-bottom: var(--f1-space-4); }
.lr-tyre-sm { width: 16px; height: 16px; margin: 0 var(--f1-space-1) 0 0; font-size: 9px; border-width: 1.5px; }
.lr-tag { display: inline-flex; align-items: center; min-height: 20px; padding: 0 var(--f1-space-2); border-radius: var(--f1-radius-pill); border: 1px solid var(--line-strong); color: var(--muted); font-size: var(--f1-fs-xs); white-space: nowrap; }
.lr-tag-clean { border-color: var(--f1-pos); color: var(--text); }
.lr-tag-traffic { border-color: var(--f1-warn); color: var(--text); }
.lr-table tbody tr.lr-row-muted td { color: var(--muted); }
@media (max-width: 760px) {
    .lr-detail { padding: var(--f1-space-3); }
    .lr-dstats { grid-template-columns: 1fr 1fr; }
}
