/* Self-hosted fonts (SIL OFL, see web/fonts/LICENSE-*.txt). */
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("fonts/manrope-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url("fonts/manrope-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("fonts/manrope-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("fonts/manrope-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Bebas Neue"; font-weight: 400; font-display: swap; src: url("fonts/bebas-neue-latin-400-normal.woff2") format("woff2"); }

:root {
  --bg: #05060a;
  --panel: rgba(10, 12, 18, 0.72);
  --panel-border: rgba(255, 255, 255, 0.07);
  --ink: #f4f6fb;
  --muted: #8b93a7;
  --dim: #7f8799; /* ≥4.5:1 on every panel background */
  --gold: #e4b04a;
  --red: #c8102e;
  --purple: #c14bff;
  --green: #3ce07a;
  --yellow: #f1c40f;
  --soft: #da291c;
  --medium: #ffd12e;
  --hard: #f0f0ec;
  --inter: #43b02a;
  --wet: #0067ad;
  --row: 34px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body { display: flex; flex-direction: column; }

body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(200, 16, 46, 0.16), transparent 55%),
    radial-gradient(900px 500px at 110% 0%, rgba(228, 176, 74, 0.12), transparent 50%),
    linear-gradient(180deg, #07080d 0%, #05060a 100%);
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  z-index: 50;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  min-height: 72px;
  height: auto;
  flex: 0 0 auto;
  padding: 10px 22px;
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}
.brand { flex: 0 0 auto; }
.meeting { flex: 1 1 200px; min-width: 0; }
.meeting-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nation-flag {
  width: 28px;
  height: 20px;
  object-fit: cover;
  border-radius: 3px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.16);
}
.nation-flag-emoji {
  font-size: 22px;
  line-height: 1;
  flex: 0 0 auto;
}
.nation-flag:not([hidden]) + .nation-flag-emoji { display: none; }
.lap-block, .clock-block, .status-block { flex: 0 0 auto; }
.links { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.link-dot { flex: 0 0 auto; }

.brand-mark {
  font-family: "Bebas Neue", sans-serif;
  font-size: 38px;
  letter-spacing: 2px;
  line-height: 0.85;
  background: linear-gradient(90deg, #fff, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.42em;
  color: var(--gold);
  font-weight: 700;
}

.meeting-kicker {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--muted);
  font-weight: 700;
}
.meeting-name {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meeting-loc {
  font-size: 12px;
  color: var(--muted);
}

.lap-label, .wx-item span {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
  font-weight: 700;
}
.lap-value {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}
.lap-total { color: var(--dim); font-size: 22px; }
.clock-value {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.track-flag {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 18px;
  padding: 4px 10px;
  border-radius: 3px;
  text-align: center;
}
.track-flag.clear { background: #1a7a43; color: #fff; }
.track-flag.yellow { background: #e6c200; color: #111; }
.track-flag.sc, .track-flag.vsc { background: #e67e22; color: #111; }
.track-flag.red { background: #c0392b; color: #fff; animation: pulse 1s infinite; }
.session-status {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.wx {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  flex: 1 1 160px;
  min-width: 0;
}
.wx-item { display: flex; flex-direction: column; }
.wx-item b {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.link-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  box-shadow: 0 0 0 0 rgba(60, 224, 122, 0.6);
}
.link-dot.on {
  background: #3ce07a;
  animation: live 1.6s infinite;
}
.link-dot.off { background: #c0392b; }
/* Square = F1 feed, round = dashboard server. */
.link-dot.feed { border-radius: 2px; }
.link-dot.feed.off { background: #6b7385; }
.link-dot.feed.stalled { background: #e6c200; animation: none; }
.feed-banner.down { background: #c0392b; color: #fff; }
body.disconnected .board { filter: grayscale(0.7) brightness(0.7); transition: filter 0.3s; }
.seek-wrap { position: relative; flex: 1; display: flex; align-items: center; min-width: 120px; }
.seek-wrap input[type=range] { flex: 1; width: 100%; }
.lap-ticks { position: absolute; left: 8px; right: 8px; bottom: -3px; height: 5px; pointer-events: none; }
.lap-ticks i { position: absolute; top: 0; width: 1px; height: 5px; background: rgba(255,255,255,0.35); }
.map-wrap { position: relative; }
.map-source {
  position: absolute; left: 14px; bottom: 10px;
  font-size: 9px; letter-spacing: 0.16em; color: var(--dim); font-weight: 700;
}
kbd {
  font: 700 10px/1 Manrope, sans-serif;
  padding: 1px 4px;
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  color: var(--ink);
}

.feed-banner {
  flex: 0 0 auto;
  padding: 6px 22px;
  font-size: 12px;
  font-weight: 600;
  color: #111;
  background: #e4b04a;
  letter-spacing: 0.02em;
}
.feed-banner.replay { background: rgba(228,176,74,0.14); color: var(--gold); }

.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 100;
  background: var(--gold);
  color: #111;
  padding: 6px 10px;
  border-radius: 4px;
  font-weight: 700;
}
.skip-link:focus { top: 8px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.row:focus-visible, .lap-table tr:focus-visible { outline-offset: -2px; }
.widget:focus-visible { outline: 2px dashed var(--gold); outline-offset: -3px; }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(60, 224, 122, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(60, 224, 122, 0); }
}
@keyframes pulse {
  50% { opacity: 0.7; }
}

.wall {
  height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: minmax(480px, 1.15fr) minmax(320px, 0.95fr) minmax(280px, 0.85fr);
  grid-template-rows: minmax(0, 1fr) 240px;
  gap: 12px;
  padding: 12px;
}
.lap-plot { grid-column: 1 / 3; grid-row: 2; }
.speed-plot { grid-column: 3; grid-row: 2; }
.plots canvas,
.widget canvas {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 0;
  flex: 1;
}
#speedChart { cursor: crosshair; }
.plot-tools { display: flex; align-items: center; gap: 8px; }
.plot-hint { font-size: 10px; letter-spacing: 0.12em; color: var(--dim); }
.sess-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font: 700 10px/1 Manrope, sans-serif;
  letter-spacing: 0.14em;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.sess-btn.on { border-color: var(--gold); color: var(--gold); }
.row.picked { outline: 1px solid rgba(228,176,74,0.45); }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--panel-border);
  cursor: grab;
  touch-action: none;
  user-select: none;
  gap: 8px;
}
.panel-head h2 {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}
.drag-grip {
  width: 12px;
  height: 16px;
  flex: 0 0 auto;
  cursor: grab;
  opacity: 0.55;
  background-image: radial-gradient(circle, var(--muted) 1.15px, transparent 1.25px);
  background-size: 6px 6px;
  background-position: 0 0;
}
.panel-head:hover .drag-grip { opacity: 0.9; }
.widget.dragging .panel-head,
.panel-head:active { cursor: grabbing; }
.legend { display: flex; gap: 8px; font-size: 10px; color: var(--muted); font-weight: 700; }
.lg { padding: 1px 5px; border-radius: 3px; }
.lg.purple { background: rgba(193,75,255,.2); color: var(--purple); }
.lg.green { background: rgba(60,224,122,.15); color: var(--green); }
.lg.yellow { background: rgba(241,196,15,.15); color: var(--yellow); }

.tower-head, .row {
  display: grid;
  grid-template-columns: 28px minmax(118px, 1.25fr) 66px 70px 62px 50px 28px minmax(80px, 1.1fr);
  gap: 6px;
  align-items: center;
  padding: 0 10px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.tower-head {
  height: 22px;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
  font-weight: 700;
}
.tower-empty { padding: 18px 16px; line-height: 1.6; letter-spacing: 0.04em; font-size: 12px; }
.tower-body {
  overflow: auto;
  padding-bottom: 8px;
}
.row {
  height: var(--row);
  border-radius: 6px;
  margin: 1px 6px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 16px;
  font-weight: 600;
  position: relative;
}
.row:nth-child(odd) { background: rgba(255,255,255,0.025); }
/* Out of the session: muted, but text keeps readable contrast (no row opacity). */
.row.retired, .row.knocked-out { color: var(--dim); }
.row.retired *, .row.knocked-out * { color: var(--dim) !important; }
.row.retired .num, .row.knocked-out .num { background: #2b303b !important; color: #aab0bd !important; }
.row.retired img, .row.retired .tyre, .row.knocked-out img, .row.knocked-out .tyre { filter: grayscale(1); opacity: 0.6; }
.row.in-pit { background: rgba(228, 176, 74, 0.08); }
.row.leader { background: linear-gradient(90deg, rgba(228,176,74,0.16), transparent 55%); }
.row .pos {
  font-weight: 800;
  font-size: 18px;
}
.drv, .segments, .gap, .int, .last { min-width: 0; overflow: hidden; white-space: nowrap; }
.row { cursor: pointer; }
.row .drv {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.num {
  width: 22px;
  height: 18px;
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #0b0c10;
  background: #ccc;
}
.tla { letter-spacing: 0.08em; font-weight: 800; }
.row .tla { overflow: hidden; text-overflow: ellipsis; }
.team-logo {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #1a1d24;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
.team-logo img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
  object-position: center;
}
.team-dot {
  width: 3px;
  height: 18px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.delta {
  font-size: 11px;
  margin-left: 4px;
  color: var(--dim);
}
.delta.up { color: var(--green); }
.delta.down { color: #ff6b6b; }
.time.purple { color: var(--purple); }
.time.green { color: var(--green); }
.gap, .int, .last { font-weight: 700; }
.int.catching { color: var(--green); }
.tyre-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 800;
}
.tyre-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.35);
}
.tyre-pill.SOFT .tyre-dot { background: var(--soft); }
.tyre-pill.MEDIUM .tyre-dot { background: var(--medium); }
.tyre-pill.HARD .tyre-dot { background: var(--hard); }
.tyre-pill.INTERMEDIATE .tyre-dot { background: var(--inter); }
.tyre-pill.WET .tyre-dot { background: var(--wet); }
.age { color: var(--muted); font-weight: 600; font-size: 13px; }
.pits { text-align: center; color: var(--muted); }

.segments {
  display: flex;
  gap: 8px;
  align-items: center;
}
.seg-group {
  display: flex;
  gap: 1px;
  height: 10px;
}
.seg {
  width: 5px;
  height: 10px;
  background: #1d2230;
  border-radius: 1px;
}
.seg.s2048 { background: #f1c40f; }
.seg.s2049 { background: #3ce07a; }
.seg.s2051 { background: #c14bff; }
.seg.s2064, .seg.s2068 { background: #888; }
.seg.on { background: #8b93a7; }

.center {
  display: grid;
  grid-template-rows: 1fr 180px;
  gap: 12px;
  min-height: 0;
}
.map-wrap {
  flex: 1;
  min-height: 0;
  padding: 6px 10px 12px;
}
#trackSvg { width: 100%; height: 100%; }
.circuit {
  fill: none;
  stroke: url(#asphalt);
  stroke-width: 12;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.runoff {
  fill: none;
  stroke: rgba(255,255,255,0.05);
  stroke-width: 22;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.pit-lane {
  fill: none;
  stroke: rgba(228, 176, 74, 0.55);
  stroke-width: 6;
  stroke-dasharray: 8 6;
}
#startFinish {
  stroke: #fff;
  stroke-width: 4;
}
.sf-label, .corner-label {
  fill: var(--dim);
  font-family: Manrope, sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
}
.car-icon {
  transform-box: fill-box;
  transform-origin: center;
}
.car-body, .car-wing-r, .car-wing-f {
  stroke: #05060a;
  stroke-width: 1.15;
  stroke-linejoin: round;
}
.car-halo { stroke: #05060a; stroke-width: 0.7; }
.car-label {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12px;
  font-weight: 800;
  fill: #fff;
  paint-order: stroke;
  stroke: #05060a;
  stroke-width: 3px;
  pointer-events: none;
}
.map-meta {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--gold);
  font-weight: 700;
}

.rc-list {
  overflow: auto;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rc-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.rc-item b { color: var(--ink); font-weight: 600; }
.rc-flag {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.rc-flag.GREEN, .rc-flag.CLEAR { color: var(--green); }
.rc-flag.YELLOW { color: var(--yellow); }
.rc-flag.RED { color: #ff6b6b; }
.rc-flag.BLUE { color: #5dade2; }
.rc-flag.CHEQUERED { color: #fff; }
.rc-flag.SafetyCar { color: #e67e22; }

.tyre-key {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.tyre-key i {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 3px;
}
.t-soft { background: var(--soft); }
.t-medium { background: var(--medium); }
.t-hard { background: var(--hard); }
.t-inter { background: var(--inter); }
.t-wet { background: var(--wet); }

.strat-axis {
  display: flex;
  justify-content: space-between;
  padding: 4px 58px 0 86px;
  font-size: 10px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.strat-body {
  overflow: auto;
  padding: 6px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stint-row {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 8px;
  align-items: center;
  height: 22px;
}
.stint-drv {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: 15px;
  min-width: 0;
}
.stint-drv .tla { overflow: hidden; text-overflow: ellipsis; }
.stint-track {
  display: flex;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
  background: #141824;
  min-width: 0;
}
.stint-block {
  display: grid;
  place-items: center;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #111;
  min-width: 0;
  overflow: hidden;
  flex: 0 0 auto;
}
.stint-block.SOFT { background: var(--soft); color: #fff; }
.stint-block.MEDIUM { background: var(--medium); }
.stint-block.HARD { background: var(--hard); }
.stint-block.INTERMEDIATE { background: var(--inter); color: #fff; }
.stint-block.WET { background: var(--wet); color: #fff; }
.stint-block.UNKNOWN { background: #444; color: #ddd; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a3140; border-radius: 8px; }

.board-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 14px;
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--panel-border);
  flex: 0 0 auto;
}
.page-tabs {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}
.page-tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: 700 11px/1 Manrope, sans-serif;
  letter-spacing: 0.16em;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.page-tab.on { color: var(--gold); border-bottom-color: var(--gold); }
.page-tab-wrap { display: inline-flex; align-items: center; }
.page-del {
  background: transparent;
  border: 0;
  color: var(--dim);
  font-size: 11px;
  cursor: pointer;
  padding: 4px;
}
.page-del:hover { color: #ff6b6b; }
.nav-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
  color: var(--ink);
  font: 700 10px/1 Manrope, sans-serif;
  letter-spacing: 0.14em;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.nav-btn.ghost { color: var(--muted); }
.nav-btn.on { border-color: var(--gold); color: var(--gold); }
.nav-spacer { flex: 1; }
.add-wrap { position: relative; }
.add-menu {
  position: absolute;
  right: 0;
  top: 110%;
  background: #10131b;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 6px;
  z-index: 40;
  min-width: 180px;
}
.add-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--ink);
  font: 600 12px/1.4 Manrope, sans-serif;
  padding: 7px 8px;
  cursor: pointer;
  border-radius: 4px;
}
.add-menu button:hover { background: rgba(255,255,255,0.06); }

.board {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.board::after {
  content: "";
  display: block;
  height: var(--board-h, 0px);
  pointer-events: none;
}
.replay-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 14px 6px;
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--panel-border);
  flex: 0 0 auto;
}
.replay-bar .nav-btn {
  min-width: 76px;
  text-align: center;
}
.replay-bar input[type=range] { flex: 1; }
.replay-bar #replayLap { max-width: 80px; }
.replay-bar select {
  background: #10131b;
  color: var(--ink);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 4px;
}
#replayTime { font-family: "Barlow Condensed", sans-serif; font-size: 16px; min-width: 110px; }
.drv-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  overflow: auto;
  max-height: 72px;
  flex: 0 0 auto;
}
.speed-drop {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.speed-drop.over { outline: 1px dashed var(--gold); }
.trace-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 10px;
}
.trace-chip {
  border: 0;
  font: 800 12px/1 "Barlow Condensed", sans-serif;
  padding: 4px 8px;
  border-radius: 4px;
  color: #111;
  cursor: pointer;
}
.board.edit {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: calc(100% / 12) 56px;
}
.widget {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  container-type: inline-size;
  container-name: pitwidget;
  transition: box-shadow 0.15s ease;
}
.board.edit .widget { cursor: grab; }
.widget.dragging {
  cursor: grabbing;
  z-index: 40;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  opacity: 0.94;
  transition: none;
}
.widget.drop-target {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}
.drop-ghost {
  position: absolute;
  border: 2px dashed var(--gold);
  background: rgba(228, 176, 74, 0.12);
  border-radius: 14px;
  pointer-events: none;
  z-index: 5;
  box-sizing: border-box;
}
.widget-x {
  margin-left: 8px;
  background: transparent;
  border: 0;
  color: var(--dim);
  cursor: pointer;
  font-size: 14px;
  display: none;
}
.board.edit .widget-x { display: inline; }
.resize-h {
  display: none;
  position: absolute;
  right: 0; bottom: 0;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, var(--gold) 50%);
  opacity: 0.7;
}
.board.edit .resize-h { display: block; }

.lap-table {
  overflow: auto;
  flex: 1;
  min-height: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 15px;
  padding: 6px 10px 10px;
}
.lap-table table { width: 100%; border-collapse: collapse; }
.lap-table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--dim);
  font-weight: 700;
  padding: 4px 6px;
}
.lap-table td { padding: 4px 6px; font-variant-numeric: tabular-nums; }
.lap-table tr.push td { color: var(--ink); }
.lap-table tr.out td { color: var(--muted); }
.lap-table tr.cool td { color: var(--dim); }
.lap-table tr.on td { background: rgba(228,176,74,0.12); }
.kind {
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 800;
}
.kind.PUSH { color: var(--green); }
.kind.OUT { color: var(--yellow); }
.kind.COOL { color: var(--dim); }
.delta-best { color: var(--purple); }
.drv-tabs { display: flex; gap: 4px; padding: 0 10px 6px; flex-wrap: wrap; }
.drv-tab {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font: 800 12px/1 "Barlow Condensed", sans-serif;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.drv-tab.on { color: #111; }

.sess-pick { display: flex; gap: 6px; align-items: center; min-width: 0; flex-wrap: wrap; }
.sess-pick select {
  background: #10131b;
  color: var(--ink);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font: 600 11px Manrope, sans-serif;
  padding: 5px 6px;
  max-width: 180px;
  min-width: 0;
}
.load-status { font-size: 11px; color: var(--gold); min-width: 0; }
.settings {
  position: fixed;
  right: 12px;
  top: 130px;
  width: 240px;
  background: #10131b;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px;
  z-index: 30;
}
.settings h2 {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 10px;
}
.settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}
.settings input[type=range] { flex: 1; }
.settings b { width: 24px; text-align: right; color: var(--ink); }
.settings h2 + label, .settings-row + .plot-hint { margin-top: 4px; }
.settings h2:not(:first-child) { margin-top: 14px; }
.settings-row { display: flex; gap: 8px; }
.settings .file-btn { margin: 0; color: var(--ink); display: inline-flex; }
.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.settings .plot-hint { margin-top: 10px; line-height: 1.5; letter-spacing: 0.04em; }
.lap-table tr.plottable { cursor: pointer; }
.lap-table tr.plottable:hover td { background: rgba(255,255,255,0.04); }
.radar-wrap { flex: 1; min-height: 0; position: relative; }
.radar-wrap svg { width: 100%; height: 100%; }
.radar-center {
  fill: #f4f6fb;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  text-anchor: middle;
}
.radar-sub { fill: #8b93a7; font-size: 14px; font-family: Manrope, sans-serif; text-anchor: middle; }

.panel-head h2, .map-meta, .legend, .tyre-key, .plot-tools {
  min-width: 0;
}
.legend, .tyre-key, .plot-tools { flex-shrink: 1; }
.meeting-loc, .meeting-kicker {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@container pitwidget (max-width: 560px) {
  .tower-head, .row {
    grid-template-columns: 26px minmax(92px, 1.2fr) 64px 68px 60px 46px;
  }
  .c-pits, .c-sec, .pits, .segments { display: none; }
}
@container pitwidget (max-width: 480px) {
  .row .num, .row .delta { display: none; }
}
@container pitwidget (max-width: 420px) {
  .tower-head, .row {
    grid-template-columns: 24px minmax(72px, 1fr) 64px 66px 44px;
    gap: 4px;
  }
  .row { font-size: 15px; }
  .c-int, .int { display: none; }
  .strat-axis { padding: 4px 10px 0 64px; }
  .stint-row { grid-template-columns: 72px 1fr; }
}
@container pitwidget (max-width: 280px) {
  .tower-head, .row {
    grid-template-columns: 22px 1fr 54px 52px;
  }
  .c-tyre, .tyre-pill { display: none; }
  .panel-head .legend, .panel-head .tyre-key { display: none; }
  .row .num { display: none; }
}

@media (max-width: 820px) {
  .add-wrap, #settingsBtn { display: none; }
}

@media (max-width: 1100px) {
  .meeting-name { font-size: 22px; }
  .lap-value { font-size: 28px; }
  .lap-total { font-size: 18px; }
  .clock-value { font-size: 22px; }
  .wx { gap: 10px; }
  .wx-item b { font-size: 16px; }
  .sess-pick select { max-width: 150px; }
  .settings { top: auto; bottom: 12px; }
  #addPage, #resetLayout { display: none; }
  .nav-btn { padding: 7px 8px; }
  .nation-flag { width: 24px; height: 17px; }
}

@media (max-width: 720px), (max-height: 520px) and (max-width: 960px) {
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand meeting meeting link"
      "lap clock status status"
      "wx wx wx wx";
    gap: 6px 12px;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    min-height: 0;
  }
  .brand { grid-area: brand; }
  .meeting { grid-area: meeting; }
  .lap-block { grid-area: lap; }
  .clock-block { grid-area: clock; }
  .status-block { grid-area: status; justify-self: end; text-align: right; }
  .wx { grid-area: wx; justify-content: space-between; flex: unset; }
  .links { grid-area: link; align-self: center; flex-direction: row; }
  .feed-banner { padding: 6px 12px; }
  .brand-mark { font-size: 26px; }
  .brand-sub { font-size: 9px; letter-spacing: 0.28em; }
  .meeting-name { font-size: 18px; }
  .nation-flag { width: 22px; height: 15px; }
  .nation-flag-emoji { font-size: 18px; }
  .meeting-kicker { font-size: 9px; letter-spacing: 0.18em; }
  .meeting-loc { font-size: 11px; }
  .lap-value { font-size: 22px; }
  .lap-total { font-size: 15px; }
  .clock-value { font-size: 20px; }
  .track-flag { font-size: 14px; padding: 3px 8px; }
  .session-status { font-size: 10px; }

  .board-nav {
    flex-wrap: wrap;
    padding: 6px 10px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .page-tab { padding: 8px 10px; }
  .nav-spacer { display: none; }
  #addPage, .add-wrap, #editToggle, #resetLayout, #settingsBtn { display: none; }
  .sess-pick {
    flex: 1 1 100%;
    order: 8;
  }
  .sess-pick select {
    flex: 1;
    max-width: none;
    font-size: 16px;
  }
  .load-status { order: 9; }

  .replay-bar .seek-wrap {
    flex: 1 1 100%;
    order: 8;
    width: 100%;
  }
  .replay-bar .nav-btn { min-width: 58px; }
  #replayTime { min-width: 0; font-size: 14px; }
  .replay-bar select { font-size: 16px; }

  .settings {
    left: 12px;
    right: 12px;
    width: auto;
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  body[data-layout="phone"] .panel-head {
    cursor: default;
    touch-action: pan-y;
  }
  body[data-layout="phone"] .drag-grip { display: none; }
}

@media (max-height: 500px) and (max-width: 960px) {
  .wx, .brand-sub, .meeting-kicker, .meeting-loc { display: none; }
  .topbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px 14px;
    padding: 4px 10px;
    padding-top: max(4px, env(safe-area-inset-top));
  }
  .meeting { flex: 1 1 auto; }
  .sess-pick, .load-status { display: none; }
  .replay-bar { flex-wrap: nowrap; }
  .replay-bar .seek-wrap {
    flex: 1 1 auto;
    order: 0;
    width: auto;
  }
}

@media (min-width: 1800px) {
  .board {
    max-width: 1760px;
    margin: 0 auto;
    width: 100%;
  }
}



@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

/* Sign-in page */
body.login-page { display: grid; place-items: center; min-height: 100vh; overflow: auto; }
.login-card {
  width: min(360px, calc(100vw - 32px));
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  display: grid;
  gap: 22px;
}
.login-card form { display: grid; gap: 10px; }
.login-card label { font-size: 11px; letter-spacing: 0.2em; color: var(--muted); font-weight: 700; }
.login-card input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--ink);
  padding: 10px 12px;
  font: 600 16px Manrope, sans-serif;
}
.login-card button { justify-self: start; padding: 10px 16px; }
.login-error { color: #ff6b6b; font-size: 13px; }

/* Strategy widgets */
.pit-window, .tyre-deg { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.pit-window { flex: 1; }
.pit-summary { padding: 8px 12px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.pit-summary b { color: var(--ink); }
.pit-summary .down, .tyre-deg .down { color: #ff6b6b; }
.pit-summary .up, .tyre-deg .up { color: var(--green); }
.pit-window tr[data-focus] { cursor: pointer; }
.pit-window tr.on td { background: rgba(228,176,74,0.12); }
.pit-window tr.tight td:last-child { color: var(--yellow); }
.pit-loss { gap: 4px; font-size: 10px; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.pit-loss input { width: 52px; background: rgba(255,255,255,0.04); border: 1px solid var(--panel-border); color: var(--ink); border-radius: 4px; padding: 2px 4px; }
.tyre-deg { max-height: 45%; font-family: "Barlow Condensed", sans-serif; font-size: 14px; padding: 4px 10px; }
.tyre-deg table { width: 100%; border-collapse: collapse; }
.tyre-deg th { text-align: left; font: 700 9px/1 Manrope, sans-serif; letter-spacing: 0.14em; color: var(--dim); padding: 4px; }
.tyre-deg td { padding: 3px 4px; }
.tyre-deg .tyre-pill { display: inline-flex; }
.plot-hint.pad { padding: 12px; }
.sess-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Alerts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  background: #10131b; border: 1px solid var(--panel-border); border-left: 4px solid var(--gold);
  padding: 10px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--ink);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45); transition: opacity 0.5s, transform 0.5s;
}
.toast.flag.red { border-left-color: #c0392b; }
.toast.flag.sc, .toast.flag.vsc { border-left-color: #e67e22; }
.toast.flag.yellow { border-left-color: #e6c200; }
.toast.flag.clear { border-left-color: #1f8a4c; }
.toast.out { border-left-color: #ff6b6b; }
.toast.leaving { opacity: 0; transform: translateY(8px); }
.settings label input[type=checkbox] { accent-color: var(--gold); }

/* ==== racepicture ==== */
.rp-battles { flex: 1; min-height: 0; overflow: auto; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 6px; }
.rp-battle {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "pos pair int" "notes notes notes";
  align-items: center; gap: 2px 8px; width: 100%; text-align: left; cursor: pointer;
  background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border); border-radius: 8px;
  padding: 6px 8px; color: var(--ink); font: 600 12px/1.3 Manrope, sans-serif;
}
.rp-battle:hover { background: rgba(255,255,255,0.06); }
.rp-battle.on { border-color: var(--gold); background: rgba(228,176,74,0.10); }
.rp-battle.drs { border-left: 3px solid var(--green); }
.rp-bpos { grid-area: pos; font: 800 14px/1 "Barlow Condensed", sans-serif; color: var(--muted); }
.rp-pair { grid-area: pair; display: flex; align-items: center; gap: 6px; min-width: 0; }
.rp-on { font-size: 10px; color: var(--dim); }
.rp-int { grid-area: int; font: 800 16px/1 "Barlow Condensed", sans-serif; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.rp-drs { font: 800 9px/1 Manrope, sans-serif; letter-spacing: 0.1em; color: #05060a; background: var(--green); border-radius: 3px; padding: 2px 4px; }
.rp-notes { grid-area: notes; font-size: 11px; color: var(--muted); }
.rp-trend.closing { color: #ff8a8a; }
.rp-trend.opening { color: var(--green); }
.rp-chip { display: inline-block; font: 800 12px/1 "Barlow Condensed", sans-serif; letter-spacing: 0.08em; padding: 3px 6px; border-radius: 3px; }
.rp-thr { gap: 4px; font-size: 10px; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.rp-thr select, .rp-rule-form select, .rp-rule-form input {
  background: #10131b; border: 1px solid var(--panel-border); color: var(--ink); border-radius: 4px; padding: 2px 4px; font: 600 12px Manrope, sans-serif;
}
.rp-movers td, .rp-champ td { padding: 3px 6px; }
.rp-movers tr.retired td { color: var(--dim); }
.rp-gain.up, .rp-plus { color: var(--green); }
.rp-gain.down { color: #ff6b6b; }
.rp-gain.out { color: var(--dim); }
.rp-pick { background: none; border: 0; padding: 0; cursor: pointer; }
.rp-pick[aria-pressed="true"] .rp-chip { outline: 2px solid var(--gold); outline-offset: 1px; }
.rp-team { display: inline-flex; align-items: center; gap: 6px; }
.rp-team i { width: 4px; height: 14px; border-radius: 2px; display: inline-block; }
.rp-rules { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.rp-rule-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rp-rule-form #rpRuleType { flex: 1 1 100%; }
.rp-rule-form input { width: 64px; }
.rp-rule-form [hidden] { display: none; }
.rp-rule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.rp-rule-list li { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 4px 6px; border: 1px solid var(--panel-border); border-radius: 6px; }
.rp-rule-list li.plot-hint { border: 0; }
.rp-rule-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.rp-rule-x:hover { color: var(--ink); }
.toast.rule { border-left-color: var(--purple); }
.toast.rule.warn { border-left-color: var(--yellow); }
@media (max-width: 1400px) { .rp-hide-narrow { display: none; } }
/* ==== timingdata (DATA page: sectors, heatmap, speed traps, pit stops, weather) ==== */
.td-sectors, .td-traps, .td-pits { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; }
.td-sectors .lap-table, .td-pits .lap-table { font-size: 14px; }
.td-sectors tfoot td { border-top: 1px solid var(--panel-border); color: var(--muted); font-weight: 700; }
.td-drv { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; white-space: nowrap; }
.td-drv i { width: 3px; height: 13px; border-radius: 2px; display: inline-block; }
.td-purple { color: var(--purple); }
.td-strong { color: var(--ink); font-weight: 700; }
.td-dim { color: var(--dim); }
.td-pits .up { color: var(--green); }
.td-pits .down { color: #ff6b6b; }
.td-pits .td-teams { margin-top: 10px; }
.td-tyre { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.td-tyre i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.td-tyre.SOFT i { background: var(--soft); }
.td-tyre.MEDIUM i { background: var(--medium); }
.td-tyre.HARD i { background: var(--hard); }
.td-tyre.INTERMEDIATE i { background: var(--inter); }
.td-tyre.WET i { background: var(--wet); }
.td-board { list-style: none; padding: 6px 10px 10px; font-family: "Barlow Condensed", sans-serif; font-size: 15px; }
.td-board li { display: grid; grid-template-columns: 22px 48px 1fr auto; align-items: center; gap: 6px; padding: 2px 0; }
.td-board li.top .td-speed { color: var(--purple); }
.td-pos { color: var(--dim); font-variant-numeric: tabular-nums; text-align: right; }
.td-bar { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.td-bar i { display: block; height: 100%; border-radius: 3px; opacity: 0.85; }
.td-speed { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.td-speed small { color: var(--dim); font-size: 10px; font-weight: 600; }
.td-tip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-heat { cursor: crosshair; }
.td-wx-now { padding: 4px 12px 0; letter-spacing: 0.08em; }
.td-wx-now b { color: var(--ink); }
.td-wx-now .td-rain { color: #5aa9ff; }
.widget[data-type="speedtraps"] .plot-tools { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.widget[data-type="speedtraps"] .sess-btn { padding: 4px 6px; }
/* ==== stewards ==== */
.stw { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); flex: 1; min-height: 0; }
.stw-list, .stw-side { overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.stw-side { border-left: 1px solid var(--panel-border); }
.stw-items { list-style: none; padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.stw-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 6px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); border-left: 3px solid var(--dim);
  font-size: 12px; color: var(--muted);
}
.stw-item.open { border-left-color: var(--yellow); }
.stw-item.penalty { border-left-color: #ff6b6b; }
.stw-item.closed { border-left-color: var(--green); }
.stw-where { font: 700 13px/1.1 "Barlow Condensed", sans-serif; color: var(--ink); }
.stw-where small { display: block; font: 500 10px/1.3 Manrope, sans-serif; color: var(--dim); }
.stw-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stw-main b { color: var(--ink); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; }
.stw-reason { overflow-wrap: anywhere; }
.stw-cars { display: flex; flex-wrap: wrap; gap: 4px; }
.stw-car {
  display: inline-block; min-width: 34px; text-align: center; padding: 1px 5px; border-radius: 3px;
  font: 800 11px/1.3 "Barlow Condensed", sans-serif; letter-spacing: 0.04em;
}
.stw-chip {
  font: 800 10px/1 Manrope, sans-serif; letter-spacing: 0.1em; padding: 4px 6px; border-radius: 4px;
  border: 1px solid currentColor; white-space: nowrap; color: var(--muted);
}
.stw-chip.open { color: var(--yellow); }
.stw-chip.penalty { color: #ff6b6b; }
.stw-chip.closed { color: var(--green); }
.stw-table { font-size: 14px; padding-top: 2px; }
.stw-table td small { display: block; font: 700 9px/1.2 Manrope, sans-serif; letter-spacing: 0.08em; color: var(--dim); }
.stw-table tr.pending td { background: rgba(255, 107, 107, 0.08); }
.stw-table .down { color: #ff6b6b; }
.stw-table .up { color: var(--green); }
.stw-dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.stw-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--dim); display: inline-block; }
.stw-dots i.on { background: var(--muted); border-color: var(--muted); }
.stw-dots.warn i.on { background: var(--yellow); border-color: var(--yellow); }
.stw-dots.pen i.on { background: #ff6b6b; border-color: #ff6b6b; }
a.sess-btn { text-decoration: none; display: inline-block; }
.stw-report { color: var(--gold); }
.radio-filter {
  background: #10131b; color: var(--ink); border: 1px solid var(--panel-border); border-radius: 4px;
  font: 700 10px/1 Manrope, sans-serif; letter-spacing: 0.1em; padding: 3px 4px; max-width: 130px;
}
.radio-list { overflow: auto; flex: 1; min-height: 0; }
.radio-items { list-style: none; padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.radio-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px;
  font: 600 13px/1.2 "Barlow Condensed", sans-serif; color: var(--muted);
}
.radio-item.new { background: rgba(228, 176, 74, 0.1); }
.radio-item.playing { background: rgba(60, 224, 122, 0.08); }
.radio-play { min-width: 34px; }
.radio-lap { color: var(--ink); min-width: 28px; }
.radio-new { font: 800 9px/1 Manrope, sans-serif; letter-spacing: 0.12em; color: var(--gold); }
.radio-err { font: 800 9px/1 Manrope, sans-serif; letter-spacing: 0.12em; color: #ff6b6b; }
@media (max-width: 720px) {
  .stw { grid-template-columns: 1fr; }
  .stw-side { border-left: 0; border-top: 1px solid var(--panel-border); }
}
/* ==== telemetry ==== */
/* TELEMETRY (lap compare), TRACK DOMINANCE, LIVE TELEMETRY, DRIVER FOCUS */
.tlm, .dom, .lt, .fc { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tlm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 10px; }
.tlm-sel {
  background: #10131b; color: var(--ink); border: 1px solid var(--panel-border); border-radius: 4px;
  font: 700 11px/1 Manrope, sans-serif; padding: 3px 4px; max-width: 150px;
}
.tlm-chips { padding: 0; }
.tlm-main { flex: 1; min-height: 0; display: flex; gap: 6px; padding: 0 8px 4px 0; }
.widget .tlm-chart { flex: 1; min-width: 0; cursor: crosshair; touch-action: pan-y; }
.tlm-map { flex: 0 0 32%; max-width: 340px; min-width: 110px; align-self: flex-start; height: auto; aspect-ratio: 1; }
.tlm-outline { fill: none; stroke: #3a4254; stroke-width: 14; stroke-linejoin: round; }
.tlm-note:empty { display: none; }
.tlm-note { padding: 0 10px 6px; }
@container pitwidget (max-width: 520px) { .tlm-map { display: none; } }

.dom-map { flex: 1; min-height: 0; width: 100%; }
.dom-base { fill: none; stroke: #2a3140; stroke-width: 26; stroke-linejoin: round; }
.dom-seg { fill: none; stroke-width: 14; stroke-linecap: butt; stroke-linejoin: round; }
.dom-sf { fill: var(--ink); stroke: #05060a; stroke-width: 4; }
.dom-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 12px 8px; font: 600 13px/1.3 "Barlow Condensed", sans-serif; }
.dom-legend li { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.dom-legend b { color: var(--ink); }
.dom-legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.dom-pct { color: var(--ink); font-weight: 800; }

.lt { overflow: auto; padding: 4px 10px 8px; gap: 8px; }
.lt-car { display: flex; gap: 10px; border-left: 4px solid var(--muted); padding-left: 8px; }
.lt-name { display: flex; flex-direction: column; min-width: 40px; font: 800 16px/1.2 "Barlow Condensed", sans-serif; }
.lt-name span { color: var(--muted); font-size: 12px; }
.lt-data, .fc-live { flex: 1; min-width: 0; }
.lt-top { display: flex; align-items: baseline; gap: 10px; font-family: "Barlow Condensed", sans-serif; }
.lt-speed { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lt-speed small { font-size: 11px; color: var(--muted); font-weight: 600; }
.lt-gear { font-size: 16px; font-weight: 800; color: var(--gold); }
.lt-drs { font: 800 10px/1 Manrope, sans-serif; letter-spacing: 0.1em; padding: 3px 5px; border-radius: 3px; border: 1px solid var(--panel-border); color: var(--muted); }
.lt-drs.elig { border-color: var(--yellow); color: var(--yellow); }
.lt-drs.open { background: var(--green); border-color: var(--green); color: #05060a; }
.lt-row { display: grid; grid-template-columns: 30px 1fr 48px; align-items: center; gap: 6px; font: 700 10px/1.6 Manrope, sans-serif; color: var(--muted); }
.lt-val { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.lt-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.07); overflow: hidden; }
.lt-bar i { display: block; height: 100%; border-radius: 4px; transition: width 0.12s linear; }
.lt-bar.thr i { background: var(--green); }
.lt-bar.brk i { background: #ff4d5e; }
.lt-bar.rpm i { background: var(--gold); }

.fc { overflow: auto; padding: 6px 12px 10px; gap: 8px; }
.fc-head { display: flex; align-items: center; gap: 12px; border-left: 5px solid var(--muted); padding-left: 10px; }
.fc-pos { font: 400 40px/1 "Bebas Neue", sans-serif; }
.fc-name { display: flex; flex-direction: column; font: 600 13px/1.3 Manrope, sans-serif; color: var(--muted); }
.fc-name b { font: 800 22px/1 "Barlow Condensed", sans-serif; color: var(--ink); }
.fc-name small { font-size: 11px; }
.fc-status { margin-left: auto; font: 800 12px/1 Manrope, sans-serif; letter-spacing: 0.12em; color: var(--yellow); }
.fc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.fc-box { background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border); border-radius: 8px; padding: 8px 10px; font-size: 13px; min-width: 0; }
.fc-box h3 { font: 700 10px/1 Manrope, sans-serif; letter-spacing: 0.14em; color: var(--dim); margin-bottom: 6px; }
.fc-box p { margin: 3px 0; line-height: 1.5; }
.fc-k { display: inline-block; min-width: 56px; font: 700 10px/1 Manrope, sans-serif; letter-spacing: 0.12em; color: var(--muted); }
.fc-trend { font-size: 11px; color: var(--muted); white-space: nowrap; }
.fc-trend.closing { color: var(--green); }
.fc-trend.opening { color: #ff6b6b; }
.fc-stints { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.fc-laps, .fc-rc { grid-column: 1 / -1; }
.fc-msgs { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.fc-lap { color: var(--gold); font-weight: 700; margin-right: 4px; }
/* ==== simulator ==== */
.sim-root { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.sim-root .sim-out { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.sim-pace .sim-out { flex: 0 1 auto; max-height: 48%; }
.sim-pace canvas { flex: 1; min-height: 90px; }
.sim-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); flex: 1; min-height: 0; }
.sim-split .sim-out { min-height: 0; }
.sim-split canvas { min-height: 0; height: 100%; }
@container pitwidget (max-width: 620px) {
  .sim-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(120px, 40%); }
}
.sim-root > .sim-out, .sim-root > .sim-note + .sim-out { flex: 1; }
.sim-summary { padding: 6px 12px 2px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.sim-summary b { color: var(--ink); }
.sim-table { padding: 2px 8px 8px; font-size: 14px; }
.sim-table td { padding: 3px 6px; white-space: nowrap; }
.sim-table .tyre-pill { display: inline-flex; margin-right: 3px; }
.sim-table .up, .sim-verdict.up { color: var(--green); }
.sim-table .down, .sim-verdict.down { color: #ff6b6b; }
.sim-table tr.sim-forced td { box-shadow: inset 0 -1px 0 var(--gold); }
.sim-dim { color: var(--dim); }
.sim-swatch { display: inline-block; width: 3px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 1px; }
.sim-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 12px 2px; }
.sim-controls select, .sim-field input {
  background: #10131b; border: 1px solid var(--panel-border); color: var(--ink);
  border-radius: 4px; padding: 2px 4px; font: 600 11px/1.4 Manrope, sans-serif;
}
.sim-field { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.sim-field input { width: 58px; }
.sim-settings { padding: 0 12px; }
.sim-settings summary { cursor: pointer; font-size: 10px; letter-spacing: 0.14em; font-weight: 700; color: var(--muted); padding: 4px 0; }
.sim-settings .sim-controls { padding: 2px 0; }
.sim-settings .plot-hint { letter-spacing: 0.04em; line-height: 1.5; padding-bottom: 4px; }
.sim-verdict { margin: 4px 12px; padding: 6px 10px; border: 1px solid currentColor; border-radius: 4px; font: 700 12px/1.3 Manrope, sans-serif; letter-spacing: 0.1em; }
.sim-tag { margin-left: 6px; padding: 0 4px; border-radius: 3px; font: 700 9px/15px Manrope, sans-serif; letter-spacing: 0.1em; vertical-align: 1px; }
.sim-tag.cheap { background: #e67e22; color: #05060a; }
.sim-tag.free { background: var(--green); color: #05060a; }
.sim-flag { color: #f39c4a; }
.sim-seq .tyre-pill { font-size: 12px; }
/* More default pages than fit a phone's width: let the tab strip scroll. */
.page-tabs { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
/* ==== controlroom ==== */
/* Bookmarks (A7), shared control room (X3), wall mode (L11), video sync (X4). */
.bm-ticks { position: absolute; left: 8px; right: 8px; top: -2px; height: 6px; pointer-events: none; }
.bm-ticks i {
  position: absolute; top: 0; width: 7px; height: 7px; margin-left: -3px;
  background: var(--gold); border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6);
}
.room-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 10px/1 Manrope, sans-serif; letter-spacing: 0.14em; color: var(--gold);
  border: 1px solid rgba(228,176,74,0.5); border-radius: 999px; padding: 2px 2px 2px 10px;
}
.room-chip[hidden] { display: none; }
.room-chip .nav-btn { padding: 5px 8px; border-radius: 999px; }
body.following #replayBar .seek-wrap { opacity: 0.55; }
.widget-pop {
  background: transparent; border: 0; color: var(--dim); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px;
}
.widget-pop:hover, .widget-pop:focus-visible { color: var(--gold); }
body.kiosk .topbar, body.kiosk .board-nav, body.kiosk .replay-bar, body.kiosk .skip-link { display: none; }
body.kiosk-widget .widget-pop, body.kiosk-widget .widget-x, body.kiosk-widget .drag-grip, body.kiosk-widget .resize-h { display: none; }
body.kiosk-widget .panel-head { cursor: default; }
.kiosk-exit {
  position: fixed; top: 6px; right: 8px; z-index: 60;
  background: rgba(10,12,18,0.92); border: 1px solid var(--panel-border); border-radius: 999px;
  color: var(--muted); font: 700 9px/1 Manrope, sans-serif; letter-spacing: 0.16em; padding: 5px 9px; cursor: pointer;
}
.kiosk-exit:hover, .kiosk-exit:focus-visible { color: var(--ink); border-color: var(--gold); }
.panel .file-btn { position: relative; }
.bm-form, .video-form, .room-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px;
  border-bottom: 1px solid var(--panel-border);
}
.bm-form input[type=text], .video-form input[type=text], .room-form input[type=text], .video-offset input {
  background: rgba(255,255,255,0.04); border: 1px solid var(--panel-border); border-radius: 6px;
  color: var(--ink); font: 600 12px/1.2 Manrope, sans-serif; padding: 6px 8px; min-width: 0;
}
.bm-form input[type=text], .video-form input[type=text], .room-form input[type=text] { flex: 1 1 140px; }
.bm-form input::placeholder, .video-form input::placeholder, .room-form input::placeholder { color: var(--dim); }
.video-offset input { width: 76px; }
.bm-check, .video-offset {
  display: inline-flex; align-items: center; gap: 5px;
  font: 700 10px/1 Manrope, sans-serif; letter-spacing: 0.12em; color: var(--muted);
}
.bm-check input { accent-color: var(--gold); }
.bm-list, .room-list { list-style: none; overflow: auto; flex: 1; min-height: 0; padding: 4px 0; }
.bm-item, .room-item {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px;
  padding: 5px 12px; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 12px;
}
.bm-item .bm-jump { font-family: "Barlow Condensed", sans-serif; font-size: 13px; letter-spacing: 0.04em; white-space: nowrap; }
.bm-item .bm-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bm-meta { font-size: 10px; letter-spacing: 0.08em; color: var(--dim); white-space: nowrap; }
.bm-item .bm-del { display: inline; margin: 0; }
.bm-empty { padding: 10px 12px; letter-spacing: 0.04em; line-height: 1.5; }
.room-name { font-weight: 700; color: var(--ink); }
.room-list .plot-hint { padding: 8px 12px; }
.room-status { padding: 8px 12px 4px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.video-wrap { position: relative; flex: 1; min-height: 0; background: #000; display: flex; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; display: none; }
.video-wrap.has-video video { display: block; }
.video-status { padding: 6px 12px; letter-spacing: 0.04em; }
/* ==== weekend ==== */
.weekend-body, .xc-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wk-caption { padding: 8px 10px 0; }
.wk-key { color: var(--purple); }
.wk-table table { width: auto; min-width: 40%; }
.wk-table th[scope="col"] { text-align: right; padding: 4px 12px; }
.wk-table td { text-align: right; white-space: nowrap; padding: 4px 12px; }
.wk-table td small { display: block; font-size: 11px; color: var(--muted); line-height: 1.1; }
.wk-table td.wk-best { color: var(--purple); font-weight: 700; background: rgba(193,75,255,0.12); }
.wk-table td.wk-none { color: var(--dim); }
.wk-table th.wk-cur { color: var(--gold); }
.wk-table td.wk-cur:not(.wk-best) { background: rgba(228,176,74,0.06); }
.wk-drv { text-align: left; font-weight: 800; letter-spacing: 0.06em; white-space: nowrap; color: var(--ink); }
.wk-team { display: inline-block; width: 4px; height: 14px; border-radius: 2px; margin-right: 6px; vertical-align: -2px; }
.wk-export { position: relative; }
.wk-export summary { list-style: none; display: inline-block; }
.wk-export summary::-webkit-details-marker { display: none; }
.wk-export[open] summary { border-color: var(--gold); color: var(--gold); }
.wk-export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: #10131b;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  min-width: 140px;
}
.wk-export-menu a { text-decoration: none; text-align: left; }
.wk-export-menu a:hover, .wk-export-menu a:focus-visible { color: var(--gold); border-color: var(--gold); }
.xc-pick { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 10px 0; font: 700 10px/1 Manrope, sans-serif; letter-spacing: 0.14em; color: var(--muted); }
.xc-pick label { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 160px; }
.xc-pick select {
  background: #10131b;
  color: var(--ink);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font: 600 11px Manrope, sans-serif;
  padding: 5px 6px;
  min-width: 0;
  width: 100%;
}
.xc-note { padding: 2px 10px 0; }
.xc-body canvas { min-height: 140px; }
.xc-table { flex: 0 1 auto; max-height: 40%; font-size: 14px; }
.xc-table th[scope="col"], .xc-table td { text-align: right; white-space: nowrap; }
.xc-table th[scope="row"] { text-align: left; }
.xc-table .down { color: #ff6b6b; }
.xc-table .up { color: var(--green); }
/* ==== prep ==== */
.prep-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.prep-table { overflow: auto; min-height: 0; flex: 1 1 55%; font-family: "Barlow Condensed", sans-serif; font-size: 14px; padding: 2px 10px 4px; }
.prep-body .prep-chart { flex: 1 1 45%; min-height: 90px; }
.prep-grid { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.prep-grid th { text-align: left; font: 700 9px/1 Manrope, sans-serif; letter-spacing: 0.14em; color: var(--dim); padding: 5px 4px; position: sticky; top: 0; background: #0b0d13; }
.prep-grid td { padding: 3px 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prep-grid .tyre-pill { display: inline-flex; font-size: 12px; }
.prep-grid tr[data-run] { cursor: pointer; }
.prep-grid tr[data-run]:hover td { background: rgba(255,255,255,0.04); }
.prep-grid tr.on td { background: rgba(228,176,74,0.12); }
.prep-grid tr:focus-visible { outline: 1px solid var(--gold); outline-offset: -1px; }
.prep-grid .down { color: #ff6b6b; }
.prep-grid .up { color: var(--green); }
.prep-grid tr.prep-group th { position: static; background: none; color: var(--muted); padding-top: 8px; }
.prep-swatch { display: inline-block; width: 3px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.prep-dim { color: var(--muted); font-size: 12px; }
.q-body { display: flex; flex-direction: column; flex: 1 1 58%; min-height: 0; }
.q-summary { padding: 6px 12px 2px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.q-summary b { color: var(--ink); }
.q-fly { color: var(--green); }
.q-table tr.drop td { color: #ff8a8a; }
.q-table tr.q-cut td { color: var(--gold); font: 700 10px/1.2 Manrope, sans-serif; letter-spacing: 0.12em; border-top: 1px dashed var(--gold); padding: 4px; }
.q-table .q-note { color: var(--ink); }
.q-table tr.drop .q-note { color: #ff8a8a; font-weight: 700; }
.q-phase { font: 700 10px/1 Manrope, sans-serif; letter-spacing: 0.1em; color: var(--muted); }
.q-phase.flying { color: var(--green); }
.q-phase.pit { color: var(--yellow); }
.b-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.b-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 12px; font: 700 10px/1.2 Manrope, sans-serif; letter-spacing: 0.12em; color: var(--muted); }
.b-note { color: var(--green); letter-spacing: 0.04em; }
.b-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; padding: 0 12px 6px; }
.b-tile { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border: 1px solid var(--panel-border); border-radius: 8px; background: rgba(255,255,255,0.02); min-width: 0; }
.b-label { font: 700 9px/1 Manrope, sans-serif; letter-spacing: 0.14em; color: var(--dim); }
.b-value { font: 700 20px/1.1 "Barlow Condensed", sans-serif; color: var(--ink); }
.b-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-body { flex: 1; }
.rp-input { width: 100%; min-width: 120px; background: rgba(255,255,255,0.04); border: 1px solid var(--panel-border); color: var(--ink); border-radius: 4px; padding: 3px 6px; font: 600 14px "Barlow Condensed", sans-serif; }
.rp-input:focus { outline: 1px solid var(--gold); }
.rp-table .rp-status { white-space: normal; font-size: 13px; color: var(--muted); }
.rp-table .rp-status.ok { color: var(--green); }
.rp-table .rp-status.dev { color: var(--yellow); font-weight: 700; }
.rp-table .rp-status.bad { color: #ff8a8a; }
