:root {
  /* GTE Racing brand: https://gte-racing.be — flat/sharp shapes (no
     border-radius anywhere), bold uppercase Arial/Helvetica, red as a
     structural accent against near-black. Functional status colors
     (--our-car/--competitor/--pit/--purple/--green/--warn/--follow) stay as
     their own distinct hues — reusing brand red for "your car"/status
     highlighting would collide with red's new meaning as chrome/accent. */
  --brand-red: #e10600;
  --bg: #090909;
  --panel: #161616;
  --border: #2b2b2b;
  --text: #f3f1ec;
  --muted: #96938d;
  --our-car: #2ee6a6;
  --competitor: #ffcc66;
  --pit: #5b8cff;
  --purple: #c86bfa;
  --green: #34d17a;
  --warn: #ff6b6b;
  --follow: #4ad9ff;
  --track-line: #2b2b2b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  border-top: 3px solid var(--brand-red);
}
header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 16px;
}
header h1 { font-size: 16px; margin: 0; font-weight: 800; letter-spacing: 0.06em; }
header .session { color: var(--muted); font-size: 12px; }
header .status { color: var(--muted); font-size: 12px; margin-left: auto; }
nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--border);
}
nav button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
nav button.active { color: var(--text); border-bottom-color: var(--brand-red); }
.toolbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}
.toolbar label { display: flex; align-items: center; gap: 6px; }
.toolbar select, .toolbar input {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
}
.toolbar select:focus, .toolbar input:focus { outline: 2px solid var(--brand-red); outline-offset: 1px; border-color: var(--brand-red); }
.toolbar input { width: 70px; }
.toolbar input::placeholder { color: var(--muted); }
.screen { display: none; }
.screen.active { display: block; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 6px 8px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", Consolas, monospace;
}
th.left, td.left { text-align: left; font-family: inherit; }
th.narrow, td.narrow { padding-left: 2px; padding-right: 2px; text-align: center; }
thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 2px solid var(--brand-red);
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--panel); }
tr.our-car { background: rgba(46, 230, 166, 0.12); }
tr.our-car td.nr { color: var(--our-car); font-weight: 700; }
tr.competitor td.nr { color: var(--competitor); font-weight: 700; }
tr.followed { outline: 2px solid var(--follow); outline-offset: -1px; }
tr.followed td.nr { color: var(--follow); font-weight: 700; }
td.state-pit { color: var(--pit); }
td.t-purple { color: var(--purple); font-weight: 700; }
td.t-green { color: var(--green); font-weight: 700; }
.badge { display: inline-block; min-width: 1.4em; padding: 1px 4px; border-radius: 0; font-size: 11px; font-weight: 700; }
.badge-pit { background: var(--pit); color: #fff; }
.badge-outlap { background: #2bb3a3; color: #fff; }
.badge-finish { background: #e08a2b; color: #fff; }
.badge-sector { color: var(--green); }
.badge-up { color: var(--green); }
.badge-down { color: var(--warn); }
.badge-best { color: var(--green); }
.badge-ontrack { color: var(--green); }
.badge-flag { }
.badge-warn { color: var(--warn); }
.badge-muted { color: var(--muted); }

/* Messages screen */
#messagesList { padding: 4px 16px; }
#messagesList table td.left { font-family: inherit; }
tr.penalty td { color: var(--warn); }

/* Tracker screen */
#trackerWrap { padding: 12px 16px; }
#trackSvg { width: 100%; height: auto; max-height: calc(100vh - 100px); }
.track-path { fill: none; stroke: var(--track-line); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.pit-path { fill: none; stroke: var(--pit); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; stroke-dasharray: 2 6; }
.sf-line { stroke: #fff; stroke-width: 4; }
.sector-line { stroke: #ffd23f; stroke-width: 2.5; opacity: 0.85; }
.pit-limit-line { stroke: var(--warn); stroke-width: 2.5; opacity: 0.85; }
.pit-sf-line { stroke: var(--pit); stroke-width: 3.5; }
.track-marker-label { font-size: 9px; fill: var(--muted); font-family: "SF Mono", Consolas, monospace; pointer-events: none; }
.turn-label { font-size: 11px; fill: var(--muted); font-family: "SF Mono", Consolas, monospace; text-anchor: middle; pointer-events: none; }
.pit-io-dot { fill: var(--pit); }
.car-dot { stroke: var(--bg); stroke-width: 1.5; }
.car-dot.pit { opacity: 0.45; }
.car-dot.leader { stroke: #ffd23f; stroke-width: 3; }
.car-label { font-size: 10px; fill: var(--text); font-family: "SF Mono", Consolas, monospace; pointer-events: none; }
.car-label.our-car { fill: var(--our-car); font-weight: 700; }
.car-label.competitor { fill: var(--competitor); font-weight: 700; }
.car-label.leader { fill: #ffd23f; }
.car-label.followed { fill: var(--follow); font-weight: 700; }
.follow-ring { fill: none; stroke: var(--follow); stroke-width: 2; opacity: 0.9; animation: follow-pulse 1.4s ease-out infinite; }
@keyframes follow-pulse {
  0% { r: 9; stroke-opacity: 0.9; }
  100% { r: 18; stroke-opacity: 0; }
}
