/* Pit wall timing screen: black glass, monospace figures, FIA timing colours. */

:root {
  --bg: #000;
  --panel: #050607;
  --grid: #1a1d22;
  --stripe: #0a0b0d;
  --text: #f1f2f3;
  --muted: #868c95;
  --dim: #545a62;
  --yellow: #ffd60a;
  --green: #21e065;
  --purple: #c65cff;
  --red: #ff3b30;
  --orange: #ff9500;
  --cyan: #3ad2ff;
  --blue: #3b82ff;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'Barlow Semi Condensed', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --side-w: clamp(300px, 27vw, 540px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

kbd {
  font: 700 0.92em var(--mono);
  padding: 0 0.35em;
  border: 1px solid #4b515a;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #111317;
  color: #fff;
}

[hidden] {
  display: none !important;
}

/* ---------- buttons ---------- */

.btn {
  font: 700 12px/1 var(--sans);
  letter-spacing: 0.08em;
  color: var(--text);
  background: #101216;
  border: 1px solid #2a2e35;
  border-radius: 3px;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: #4f5660;
  background: #15181d;
}

.btn:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 1px;
}

.btn.on {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000;
}

.btn.ghost {
  background: transparent;
}

.btn.lit {
  border-color: #6b7380;
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--yellow);
}

.seg {
  display: inline-flex;
}

.seg .btn {
  border-radius: 0;
  margin-left: -1px;
}

.seg .btn:first-child {
  border-radius: 3px 0 0 3px;
  margin-left: 0;
}

.seg .btn:last-child {
  border-radius: 0 3px 3px 0;
}

/* ---------- picker ---------- */

.picker {
  height: 100vh;
  overflow: auto;
}

.pick-head {
  padding: 28px 32px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand .mark {
  font: 800 30px/1 var(--mono);
  color: #000;
  background: var(--yellow);
  padding: 6px 9px;
}

.brand .word {
  font: 700 32px/1 var(--sans);
  letter-spacing: 0.16em;
}

.brand .tag {
  font: 700 11px/1 var(--sans);
  letter-spacing: 0.2em;
  color: var(--green);
  border: 1px solid #1c5c34;
  padding: 6px 9px;
}

.lede {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font: 500 15px/1.45 var(--sans);
}

.years {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 14px 32px;
  overflow-x: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--grid);
}

.year {
  font: 700 15px/1 var(--mono);
  padding: 9px 13px;
  background: #0d0f12;
  border: 1px solid #262a31;
  border-radius: 3px;
  cursor: pointer;
}

.year:hover {
  border-color: #4f5660;
}

.year.on {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000;
}

.meetings {
  display: grid;
  gap: 10px;
  padding: 18px 32px 28px;
}

.pick-msg {
  padding: 48px 0;
  color: var(--muted);
  font: 600 14px/1.4 var(--sans);
  letter-spacing: 0.12em;
}

.group {
  margin: 18px 0 2px;
  color: var(--muted);
  font: 700 13px/1 var(--sans);
  letter-spacing: 0.22em;
}

.meeting {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2.4fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--grid);
}

.m-name {
  font: 700 19px/1.15 var(--sans);
  letter-spacing: 0.05em;
}

.m-sub {
  margin-top: 4px;
  color: var(--muted);
  font: 500 14px/1.3 var(--sans);
}

.meeting.testing .m-name {
  color: #c9ccd1;
}

.sessions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sess {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 128px;
  padding: 10px 12px;
  text-align: left;
  background: #0d0f12;
  border: 1px solid #262a31;
  border-left: 3px solid var(--green);
  border-radius: 2px;
  cursor: pointer;
}

.sess:hover:not(:disabled) {
  background: #14171c;
  border-color: #4f5660;
  border-left-color: var(--green);
}

.sess:focus-visible {
  outline: 2px solid var(--yellow);
}

.sess:disabled {
  cursor: default;
  opacity: 0.42;
  border-left-color: #3a3f47;
}

.sess.s-live {
  border-left-color: var(--yellow);
}

.s-name {
  font: 700 14px/1 var(--sans);
  letter-spacing: 0.09em;
}

.s-when {
  font: 600 11px/1 var(--mono);
  color: var(--muted);
}

.s-state {
  font: 700 10px/1 var(--sans);
  letter-spacing: 0.14em;
  color: var(--yellow);
}

.s-resume {
  font: 700 11px/1 var(--mono);
  color: var(--cyan);
}

.pick-foot {
  padding: 0 32px 32px;
  color: var(--dim);
  font: 500 12px/1.4 var(--sans);
}

/* ---------- standings (spoilers, opened on request) ---------- */

.standings-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  font: 700 13px/1 var(--sans);
  letter-spacing: 0.12em;
  background: #0d0f12;
  border: 1px solid #5a2a26;
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.standings-btn span {
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.14em;
  color: #ff7a70;
}

.standings-btn:hover {
  border-color: #ff5a50;
}

.standings-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #000000c8;
}

.standings {
  width: min(980px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #0a0b0d;
  border: 1px solid #2f343b;
  border-top: 2px solid var(--yellow);
}

.st-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #0a0b0d;
  border-bottom: 1px solid var(--grid);
  font: 700 18px/1 var(--sans);
  letter-spacing: 0.08em;
}

.st-sub {
  font: 600 12px/1.2 var(--sans);
  letter-spacing: 0.12em;
  color: var(--muted);
}

.st-close {
  margin-left: auto;
}

.st-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 24px;
  padding: 12px 16px 16px;
  align-items: start;
}

.st-table {
  width: 100%;
  border-collapse: collapse;
  font: 600 14px/1.3 var(--mono);
}

.st-table th {
  padding: 6px 8px;
  text-align: left;
  font: 700 10px/1 var(--sans);
  letter-spacing: 0.16em;
  color: var(--muted);
  border-bottom: 1px solid #262a31;
}

.st-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #14171b;
  white-space: nowrap;
}

.st-table .r {
  text-align: right;
}

.st-table tr.tinted td {
  background: color-mix(in srgb, var(--team) 16%, transparent);
}

.st-table tr.tinted td:first-child {
  box-shadow: inset 4px 0 0 var(--team);
  padding-left: 12px;
}

.st-table .dim {
  color: var(--muted);
  font-family: var(--sans);
}

.st-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--dim);
  font: 500 12px/1.4 var(--sans);
}

@media (max-width: 760px) {
  .st-body {
    grid-template-columns: 1fr;
  }
}

/* ---------- loading ---------- */

.loading {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  text-align: center;
}

.loading .row {
  display: flex;
  gap: 10px;
}

.spinner {
  width: 46px;
  height: 46px;
  border: 3px solid #1f2227;
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-title {
  font: 700 26px/1.1 var(--sans);
  letter-spacing: 0.08em;
}

.loading-sub {
  max-width: 70ch;
  color: var(--muted);
  font: 600 13px/1.5 var(--mono);
  letter-spacing: 0.04em;
}

/* ---------- timing screen ---------- */

.timing {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.tbar {
  display: flex;
  align-items: stretch;
  min-height: 58px;
  border-bottom: 1px solid var(--grid);
  overflow: hidden;
}

.tbar .back {
  align-self: center;
  margin: 0 4px 0 10px;
  font-size: 15px;
  padding: 8px 10px;
}

.ttl {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 6px 18px 6px 8px;
  border-right: 1px solid var(--grid);
}

.ttl .ev {
  font: 700 19px/1.1 var(--sans);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ttl .ses {
  margin-top: 3px;
  font: 700 12px/1 var(--sans);
  letter-spacing: 0.16em;
  color: var(--yellow);
}

.tbar .cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 18px;
  border-right: 1px solid var(--grid);
}

.cell .k {
  font: 700 10px/1 var(--sans);
  letter-spacing: 0.16em;
  color: var(--muted);
}

.cell .k {
  margin-bottom: 6px;
}

.cell .v {
  font: 700 23px/1 var(--mono);
  white-space: nowrap;
}

.cell .v b {
  font-weight: 800;
}

.h-total {
  color: var(--muted);
}

.h-session[data-tone='green'] {
  color: var(--green);
}

.h-session[data-tone='red'] {
  color: var(--red);
}

.h-session[data-tone='grey'] {
  color: var(--muted);
}

.flag {
  align-self: center;
  margin: 0 16px;
  padding: 9px 14px;
  min-width: 128px;
  text-align: center;
  font: 700 14px/1 var(--sans);
  letter-spacing: 0.12em;
  border-radius: 2px;
  color: var(--muted);
  border: 1px solid #2a2e35;
}

.flag[data-tone='green'] {
  background: #00a74f;
  border-color: #00a74f;
  color: #000;
}

.flag[data-tone='yellow'] {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000;
}

.flag[data-tone='sc'] {
  background: var(--orange);
  border-color: var(--orange);
  color: #000;
  animation: pulse 1.2s ease-in-out infinite;
}

.flag[data-tone='red'] {
  background: #e10600;
  border-color: #e10600;
  color: #fff;
}

@keyframes pulse {
  50% {
    opacity: 0.65;
  }
}

.wx {
  margin-left: auto;
  align-self: center;
  padding: 0 18px;
  font: 600 12px/1.55 var(--mono);
  color: var(--muted);
  white-space: pre;
  text-align: right;
}

.wx[data-rain='true'] {
  color: var(--cyan);
}

.notice {
  padding: 8px 16px;
  background: #241d00;
  border-bottom: 1px solid #4a3c00;
  color: var(--yellow);
  font: 600 13px/1.3 var(--sans);
}

.timing main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-w);
}

.timing.no-side main {
  grid-template-columns: minmax(0, 1fr);
}

.timing.no-side .side {
  display: none;
}

.timing.no-map .map {
  display: none;
}

.timing.no-map .side {
  grid-template-rows: minmax(0, 1.5fr) minmax(0, 1fr);
}

/* ---------- tower ---------- */

.tower {
  --rh: 32px;
  --fs: 18px;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  font: 700 var(--fs) / 1 var(--mono);
}

.tower .tr {
  display: grid;
  grid-template-columns: var(--cols);
  column-gap: 1ch;
  align-items: center;
  height: var(--rh);
  padding: 0 0.75ch;
}

.tower .thead {
  height: calc(var(--rh) * 0.9);
  border-bottom: 1px solid #262a31;
}

.tower .head {
  height: 100%;
}

.tower .head .c {
  font: 700 0.6em/1 var(--sans);
  letter-spacing: 0.14em;
  color: var(--muted);
}

.tbody {
  position: relative;
  height: calc(100% - var(--rh) * 0.9);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent var(--rh),
    var(--stripe) var(--rh),
    var(--stripe) calc(var(--rh) * 2)
  );
}

.tbody .tr {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(calc(var(--i, 0) * var(--rh)));
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  cursor: pointer;
}

.tbody .tr:hover {
  background: #ffffff0a;
}

/* The reference driver for relative gaps. */
.tbody .tr.selected {
  background: color-mix(in srgb, var(--team) 24%, transparent);
  box-shadow:
    inset 4px 0 0 var(--yellow),
    inset 0 1px 0 color-mix(in srgb, var(--team) 60%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--team) 60%, transparent);
}

.c-gap[data-tone='ref'] {
  justify-self: end;
  padding: 0.3em 0.55em;
  font: 700 0.62em/1 var(--sans);
  letter-spacing: 0.16em;
  color: var(--yellow);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--yellow);
}

.tower [data-tone='gain'] {
  color: var(--green);
}

.tower [data-tone='loss'] {
  color: #ff5a50;
}

.tower .head .c.rel {
  color: var(--yellow);
}

.tbody .tr.out {
  color: var(--dim);
}

.tbody .tr.out [data-tone] {
  color: var(--dim);
}

.tower .c {
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}

.tower .c.r {
  text-align: right;
}

.tower [data-tone='ob'] {
  color: var(--purple);
}

.tower [data-tone='pb'] {
  color: var(--green);
}

.tower [data-tone='nm'] {
  color: var(--yellow);
}

.tower [data-tone='dim'] {
  color: var(--dim);
}

.tower [data-tone='close'] {
  color: var(--green);
}

.tower [data-tone='up'] {
  color: var(--green);
}

.tower [data-tone='down'] {
  color: var(--red);
}

.c-pos {
  font-weight: 800;
}

.c-chg {
  font-size: 0.72em;
}

.c-drv {
  display: flex;
  align-items: center;
  gap: 0.55ch;
}

.c-drv .bar {
  flex: none;
  width: 0.32em;
  height: 1.05em;
  background: var(--team);
  border-radius: 1px;
}

.c-drv .no {
  flex: none;
  width: 2.4ch;
  text-align: right;
  font-size: 0.74em;
  color: var(--muted);
}

.c-drv .tla {
  letter-spacing: 0.05em;
  color: #fff;
}

.tr.out .c-drv .tla {
  color: var(--dim);
}

.c-gap,
.c-int {
  font-variant-numeric: tabular-nums;
}

.c-stop,
.c-st,
.c-laps,
.c-pit {
  font-size: 0.86em;
}

.c-status {
  justify-self: start;
  font: 700 0.62em/1 var(--sans);
  letter-spacing: 0.1em;
  padding: 0.3em 0.45em;
  border-radius: 2px;
}

.c-status[data-tone='pit'] {
  background: var(--cyan);
  color: #000;
}

.c-status[data-tone='out'] {
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.c-status[data-tone='ret'],
.c-status[data-tone='stop'] {
  color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}

.tr.out .c-status[data-tone='ret'],
.tr.out .c-status[data-tone='stop'] {
  color: var(--red);
}

.c-status[data-tone='elim'] {
  color: var(--dim);
  box-shadow: inset 0 0 0 1px #3a3f47;
}

.c-tyre {
  display: flex;
  align-items: center;
}

/* Tyre: compound colour drives everything via --tc. */
.tyre {
  --tc: #9aa0a8;
  display: inline-flex;
  align-items: center;
  gap: 0.45ch;
}

.t-soft {
  --tc: #ff2d2d;
}

.t-medium {
  --tc: #ffd60a;
}

.t-hard {
  --tc: #f4f4f4;
}

.t-intermediate {
  --tc: #2fd34f;
}

.t-wet {
  --tc: #2f7dff;
}

/* 2018 and earlier: seven compounds, different colours. */
.legacy-tyres .t-hypersoft {
  --tc: #ff7eb9;
}

.legacy-tyres .t-ultrasoft {
  --tc: #b05cff;
}

.legacy-tyres .t-supersoft {
  --tc: #ff2d2d;
}

.legacy-tyres .t-soft {
  --tc: #ffd60a;
}

.legacy-tyres .t-medium {
  --tc: #f4f4f4;
}

.legacy-tyres .t-hard {
  --tc: #6fd3ff;
}

.legacy-tyres .t-superhard {
  --tc: #ff9500;
}

.ball {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.45em;
  height: 1.45em;
  border-radius: 50%;
  border: 0.17em solid var(--tc);
  font: 800 0.66em/1 var(--sans);
  color: var(--tc);
}

/* New set: solid disc. */
.tyre.new .ball {
  background: var(--tc);
  color: #000;
}

.wear {
  --track: #23272d;
  --pre: #5d636b;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  width: 3ch;
  height: 1.2em;
  background: linear-gradient(
      to right,
      var(--pre) 0 calc(var(--fit) * 100%),
      var(--tc) calc(var(--fit) * 100%) calc(var(--end) * 100%),
      var(--track) calc(var(--end) * 100%)
    )
    bottom / 100% 3px no-repeat;
}

.wear .age {
  font-size: 0.72em;
  line-height: 1;
  color: var(--text);
}

.tyre.used .wear .age {
  color: #c9ced4;
}

.tower .mini-sector {
  display: flex;
  align-items: center;
  gap: 0.7ch;
}

.tower .sg {
  flex: 1;
  display: flex;
  gap: 1px;
  height: 0.62em;
}

.tower .sg i {
  flex: 1;
  min-width: 0;
  background: #24272d;
  border-radius: 1px;
}

.tower .sg i.nm {
  background: var(--yellow);
}

.tower .sg i.pb {
  background: var(--green);
}

.tower .sg i.ob {
  background: var(--purple);
}

.tower .sg i.pit {
  background: #2d5bd8;
}

.tower .mini-sector .t {
  flex: none;
  min-width: 6.5ch;
  text-align: right;
}

.cutoff {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  height: 0;
  border-top: 2px solid var(--red);
  transform: translateY(calc(var(--i, 0) * var(--rh) - 1px));
  transition: transform 0.5s;
  pointer-events: none;
}

/* Previous lap's time (or delta), kept until the new one arrives. */
.tower .old {
  opacity: 0.38;
}

/* Cars currently in qualifying's drop zone. */
.tbody .tr.danger .c-pos {
  color: var(--red);
}

/* ---------- status strip ---------- */

.strip {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 38px;
  padding: 6px 14px;
  border-top: 1px solid var(--grid);
  background: #000;
  white-space: nowrap;
  overflow: hidden;
}

/* Play / pause without a keyboard (iPad); Space does the same. */
.strip-go {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 30px;
  margin: -4px 0;
  font: 700 15px/1 var(--sans);
  color: #000;
  background: var(--green);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.strip[data-state='hold'] .strip-go {
  background: var(--yellow);
  animation: pulse 1.2s ease-in-out infinite;
}

.strip[data-state='play'] .strip-go {
  background: #1d2a1f;
  color: var(--green);
  box-shadow: inset 0 0 0 1px #2d6b3c;
}

@media (hover: none) and (pointer: coarse) {
  .strip-go {
    width: 64px;
    height: 44px;
    font-size: 20px;
  }
}

.go-glyph {
  color: var(--yellow);
}

.strip-title {
  font: 700 13px/1 var(--sans);
  letter-spacing: 0.14em;
  color: var(--muted);
}

.strip-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  font: 500 14px/1.3 var(--sans);
  color: var(--dim);
}

.strip[data-state='play'] .strip-title {
  color: var(--green);
}

.strip[data-state='hold'] {
  background: #1f1a00;
  border-top-color: var(--yellow);
  box-shadow: inset 4px 0 0 var(--yellow);
}

.strip[data-state='hold'] .strip-title {
  font-size: 15px;
  color: var(--yellow);
}

.strip[data-state='hold'] .strip-sub {
  color: #e6e1c8;
}

/* ---------- side panel ---------- */

.side {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) minmax(0, 0.6fr);
  min-height: 0;
  border-left: 1px solid var(--grid);
  background: #020203;
}

.map {
  position: relative;
  height: min(46vh, calc(var(--side-w) * 0.78));
  border-bottom: 1px solid var(--grid);
}

.map canvas {
  position: absolute;
  inset: 0;
}

.map-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--dim);
  font: 700 11px/1.4 var(--sans);
  letter-spacing: 0.16em;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--grid);
}

.panel .ph {
  padding: 9px 12px 7px;
  font: 700 11px/1 var(--sans);
  letter-spacing: 0.18em;
  color: var(--muted);
  border-bottom: 1px solid #111316;
}

.panel .pb {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2e35 transparent;
}

.empty {
  padding: 14px 12px;
  color: var(--dim);
  font: 700 11px/1 var(--sans);
  letter-spacing: 0.16em;
}

.msg {
  display: flex;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid #0f1113;
  font: 600 12px/1.4 var(--mono);
}

.msg .time {
  flex: none;
  color: var(--dim);
}

.msg .lap {
  flex: none;
  color: var(--muted);
}

.msg .text {
  color: #dfe2e6;
}

.msg[data-tone='yellow'] .text {
  color: var(--yellow);
}

.msg[data-tone='red'] .text {
  color: #ff5a50;
}

.msg[data-tone='green'] .text {
  color: var(--green);
}

.msg[data-tone='blue'] .text {
  color: #6aa2ff;
}

.msg[data-tone='orange'] .text {
  color: var(--orange);
}

.msg[data-tone='cyan'] .text {
  color: var(--cyan);
}

.clip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: 0;
  border-bottom: 1px solid #0f1113;
  font: 600 12px/1 var(--mono);
  text-align: left;
  cursor: pointer;
}

.clip:hover {
  background: #0d0f12;
}

.clip .icon::before {
  content: '▶';
  color: var(--muted);
  font-size: 10px;
}

.clip.playing .icon::before {
  content: '■';
  color: var(--yellow);
}

.clip .time {
  color: var(--dim);
}

.clip .bar {
  width: 4px;
  height: 14px;
  background: var(--team);
}

.clip.playing .tla {
  color: var(--yellow);
}

/* ---------- clock button + sync panel ---------- */

.tbar .clock-btn {
  position: relative;
  align-items: flex-start;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--grid);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.tbar .clock-btn:hover,
.tbar .clock-btn.open {
  background: #0d0f12;
}

.tbar .clock-btn.open {
  box-shadow: inset 0 -2px 0 var(--yellow);
}

.tbar .clock-btn:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: -2px;
}

.clock-btn .caret {
  color: var(--yellow);
  font-size: 9px;
}

.clock-btn.flash .v {
  animation: flash 0.45s ease-out;
}

@keyframes flash {
  from {
    color: var(--yellow);
  }
}

.tbar .tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 4px;
}

.sync-panel {
  position: fixed;
  z-index: 15;
  display: grid;
  gap: 10px;
  max-width: calc(100vw - 16px);
  padding: 12px 14px;
  background: #0a0b0d;
  border: 1px solid #2f343b;
  border-top: 2px solid var(--yellow);
  box-shadow: 0 16px 50px #000;
}

.sp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sp-row > .k,
.readout .k {
  min-width: 62px;
  font: 700 10px/1 var(--sans);
  letter-spacing: 0.16em;
  color: var(--muted);
}

.readout {
  margin-left: 6px;
  white-space: nowrap;
}

.readout .k {
  min-width: 0;
}

.readout .v {
  font: 700 16px/1 var(--mono);
}

.readout.flash .v {
  animation: flash 0.45s ease-out;
}

.sp-hint {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font: 500 13px/1.4 var(--sans);
}

.btn.play {
  min-width: 92px;
}

.btn.play.on {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}

.sync-input {
  width: 150px;
  padding: 7px 9px;
  font: 700 14px/1 var(--mono);
  background: #000;
  border: 1px solid #3a3f47;
  border-radius: 3px;
}

.sync-input::placeholder {
  color: #4b5058;
  font-weight: 500;
}

.sync-input:focus {
  outline: 2px solid var(--yellow);
  outline-offset: 0;
  border-color: transparent;
}

.btn.go {
  background: #1d2a1f;
  border-color: #2d6b3c;
}

.btn.go:hover {
  background: #23392a;
}

.toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 10px 16px;
  background: #15181d;
  border: 1px solid #3a3f47;
  box-shadow: 0 8px 30px #000;
  font: 600 14px/1.3 var(--sans);
  white-space: nowrap;
}

/* ---------- hover popovers ---------- */

.c-tyre[data-pop] {
  cursor: help;
}

.hover-pop {
  position: fixed;
  z-index: 30;
  width: 404px;
  padding: 12px 14px 12px;
  background: #0a0b0d;
  border: 1px solid #343a42;
  box-shadow: 0 14px 44px #000;
  font: 500 13px/1.4 var(--sans);
  color: var(--text);
  pointer-events: auto;
}

.hp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1f2329;
  font: 700 14px/1 var(--mono);
}

.hp-bar {
  width: 4px;
  height: 16px;
}

.hp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 13px/1 var(--sans);
  color: var(--muted);
}

.hp-title,
.hp-sub {
  font: 700 10px/1 var(--sans);
  letter-spacing: 0.16em;
  color: var(--muted);
}

.hp-title {
  margin-left: auto;
}

.hp-sub {
  margin: 12px 0 6px;
}

.hp-stints {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.hp-stints li {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  grid-template-areas: 'ball cmp laps' 'ball age age';
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  padding: 5px 0;
  color: #b8bdc4;
}

.hp-stints li + li {
  border-top: 1px solid #16191d;
}

.hp-stints li.cur {
  color: #fff;
}

.hp-stints .hp-tyre {
  grid-area: ball;
}

.hover-pop .ball {
  font-size: 13px;
}

.hp-age {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hp-wear {
  flex: none;
  width: 96px;
  height: 6px;
  background-size: 100% 4px;
}

.hp-stints .hp-cmp {
  grid-area: cmp;
}

.hp-stints .hp-laps {
  grid-area: laps;
}

.hp-stints .hp-age {
  grid-area: age;
}

.hp-now {
  margin-left: 6px;
  padding: 1px 5px;
  font: 700 9px/1.4 var(--sans);
  letter-spacing: 0.14em;
  color: #000;
  background: var(--yellow);
  border-radius: 2px;
}

.hp-cmp {
  font: 700 12px/1 var(--sans);
  letter-spacing: 0.06em;
}

.hp-age,
.hp-laps {
  font: 500 12px/1.2 var(--mono);
  color: var(--muted);
  white-space: nowrap;
}

.hp-laps {
  text-align: right;
}

.hover-pop {
  overflow-wrap: anywhere;
}

.hp-stints li.cur .hp-laps {
  color: var(--yellow);
}

.hp-chart {
  display: block;
  font: 600 10px var(--mono);
  fill: var(--muted);
}

.hp-stats {
  margin-top: 6px;
  font: 600 12px/1.4 var(--mono);
  color: #c9cdd2;
}

.hp-stats .gain {
  color: var(--green);
}

.hp-stats .loss {
  color: #ff5a50;
}

.hp-note,
.hp-empty {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- popovers ---------- */

.pop {
  position: fixed;
  right: 12px;
  top: 64px;
  z-index: 20;
  width: min(400px, calc(100vw - 24px));
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 6px 18px 16px;
  background: #0a0b0d;
  border: 1px solid #2f343b;
  box-shadow: 0 12px 50px #000;
  font: 500 14px/1.45 var(--sans);
}

.pop h3 {
  margin: 14px 0 8px;
  font: 700 11px/1 var(--sans);
  letter-spacing: 0.18em;
  color: var(--muted);
}

.pop label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0;
  cursor: pointer;
}

.pop input[type='checkbox'] {
  accent-color: var(--yellow);
  width: 15px;
  height: 15px;
}

.pop select {
  margin-left: auto;
  background: #000;
  border: 1px solid #3a3f47;
  border-radius: 3px;
  padding: 4px 6px;
}

.pop p {
  margin: 6px 0;
  color: #c3c7cc;
}

.pop .note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.pop dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
}

.pop dt {
  font: 700 12px/1.5 var(--mono);
  color: var(--yellow);
}

.pop dd {
  margin: 0;
  color: #d4d7db;
}

/* ---------- narrow screens ---------- */

@media (max-width: 1440px) {
  .tbar .cell {
    padding: 6px 12px;
  }

  .ttl {
    padding-right: 12px;
  }

  .flag {
    margin: 0 10px;
    min-width: 0;
  }

  .tbar .tools .btn {
    padding: 8px 7px;
  }
}

@media (max-width: 1100px) {
  .wx {
    display: none;
  }
}

@media (max-width: 960px) {
  .timing main {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    display: none;
  }

  .tbar {
    flex-wrap: wrap;
  }

  .meeting {
    grid-template-columns: 1fr;
  }

  .sessions {
    justify-content: flex-start;
  }

  .pick-head,
  .meetings,
  .pick-foot {
    padding-left: 16px;
    padding-right: 16px;
  }

  .years {
    padding: 12px 16px;
  }
}

/* ---------- phone (compact) layout ---------- */

.info-btn,
.sheet-bar {
  display: none;
}

.timing.compact .tbar {
  min-height: 48px;
  flex-wrap: nowrap;
}

.timing.compact .ttl,
.timing.compact .wide-only,
.timing.compact .wx,
.timing.compact .tbar .tools {
  display: none;
}

.timing.compact .tbar .back {
  margin: 0 2px 0 6px;
  padding: 6px 8px;
}

.timing.compact .tbar .cell {
  padding: 4px 10px;
}

.timing.compact .cell .k {
  margin-bottom: 4px;
  font-size: 9px;
}

.timing.compact .cell .v {
  font-size: 19px;
}

.timing.compact .flag {
  margin: 0 6px;
  padding: 7px 9px;
  min-width: 0;
  font-size: 12px;
  cursor: pointer;
}

.timing.compact .info-btn {
  display: block;
  align-self: center;
  margin: 0 8px 0 auto;
  padding: 7px 11px;
  font-size: 16px;
}

/* Just the tower; map, race control and radio open as sheets. */
.timing.compact main {
  grid-template-columns: minmax(0, 1fr);
}

.timing.compact .side {
  display: none;
}

.timing.compact .tower {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.timing.compact .tower .thead {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  cursor: pointer;
}

.tower.compact .c-drv .no {
  display: none;
}

.timing.compact[data-sheet] .side {
  position: absolute;
  inset: 44px 0 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  border: 0;
  background: var(--bg);
}

.timing.compact[data-sheet] .side > * {
  display: none;
}

.timing.compact[data-sheet='map'] .side .map {
  display: block;
  flex: 1;
  height: auto;
}

.timing.compact[data-sheet='rc'] .side .panel:not(.radio),
.timing.compact[data-sheet='radio'] .side .panel.radio {
  display: flex;
  flex: 1;
}

.timing.compact[data-sheet] .sheet-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 13;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 8px 0 14px;
  background: #0a0b0d;
  border-bottom: 1px solid var(--grid);
  font: 700 13px/1 var(--sans);
  letter-spacing: 0.16em;
}

.sheet-close {
  margin-left: auto;
}

.timing.compact .strip {
  gap: 10px;
  padding: 6px 10px;
}

.timing.compact .strip-sub {
  font-size: 12px;
}

.timing.compact .pop {
  top: 54px;
  right: 8px;
  width: calc(100vw - 16px);
  max-height: calc(100vh - 120px);
}

.info-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0 0 12px;
}

.info-dl dt {
  font: 700 10px/1.6 var(--sans);
  letter-spacing: 0.16em;
  color: var(--muted);
}

.info-dl dd {
  margin: 0;
  font: 600 13px/1.4 var(--mono);
}

.info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-actions .btn {
  padding: 10px 12px;
}

.timing.compact .sync-panel {
  left: 8px !important;
  right: 8px;
}

.hover-pop {
  max-width: calc(100vw - 16px);
}

.hp-chart {
  width: 100%;
  height: auto;
}
