/* Compact score sheet; the shared homepage theme supplies all colours. */
button,select,input,textarea{font:inherit;color:var(--rp-text);border:1px solid var(--rp-border);border-radius:var(--rp-radius-control);padding:7px 9px;background:var(--rp-bg)}
button{background:var(--rp-raised);cursor:pointer;min-height:34px}button:hover{background:var(--rp-border)}button:disabled{opacity:.5;cursor:not-allowed}
button:focus-visible,.sheet-wrap:focus-visible{outline:2px solid var(--rp-blue);outline-offset:2px}.primary{background:var(--rp-primary);border-color:var(--rp-primary-hover);color:var(--rp-on-primary)}.primary:hover{background:var(--rp-primary-hover)}
.toolbar{display:flex;flex-wrap:wrap;gap:10px;align-items:end}.toolbar label,form label{display:flex;flex-direction:column;gap:4px;font-size:13px}.toolbar input[type=search]{max-width:165px}.toolbar .check{flex-direction:row;align-items:center;padding:7px 0}.check input{width:15px;height:15px}
.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--rp-text-2);margin-top:10px}.legend span{display:inline-flex;align-items:center;gap:6px}.empty-sample{width:18px;height:15px;background:var(--rp-bg);border:1px solid var(--rp-border)}.pending-sample{width:5px;height:5px;background:var(--rp-blue);border-radius:50%}
#summary{margin:7px 0;font-size:12px}.sheet-wrap{overflow:auto;max-height:520px;border:1px solid var(--rp-border);background:var(--rp-bg);scrollbar-color:var(--rp-muted) var(--rp-bg)}
:is(#sheet,.route-reference-sheet){--index-width:28px;--map-width:88px;--track-width:144px;--car-width:72px;width:calc(var(--index-width) + var(--map-width) + var(--track-width) + var(--car-width) * var(--coverage-columns,1));border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:12px;line-height:1.25;text-align:center}
:is(#sheet,.route-reference-sheet) th,:is(#sheet,.route-reference-sheet) td{border-right:1px solid var(--rp-border);border-bottom:1px solid var(--rp-border);padding:0;height:32px}:is(#sheet,.route-reference-sheet) th{font-weight:500;background:var(--rp-surface);color:var(--rp-text-2)}
:is(#sheet,.route-reference-sheet) thead th{position:sticky;top:0;z-index:3;height:38px;padding:3px 2px;color:var(--rp-text);overflow-wrap:anywhere}
:is(#sheet,.route-reference-sheet) .row-num{width:var(--index-width);position:sticky;left:0;z-index:2;background:var(--rp-surface);font-size:11px;color:var(--rp-text-2)}
:is(#sheet,.route-reference-sheet) .map-col{width:var(--map-width);position:sticky;left:var(--index-width);z-index:2;background:var(--rp-surface);text-align:left;padding:2px 4px}
:is(#sheet,.route-reference-sheet) .track-col{width:var(--track-width);position:sticky;left:calc(var(--index-width) + var(--map-width));z-index:2;background:var(--rp-surface);text-align:left;padding:2px 4px}
:is(#sheet,.route-reference-sheet) thead .row-num,:is(#sheet,.route-reference-sheet) thead .map-col,:is(#sheet,.route-reference-sheet) thead .track-col{z-index:5}:is(#sheet,.route-reference-sheet) .car-col{width:var(--car-width)}:is(#sheet,.route-reference-sheet) .car-col small{display:block;font-size:10px;line-height:1.2;color:var(--rp-text-2);margin-top:2px}
:is(#sheet,.route-reference-sheet) .filled{background:var(--rp-surface);font-variant-numeric:tabular-nums}
:is(#sheet,.route-reference-sheet) .cell{position:relative;display:block;width:100%;height:100%;min-height:32px;border:0;border-radius:0;background:transparent;padding:2px 3px;color:var(--rp-text)}:is(#sheet,.route-reference-sheet) .cell:hover{background:var(--rp-selected)}:is(#sheet,.route-reference-sheet) .cell:focus-visible{outline:2px solid var(--rp-blue);outline-offset:-2px}
:is(#sheet,.route-reference-sheet) .pending-mark{position:absolute;right:3px;top:3px;width:5px;height:5px;background:var(--rp-blue);border-radius:50%}
.sheets{display:flex;overflow:auto;border:1px solid var(--rp-border);border-top:0;background:var(--rp-bg)}.sheets button{flex:none;border:0;border-right:1px solid var(--rp-border);border-radius:0;background:transparent;color:var(--rp-text-2);min-width:100px;min-height:32px;padding:6px 10px}.sheets button[aria-current=true]{background:var(--rp-raised);color:var(--rp-text);box-shadow:inset 0 -2px var(--rp-blue)}
.paging{display:flex;align-items:center;gap:10px;margin:8px 0;font-size:12px}.paging button{min-height:30px;padding:5px 9px}.muted{color:var(--rp-text-2)}.warning{color:var(--rp-warning)}#message:empty{display:none}a{color:var(--rp-blue)}
dialog{width:min(580px,calc(100vw - 28px));max-height:88vh;overflow:auto;padding:22px;color:var(--rp-text);font-size:14px;box-sizing:border-box}dialog h2{margin:0 0 14px}dialog p{overflow-wrap:anywhere}dialog .actions{justify-content:flex-end;margin-top:18px}form label{margin-top:12px}form textarea{min-height:80px;resize:vertical}
[hidden]{display:none!important}
@media(max-width:600px){.toolbar{gap:8px}.toolbar label{flex:1 1 120px}.toolbar .check{flex:0 0 auto;white-space:nowrap}.toolbar input[type=search]{max-width:none;width:100%}.sheet-wrap{max-height:460px}:is(#sheet,.route-reference-sheet){--index-width:26px;--map-width:72px;--track-width:136px;--car-width:68px}:is(#sheet,.route-reference-sheet) th,:is(#sheet,.route-reference-sheet) td{height:36px}:is(#sheet,.route-reference-sheet) .cell{min-height:36px}:is(#sheet,.route-reference-sheet) .map-col,:is(#sheet,.route-reference-sheet) .track-col{font-size:12px}.legend{gap:8px 12px}dialog{padding:17px}}

:is(#sheet,.route-reference-sheet) .star-select{display:block;max-width:60px;width:100%;min-height:22px;margin:2px auto 0;padding:1px 3px;font-size:11px;line-height:1.25}:is(#sheet,.route-reference-sheet) .car-col:has(.star-select){height:44px}

:is(#sheet,.route-reference-sheet) .selected-cell{box-shadow:inset 0 0 0 2px var(--rp-blue);background:var(--rp-selected)}.cell-tap-hint{position:fixed;width:120px;padding:6px 8px;border:1px solid var(--rp-border);border-radius:var(--rp-radius-control);background:var(--rp-raised);color:var(--rp-text);font-size:12px;text-align:center;pointer-events:none;z-index:20}.sheet-wrap{touch-action:manipulation}

/* 视图切换：与首页一致的两段式分段控件（coverage.html 不加载 styles.css，故在此复刻） */
.route-reference-tabs{display:inline-flex;align-items:center;gap:2px;margin:0 0 14px;padding:2px;max-width:100%;border:1px solid var(--rp-border);border-radius:var(--rp-radius-control);background:var(--rp-bg)}
.route-reference-tabs button{min-height:30px;padding:4px 12px;border:0;border-radius:var(--rp-radius-chip);background:transparent;color:var(--rp-muted);font-size:var(--rp-size-sm);line-height:1.2;white-space:nowrap}
.route-reference-tabs button:hover{background:var(--rp-surface);color:var(--rp-text-2)}
.route-reference-tabs button[aria-pressed=true]{background:var(--rp-raised);color:var(--rp-text);font-weight:600}
.show-route-reference > :not(.route-reference-tabs,.route-reference){display:none}

/* 跑法参考沿用成绩表的外壳：不套 section 卡片，表格自带边框 */
.rp-page main > section.route-reference{margin:0;padding:0;background:none;border:0;border-radius:0}
.route-reference .toolbar{margin-bottom:2px}
.route-reference > p{margin:7px 0;font-size:12px;color:var(--rp-text-2)}
.route-reference > p:empty{display:none}
.route-reference .paging{margin:8px 0 0}

.sheet-wrap { border-radius: var(--rp-radius-card) var(--rp-radius-card) 0 0; }
.sheets { border-radius: 0 0 var(--rp-radius-card) var(--rp-radius-card); }
/* 跑法参考没有底部工作表条，表格四条圆角自带 */
.sheet-wrap.route-reference-grid { border-radius: var(--rp-radius-card); }
.rp-page main .muted { color: var(--rp-text-2); }

:is(#sheet,.route-reference-sheet) .row-num,
:is(#sheet,.route-reference-sheet) .filled,
:is(#sheet,.route-reference-sheet) td .cell {
    font-family: var(--rp-display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums;
}
:is(#sheet,.route-reference-sheet) thead th { background-color: var(--rp-elevated); }
:is(#sheet,.route-reference-sheet) tbody tr:hover :is(.map-col,.track-col,.row-num) { background: var(--rp-raised); }
:is(#sheet,.route-reference-sheet) .track-col { border-right-color: var(--rp-border-strong); }
.sheets button[aria-current=true] { background: var(--rp-pill-active); color: var(--rp-accent-text); box-shadow: inset 0 -2px var(--rp-blue); }
.rp-page .sheet-wrap { scrollbar-color: var(--rp-muted) var(--rp-surface-2); }

.filled-score-dialog { width: min(390px,calc(100% - 28px)); padding: 20px; }
.filled-score-dialog h2 { margin: 0; }.filled-score-dialog p { color: var(--rp-text-2); }
#filledCellScore { display: block; margin: 10px 0 18px; font: 700 28px var(--rp-display); color: var(--rp-accent-text); }

.toolbar .garage-filter{display:inline-flex;flex-direction:row;align-items:center;gap:.45rem;min-height:36px;cursor:pointer}
.garage-filter input{width:1.05rem;height:1.05rem;accent-color:var(--rp-primary,#70a9ca)}
#garageMatches{font-variant-numeric:tabular-nums;color:var(--rp-text-dim,#a9bdc8)}

.video-binding h2 { margin: 0; }
.video-binding .video-target { margin: 4px 0 14px; color: var(--rp-text-2); }
.video-binding form { display: grid; gap: 12px; }
.video-binding label { margin: 0; min-width: 0; }
.video-binding :is(input:not([type=checkbox]),select,textarea) { width: 100%; min-width: 0; box-sizing: border-box; }
.video-binding textarea { min-height: 3.4em; }
.video-fields { display: grid; grid-template-columns: minmax(5.5em,1fr) minmax(0,2fr); align-items: start; gap: 10px; }
.video-config-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding-top: 10px; }
.video-config-fields label:has(input[type=checkbox]) { flex-direction: row-reverse; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--rp-border); border-radius: var(--rp-radius-chip); }
.video-evidence { overflow-wrap: anywhere; font-size: 13px; }
.video-binding :is(.video-evidence,[role=status]):empty { display: none; }
.video-binding details { border-top: 1px solid var(--rp-border); padding-top: 10px; }
.video-binding summary { cursor: pointer; }
.video-binding > details { margin-top: 14px; }
.video-binding :is(.video-fixed, [role=status], .actions) { margin: 0; }
.video-binding .video-fixed { color: var(--rp-text-2); align-self: start; padding: 6px 0; }
.video-binding .actions { justify-content: flex-end; }
