/* MS Timing live viewer - the Public Display (L1) look: same colours, same Inter type, same layout. */
:root {
  --bg: #05070D; --surface: #0D1220; --surface-2: #121A2E; --border: #1E2A45;
  --text: #E7ECF5; --dim: rgba(231, 236, 245, 0.62); --accent: #3B82F6; --accent-bright: #60A5FA;
  --row-alt: rgba(96, 165, 250, 0.10); --driver: #1D5FE6; --purple: #D946EF; --green: #22C55E;
  --scale: 1;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: 'Inter', 'Segoe UI', sans-serif; }
body { display: flex; flex-direction: column; font-size: calc(15px * var(--scale)); overflow: hidden; }
.dim { color: var(--dim); } .small { font-size: 0.8em; } .hidden { display: none !important; }
.purple { color: var(--purple) !important; } .blue { color: var(--accent-bright); } .green { color: var(--green) !important; }
#flagbar { height: 6px; background: #334155; flex: none; }
header#top { display: flex; align-items: center; gap: 2.2em; margin: 10px 14px 8px; padding: 10px 18px; background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; flex: none; }
header .title { flex: 1; min-width: 0; }
#evt { font-size: 1.65em; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sub { font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx { display: flex; align-items: center; gap: 0.8em; font-size: 0.95em; }
.wx b { font-size: 1.45em; }
.stat { text-align: center; }
.stat .lbl { font-size: 0.8em; color: var(--dim); letter-spacing: 0.04em; }
.stat .val { font-size: 1.9em; font-weight: 800; font-variant-numeric: tabular-nums; }
.flagpill { padding: 0.45em 1.4em; border-radius: 8px; font-size: 1.3em; font-weight: 800; letter-spacing: 0.04em; min-width: 6em; text-align: center; }
.flagpill:empty { display: none; }
.flag-chequered { background: repeating-conic-gradient(#0B1220 0 25%, #F8FAFC 0 50%) 0 0 / 20px 20px; color: #0B1220; text-shadow: 0 0 4px #fff, 0 0 4px #fff; }
main#main { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 0 14px 8px; }
#boardWrap { flex: 1; min-width: 0; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table#board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: calc(1em * var(--fit, 1)); }
#board th { position: sticky; top: 0; background: var(--surface-2); color: var(--accent-bright); font-size: 0.78em; font-weight: 700;
  text-transform: uppercase; padding: 0.55em 0.45em; white-space: nowrap; z-index: 1; }
#board td { padding: 0.32em 0.45em; white-space: nowrap; border-bottom: 1px solid var(--border); }
#board tbody tr:nth-child(even) { background: var(--row-alt); }
#board .r { text-align: right; } #board .c { text-align: center; } #board .l { text-align: left; }
#board td.pos { font-weight: 800; text-align: center; width: 2.6em; }
#board td.no { font-weight: 800; }
#board td.driver { background: var(--driver); font-weight: 700; color: #fff; }
#board tr.out td.driver { background: transparent; color: var(--text); font-weight: 500; }
#board td.team { color: var(--dim); max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.tag-new { background: #FACC15; color: #0B1220; font-size: 0.62em; font-weight: 800; padding: 0 0.35em; border-radius: 3px; margin-left: 0.5em; vertical-align: middle; }
.cls { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 0.4em; font-size: 0.8em; font-weight: 700; }
.pit-p { background: #FACC15; color: #0B1220; font-weight: 800; padding: 0 0.32em; border-radius: 3px; }
.pit-o { background: #F97316; color: #0B1220; font-weight: 800; padding: 0 0.32em; border-radius: 3px; }
.pen { color: #FACC15; font-size: 0.85em; margin-right: 0.4em; }
.chq { display: inline-block; width: 1.2em; height: 0.9em; background: repeating-conic-gradient(#0B1220 0 25%, #F8FAFC 0 50%) 0 0 / 0.45em 0.45em; vertical-align: middle; margin-right: 0.3em; }
.up { color: var(--green); } .down { color: #F97316; }
.carimg { height: 1.5em; vertical-align: middle; }
aside#side { width: 34%; max-width: 560px; min-width: 280px; display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.panel.grow { flex: 1; min-height: 0; overflow: auto; }
.ptitle { color: var(--accent-bright); font-weight: 700; font-size: 0.85em; letter-spacing: 0.04em; margin-bottom: 0.4em; }
#mapPanel { height: 36%; min-height: 180px; padding: 6px; }
#map { width: 100%; height: 100%; }
#best .row, #msgs .row { display: flex; justify-content: space-between; gap: 1em; padding: 0.25em 0; border-bottom: 1px solid var(--border); }
#msgs .row { justify-content: flex-start; }
#msgs .t { color: var(--dim); font-variant-numeric: tabular-nums; }
footer#foot { flex: none; display: flex; align-items: center; gap: 1em; padding: 4px 14px 8px; font-size: 0.85em; }
footer .spacer { flex: 1; }
#logo { height: 22px; }
.conn { padding: 0.1em 0.6em; border-radius: 10px; background: #334155; }
.conn.live { background: #15803D; } .conn.wait { background: #B45309; }
button { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0.35em 0.8em; font: inherit; cursor: pointer; }
button:hover { border-color: var(--accent); }
#settings { position: fixed; right: 14px; bottom: 50px; width: 380px; max-height: 75vh; overflow: auto; background: var(--surface); border: 1px solid var(--accent);
  border-radius: 10px; padding: 12px; z-index: 10; box-shadow: 0 10px 40px rgba(0,0,0,0.6); font-size: 14px; }
.shead { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 6px; }
#colList .col { display: flex; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--border); }
#colList .col label { flex: 1; }
#colList .col button { padding: 0 6px; }
.srow { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
/* Track map only (the Windows display's second window: ?view=map) */
body.mapOnly header#top, body.mapOnly #boardWrap, body.mapOnly #bestPanel, body.mapOnly #msgPanel { display: none; }
body.mapOnly aside#side { width: 100%; max-width: none; }
body.mapOnly #mapPanel { height: 100%; }
/* Phones */
@media (max-width: 900px) {
  header#top { flex-wrap: wrap; gap: 0.8em 1.4em; }
  header .title { flex-basis: 100%; }
  main#main { flex-direction: column; overflow: auto; }
  #boardWrap { flex: none; overflow-x: auto; overflow-y: visible; }
  aside#side { width: 100%; max-width: none; min-width: 0; }
  #mapPanel { height: 260px; }
  #board td.team, #board th.team { display: none; }
}

/* Dark scrollbars (Windows display / desktop browsers) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
* { scrollbar-color: #334155 var(--surface); }
