:root {
  --bg: #0a0c0f;
  --panel: #13161b;
  --panel-2: #1a1e25;
  --line: #262b34;
  --text: #e9ebee;
  --muted: #8a919b;
  --accent: #e10600;
  --dep: #ff8a1f;
  --harv: #1fd17a;
  --rpm: #7aa7ff;
  --thr: #1fd17a;
  --brk: #ff3b3b;
  --warn: #ffcc00;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --sunken: #0d1014;
  --row-line: #1b1f26;
  --track-bg: #262b33;
  --tag-bg: #2b3340;
  --sel-bg: #24161a;
  --tgl-on: #2a1215;
  --overlay: #0a0c0ff2;
  --topbar-tint: #15080a;
  --text-soft: #c3c8cf;
  --faint-line: #ffffff30;
  --shadow: #000a;
  --scroll: #2a303a;
  --fav-bg: #1a1416;
  --dot: #555;
  --ok-bg: #0f3d22; --ok-fg: #8ff0bd; --ok-line: #1fd17a;
  --warn-bg: #3a2f00; --warn-fg: #ffcc00;
  --bad-bg: #4d0b0b; --bad-fg: #ff9b9b; --bad-line: #ff3b3b;
  --note-bg: #2a2200; --note-line: #5c4a00; --note-fg: #ffe27a;
  --red-bg: #4a0909; --red-bg2: #5c0d0d; --red-fg: #ffd7d7;
  --yel-bg: #3d3300; --yel-fg: #fff3b0;
  --toast-red: #2a0d0d;
  --rw-bg: #0f2a36; --rw-fg: #9fe3ff;
  --live-fg: #ff8a80;
  --purple: #c77dff;
  /* canvas drawing colours (read by theme.js) */
  --cv-grid: #1f242c; --cv-grid2: #1b2027; --cv-axis: #5b636e; --cv-track: #3a414c; --cv-zero: #2a303a;
  --cv-strip: #161a20; --cv-hover: #ffffff66; --cv-strong: #ffffff; --cv-soft: #c9d1dc;
  --hard: #f0f0f0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Titillium Web', system-ui, sans-serif; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.r { text-align: right; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 22px; padding: 10px 18px; background: linear-gradient(90deg, var(--topbar-tint), var(--panel) 30%); border-bottom: 2px solid var(--accent); flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .18em; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 16px; height: 16px; background: var(--accent); clip-path: polygon(0 100%, 35% 0, 100% 0, 65% 100%); }
.session { flex: 1; min-width: 180px; }
.session-pick { all: unset; cursor: pointer; display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; column-gap: 6px; padding: 2px 6px; margin-left: -6px; border-radius: 6px; }
.session-pick:hover, .session-pick[aria-expanded="true"] { background: var(--sunken); }
.session-pick:focus-visible { outline: 2px solid var(--accent, #e10600); }
.session-pick #sessionName { grid-column: 1 / -1; }
.pick-caret { font-size: 11px; color: var(--muted); }
.past-menu { left: 0; right: auto; width: min(560px, calc(100vw - 24px)); }
.past-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.past-head b { flex: 1; }
.past-live { width: 100%; text-align: left; margin-bottom: 8px; }
.past-list { display: flex; flex-direction: column; gap: 6px; }
.past-meet { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--sunken); }
.past-meet.cur { border-color: var(--accent); }
.past-meet-t { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.past-ses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.past-ses .btn { font-size: 12px; padding: 3px 9px; }
.past-ses .btn.on { background: var(--accent); color: #fff; border-color: transparent; }
.replay-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #fff; background: #6b3fd6; border-radius: 3px; padding: 1px 5px; vertical-align: middle; margin-right: 6px; }
.meeting { font-weight: 700; font-size: 18px; line-height: 1.1; }
.stat .value { font-size: 18px; font-weight: 600; }
.pill { padding: 4px 12px; border-radius: 4px; font-weight: 700; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); }
.pill.green { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.pill.yellow { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.pill.red { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-fg); }
.pill.sc { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.source { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.dot.ok { background: var(--harv); box-shadow: 0 0 8px var(--harv); }
.dot.bad { background: var(--brk); }

.replaybar { position: relative; z-index: 40; padding: 6px 18px 4px; background: var(--panel); border-bottom: 1px solid var(--line); }
.rp-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rp-row .small-btn { margin-left: 0; padding: 4px 9px; font-variant-numeric: tabular-nums; }
.rp-group { display: inline-flex; }
.rp-group .btn { border-radius: 0; margin-left: -1px; }
.rp-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.rp-group .btn:last-child { border-radius: 0 6px 6px 0; }
.rp-group .btn:hover, .rp-row .rp-play:hover { position: relative; border-color: var(--accent); }
.rp-play { min-width: 86px; font-weight: 600; }
.replaybar #rpTime:empty { display: none; }
.replaybar #tlLive { margin-left: auto; }
.replaybar .tl-main { margin-top: 4px; }
.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }

.banner { margin: 10px 18px 0; padding: 10px 14px; border: 1px solid var(--note-line); background: var(--note-bg); color: var(--note-fg); border-radius: 6px; font-size: 14px; }


h2 { margin: 0; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.est { font-size: 9px; font-weight: 700; letter-spacing: .1em; padding: 1px 4px; border-radius: 3px; background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--note-line); vertical-align: middle; }
.est.big { display: inline-block; margin-top: 4px; }

/* tower */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 4px 6px; border-bottom: 1px solid var(--row-line); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.sel { background: var(--sel-bg); box-shadow: inset 3px 0 0 var(--accent); }
tbody tr.out { opacity: .4; }
.pos { font-weight: 700; width: 26px; text-align: center; }
.teambar { width: 4px; padding: 0; }
.teambar i { display: block; width: 4px; height: 20px; border-radius: 2px; }
.tla { font-weight: 700; letter-spacing: .04em; }
.tla .num { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 4px; }
.pb { color: var(--harv); }
.pit { font-size: 10px; background: var(--tag-bg); padding: 1px 4px; border-radius: 3px; margin-left: 4px; }
.tyre { display: inline-flex; align-items: center; gap: 4px; }
.tyre b { width: 18px; height: 18px; border-radius: 50%; border: 3px solid; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; }
.mini { display: flex; align-items: center; gap: 6px; min-width: 140px; }
.mini .bar { width: 64px; height: 8px; }
.mini .tag { font-size: 10px; font-weight: 700; width: 14px; }

/* bars */
.bar { flex: 1; height: 10px; background: var(--sunken); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.fill { height: 100%; width: 0; }
.dep-bg { background: var(--dep); } .harv-bg { background: var(--harv); } .rpm-bg { background: var(--rpm); } .thr-bg { background: var(--thr); } .brk-bg { background: var(--brk); }
.row-bar { display: grid; grid-template-columns: 70px 1fr 74px; align-items: center; gap: 8px; margin: 6px 0; }
.row-bar .mono { text-align: right; }

/* focus */
.focus-top { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: center; }
@media (max-width: 560px) { .focus-top { grid-template-columns: 1fr; justify-items: center; } }
.gauge-wrap { position: relative; width: 200px; height: 200px; }
.gauge { width: 100%; height: 100%; transform: rotate(-90deg); }
.g-track { fill: none; stroke: var(--track-bg); stroke-width: 16; }
.g-arc { fill: none; stroke: var(--harv); stroke-width: 16; stroke-linecap: round; stroke-dasharray: 527.8; stroke-dashoffset: 527.8; transition: stroke-dashoffset .2s linear, stroke .3s; }
.gauge-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.g-pct { font-size: 40px; font-weight: 600; }
.mode { font-size: 22px; font-weight: 700; letter-spacing: .06em; margin-bottom: 8px; }
.mode.DEPLOY { color: var(--dep); } .mode.HARVEST, .mode.SUPER-CLIP, .mode.LIFT { color: var(--harv); } .mode.DEPLETED { color: var(--brk); }
.pbar { position: relative; height: 18px; background: var(--sunken); border: 1px solid var(--line); border-radius: 3px; margin-top: 4px; }
.pbar-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--muted); }
.pbar-h { position: absolute; right: 50%; top: 0; bottom: 0; background: var(--harv); width: 0; transition: width .15s linear; }
.pbar-d { position: absolute; left: 50%; top: 0; bottom: 0; background: var(--dep); width: 0; transition: width .15s linear; }
.pbar-scale { display: flex; justify-content: space-between; margin-top: 2px; }
.pvals { display: flex; justify-content: space-between; font-size: 18px; margin-top: 4px; }
.dep { color: var(--dep); } .harv { color: var(--harv); }

.telemetry { display: grid; grid-template-columns: 130px 70px 1fr; gap: 16px; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .telemetry { grid-template-columns: 1fr 1fr; } .tel-bars { grid-column: 1 / -1; } }
.big-num { font-size: 32px; font-weight: 600; }
.big-num small { font-size: 12px; color: var(--muted); }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 4px; }

.legend { text-transform: none; letter-spacing: 0; margin-left: 8px; }
.sw { display: inline-block; width: 10px; height: 3px; margin: 0 3px 2px 8px; vertical-align: middle; }
.sw.spd { background: #c9d1dc; }

/* field */
.field { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.frow { display: grid; grid-template-columns: 22px 38px 1fr 34px; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.frow .bar { height: 7px; }

/* race control */
.rcm { list-style: none; margin: 0; padding: 0; }
.rcm li { font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--row-line); display: grid; grid-template-columns: max-content 1fr; gap: 8px; }
.rcm .flag-YELLOW, .rcm .flag-DOUBLE { color: var(--warn); }
.rcm .flag-RED { color: #ff7b7b; }
.rcm .flag-GREEN, .rcm .flag-CLEAR { color: var(--harv); }

.st-about { padding: 6px 12px 10px 40px; line-height: 1.45; max-width: 340px; }
@media (max-width: 560px) {
  .tower th:nth-child(5), .tower td:nth-child(5), .tower th:nth-child(7), .tower td:nth-child(7) { display: none; }
  .topbar { gap: 12px; }
}

/* F1 TV chip + sign-in page */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-decoration: none; color: var(--text); border: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.chip.ok { border-color: var(--ok-line); color: var(--ok-fg); background: var(--ok-bg); }
.chip.warn { border-color: var(--warn); color: var(--warn-fg); background: var(--warn-bg); }
.chip.bad { border-color: var(--bad-line); color: var(--bad-fg); background: var(--bad-bg); }
.chip:hover { filter: brightness(1.15); }
.banner a { color: inherit; text-decoration: underline; }
.auth-page .topbar a.btn { text-decoration: none; }
.auth-wrap { max-width: 820px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.tagline { font-size: 11px; color: var(--harv); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.status-box { border-left: 3px solid var(--muted); padding: 6px 0 6px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.status-box.ok { border-color: var(--harv); } .status-box.warn { border-color: var(--warn); } .status-box.bad { border-color: var(--brk); }
.status-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.bad-t { color: #ff9b9b; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; line-height: 1.5; }
.steps a.btn { text-decoration: none; display: inline-block; margin-right: 4px; }
.bm-row { margin: 8px 0 2px; }
.bookmarklet { display: inline-block; padding: 8px 14px; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; cursor: grab; }
textarea { width: 100%; background: var(--sunken); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-family: var(--mono); font-size: 12px; margin: 10px 0; resize: vertical; }
details summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
code { font-family: var(--mono); font-size: 12px; background: var(--sunken); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.danger { margin-top: 12px; border-color: var(--bad-line); color: var(--bad-fg); }
.link-confirm { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--warn); border-radius: 6px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.link-confirm .lc-btns { display: flex; gap: 8px; margin-top: 4px; }
.result { margin-top: 10px; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.result.ok { background: var(--ok-bg); color: var(--ok-fg); } .result.bad { background: var(--bad-bg); color: var(--bad-fg); }

/* lap details */
.laprow { display: grid; grid-template-columns: 1.4fr .6fr 1fr; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); align-items: start; }
@media (max-width: 560px) { .laprow { grid-template-columns: 1fr 1fr; } }
.sectors { display: flex; gap: 8px; margin-top: 4px; font-size: 14px; }
.sectors span { padding: 1px 6px; border-radius: 3px; background: var(--sunken); border: 1px solid var(--line); }
.sectors .pb { color: var(--harv); border-color: #1d5a3a; } .sectors .ob { color: var(--purple); border-color: #5b2a86; }
.stints { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.stint { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); }
.stint b { width: 16px; height: 16px; border-radius: 50%; border: 3px solid; display: inline-flex; align-items: center; justify-content: center; font-size: 8px; }

.rcm li.radio-item { display: grid; grid-template-columns: max-content 36px minmax(120px, 1fr); gap: 8px; align-items: center; }
.radio-item audio { width: 100%; height: 28px; }
.mtable { width: 100%; font-size: 12px; }
.mtable td, .mtable th { padding: 4px 4px; }
.up { color: var(--harv); } .down { color: var(--brk); }

/* qualifying */
tbody tr.ko { opacity: .4; }
tbody tr.cut td { border-bottom: 2px solid #ff3b3b66; }
.muted-cell { color: var(--muted); }
@media (max-width: 560px) { .tower th:nth-child(7), .tower td:nth-child(7) { display: none; } }

.qp { font-size: 9px; color: var(--muted); margin-left: 4px; border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; }
.mini .tag.dep { color: var(--dep); } .mini .tag.harv { color: var(--harv); }

/* mini sectors */
.ms { display: inline-flex; gap: 3px; vertical-align: middle; }
.ms .msg { display: inline-flex; gap: 1px; }
.ms i { display: inline-block; width: 4px; height: 11px; border-radius: 1px; background: var(--track-bg); }
.ms i.y { background: #f2c200; } .ms i.g { background: #1fd17a; } .ms i.p { background: #b25cff; } .ms i.b { background: #3b7bff; }
.ms.big { display: flex; margin-top: 8px; gap: 5px; }
.ms.big .msg { flex: 1; gap: 2px; } .ms.big i { flex: 1; width: auto; height: 12px; }
/* the tower: each sector's time under its mini sectors */
.ms.st { gap: 5px; align-items: flex-start; }
.ms.st .msg { flex-direction: column; align-items: stretch; gap: 2px; }
.ms.st .mb { display: inline-flex; gap: 1px; justify-content: center; }
.ms.st i { height: 7px; flex: 1; min-width: 3px; }
.mst { font: 11px/1 'JetBrains Mono', monospace; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 42px; }
.mst.y { color: #e8c547; } .mst.g { color: #1fd17a; } .mst.p { color: #c084ff; }
:root[data-theme="light"] .mst.y { color: #a07c00; } :root[data-theme="light"] .mst.g { color: #0f9b55; } :root[data-theme="light"] .mst.p { color: #8a3fd1; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .mst.y { color: #a07c00; } :root[data-theme="auto"] .mst.g { color: #0f9b55; } :root[data-theme="auto"] .mst.p { color: #8a3fd1; } }
td.mscol, th.mscol { padding-left: 10px; }


.ob-msg { max-width: 460px; line-height: 1.5; }
.ob-msg a { color: var(--text); }
.ob-controls { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ob-controls label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.ob-controls a.btn { text-decoration: none; margin-left: auto; }

/* driver onboard */
.ob-body { display: flex; flex-direction: column; }
.ob-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.ob-dock { aspect-ratio: 16 / 9; width: min(100cqw, 100cqh * 16 / 9); background: #000; border: 1px dashed var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; overflow: hidden; }
.ob-dock.live { border-style: solid; border-color: var(--accent); }
.ob-controls { display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ob-controls label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.ob-controls a.btn { text-decoration: none; margin-left: auto; }

/* ---------- widget grid ---------- */
.grid-stack { margin: 6px 14px 0; }
.grid-stack-item-content { overflow: hidden !important; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.widget { height: 100%; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; min-height: 24px; cursor: move; user-select: none; touch-action: none; }
.panel-head h2 { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-head h2:has(+ .w-help) { flex: 0 1 auto; } /* the (i) sits right after the title and takes the free space instead */
/* when a widget is narrow, its subtitle gives way before its title does */
.panel-head > .muted.small { flex: 0 4 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-locked .panel-head { cursor: default; touch-action: auto; }
.w-close { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px; cursor: pointer; opacity: .55; }
.w-close:hover { color: var(--text); opacity: 1; }
.layout-locked .w-close { display: none; }
.w-body { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
.tower thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
/* canvases fill their widget and follow it when resized */
.canvas-box { position: relative; flex: 1; min-height: 40px; overflow: hidden; }
.canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
canvas { display: block; background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; }
.charts { display: flex; flex-direction: column; overflow: hidden; }
.charts .chart-head { margin: 2px 0 4px; }
.charts .canvas-box.tall { flex: 1.3; }
.chart-head + .canvas-box { margin-bottom: 6px; }
.count { color: var(--accent); }
.gs-12 .w-body, .grid-stack-item[gs-w] .w-body { overscroll-behavior: contain; }
.grid-stack > .grid-stack-item > .ui-resizable-se { opacity: .5; }
/* widgets resize from every edge and corner; only the bottom-right grip shows until you point at the widget */
.grid-stack > .grid-stack-item > .ui-resizable-ne, .grid-stack > .grid-stack-item > .ui-resizable-nw, .grid-stack > .grid-stack-item > .ui-resizable-sw { opacity: 0; transition: opacity .15s; }
.grid-stack > .grid-stack-item:hover > .ui-resizable-ne, .grid-stack > .grid-stack-item:hover > .ui-resizable-nw, .grid-stack > .grid-stack-item:hover > .ui-resizable-sw { opacity: .5; }
.grid-stack > .grid-stack-item > .ui-resizable-n { height: 6px; } /* (thin, so the title bar stays easy to grab for moving) */
.layout-locked .grid-stack-item > .ui-resizable-handle { display: none !important; }
.grid-stack-placeholder > .placeholder-content { background: #e1060018; border: 1px dashed var(--accent); border-radius: 8px; }
/* the battery column is pointless without telemetry; mini sectors drop when the tower is narrow */
/* narrower towers: the sector times replace the last lap first (they break that lap down), then go too */
@container (max-width: 900px) { .tower th.lastcol, .tower td.lastcol { display: none; } }
@container (max-width: 640px) { .tower th.mscol, .tower td.mscol { display: none; } }
/* laptop-width towers: a slimmer battery cell, then the interval goes (as on phones), so the battery stays in view */
@container (max-width: 580px) { .tower .mini { min-width: 0; gap: 4px; } .tower .mini .bar { width: 36px; } }
@container (max-width: 500px) { .tower th:nth-child(5), .tower td:nth-child(5) { display: none; } }
@container (max-width: 430px) { .tower .mini .bar, .tower th .est, .tower td.tla .num { display: none; } }
.tower { container-type: inline-size; }
/* field battery: one or two columns depending on widget width */
.field { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 14px; }
/* weather */
.wx-stat .value small { font-size: 10px; color: var(--muted); font-weight: 500; }
.wx-stat .label { white-space: nowrap; }
.wx-rain { color: #fff; background: #2b7fff; border-radius: 3px; padding: 0 4px; font-size: 9px; letter-spacing: .06em; }
.rain { color: #7ab8ff; font-weight: 700; }
/* driver widget adapts to its width */
.focus .w-body { container-type: inline-size; }
@container (max-width: 520px) {
  .focus-top { grid-template-columns: 1fr; justify-items: center; }
  .focus .power { width: 100%; }
  .telemetry { grid-template-columns: 1fr 1fr; }
  .tel-bars { grid-column: 1 / -1; }
  .laprow { grid-template-columns: 1fr 1fr; }
}

/* widgets menu */
.wm-wrap { position: relative; }
.wm { position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000; width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 90px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: 0 16px 40px var(--shadow); }
.wm-head { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; }
.wm-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.wm-item { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; padding: 6px; border-radius: 6px; cursor: pointer; }
.wm-item:hover { background: var(--panel-2); }
.wm-item input { margin-top: 3px; accent-color: var(--accent); }
.wm-item span { display: flex; flex-direction: column; }
.wm-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.wm-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; }
.wm-foot label { display: inline-flex; gap: 6px; align-items: center; }
.small-btn { padding: 2px 8px; font-size: 12px; margin-left: 6px; }
.link-btn { background: none; border: 0; color: inherit; cursor: pointer; float: right; font-size: 14px; }

/* phones: one column, widgets stack */
@media (max-width: 760px) {
  .grid-stack { margin: 6px 6px 0; }
  .topbar { gap: 10px; padding: 8px 10px; }
  .topbar .weather, .topbar .source .small { display: none; }
  .tower th:nth-child(5), .tower td:nth-child(5), .tower th:nth-child(7), .tower td:nth-child(7) { display: none; }
}
.check { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; } .check input { margin-top: 3px; accent-color: var(--accent); }

/* ---------- strategy & energy widgets ---------- */
.tgl { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 11px; font-weight: 700; padding: 2px 7px; cursor: pointer; text-transform: uppercase; letter-spacing: .04em; }
.tgl.on { color: var(--text); border-color: var(--accent); background: var(--tgl-on); }
.small-sel { padding: 2px 6px; font-size: 12px; }

.battles { display: flex; flex-direction: column; gap: 4px; }
.battle { display: grid; grid-template-columns: 32px 1fr auto 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.battle .bt-pair { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.battle .bt-pair .bt-soc { flex: 0 1 44px; min-width: 12px; }
.battle .bt-gap { text-align: center; white-space: nowrap; line-height: 1.15; }
.battle .bt-gap .small { display: block; font-size: 10px; }
.battle .bt-st { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.battle.hot { border-color: var(--dep); } .battle.hot .bt-st { color: var(--dep); }
.battle.warm .bt-st { color: var(--warn); }
.battle.def .bt-st { color: #7ab8ff; }
.bt-soc { display: inline-block; width: 44px; height: 6px; background: var(--track-bg); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.bt-soc i { display: block; height: 100%; }

.pw-loss { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pw-loss input { width: 70px; background: var(--sunken); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; font-family: var(--mono); }
.pw-sel { margin-bottom: 8px; padding: 8px 10px; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; gap: 4px; }
.pw-big { font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pw-big b { font-size: 20px; }
.mtable tr.sel td { background: var(--sel-bg); }
.mtable tbody tr { cursor: pointer; }

.lt-stints { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.lt-stint b { display: inline-block; width: 16px; text-align: center; }

.etable td, .etable th { padding: 3px 4px; }
.etable .ec-h { text-align: center; font-size: 10px; }
.etable .ec-c { min-width: 42px; }
.ec { display: flex; flex-direction: column; gap: 2px; padding: 2px; border-radius: 3px; border: 1px solid transparent; }
.ec i { display: block; height: 5px; border-radius: 2px; }
.ec i.d { background: var(--dep); } .ec i.h { background: var(--harv); }
.ec.cap { border-color: #ffcc0099; }

/* TV delay */
#delayBtn.on { border-color: var(--warn); color: var(--warn); }
.wm.dl { width: min(360px, calc(100vw - 24px)); }
.dl-row { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.dl-row input[type=range] { flex: 1; accent-color: var(--accent); }
.dl-row .btn { flex: 1; }

/* ---------- top bar: left | centred tabs | right ---------- */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.tb-left { display: flex; align-items: center; gap: 22px; min-width: 0; }
.tb-right { display: flex; align-items: center; gap: 16px; justify-content: flex-end; flex-wrap: wrap; min-width: 0; }
.view-tabs { display: flex; gap: 3px; padding: 3px; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; }
.vtab { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; padding: 6px 18px; border-radius: 6px; cursor: pointer; }
.vtab:hover { color: var(--text); }
.vtab[aria-selected="true"] { background: var(--accent); color: #fff; }
.vtab:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
@media (max-width: 1100px) { .topbar { grid-template-columns: 1fr; } .view-tabs { justify-self: center; order: -1; } .tb-right { justify-content: flex-start; } }

/* ---------- streaming tab ---------- */
.stream-view { display: flex; flex-direction: column; gap: 8px; padding: 8px 14px 8px; }
.sv-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sv-lbl { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.sv-save { display: inline-flex; gap: 4px; }
.sv-input { background: var(--sunken); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; font: inherit; font-size: 13px; width: 150px; }
.sv-msg a { color: var(--text); }
.sv-grid { flex: 1; min-height: 0; display: grid; gap: 12px; position: relative; }
.sv-tl { grid-area: tl; } .sv-bl { grid-area: bl; } .sv-tr { grid-area: tr; } .sv-br { grid-area: br; } .sv-main { grid-area: main; }
/* each box is the largest 16:9 that fits its cell, below its header and caption */
.sv-slot { container-type: size; display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; align-items: center; justify-content: center; }
.sv-head, .sv-cap, .sv-dock { width: min(100cqw, (100cqh - 70px) * 16 / 9); }
.sv-head { display: flex; gap: 6px; align-items: center; }
.sv-sel { flex: 1; min-width: 0; }
.sv-aud, .sv-swap { min-width: 38px; }
.sv-aud.on { border-color: var(--harv); }
.sv-cap { min-height: 20px; display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; font-size: 12px; }
.cap-tyre { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; border: 2px solid; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; }
.cap-soc { display: inline-block; width: 40px; height: 6px; background: var(--track-bg); border-radius: 3px; overflow: hidden; } .cap-soc i { display: block; height: 100%; }
.cap-atk { color: var(--dep); font-weight: 700; } .cap-def { color: #7ab8ff; font-weight: 700; } .cap-pit { background: var(--tag-bg); padding: 0 5px; border-radius: 3px; font-weight: 700; } .cap-auto { color: var(--muted); }
.sv-dock { aspect-ratio: 16 / 9; background: #000; border: 1px dashed var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center; }
.sv-dock.live { border: 1px solid var(--accent); }
.sv-ph b { font-size: 22px; letter-spacing: .06em; }
/* 1 + 4: main in the middle, corners hug the corners */
.lay-quad { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "tl main tr" "bl main br"; }
.lay-quad .sv-tl { align-items: flex-start; justify-content: flex-start; }
.lay-quad .sv-tr { align-items: flex-end; justify-content: flex-start; }
.lay-quad .sv-bl { align-items: flex-start; justify-content: flex-end; }
.lay-quad .sv-br { align-items: flex-end; justify-content: flex-end; }
/* 2 × 2 */
.lay-grid4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "tl tr" "bl br"; }
/* 1 + 3: big main, three stacked on the right */
.lay-side3 { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); grid-template-areas: "main tl" "main tr" "main bl"; }
.lay-side3 .sv-tl, .lay-side3 .sv-tr, .lay-side3 .sv-bl { align-items: flex-end; }
/* 1 + 2 */
.lay-duo { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "main tl" "main tr"; }
.lay-duo .sv-tl, .lay-duo .sv-tr { align-items: flex-end; }
/* picture in picture: one small window over the main's top-right corner */
.lay-pip { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "main"; }
.lay-pip .sv-tr { position: absolute; top: 44px; right: 12px; width: 26%; height: 32%; z-index: 2; }
.sv-tick { display: none; }
.sv-ticker { display: flex; gap: 16px; align-items: center; overflow: hidden; white-space: nowrap; font-size: 13px; padding: 6px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; min-height: 32px; }
.tk-ses { font-weight: 700; } .tk-lap { color: var(--muted); }
.tk-ts { font-weight: 700; font-size: 11px; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line); }
.tk-ts.ts-1 { color: #8ff0bd; border-color: #1fd17a; } .tk-ts.ts-2, .tk-ts.ts-4, .tk-ts.ts-6, .tk-ts.ts-7 { color: var(--warn); border-color: var(--warn); } .tk-ts.ts-5 { color: #ff9b9b; border-color: #ff3b3b; }
@media (max-width: 760px) {
  .sv-grid[class] { grid-template-columns: 1fr 1fr; grid-template-rows: auto; grid-template-areas: "main main" "tl tr" "bl br"; }
  .sv-slot { container-type: inline-size; }
  .sv-head, .sv-cap, .sv-dock { width: 100%; }
  .lay-pip .sv-tr { position: static; width: auto; height: auto; }
}

/* ---------- v2 ---------- */
/* toasts */
.toasts { position: fixed; top: 64px; right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #7ab8ff; border-radius: 6px; padding: 10px 12px; box-shadow: 0 10px 30px var(--shadow); display: flex; flex-direction: column; gap: 3px; font-size: 13px; cursor: pointer; transition: opacity .5s, transform .5s; }
.toast b { font-size: 14px; } .toast span { color: var(--muted); }
.toast.warn { border-left-color: var(--warn); } .toast.red { border-left-color: #ff3b3b; background: var(--toast-red); }
.toast.out { opacity: 0; transform: translateX(30px); }
/* alerts menu */
.fav-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.fav { background: var(--sunken); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 3px 7px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.fav.on { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 30%, var(--sunken)); }
/* spoiler curtain */
.topbar .wm { z-index: 2100; } /* menus from the top bar open over the spoiler curtain, which leaves the top bar usable */
.curtain { position: fixed; inset: 0; top: var(--curtain-top, 56px); z-index: 2000; background: var(--overlay); backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: center; }
.curtain-box { max-width: 460px; text-align: center; padding: 24px; }
.curtain-icon { font-size: 42px; } .curtain-box h2 { margin: 8px 0; font-size: 22px; }
.curtain-btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; } .curtain-btns a { text-decoration: none; }
/* TV delay: follow MultiViewer */
.dl-auto { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 4px; line-height: 1.4; } .dl-auto input { margin-top: 3px; accent-color: var(--accent); }
/* tower history */
/* team radio */
.rd-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.rd-bar label { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); }
.rcm li.radio-item.fav { background: var(--fav-bg); }
/* tyre strategy */
.tyres { display: flex; flex-direction: column; gap: 3px; }
.ty-scale { display: flex; justify-content: space-between; margin-left: 76px; margin-right: 68px; color: var(--muted); }
.ty-row { display: grid; white-space: nowrap; grid-template-columns: 22px 42px 1fr 62px; gap: 6px; align-items: center; font-size: 12px; cursor: pointer; }
.ty-bar { position: relative; height: 14px; background: var(--sunken); border-radius: 3px; }
.ty-seg { position: absolute; top: 1px; bottom: 1px; border-radius: 3px; background: var(--c); color: #000; font-size: 9px; font-weight: 700; font-style: normal; display: flex; align-items: center; justify-content: center; border-right: 2px solid var(--panel); overflow: hidden; }
.ty-seg.used { background: repeating-linear-gradient(135deg, var(--c) 0 5px, color-mix(in srgb, var(--c) 55%, #000) 5px 8px); }
/* sectors */
.sec-bar { display: flex; gap: 6px; margin-bottom: 6px; }
.mtable td.ob { color: #c77dff; font-weight: 700; }
.mtable.sec tbody tr { cursor: pointer; }
/* incidents */
.inc { display: grid; grid-template-columns: 42px auto 1fr auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--row-line); font-size: 12px; }
.inc-what { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inc-st { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line); white-space: nowrap; }
.inc-st.st-pen { color: #ff9b9b; border-color: #ff3b3b; } .inc-st.st-inv, .inc-st.st-after { color: var(--warn); border-color: var(--warn); } .inc-st.st-nfa { color: var(--muted); } .inc-st.st-noted { color: #7ab8ff; border-color: #34507a; }
.tl-list { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }
.bw-flag { margin-left: 3px; }
.inc-sts { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.wm.dl.replay .dl-row, .wm.dl.replay .dl-man { display: none; }

/* flag banner: red flag in red, yellows / SC / VSC in yellow */
.banner.flag-red, .banner.flag-yellow { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 14px; border-width: 1px 1px 1px 6px; }
.banner.flag-red { background: var(--red-bg); border-color: #ff3b3b; color: var(--red-fg); animation: flagpulse 1.6s ease-in-out infinite; }
.banner.flag-yellow { background: var(--yel-bg); border-color: #ffcc00; color: var(--yel-fg); }
@keyframes flagpulse { 50% { background: var(--red-bg2); } }
.fb-label { font-weight: 700; letter-spacing: .1em; padding: 2px 10px; border-radius: 4px; }
.flag-red .fb-label { background: #ff3b3b; color: #fff; }
.flag-yellow .fb-label { background: #ffcc00; color: #1a1400; }
.fb-time, .fb-src, .fb-stale { font-size: 12px; opacity: .8; }
.fb-src { text-transform: uppercase; letter-spacing: .06em; font-size: 10px; border: 1px solid currentColor; border-radius: 3px; padding: 0 5px; }
.fb-where { text-transform: capitalize; }
.fb-who { font-weight: 700; }
.fb-car { color: #fff; background: color-mix(in srgb, var(--c) 45%, #000); border-left: 3px solid var(--c); padding: 1px 6px; border-radius: 3px; margin-left: 3px; }
.fb-msg { font-style: italic; opacity: .85; text-transform: none; }

/* in-page F1 TV video */
.sv-dock, .ob-dock { position: relative; overflow: hidden; }
.sv-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 6px; }
.sv-dock:has(.sv-video) .sv-ph, .ob-dock:has(.sv-video) .ob-msg { display: none; }

/* data pages (Live / Strategy / Energy / Analysis) */
.page-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 12px 0; flex-wrap: wrap; }
.page-tabs.hidden { display: none; }
.ptab { background: none; border: 1px solid transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ptab:hover { color: var(--text); background: var(--panel-2); }
.ptab[aria-selected="true"] { color: var(--text); background: var(--panel-2); border-color: var(--line); box-shadow: inset 0 -2px 0 var(--accent); }
.ptab-hint { margin-left: auto; color: var(--muted); font-size: 12px; }
.wm-item.dim { opacity: .5; }

/* one ⚙ menu for widgets, TV delay, alerts and F1 TV */
#settingsBtn { font-size: 16px; line-height: 1; padding: 6px 10px; }
.st-menu { width: min(300px, calc(100vw - 24px)); padding: 6px; }
.st-item { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 8px; border-radius: 6px; cursor: pointer; font: inherit; text-decoration: none; }
.st-item:hover, .st-item:focus-visible { background: var(--panel-2); outline: none; }
.st-item > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.st-ic { font-size: 16px; text-align: center; }
.st-foot { border-top: 1px solid var(--line); margin-top: 6px; padding: 8px 8px 4px; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.st-sub > .wm-wrap { position: static; }
.st-sub > .wm-wrap > button { display: none; }
#delayChip { cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
@media (max-width: 760px) { .ptab-hint { display: none; } .page-tabs { padding: 6px 6px 0; } .ptab { padding: 6px 10px; } }

/* ================= v3 ================= */
/* spotlight */
.spotlight { display: flex; flex-direction: column; gap: 8px; }
.sp-empty { padding: 8px 2px; line-height: 1.5; }
.sp-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; gap: 8px; align-items: center; }
.sp-name { color: var(--text); font-size: 18px; letter-spacing: .02em; cursor: pointer; border-left: 4px solid var(--c); padding-left: 6px; }
.sp-duel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.sp-car { display: flex; flex-direction: column; gap: 3px; }
.sp-car.r { align-items: flex-end; text-align: right; }
.sp-car.r .sp-name { border-left: 0; border-right: 4px solid var(--c); padding: 0 6px 0 0; }
.sp-gap { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sp-gapv { font-size: 34px; font-weight: 600; line-height: 1; }
.sp-gapv small { font-size: 14px; color: var(--muted); }
.sp-spark { width: 120px; height: 28px; }
.sp-spark polyline { fill: none; stroke: var(--text); stroke-width: 1.6; }
.sp-spark .sp-1s { stroke: var(--faint-line); stroke-dasharray: 3 3; }
.sp-tyre b { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 2px solid var(--tc); color: var(--tc); border-radius: 50%; font-size: 10px; margin-right: 3px; }
.sp-tyre { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; }
.sp-soc { display: inline-block; width: 70px; height: 6px; background: var(--track-bg); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 4px; }
.sp-soc i { display: block; height: 100%; }
.sp-batt { display: flex; align-items: center; gap: 2px; }
.sp-speed { font-size: 15px; } .sp-speed small { color: var(--muted); font-size: 10px; }
.sp-call { padding: 7px 10px; border-radius: 6px; background: var(--panel-2); border-left: 3px solid var(--line); font-weight: 600; }
.sp-call.hot { border-left-color: var(--brk); } .sp-call.warm { border-left-color: var(--dep); } .sp-call.def { border-left-color: #3fc8ff; }
.sp-big { font-size: 22px; font-weight: 700; line-height: 1.2; }
.sp-big.sp-red { color: #ff6b6b; } .sp-big.sp-yellow { color: var(--warn); }
.sp-cars { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp-cars .sp-name { font-size: 15px; }
.sp-secs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sp-sec { background: var(--panel-2); border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; gap: 1px; border-top: 3px solid #f2c200; }
.sp-sec.pb { border-top-color: #1fd17a; } .sp-sec.ob { border-top-color: #b25cff; }
.sp-sec .mono:first-of-type { font-size: 17px; }
.sp-ms { display: flex; } .sp-ms .msg { flex: 1; gap: 2px; } .sp-ms i { flex: 1; width: auto; height: 10px; }
.sp-actions { display: flex; gap: 6px; }
#spMode { margin-left: auto; max-width: 110px; }

/* moments */
.mo-filters { display: inline-flex; gap: 3px; margin-left: auto; }
.moments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.moments li.mo { display: grid; grid-template-columns: 40px 20px 1fr auto; gap: 6px; align-items: start; padding: 5px 4px; border-bottom: 1px solid var(--row-line); cursor: pointer; border-left: 3px solid transparent; }
.moments li.mo:hover { background: var(--panel-2); }
.mo-t { color: var(--muted); font-size: 11px; padding-top: 2px; }
.mo-i { text-align: center; color: var(--muted); font-weight: 700; }
.mo-b { display: flex; flex-direction: column; min-width: 0; }
.mo-x { line-height: 1.3; }
.mo-d { color: var(--muted); font-size: 12px; line-height: 1.3; }
.mo.s1 .mo-x { color: var(--text-soft); font-size: 13px; }
.mo.s2 .mo-x { font-weight: 600; }
.mo.s3 .mo-x { font-weight: 700; font-size: 15px; }
.mo.s3 { border-left-color: var(--accent); }
.mo.k-flag.yellow { border-left-color: var(--warn); } .mo.k-flag.yellow .mo-i { color: var(--warn); }
.mo.k-flag.red { border-left-color: var(--brk); } .mo.k-flag.red .mo-i { color: var(--brk); }
.mo.k-flag.green .mo-i { color: var(--harv); }
.mo.k-pit .mo-i { border: 1.5px solid var(--muted); border-radius: 4px; font-size: 11px; line-height: 15px; }
.mo.k-stewards .mo-i { color: var(--dep); } .mo.k-out .mo-i { color: var(--brk); } .mo.k-fastest .mo-i, .mo.k-quali .mo-i { color: #b25cff; }
.mo.fresh { animation: moFresh 8s ease-out; }
@keyframes moFresh { 0% { background: #e1060033; } 100% { background: transparent; } }
.mo-lap { list-style: none; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 4px 2px; font-weight: 700; }
.mo-a { display: inline-flex; gap: 4px; }
.mo-a button { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 4px; cursor: pointer; font-size: 11px; padding: 1px 6px; }
.mo-a button:hover { border-color: var(--accent); }
.mo-empty { padding: 10px 4px; line-height: 1.5; }

/* outlook */
.ol-list { list-style: none; margin: 0; padding: 0; }
.ol-list li { display: grid; grid-template-columns: 52px 1fr auto; gap: 6px; align-items: center; padding: 5px 2px; border-bottom: 1px solid var(--row-line); cursor: pointer; }
.ol-list .sp-name { font-size: 14px; }
.ol-when { color: var(--muted); font-size: 12px; }
.ol-list li.ol-danger { background: #ff3b3b10; }
.ol-list li.ol-cut { display: block; border-bottom: 2px dashed var(--brk); padding: 2px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--brk); cursor: default; }
.ol-run { font-size: 11px; color: var(--harv); }
.ol-foot { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* compare */
.cmp-pick { display: inline-flex; gap: 4px; margin-left: auto; align-items: center; }
.cmp-body { display: flex; flex-direction: column; gap: 6px; }
.cmp-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; min-height: 24px; }
.cmp-who { font-weight: 700; font-size: 16px; border-left: 4px solid var(--c); padding-left: 6px; }
.cmp-vs { font-weight: 700; padding: 0 6px; }
.cmp-note { flex-basis: 100%; }
.cmp-canvas { position: relative; flex: 1; min-height: 200px; }
.cmp-cursor { position: absolute; top: 4px; display: flex; flex-direction: column; gap: 1px; font-size: 11px; background: var(--overlay); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; pointer-events: none; white-space: nowrap; }

/* session strip (in the session bar at the top) */
.tl-main { position: relative; height: 40px; }
.tl-main canvas { width: 100%; height: 40px; display: block; cursor: crosshair; touch-action: none; }
.tl-tip { position: absolute; top: 44px; z-index: 60; max-width: 320px; background: var(--overlay); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; pointer-events: none; line-height: 1.35; }
#tlState.live { border-color: var(--accent); color: var(--live-fg); }
#tlState.rw { border-color: #3fc8ff; color: var(--rw-fg); background: var(--rw-bg); }
@media (max-width: 760px) {
  .replaybar { padding: 6px 10px 4px; }
  .rp-row .small-btn { padding: 4px 6px; }
  .sp-gapv { font-size: 26px; }
  .sp-duel { gap: 6px; }
  .moments li.mo { grid-template-columns: 36px 18px 1fr auto; }
}


/* ================= light theme (⚙ → Preferences → Appearance) ================= */
:root[data-theme="light"] {
  --bg: #eef0f3; --panel: #ffffff; --panel-2: #f1f3f6; --line: #d5d9e0; --text: #14171c; --muted: #5d6570;
  --harv: #0e9a52; --dep: #d9650b; --warn: #a77a00; --thr: #0e9a52; --rpm: #3d6fd8;
  --sunken: #f6f7f9; --row-line: #e6e9ee; --track-bg: #e1e5eb; --tag-bg: #e3e7ee; --sel-bg: #fdeaea; --tgl-on: #fde3e2;
  --overlay: #ffffffee; --topbar-tint: #ffecec; --text-soft: #3a4049; --faint-line: #00000030; --shadow: #0002;
  --scroll: #c3c9d2; --fav-bg: #fdf0f0; --dot: #b7bdc6;
  --ok-bg: #dff6e9; --ok-fg: #0b6b3a; --ok-line: #19a35c;
  --warn-bg: #fff4cc; --warn-fg: #7a5a00;
  --bad-bg: #fde2e2; --bad-fg: #a31212; --bad-line: #e03131;
  --note-bg: #fff6d6; --note-line: #e8c95b; --note-fg: #6b5000;
  --red-bg: #fde0e0; --red-bg2: #fbcaca; --red-fg: #8f0d0d;
  --yel-bg: #fff3c4; --yel-fg: #5e4700;
  --toast-red: #fde7e7; --rw-bg: #dff3fb; --rw-fg: #0b5d7d; --live-fg: #c00500; --purple: #8a3fd1;
  --cv-grid: #e3e6eb; --cv-grid2: #edf0f3; --cv-axis: #7b838e; --cv-track: #c4cad3; --cv-zero: #cfd4db;
  --cv-strip: #e9ecf0; --cv-hover: #00000055; --cv-strong: #14171c; --cv-soft: #48505b;
  --hard: #6b7380;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
  --bg: #eef0f3; --panel: #ffffff; --panel-2: #f1f3f6; --line: #d5d9e0; --text: #14171c; --muted: #5d6570;
  --harv: #0e9a52; --dep: #d9650b; --warn: #a77a00; --thr: #0e9a52; --rpm: #3d6fd8;
  --sunken: #f6f7f9; --row-line: #e6e9ee; --track-bg: #e1e5eb; --tag-bg: #e3e7ee; --sel-bg: #fdeaea; --tgl-on: #fde3e2;
  --overlay: #ffffffee; --topbar-tint: #ffecec; --text-soft: #3a4049; --faint-line: #00000030; --shadow: #0002;
  --scroll: #c3c9d2; --fav-bg: #fdf0f0; --dot: #b7bdc6;
  --ok-bg: #dff6e9; --ok-fg: #0b6b3a; --ok-line: #19a35c;
  --warn-bg: #fff4cc; --warn-fg: #7a5a00;
  --bad-bg: #fde2e2; --bad-fg: #a31212; --bad-line: #e03131;
  --note-bg: #fff6d6; --note-line: #e8c95b; --note-fg: #6b5000;
  --red-bg: #fde0e0; --red-bg2: #fbcaca; --red-fg: #8f0d0d;
  --yel-bg: #fff3c4; --yel-fg: #5e4700;
  --toast-red: #fde7e7; --rw-bg: #dff3fb; --rw-fg: #0b5d7d; --live-fg: #c00500; --purple: #8a3fd1;
  --cv-grid: #e3e6eb; --cv-grid2: #edf0f3; --cv-axis: #7b838e; --cv-track: #c4cad3; --cv-zero: #cfd4db;
  --cv-strip: #e9ecf0; --cv-hover: #00000055; --cv-strong: #14171c; --cv-soft: #48505b;
  --hard: #6b7380;
  color-scheme: light;
  }
}
/* light-theme touches for things drawn on purpose in dark colours */
:root[data-theme="light"] .topbar, :root[data-theme="light"] .page-tabs { color: var(--text); }
:root[data-theme="light"] .ms i.y { background: #e0b100; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .ms i.y { background: #e0b100; } }
/* appearance switch */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 2px 0 10px; }
.seg button { background: var(--panel-2); color: var(--muted); border: 0; border-right: 1px solid var(--line); padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }

/* widget help: an (i) after each widget's title; pointing at the title or tapping the (i) explains the widget */
.w-help { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--muted); font: italic 700 10px/14px Georgia, serif; padding: 0; cursor: help; opacity: .6; margin-left: -4px; margin-right: auto; }
.w-help:hover, .w-help:focus-visible { opacity: 1; color: var(--text); border-color: var(--muted); }
.panel-head h2 { cursor: help; }
.help-pop { position: fixed; z-index: 2200; max-width: min(360px, calc(100vw - 16px)); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: 0 12px 32px var(--shadow); font-size: 12.5px; line-height: 1.45; pointer-events: none; }
.help-pop b { display: block; font-size: 13px; margin-bottom: 4px; letter-spacing: .02em; }
.help-pop p { margin: 0 0 6px; }
.help-pop ul { margin: 0; padding-left: 16px; color: var(--muted); }
.help-pop li { margin: 3px 0; }

/* the guided tour: the part being explained stays lit, the rest dims; a card explains it */
.tour { position: fixed; inset: 0; z-index: 4000; }
.tour-hole { position: fixed; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .62); outline: 2px solid var(--accent); transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-hole.none { outline: none; }
.tour-card { position: fixed; width: min(360px, calc(100vw - 16px)); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 12px; box-shadow: 0 16px 40px var(--shadow); transition: left .25s, top .25s; }
.tour-card h3 { margin: 2px 0 6px; font-size: 16px; }
.tour-text { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.tour-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour-btns { display: inline-flex; gap: 6px; }
.tour-btns .btn:disabled { opacity: .4; cursor: default; }
.tour-invite { position: fixed; left: 16px; bottom: 16px; z-index: 2300; display: flex; flex-direction: column; gap: 6px; width: min(300px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; box-shadow: 0 12px 32px var(--shadow); }
.tour-invite .tour-btns { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-card { transition: none; } }
.tour-skip { float: none; color: var(--muted); font-size: 12px; padding: 0; }
