/* Race desk: clear navigation, readable timing, touch-sized actions. */
:root {
  color-scheme: dark;
  --surface: #171e28;
  --surface-raised: #202b38;
  --line: #364557;
  --muted: #b2becd;
  --accent: #fa424b;
}
html {
  font-size: 16px;
  scroll-padding-top: 80px;
}
body {
  background: #0d131b;
  line-height: 1.45;
}
[hidden] {
  display: none !important;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
.shell {
  max-width: 1440px;
  padding: 12px 20px 100px;
}
.header {
  padding: 8px 0 12px;
}
.header .brand {
  font-size: 1rem;
}
.header .pill {
  font-size: 0.8rem;
}
.race-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px 0;
}
.race-head h1 {
  max-width: none;
  font-size: 1.25rem;
  white-space: normal;
  overflow-wrap: anywhere;
}
.race-head .clock {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
}
.race-head .clockbox .small {
  font-size: 0.875rem;
  max-width: 24rem;
}
.race-meta {
  gap: 6px 12px;
  margin-top: 8px;
}
.race-meta .pill {
  font-size: 0.875rem;
  color: var(--muted);
}
.race-nav {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: #171f2b;
  border: 1px solid var(--line);
  border-radius: 14px;
  position: sticky;
  top: 8px;
  z-index: 4;
  box-shadow: 0 8px 24px #0004;
}
.race-nav button {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-weight: 750;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}
.race-nav button.active {
  background: #d92734;
  color: #fff;
}
.race-nav button:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}
.race-view {
  min-width: 0;
}
.card {
  background: var(--surface);
  border-color: var(--line);
  border-radius: 16px;
  padding: 18px;
}
.section-top {
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-top h2 {
  font-size: 1rem;
}
.help,
.small,
.note {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}
.btn {
  min-height: 44px;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  border-color: #455469;
  background: #263344;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9375rem;
  line-height: 1.35;
}
.btn.smallbtn {
  font-size: 0.875rem;
  min-height: 44px;
}
.btn.red {
  background: var(--accent);
  border-color: var(--accent);
}
.toolbar {
  gap: 8px;
}
.toolbar .btn {
  flex: 1 1 130px;
}
.field label {
  font-size: 0.9375rem;
}
.field input,
.field select,
.field textarea {
  font-size: 1rem;
  min-height: 46px;
  background: #101923;
  border-color: #516178;
}
.fields {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}
.pro-board {
  margin: 0 0 18px;
}
.pro-grid {
  gap: 12px;
}
.pro-team {
  padding: 16px;
  border-color: var(--line);
  background: #1d2734;
}
.pro-team h3 {
  font-size: 1.05rem;
}
.pro-team > p {
  margin: 6px 0;
  color: var(--muted);
}
.pro-metrics {
  gap: 12px;
}
.pro-metrics span {
  font-size: 0.875rem;
}
.pro-metrics strong {
  font-size: 1.2rem;
}
.pro-lanes {
  display: none;
}
.race-work {
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  gap: 18px;
}
.race-work .card {
  padding: 16px;
  border-radius: 16px;
}
.race-work h2 {
  font-size: 1rem;
}
.race-work .small {
  font-size: 0.875rem;
}
.race-work .section-top {
  margin-bottom: 12px;
}
.pit-section {
  order: 0;
}
.team-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 9px;
}
.team-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  height: auto;
  min-height: 94px;
  border-radius: 12px;
  padding: 12px;
  gap: 8px;
  border-width: 1px;
  align-content: center;
}
.team-tile .tile-name {
  grid-column: 1/-1;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
  line-height: 1.35;
}
.team-tile .tile-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.team-tile .tile-kart {
  font-size: 0.875rem;
}
.team-tile .tile-stops {
  font-size: 0.8rem;
}
.team-position {
  font-weight: 800;
  margin-right: 6px;
}
.rating-unknown {
  background: #263241;
  border-color: #485b70;
}
.rating-good {
  background: #144c3b;
  border-color: #398369;
}
.rating-neutral {
  background: #5c461d;
  border-color: #a27c36;
}
.rating-bad {
  background: #622d35;
  border-color: #aa4e58;
}
.pit-lanes {
  gap: 10px;
}
.pit-lane {
  min-height: 66px;
  padding: 8px;
  gap: 8px;
  border-radius: 10px;
  min-width: 0;
}
.lane-karts {
  min-width: 0;
  gap: 7px;
  overflow-x: auto;
  padding: 3px;
  scrollbar-width: thin;
}
.pit-kart {
  height: 48px;
  min-width: 64px;
  flex: 0 0 64px;
  font-size: 1rem;
  border-radius: 9px;
  padding: 7px;
  justify-content: center;
}
.pit-kart > span {
  font-size: 1rem;
}
.pit-grade {
  font-size: 0.875rem !important;
}
.lane-signal {
  min-width: 66px;
  max-width: 90px;
  min-height: 44px;
  font-size: 0.875rem;
  padding: 6px;
  white-space: normal;
}
.lane-add {
  min-width: 44px;
  min-height: 44px;
}
.lane-label {
  font-size: 0.875rem;
  width: 18px;
}
.lane-empty {
  font-size: 0.875rem;
}
.timing-panel {
  margin: 0;
  padding: 18px;
  border-radius: 16px;
}
.timing-panel[open] {
  padding: 18px;
}
.timing-panel summary {
  font-size: 1rem;
  cursor: default;
  pointer-events: none;
  list-style: none;
}
.timing-panel summary::-webkit-details-marker {
  display: none;
}
.timing-panel .small {
  font-size: 0.875rem;
}
.timing-actions .btn {
  font-size: 0.875rem;
  min-height: 44px;
  padding: 8px 12px;
}
.timing-actions {
  flex-wrap: wrap;
}
.timing-meta {
  font-size: 1rem;
}
.timing-hint {
  font-size: 0.875rem;
}
.timing-table {
  gap: 6px;
}
.timing-row {
  font-size: 0.875rem;
  grid-template-columns: minmax(160px, 1.3fr) minmax(110px, 1fr) minmax(140px, 1fr) minmax(120px, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
}
.timing-row em,
.timing-gaps {
  font-size: 0.8rem;
}
.timing-name {
  min-height: 36px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.timing-kart {
  min-height: 44px;
}
.lap-scroll {
  max-width: 100%;
  overflow-x: auto;
}
.menu-group {
  margin-bottom: 16px;
}
.menu-group h2 {
  margin-bottom: 14px;
}
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
}
.menu-grid > .btn {
  text-align: left;
  min-height: 52px;
}
.driver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  gap: 14px;
}
.driver-grid .toolbar {
  margin-top: 14px;
}
.log {
  margin-top: 16px;
}
.log-row {
  grid-template-columns: 78px minmax(0, 1fr);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  border-color: #53667f;
  border-radius: 20px;
  background: #182331;
  box-shadow: 0 25px 90px #0009;
  overscroll-behavior: contain;
}
.modal {
  position: relative;
  padding: 24px;
}
.modal h2 {
  font-size: 1.25rem;
  padding-right: 36px;
  margin-bottom: 16px;
}
.modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  background: #263344;
  color: #fff;
  border: 1px solid #455469;
  border-radius: 50%;
  font-size: 1.5rem;
  z-index: 1;
}
.modal-actions {
  gap: 10px;
  margin-top: 20px;
}
.modal-actions .btn {
  flex: 1 1 160px;
}
.modal form > .btn {
  margin-top: 10px;
  width: 100%;
}
.modal > .btn {
  margin-top: 10px;
}
.modal details {
  padding: 12px 0;
}
.modal summary {
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9375rem;
}
.modal details .menu-grid {
  margin-top: 12px;
}
.team-subtitle {
  color: var(--muted);
  margin: 0 0 14px;
}
.team-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #101923;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.team-summary span {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
}
.team-summary strong {
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}
.team-primary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0 14px;
}
.team-primary .btn:first-child {
  background: #ed333b;
  border-color: #ed333b;
}
.team-menu {
  grid-template-columns: 1fr 1fr;
}
.team-extra {
  border-top: 1px solid var(--line);
  margin-top: 16px;
}
.team-menu .btn {
  min-height: 50px;
}
.toast {
  z-index: 10;
  bottom: 90px;
  font-size: 0.9375rem;
}
.inline-choice {
  align-items: flex-start;
  line-height: 1.45;
  margin: 12px 0;
}
.inline-choice input {
  flex-shrink: 0;
}
.plan-row {
  grid-template-columns: minmax(0, 1fr) minmax(70px, 100px);
}
.plan-row input,
.plan-row select {
  font-size: 1rem;
  padding: 10px;
  border: 1px solid #516178;
  border-radius: 8px;
  background: #101923;
  color: #fff;
}
@media (max-width: 1000px) {
  .race-work {
    grid-template-columns: 1fr;
  }
  .pit-section {
    order: 0;
  }
  .timing-row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
  .timing-head {
    display: none;
  }
  .timing-row > strong {
    font-size: 1rem;
  }
  .timing-row > span:last-child {
    grid-column: 2;
    grid-row: 2;
  }
}
@media (max-width: 600px) {
  .shell {
    padding: 8px 12px calc(90px + env(safe-area-inset-bottom));
  }
  .header .header-right .small {
    display: none;
  }
  .race-head {
    grid-template-columns: 1fr;
    padding: 14px 0;
    gap: 10px;
  }
  .race-head .clockbox {
    display: flex;
    text-align: left;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 12px;
  }
  .race-head .clockbox .small {
    flex: 1 1 170px;
  }
  .race-meta .pill {
    font-size: 0.8rem;
  }
  .race-head h1 {
    font-size: 1.125rem;
  }
  .race-nav {
    position: fixed;
    inset: auto 8px max(8px, env(safe-area-inset-bottom));
    border-radius: 16px;
    padding: 5px;
    gap: 3px;
  }
  .race-nav button {
    padding: 10px 4px;
    font-size: 0.875rem;
    min-height: 48px;
  }
  .race-work .card,
  .card,
  .timing-panel[open] {
    padding: 13px;
  }
  .team-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .team-tile {
    padding: 10px;
    min-height: 100px;
  }
  .team-tile .tile-name {
    font-size: 0.875rem;
  }
  .team-tile .tile-line {
    gap: 4px;
  }
  .team-tile .tile-kart {
    font-size: 0.8rem;
  }
  .pro-board {
    margin-bottom: 14px;
  }
  .pro-team {
    padding: 12px;
  }
  .pro-metrics {
    gap: 10px;
  }
  .pro-team .btn {
    flex-basis: 120px;
  }
  .modal {
    padding: 18px;
  }
  .modal h2 {
    font-size: 1.2rem;
  }
  .team-summary {
    padding: 10px;
    gap: 8px;
  }
  .team-summary strong {
    font-size: 1.2rem;
  }
  .team-menu .btn {
    font-size: 0.875rem;
    padding: 10px;
  }
  .modal-actions .btn {
    flex-basis: 140px;
  }
  .pit-lane {
    padding: 6px;
    gap: 5px;
  }
  .lane-signal {
    min-width: 58px;
  }
  .timing-row {
    gap: 8px;
    padding: 10px;
  }
  .timing-row > span {
    font-size: 0.875rem;
  }
}
@media (max-width: 360px) {
  .team-list {
    grid-template-columns: 1fr;
  }
  .team-tile {
    min-height: 86px;
  }
  .team-primary,
  .team-menu,
  .team-summary {
    grid-template-columns: 1fr;
  }
  .timing-row {
    grid-template-columns: 1fr;
  }
  .timing-row > span:last-child {
    grid-column: auto;
    grid-row: auto;
  }
  .race-nav button {
    font-size: 0.8rem;
  }
  .shell {
    padding-left: 8px;
    padding-right: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.team-tile {
  grid-template-rows: auto auto;
}
/* Wrap the queue rather than hide karts behind a horizontal scroll. */
.lane-karts {
  flex-wrap: wrap;
  overflow-x: visible;
}
.pit-lane.signal-left {
  grid-template-columns: 18px 66px minmax(0, 1fr);
}
.pit-lane.signal-right {
  grid-template-columns: 18px minmax(0, 1fr) 66px;
}
.pro-team .toolbar .btn {
  flex: 1 1 140px;
}
@media (max-width: 360px) {
  .timing-row > strong,
  .timing-row > span:nth-child(2),
  .timing-row > span:nth-child(3),
  .timing-row > span:nth-child(4) {
    grid-column: auto;
    grid-row: auto;
    text-align: left;
  }
}
.team-tile .tile-stops::before {
  content: 'Смены ';
  font-weight: 500;
}

.language-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
}
.language-control select {
  color: #fff;
  background: #202b38;
  border: 1px solid #53667f;
  border-radius: 8px;
  min-height: 44px;
  padding: 6px;
  min-width: 64px;
}
.header-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.header-right #save-indicator {
  max-width: 160px;
  overflow-wrap: anywhere;
}
:lang(en) .team-tile .tile-stops::before {
  content: 'Stops ';
}
@media (max-width: 420px) {
  .language-control span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .header-right #save-indicator {
    display: none;
  }
}

/* One next action and one review prompt, shared across race tabs. */
#coach-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  min-width: 0;
}
.coach-card,
.coach-notice,
.practice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid #445369;
  border-radius: 12px;
  background: #18222d;
  min-width: 0;
}
.coach-card > div,
.coach-notice > div,
.practice-bar > div {
  min-width: 0;
}
.coach-card h2 {
  font-size: 1.08rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.coach-card p,
.coach-notice p {
  margin: 6px 0 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.coach-label {
  display: block;
  color: #9ec9e9;
  font-size: 0.78rem;
  margin-bottom: 5px;
}
.coach-card .btn,
.coach-notice .btn {
  flex: 0 0 auto;
  max-width: 100%;
  white-space: normal;
}
.coach-urgent {
  border-color: #ec9b61;
}
.coach-notice {
  border-color: #ca9d48;
  background: #292519;
}
.coach-notice strong {
  overflow-wrap: anywhere;
}
.practice-bar {
  background: #22213d;
  border-color: #9386da;
  flex-wrap: wrap;
}
.practice-bar .small {
  display: block;
  margin-top: 3px;
}
.practice-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.practice-bar select {
  min-height: 44px;
  max-width: 90px;
  border: 1px solid #696384;
  border-radius: 8px;
  background: #151826;
  color: white;
  padding: 6px;
}
#coach-review .field {
  margin-bottom: 12px;
}
#coach-review [hidden] {
  display: none !important;
}
#coach-review .fields {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}
@media (max-width: 600px) {
  .coach-card,
  .coach-notice {
    align-items: stretch;
    flex-direction: column;
    padding: 13px;
  }
  .coach-card .btn,
  .coach-notice .btn {
    width: 100%;
  }
  .practice-bar .toolbar {
    width: 100%;
    gap: 7px;
  }
  .practice-bar .btn {
    flex: 1 1 90px;
  }
  .coach-card .help {
    font-size: 0.78rem;
  }
}

/* v1.20: device-only density and progressive settings disclosure. */
.settings-section {
  border: 1px solid #394859;
  border-radius: 12px;
  margin: 12px 0;
  min-width: 0;
}
.settings-section > summary {
  padding: 15px;
  font-weight: 750;
  cursor: pointer;
  min-height: 48px;
}
.settings-body {
  padding: 0 15px 16px;
  display: grid;
  gap: 12px;
}
.settings-body .field {
  margin: 0;
}
.settings-body fieldset,
.driver-config {
  border: 1px solid #46576a;
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0;
  min-width: 0;
}
.event-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.event-settings .inline-choice {
  margin: 0;
}
.driver-config input,
.settings-body input,
.settings-body select {
  min-width: 0;
  max-width: 100%;
}
.coach-card[hidden] {
  display: none !important;
}
:root[data-density='compact'] .team-tile {
  padding: 9px;
}
:root[data-density='compact'] .pit-kart {
  min-width: 60px;
  min-height: 52px;
}
:root[data-density='large'] {
  font-size: 18px;
}
:root[data-density='large'] .team-tile {
  padding: 18px;
}
:root[data-density='large'] .pit-kart {
  min-width: 90px;
  min-height: 76px;
}
:root[data-col-leader='off'] [data-timing-col='leader'],
:root[data-col-interval='off'] [data-timing-col='interval'],
:root[data-col-last='off'] [data-timing-col='last'],
:root[data-col-best='off'] [data-timing-col='best'],
:root[data-col-kart='off'] [data-timing-col='kart'],
:root[data-col-driver='off'] [data-timing-col='driver'] {
  display: none !important;
}
#race-alerts:empty {
  display: none;
}
/* Alerts are one scrollable strip of chips: several alerts never push teams off screen. */
#race-alerts {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
#race-alerts .coach-notice {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: none;
  gap: 8px;
  max-width: min(420px, 85vw);
  min-height: 0;
  margin: 0;
  padding: 3px 4px 3px 10px;
  border-radius: 7px;
  font-size: 0.8125rem;
  white-space: nowrap;
}
#race-alerts .coach-notice > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
#race-alerts .coach-notice .btn {
  flex: none;
  width: auto;
  min-height: 30px;
  padding: 3px 10px;
  font-size: 0.75rem;
}
#race-settings .modal-actions {
  position: sticky;
  bottom: -12px;
  background: #19222d;
  padding: 12px 0;
  margin-bottom: 0;
}
#race-settings legend {
  font-weight: 750;
  padding: 0 4px;
}
:root[data-col-last='on'][data-col-best='on'] [data-timing-col='best']::before {
  content: ' / ';
}
.timing-row [data-timing-col='driver'] {
  margin-left: 5px;
}
:root[data-col-kart='off'] .timing-row [data-timing-col='driver'] {
  margin-left: 0;
}

/* One working surface: live order, independent pit timers and an always reachable pit. */
.race-work {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
}
.race-work > #timing-panel {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}
.race-work > .teams-section {
  grid-column: 1;
  grid-row: 2;
}
.race-work > .pit-section {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: sticky;
  top: 84px;
  max-height: calc(100dvh - 100px);
  overflow: auto;
}
.race-work.with-live {
  grid-template-columns: minmax(0, 1fr) minmax(275px, 0.5fr);
}
.race-work.with-live > #timing-panel {
  grid-row: 1;
}
.race-work.with-live > .pit-section {
  grid-row: 1;
}
.timing-panel {
  container-type: inline-size;
}
.timing-legend {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 10px 0;
}
.timing-entrant {
  position: relative;
  isolation: isolate;
  grid-template-columns: minmax(130px, 1.4fr) minmax(100px, 1fr) minmax(110px, 1fr) minmax(100px, 1fr);
  padding-bottom: 30px;
  overflow: hidden;
}
.timing-entrant > strong {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.timing-entrant > strong .timing-name {
  flex: 1;
  min-width: 0;
}
.timing-entrant > strong {
  flex-wrap: wrap;
}
.timing-local {
  flex: 1 0 100%;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #c2d2e0;
  font-variant-numeric: tabular-nums;
}
.timing-local [data-stint] {
  white-space: nowrap;
}
.timing-entrant.warn {
  box-shadow: inset 3px 0 #ffc260;
}
.timing-entrant.over {
  box-shadow: inset 3px 0 #ff707a;
}
.timing-drag {
  width: 36px;
  min-width: 36px;
  min-height: 44px;
  touch-action: none;
  user-select: none;
  background: #354454;
  border: 1px solid #506477;
  border-radius: 8px;
  color: #dae7f2;
  font-size: 1.3rem;
  cursor: grab;
}
.timing-entrant.dragging {
  opacity: 0.45;
}
.timing-entrant.drop-over {
  outline: 3px solid white;
  outline-offset: -3px;
}
.timing-entrant.drop-ready {
  border: 1px dashed #b7c8d8;
}
.lap-progress {
  position: absolute;
  inset: auto 0 0;
  height: 23px;
  background: #14232e;
  overflow: hidden;
  pointer-events: none;
  text-align: right;
}
.lap-progress-fill {
  position: absolute;
  inset: 0;
  background: #207f9b;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s linear;
}
.lap-progress-label {
  position: relative;
  display: inline-block;
  padding: 2px 8px;
  color: #fff;
  font-size: 0.75rem;
  line-height: 19px;
  background: #101c26b8;
  white-space: nowrap;
}
.lap-progress[data-status='waiting'] .lap-progress-fill {
  background: #7b6230;
}
.lap-progress[data-status='stale'] {
  opacity: 0.65;
}
.team-signal {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  margin-top: 5px;
  border: 1px solid currentColor;
  border-radius: 7px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: normal;
}
.team-signal.red {
  color: #ffe1e4;
  background: #7a2433;
}
.team-signal.green {
  color: #c4f6d2;
  background: #194c34;
}
.team-tile .team-signal {
  grid-column: 1/-1;
}
.team-signal[type='button'] {
  min-height: 38px;
  cursor: pointer;
}
.team-signal.pending {
  color: #ffe3a4;
  background: #58421c;
}
.pit-direction {
  font-size: 0.875rem;
  flex: 0 1 auto;
}
.pit-section > .section-top .small {
  display: none;
}
.pit-lane {
  align-items: center;
}
.pit-kart {
  position: relative;
  flex-direction: column;
  height: auto;
  min-height: 54px;
  gap: 0;
  overflow: visible;
}
.kart-next {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.flow-ltr .lane-karts {
  flex-direction: row-reverse;
}
.flow-rtl .lane-karts {
  flex-direction: row;
}
.lane-karts {
  align-items: stretch;
}
@container (max-width:720px) {
  .timing-entrant {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 8px;
  }
  .timing-head {
    display: none;
  }
  .timing-entrant > span:last-of-type {
    grid-column: 2;
    grid-row: 2;
  }
  .timing-entrant > strong {
    grid-column: 1;
    grid-row: 1;
  }
  .timing-entrant > span:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }
  .timing-entrant > span:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
  }
}
@media (max-width: 850px) {
  .race-work,
  .race-work.with-live {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .race-work > * {
    width: 100%;
  }
  .race-work > .pit-section {
    order: 0;
    position: sticky;
    top: 78px;
    z-index: 3;
    max-height: 32dvh;
    overflow: auto;
    box-shadow: 0 8px 18px #0006;
  }
  .race-work > #timing-panel {
    order: 1;
  }
  .race-work > .teams-section {
    order: 2;
  }
  .race-work.with-live #timing-content {
    max-height: 56dvh;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .race-work.with-live .timing-row {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }
  .race-work.with-live .timing-row > span:last-child {
    grid-column: auto;
    grid-row: auto;
  }
}
@media (max-width: 600px) {
  .race-work > .pit-section {
    top: 8px;
    max-height: 30dvh;
  }
  .race-work.with-live #timing-content {
    max-height: 52dvh;
  }
  .timing-actions {
    margin: 5px 0;
  }
  .timing-panel[open] {
    padding: 10px;
  }
  .timing-entrant {
    gap: 6px;
    font-size: 0.875rem;
    padding: 9px 9px 28px;
  }
  .timing-drag {
    min-width: 32px;
    width: 32px;
  }
  .pit-section .section-top {
    gap: 5px;
    margin-bottom: 5px;
  }
  .pit-section h2 {
    font-size: 0.9375rem;
  }
  .pit-direction {
    padding: 5px;
    min-height: 36px;
  }
  .team-signal {
    font-size: 0.8125rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lap-progress-fill {
    transition: none;
  }
}

/* STB97 Pit Wall. Graphite surfaces keep kart quality and race warnings distinct. */
:root {
  --pit-page: #0b1215;
  --pit-card: #142126;
  --pit-raised: #192b30;
  --pit-line: #2b4147;
  --pit-muted: #9db2b8;
  --pit-ink: #ecf3f4;
  --pit-accent: #43d5c9;
  --pit-warning: #efc369;
  --pit-danger: #ff858f;
  --surface: #142126;
  --surface-raised: #1c3035;
  --line: #2b4147;
  --muted: #9db2b8;
  --accent: #43d5c9;
}
body {
  background: var(--pit-page);
  color: var(--pit-ink);
}
.shell {
  position: relative;
  max-width: 1600px;
}
.header {
  min-height: 64px;
  border-bottom-color: var(--pit-line);
}
.header .brand {
  font-size: 1.12rem;
  letter-spacing: 0.035em;
  gap: 12px;
  white-space: nowrap;
}
.header .mark {
  position: relative;
  width: 24px;
  height: 25px;
  border: 0;
  border-radius: 0;
  transform: none;
  flex: none;
}
.header .mark::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 3px;
  width: 6px;
  height: 5px;
  background: var(--pit-accent);
  transform: skewX(-25deg);
  box-shadow:
    8px 0 var(--pit-accent),
    5px 7px var(--pit-accent),
    13px 7px var(--pit-accent),
    10px 14px var(--pit-accent),
    18px 14px var(--pit-accent);
}
.header .pill {
  border-color: var(--pit-line);
  color: var(--pit-muted);
}
.language-control select {
  background: transparent;
  border-color: transparent;
  color: var(--pit-muted);
}
.btn.red {
  background: var(--pit-accent);
  border-color: var(--pit-accent);
  color: #082326;
}
.btn.red:hover {
  background: #68e1d7;
  border-color: #68e1d7;
}
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--pit-accent);
  outline-offset: 3px;
}
.race-nav {
  box-shadow: none;
  background: transparent;
  border: 0;
  gap: 5px;
  padding: 0;
  border-radius: 8px;
}
.race-nav button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pit-muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  min-height: 44px;
  padding: 10px 16px;
  white-space: nowrap;
}
.race-nav button.active {
  background: #163c3f;
  color: var(--pit-accent);
}
.quick-pit-mode .shell {
  padding: 0 20px 20px;
}
.compact-race-mode .header {
  padding: 8px 0;
  gap: 12px;
}
.compact-race-mode .header-right .small {
  display: none;
}
.compact-race-mode .race-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 20px 0 18px;
  min-height: 106px;
}
.compact-race-mode .race-head > div:first-child {
  display: block;
  min-width: 0;
}
.compact-race-mode .race-head h1 {
  font-size: 1.7rem;
  line-height: 1.2;
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.quick-pit-mode .race-meta {
  gap: 7px 12px;
  margin-top: 7px;
}
.quick-pit-mode .race-meta .pill {
  font-size: 0.75rem;
  color: var(--pit-muted);
  border: 0;
  padding: 0;
}
.quick-pit-mode .race-meta .pill:first-child {
  color: var(--pit-accent);
}
.compact-race-mode .clockbox {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
  min-width: 170px;
}
.compact-race-mode .clockbox .clock {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: 1.1;
}
.compact-race-mode .clockbox .small {
  font-size: 0.75rem;
  color: var(--pit-muted);
}
.quick-status {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--pit-muted);
}
.quick-status [data-quick-saved] {
  color: var(--pit-accent);
}
.quick-pit-mode #coach-panel .coach-card,
.quick-pit-mode #coach-panel .coach-notice {
  display: none;
}
.quick-pit-mode #coach-panel {
  margin: 0;
  gap: 0;
}
.quick-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 0 284px 14px 0;
}
.quick-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.quick-filters button {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--pit-card);
  color: var(--pit-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 650;
  white-space: nowrap;
}
.quick-filters button.active,
.quick-filters button[aria-pressed='true'] {
  background: #173d3f;
  color: var(--pit-accent);
}
.quick-filters [data-quick-filter='attention'] {
  color: var(--pit-warning);
}
.quick-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 100px;
  margin-left: auto;
  flex: 0 1 290px;
  color: var(--pit-muted);
}
.quick-search::before {
  content: '';
  position: absolute;
  left: 13px;
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
}
.quick-search::after {
  content: '';
  position: absolute;
  left: 24px;
  top: 24px;
  width: 6px;
  height: 1.5px;
  background: currentColor;
  transform: rotate(45deg);
  pointer-events: none;
}
.quick-search > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.quick-search input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px 8px 36px;
  border: 1px solid var(--pit-line);
  border-radius: 7px;
  background: var(--pit-card);
  color: var(--pit-ink);
  font: inherit;
  font-size: 0.8125rem;
}
.quick-search input::placeholder {
  color: var(--pit-muted);
  opacity: 0.9;
}
.quick-pit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: start;
  padding: 0;
}
.quick-team-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  align-items: stretch;
}
.quick-team {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 132px;
  padding: 7px 9px;
  border: 1px solid var(--pit-line);
  border-radius: 9px;
  background: #142126;
  color: var(--pit-ink);
  text-align: left;
  line-height: 1.25;
  touch-action: manipulation;
  font-variant-numeric: tabular-nums;
  box-shadow: none;
}
.quick-team:hover {
  border-color: #4a666e;
  filter: none;
}
.quick-team button:focus-visible {
  outline: 2px solid var(--pit-accent);
  outline-offset: 2px;
}
.quick-number,
.quick-current-kart,
.quick-menu {
  font: inherit;
  border: 0;
  background: transparent;
  color: inherit;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  touch-action: manipulation;
}
.quick-number {
  font-size: 0.9rem;
  font-weight: 750;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  min-height: 24px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.quick-current-kart {
  margin-left: auto;
  background: #192b30;
  color: var(--pit-muted);
  font-size: 0.6875rem;
  padding: 4px 7px;
  border-radius: 5px;
  min-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}
.quick-menu {
  min-width: 20px;
  min-height: 24px;
  font-size: 1rem;
  line-height: 1;
  color: var(--pit-muted);
}
.quick-name {
  display: block;
  font-size: 0.84rem;
  font-weight: 550;
  line-height: 1.22;
  overflow-wrap: anywhere;
  min-height: 33px;
  margin: 3px 0 4px;
  max-height: none;
  overflow: visible;
}
.quick-team.is-mine {
  border-color: var(--pit-accent);
  box-shadow: inset 2px 0 0 var(--pit-accent);
}
.quick-team.warn {
  border-color: var(--pit-warning);
  outline: 0;
  background: #142126;
}
.quick-team.warn [data-quick-remaining-label] {
  color: var(--pit-warning);
}
.quick-team.over {
  border-color: var(--pit-danger);
  outline: 0;
  background: #142126;
}
.quick-team.over [data-quick-remaining-label] {
  color: var(--pit-danger);
}
.quick-team > .team-signal {
  width: 100%;
  max-width: 100%;
  margin: 5px 0 0;
  padding: 5px 7px;
  min-height: 32px;
  line-height: 1.2;
  font-size: 0.75rem;
  border-radius: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.quick-team.dragging,
.quick-pit-kart.dragging {
  opacity: 0.4;
}
.quick-team.drop-ready,
.quick-pit-row.drop-ready {
  outline: 1px dashed var(--pit-accent);
  outline-offset: -3px;
}
.quick-team.drop-over,
.quick-pit-row.drop-over {
  outline: 3px solid var(--pit-accent);
  outline-offset: -3px;
}
.quick-empty {
  grid-column: 1/-1;
  min-height: 150px;
  display: grid;
  place-content: center;
  padding: 24px;
  border: 1px dashed var(--pit-line);
  border-radius: 10px;
  color: var(--pit-muted);
  text-align: center;
}
.quick-pit-column {
  position: sticky;
  top: 16px;
  min-width: 0;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.quick-pit-column h2 {
  font-size: 1.2rem;
  line-height: 1.2;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.quick-pit-toggle {
  display: none;
}
.quick-pit-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  padding: 8px 10px;
  margin: 0 0 8px;
  border: 1px solid var(--pit-line);
  border-radius: 10px;
  background: var(--pit-card);
  min-width: 0;
}
.quick-pit-row h3 {
  font-size: 1rem;
  line-height: 1.2;
  margin: 0;
  font-weight: 650;
}
.quick-row-status {
  display: block;
  min-height: 0;
  margin: 0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: normal;
}
.quick-row-status[data-status='open'] {
  color: var(--pit-accent);
  padding-left: 0;
}
.quick-row-status[data-status='closed'] {
  color: var(--pit-danger);
  background: #45272f;
}
.quick-pit-karts {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}
.quick-pit-kart {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--pit-line);
  border-radius: 5px;
  background: #192b30;
  color: var(--pit-ink);
  line-height: 1.2;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.quick-pit-kart.rating-good,
.quick-pit-kart.rating-neutral,
.quick-pit-kart.rating-bad,
.quick-pit-kart.rating-unknown {
  background: #192b30;
  border-color: var(--pit-line);
}
.quick-pit-kart.is-next {
  grid-column: 1/-1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  flex-basis: 100%;
  gap: 5px 10px;
  padding: 0 0 6px;
  margin: 0 0 3px;
  min-height: 0;
  border: 0;
  border-bottom: 1px solid var(--pit-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  align-items: center;
  justify-items: start;
}
.quick-pit-kart.is-next strong {
  grid-row: 2;
  grid-column: 1;
  font-size: 2.65rem;
  font-weight: 500;
  line-height: 1.1;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.quick-pit-kart.is-next small {
  grid-row: 1;
  grid-column: 1/-1;
  color: var(--pit-muted);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.quick-kart-rating {
  grid-row: 1;
  grid-column: 2/-1;
  align-self: center;
  justify-self: end;
  margin-top: 10px;
  position: relative;
  font-size: 0.6875rem;
  border-radius: 5px;
  padding: 5px 8px;
  max-width: 100%;
  color: var(--pit-muted);
  background: #23373b;
  font-weight: 550;
  white-space: normal;
  text-align: center;
}
.rating-good + .quick-kart-rating {
  color: var(--pit-accent);
  background: #173d3f;
}
.rating-neutral + .quick-kart-rating {
  color: var(--pit-warning);
  background: #3b3526;
}
.rating-bad + .quick-kart-rating {
  color: #e0b7cd;
  background: #3a2f3b;
}
.quick-lane-empty {
  font-size: 0.8125rem;
  color: var(--pit-muted);
  padding: 9px 0;
}
.quick-session-rules {
  padding: 14px 15px;
  border: 1px solid var(--pit-line);
  border-radius: 10px;
  background: var(--pit-card);
  font-size: 0.75rem;
  color: var(--pit-muted);
}
.quick-session-rules h3 {
  font-size: 0.8125rem;
  margin: 0 0 9px;
  font-weight: 600;
}
.quick-session-rules p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 0;
}
.quick-session-rules strong {
  color: var(--pit-ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
}
.team-identity-edit {
  font: inherit;
  color: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-bottom: 1px dotted #ffffff66;
  background: transparent;
}
/* Only the quick-change dialog becomes a sheet; all detailed dialogs retain their layout. */
dialog:has(.quick-confirm) {
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid #345057;
  border-radius: 20px;
  background: #17262b;
  color: var(--pit-ink);
}
dialog:has(.quick-confirm)::backdrop {
  background: #040a0dc9;
}
.modal:has(.quick-confirm) {
  padding: 28px;
}
.modal:has(.quick-confirm) .modal-x {
  top: 15px;
  right: 16px;
  border: 0;
  background: transparent;
  color: var(--pit-muted);
  border-radius: 8px;
}
.quick-confirm h2 {
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 0 0 18px;
  padding-right: 36px;
}
.quick-confirm-team {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 1.125rem;
  line-height: 1.3;
  margin: 0 0 20px;
  overflow-wrap: anywhere;
}
.quick-confirm-team small,
.quick-confirm-team > span:first-child {
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  color: var(--pit-accent);
}
.quick-confirm .field {
  margin: 0 0 13px;
}
.quick-confirm .field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--pit-muted);
  font-weight: 600;
}
.quick-confirm #quick-row {
  min-height: 44px;
  background: #102025;
  border-color: var(--pit-line);
}
.quick-confirm:has(.quick-row-option) #quick-row {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
}
#quick-row-options {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}
.quick-row-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 64px;
  padding: 12px 15px;
  border: 1px solid var(--pit-line);
  border-radius: 10px;
  background: var(--pit-card);
  color: var(--pit-ink);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
}
.quick-row-option > span {
  display: block;
  font-size: 0.8125rem;
  color: var(--pit-muted);
}
.quick-row-option.closed > span {
  color: var(--pit-danger);
}
.quick-row-option.selected,
.quick-row-option[aria-pressed='true'] {
  border-color: var(--pit-accent);
  background: #173c3e;
  box-shadow: inset 0 0 0 1px var(--pit-accent);
}
.quick-row-option.selected > span,
.quick-row-option[aria-pressed='true'] > span {
  color: var(--pit-accent);
}
.quick-transfer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 20px 22px;
  margin: 0 0 18px;
  border: 1px solid var(--pit-line);
  border-radius: 12px;
  background: #0e1b20;
}
.quick-transfer > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.quick-transfer > div > span {
  font-size: 0.6875rem;
  color: var(--pit-muted);
  text-transform: uppercase;
}
.quick-transfer strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 3.3rem;
  line-height: 1.1;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.quick-transfer strong[data-quick-next],
.quick-transfer > div:last-child > span {
  color: var(--pit-accent);
}
.quick-transfer small {
  font-size: 0.75rem;
  color: var(--pit-muted);
}
.quick-transfer > span {
  display: grid;
  place-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1a2e33;
  color: var(--pit-accent);
  font-size: 1.4rem;
}
.quick-consequences {
  margin: 0 0 20px;
}
.quick-consequences h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 10px;
}
.quick-consequences p {
  font-size: 0.875rem;
  color: var(--pit-muted);
  margin: 8px 0;
  line-height: 1.4;
}
.quick-confirm .quick-confirm-submit {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
  font-weight: 750;
  padding: 12px;
  margin-top: 0;
}
.quick-confirm-cancel {
  width: 100%;
  min-height: 44px;
  margin: 10px 0 0;
  border: 0;
  background: transparent;
  color: var(--pit-muted);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 550;
}
@media (min-width: 1150px) {
  .shell:has(#race-nav) .header {
    min-height: 68px;
  }
  .race-nav {
    position: absolute;
    top: 12px;
    left: 220px;
    width: max-content;
    z-index: 4;
  }
  .race-nav button {
    flex: none;
    padding: 10px 14px;
  }
  .quick-pit-column {
    margin-top: -49px;
  }
  .quick-pit-column h2 {
    min-height: 35px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
  }
}
@media (min-width: 1280px) {
  .quick-team-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (min-width: 1600px) {
  .quick-team {
    min-height: 152px;
    padding: 10px;
  }
  .quick-name {
    font-size: 0.9375rem;
    min-height: 38px;
  }
}
@media (min-width: 601px) and (max-width: 1149px) {
  .compact-race-mode .race-head {
    min-height: 100px;
    padding: 18px 0;
  }
  .race-nav {
    position: static;
    display: flex;
    width: 100%;
    margin: 8px 0;
  }
  .quick-toolbar {
    margin-right: 244px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .quick-search {
    flex: 1 1 160px;
    margin-left: 0;
  }
  .quick-pit-layout {
    grid-template-columns: minmax(0, 1fr) 224px;
    gap: 20px;
  }
  .quick-team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .quick-pit-row {
    padding: 12px;
  }
}
@media (min-width: 601px) and (max-width: 850px) {
  .quick-pit-mode .shell {
    padding: 0 14px 24px;
  }
  .quick-pit-layout {
    grid-template-columns: minmax(0, 1fr) 200px;
    gap: 14px;
  }
  .quick-team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-toolbar {
    margin-right: 214px;
  }
  .compact-race-mode .race-head h1 {
    font-size: 1.35rem;
  }
  .compact-race-mode .clockbox .clock {
    font-size: 1.9rem;
  }
  .quick-filters {
    gap: 5px;
    width: 100%;
  }
  .quick-filters button {
    flex: 1;
    padding: 7px 8px;
  }
  .quick-kart-rating {
    padding: 5px;
    font-size: 0.625rem;
  }
  .quick-pit-kart.is-next strong {
    font-size: 2.3rem;
  }
}
@media (max-width: 600px) {
  .quick-pit-mode .shell {
    padding: 0 16px calc(156px + env(safe-area-inset-bottom));
  }
  .header,
  .compact-race-mode .header {
    min-height: 72px;
    padding: 12px 0;
  }
  .header .brand {
    font-size: 1.125rem;
    gap: 12px;
  }
  .header-right {
    gap: 0;
  }
  .header-right #save-indicator {
    display: none;
  }
  .language-control span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .language-control select {
    min-width: 50px;
    padding: 5px 3px;
    font-size: 0.75rem;
  }
  .compact-race-mode .race-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 122px;
    padding: 16px 0;
  }
  .compact-race-mode .race-head h1 {
    font-size: 1.15rem;
    line-height: 1.25;
  }
  .quick-pit-mode .race-meta {
    gap: 5px 8px;
    margin-top: 6px;
  }
  .quick-pit-mode .race-meta .pill {
    font-size: 0.625rem;
  }
  .quick-pit-mode .race-meta .pill:nth-child(n + 3) {
    display: none;
  }
  .compact-race-mode .clockbox {
    min-width: 116px;
    gap: 4px;
    align-self: start;
    padding-top: 3px;
  }
  .compact-race-mode .clockbox .clock {
    font-size: 1.6rem;
    letter-spacing: -0.025em;
  }
  .compact-race-mode .clockbox .small {
    font-size: 0.625rem;
    max-width: 120px;
  }
  .quick-status {
    gap: 4px;
    margin-top: 7px;
    display: flex;
    flex-direction: column;
    font-size: 0.6875rem;
  }
  .quick-status [data-quick-room]:empty {
    display: none;
  }
  .race-nav {
    position: fixed;
    top: auto;
    bottom: 0;
    margin: 0;
    z-index: 10;
    display: flex;
    gap: 0;
    min-height: calc(64px + env(safe-area-inset-bottom));
    width: 100%;
    padding: 4px 0 max(4px, env(safe-area-inset-bottom));
    background: #111e23;
    border: 0;
    border-top: 1px solid var(--pit-line);
    border-radius: 0;
    box-shadow: none;
  }
  .race-nav {
    left: 0;
    right: 0;
  }
  .race-nav button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
    min-height: 55px;
    padding: 3px 2px;
    border: 0;
    border-radius: 0;
    font-size: 0.6875rem;
    font-weight: 550;
    white-space: normal;
    line-height: 1.2;
    background: transparent;
  }
  .race-nav button.active {
    background: transparent;
    color: var(--pit-accent);
  }
  .race-nav button::before {
    font-size: 1.35rem;
    line-height: 1.1;
    font-weight: 500;
  }
  .race-nav [data-view='quick']::before {
    content: '▦';
  }
  .race-nav [data-view='race']::before {
    content: '▥';
  }
  .race-nav [data-view='drivers']::before {
    content: '♧';
  }
  .race-nav [data-view='more']::before {
    content: '•••';
    letter-spacing: 2px;
  }
  .quick-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 0 0 10px;
  }
  .quick-search {
    grid-column: 1/-1;
    grid-row: 1;
    width: 100%;
    margin: 0;
    min-width: 0;
  }
  .quick-search input {
    min-height: 44px;
    font-size: 0.875rem;
    padding: 10px 12px 10px 39px;
    border-radius: 8px;
  }
  .quick-search::before {
    left: 16px;
    width: 11px;
    height: 11px;
  }
  .quick-search::after {
    left: 27px;
    top: 28px;
  }
  .quick-filters {
    grid-column: 1;
    grid-row: 2;
    gap: 7px;
    width: 100%;
    min-width: 0;
  }
  .quick-filters button {
    min-width: 0;
    flex: 1;
    min-height: 42px;
    padding: 8px 7px;
    font-size: 0.75rem;
  }
  .quick-pit-layout {
    display: block;
    padding: 0;
  }
  .quick-team-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }
  .quick-team {
    min-height: 192px;
    padding: 6px 13px;
    border-radius: 10px;
  }
  .quick-number {
    font-size: 1.3125rem;
    min-height: 44px;
    max-width: 84px;
  }
  .quick-current-kart {
    min-height: 44px;
    font-size: 0.875rem;
    background: transparent;
    padding: 3px 0;
    max-width: 125px;
  }
  .quick-menu {
    min-width: 32px;
    min-height: 44px;
    font-size: 1.4rem;
    letter-spacing: 2px;
  }
  .quick-name {
    font-size: 1.0625rem;
    line-height: 1.3;
    min-height: 29px;
    margin: 0 0 3px;
    font-weight: 550;
  }
  .quick-team.is-mine {
    box-shadow: inset 0 0 0 1px var(--pit-accent);
  }
  .quick-team > .team-signal {
    min-height: 44px;
    font-size: 0.8125rem;
    margin-top: 7px;
  }
  .quick-pit-column {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    top: auto;
    z-index: 9;
    width: 100%;
    max-height: calc(100dvh - 120px);
    padding: 0 16px;
    background: #111e23;
    border-top: 1px solid var(--pit-line);
    overflow-y: auto;
    box-shadow: 0 -5px 18px #0002;
  }
  .quick-pit-column > h2 {
    display: none;
  }
  .quick-pit-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    width: 100%;
    min-height: 55px;
    padding: 5px 0;
    border: 0;
    background: transparent;
    color: var(--pit-ink);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 650;
    text-align: left;
  }
  .quick-pit-toggle::after {
    content: '⌃';
    font-size: 1rem;
    font-weight: 500;
    color: var(--pit-muted);
    flex: none;
  }
  .quick-pit-column.expanded .quick-pit-toggle::after {
    content: '⌄';
  }
  .quick-mobile-rows {
    display: flex;
    gap: 6px;
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
  }
  .quick-mobile-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    padding: 4px 7px;
    min-height: 42px;
    min-width: 0;
    border-radius: 6px;
    background: #173b3e;
    color: var(--pit-accent);
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }
  .quick-mobile-row[data-status='closed'],
  .quick-mobile-row.closed {
    background: #45272f;
    color: var(--pit-danger);
  }
  .quick-mobile-row strong {
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
  }
  .quick-pit-column:not(.expanded) #quick-pit-content {
    display: none;
  }
  .quick-pit-column.expanded #quick-pit-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 5px 0 12px;
    max-height: calc(70dvh - 124px);
    overflow: auto;
    overscroll-behavior: contain;
  }
  .quick-pit-row {
    padding: 11px;
    margin: 0;
    border-radius: 8px;
  }
  .quick-pit-row h3 {
    font-size: 0.9375rem;
    margin-bottom: 8px;
  }
  .quick-row-status {
    min-height: 36px;
    margin-bottom: 7px;
    padding: 6px;
    font-size: 0.6875rem;
  }
  .quick-pit-kart.is-next {
    min-height: 84px;
    grid-template-columns: 1fr;
    gap: 5px;
    padding-bottom: 10px;
  }
  .quick-pit-kart.is-next strong {
    grid-row: 2;
    grid-column: 1;
    font-size: 2rem;
  }
  .quick-pit-kart.is-next small {
    grid-row: 1;
    grid-column: 1;
    font-size: 0.5625rem;
  }
  .quick-kart-rating {
    grid-row: 2;
    grid-column: 1/-1;
    font-size: 0.625rem;
    padding: 4px 6px;
    margin: -7px 0 0;
    justify-self: start;
  }
  .quick-session-rules {
    grid-column: 1/-1;
    padding: 10px 12px;
    font-size: 0.75rem;
  }
  .quick-session-rules h3 {
    font-size: 0.75rem;
  }
  dialog:has(.quick-confirm) {
    position: fixed;
    inset: auto 0 0;
    margin: 0;
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 16px);
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    overflow-y: auto;
  }
  .modal:has(.quick-confirm) {
    padding: 30px 20px max(14px, env(safe-area-inset-bottom));
  }
  .modal:has(.quick-confirm)::before {
    content: '';
    position: absolute;
    top: 10px;
    left: calc(50% - 26px);
    width: 52px;
    height: 4px;
    border-radius: 4px;
    background: #789399;
  }
  .modal:has(.quick-confirm) .modal-x {
    top: 29px;
    right: 12px;
  }
  .quick-confirm h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    padding-right: 34px;
  }
  .quick-confirm-team {
    font-size: 1rem;
    gap: 6px;
    margin-bottom: 18px;
  }
  .quick-confirm-team small,
  .quick-confirm-team > span:first-child {
    font-size: 0.6875rem;
  }
  #quick-row-options {
    gap: 10px;
    margin-bottom: 16px;
  }
  .quick-row-option {
    min-height: 62px;
    padding: 10px 13px;
    font-size: 1rem;
  }
  .quick-row-option > span {
    font-size: 0.75rem;
  }
  .quick-transfer {
    gap: 12px;
    padding: 16px;
    margin-bottom: 18px;
  }
  .quick-transfer strong {
    font-size: 3rem;
  }
  .quick-transfer > div > span {
    font-size: 0.625rem;
  }
  .quick-transfer small {
    font-size: 0.6875rem;
  }
  .quick-transfer > span {
    width: 34px;
    height: 34px;
    font-size: 1.3rem;
  }
  .quick-consequences {
    margin-bottom: 18px;
  }
  .quick-consequences h3 {
    font-size: 0.9375rem;
  }
  .quick-consequences p {
    font-size: 0.8125rem;
    margin: 8px 0;
    line-height: 1.35;
  }
  .quick-confirm .quick-confirm-submit {
    min-height: 52px;
    font-size: 1rem;
    padding: 10px;
  }
  .quick-confirm-cancel {
    min-height: 44px;
    margin-top: 8px;
  }
  .toast {
    bottom: calc(128px + env(safe-area-inset-bottom));
  }
}
@media (max-width: 360px) {
  .quick-pit-mode .shell {
    padding-left: 12px;
    padding-right: 12px;
  }
  .compact-race-mode .race-head {
    gap: 8px;
  }
  .compact-race-mode .race-head h1 {
    font-size: 1rem;
  }
  .compact-race-mode .clockbox {
    min-width: 108px;
  }
  .compact-race-mode .clockbox .clock {
    font-size: 1.45rem;
  }
  .quick-filters {
    gap: 5px;
  }
  .quick-filters button {
    font-size: 0.6875rem;
    padding: 7px 5px;
  }
  .quick-team {
    padding: 9px 11px;
  }
  .quick-pit-column {
    padding-left: 10px;
    padding-right: 10px;
  }
  .quick-mobile-row {
    padding: 4px 5px;
    font-size: 0.5625rem;
  }
  .quick-mobile-row strong {
    font-size: 0.625rem;
  }
  .modal:has(.quick-confirm) {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Align the shipped semantic markup and keep connection actions readable. */
.quick-team-area {
  min-width: 0;
}
.quick-hint {
  font-size: 0.625rem;
  color: var(--pit-muted);
  margin: 6px 1px 0;
  line-height: 1.4;
}
.quick-status button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--pit-muted);
  font: inherit;
  padding: 3px 0;
  text-align: left;
  min-height: 24px;
}
.quick-status button:focus-visible {
  outline: 2px solid var(--pit-accent);
  outline-offset: 2px;
}
.quick-panel-chevron {
  display: none;
}
.quick-row-option > small {
  font-size: 0.6875rem;
  color: var(--pit-muted);
}
.quick-row-option.selected > small {
  color: var(--pit-accent);
}
.team-primary .btn:first-child {
  background: var(--pit-accent);
  border-color: var(--pit-accent);
  color: #082326;
}
@media (min-width: 1150px) {
  .compact-race-mode .race-head {
    grid-template-columns: minmax(0, 1fr) auto 230px;
  }
  .quick-status {
    border-left: 1px solid var(--pit-line);
    padding-left: 20px;
    margin: 0 0 0 6px;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
}
@media (min-width: 601px) and (max-width: 1149px) {
  .quick-status {
    grid-column: 1/-1;
    margin-top: -12px;
  }
}
@media (max-width: 600px) {
  .quick-status {
    grid-column: 1/-1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px 10px;
    margin-top: -5px;
    font-size: 0.625rem;
  }
  .quick-status [data-quick-saved] {
    flex-basis: 100%;
  }
  .quick-status button {
    min-height: 28px;
    padding: 3px 0;
  }
  .quick-hint {
    font-size: 0.625rem;
    margin-top: 10px;
  }
  .quick-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (min-width: 1280px) and (max-width: 1599px) {
  .quick-team {
    min-height: 128px;
    padding: 6px 8px;
  }
  .quick-number,
  .quick-current-kart,
  .quick-menu {
    min-height: 21px;
  }
  .quick-current-kart {
    padding: 3px 6px;
    font-size: 0.625rem;
  }
  .quick-name {
    font-size: 0.8125rem;
    line-height: 1.2;
    min-height: 31px;
    margin: 2px 0 3px;
  }
  .quick-team > .team-signal {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 5px;
    width: auto;
    min-height: 22px;
    padding: 4px 5px;
    font-size: 0.6875rem;
    margin: 0;
  }
}
@media (max-width: 600px) {
  .quick-menu {
    min-width: 44px;
  }
  .quick-mobile-rows {
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: flex-start;
    overscroll-behavior-x: contain;
    max-width: 100%;
  }
  .quick-mobile-rows::-webkit-scrollbar {
    display: none;
  }
  .quick-mobile-row {
    flex: 0 0 auto;
    min-width: 104px;
  }
}
.quick-row-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-content: center;
  line-height: 1.25;
}
.quick-row-option > strong {
  grid-column: 1;
  grid-row: 1;
}
.quick-row-option > span {
  grid-column: 1/-1;
  grid-row: 2;
}
.quick-row-option > small {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  text-align: right;
}
@media (max-width: 600px) {
  .quick-number {
    min-width: 44px;
  }
  .quick-filters button {
    min-height: 44px;
  }
}
/* Practice remains explicit without displacing the working race surface. */
.compact-race-mode .clockbox .small {
  flex: 0 0 auto;
}
.quick-team.is-mine.warn:not(.over) {
  border-color: var(--pit-accent);
}
.compact-race-mode .header-right #save-indicator {
  display: none;
}
.compact-race-mode .practice-bar {
  min-width: 0;
  gap: 12px;
  padding: 8px 10px;
  margin: 0 0 12px;
  background: #142126;
  border: 1px solid var(--pit-line);
  border-radius: 8px;
  flex-wrap: nowrap;
}
.compact-race-mode .practice-bar > div:first-child {
  flex: 0 0 auto;
}
.compact-race-mode .practice-bar strong {
  font-size: 0.6875rem;
  letter-spacing: 0.025em;
  color: var(--pit-accent);
}
.compact-race-mode .practice-bar .small {
  display: none;
}
.compact-race-mode .practice-bar .toolbar {
  width: auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.compact-race-mode .practice-bar .toolbar .btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 5px 10px;
  font-size: 0.75rem;
  background: #192b30;
  border-color: var(--pit-line);
}
.compact-race-mode .practice-bar label {
  font-size: 0.6875rem;
  gap: 4px;
}
.compact-race-mode .practice-bar select {
  min-height: 36px;
  max-width: 56px;
  padding: 4px;
  font-size: 0.75rem;
  background: #101e23;
  border-color: var(--pit-line);
}
@media (min-width: 1280px) {
  .compact-race-mode .practice-bar {
    position: absolute;
    left: 730px;
    right: 130px;
    top: 13px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    justify-content: flex-end;
    gap: 12px;
  }
}
@media (max-width: 600px) {
  .compact-race-mode .race-head {
    align-items: start;
  }
  .compact-race-mode .practice-bar {
    gap: 6px;
    padding: 4px 7px;
    margin: 0 0 10px;
    justify-content: space-between;
    min-height: 52px;
  }
  .compact-race-mode .practice-bar strong {
    font-size: 0.5625rem;
  }
  .compact-race-mode .practice-bar label {
    font-size: 0;
    gap: 0;
  }
  .compact-race-mode .practice-bar .toolbar {
    gap: 4px;
  }
  .compact-race-mode .practice-bar .toolbar .btn {
    min-height: 44px;
    font-size: 0.6875rem;
    padding: 5px 8px;
  }
  .compact-race-mode .practice-bar select {
    min-height: 44px;
    max-width: 49px;
    font-size: 0.6875rem;
  }
}
@media (max-width: 360px) {
  .compact-race-mode .practice-bar .toolbar .btn {
    font-size: 0.625rem;
    padding: 5px 6px;
  }
  .compact-race-mode .practice-bar strong {
    font-size: 0.5rem;
  }
}
.quick-row-option.closed.selected > span,
.quick-row-option.closed[aria-pressed='true'] > span {
  color: var(--pit-danger);
}
@media (max-width: 600px) {
  .quick-pit-karts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-pit-kart:not(.is-next) {
    min-width: 0;
    white-space: nowrap;
    padding: 4px 5px;
    font-size: 0.8125rem;
  }
}
@media (min-width: 1280px) and (max-width: 1599px) {
  .compact-race-mode .race-head {
    min-height: 98px;
    padding: 16px 0 14px;
  }
  .quick-team-grid {
    gap: 6px;
  }
}

/* Compact race board: a whole tile opens details; color is only a small cue.
   The layout script sets --tile-h so every team fits without scrolling; the tile
   content adapts to the space it gets through container queries. */
.quick-team-grid,
.team-list {
  display: grid;
  grid-template-columns: repeat(var(--team-columns, 6), minmax(0, 1fr));
  grid-auto-rows: var(--tile-h, 64px);
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}
.quick-team.compact-team,
.team-tile.compact-team {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  height: var(--tile-h, 64px);
  min-width: 0;
  min-height: 0;
  padding: 0;
  gap: 0;
  border: 1px solid var(--pit-line);
  border-radius: 7px;
  background: #142126;
  color: var(--pit-ink);
  box-shadow: none;
  outline: 0;
  overflow: hidden;
  line-height: 1.1;
  touch-action: pan-y;
  container-type: size;
}
:root[data-density] .compact-team {
  padding: 0;
}
.compact-open {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  flex: 1 1 auto;
  gap: 3px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  touch-action: pan-y;
}
.compact-open:focus-visible {
  outline: 2px solid var(--pit-accent);
  outline-offset: -2px;
  z-index: 1;
}
.compact-open:hover {
  background: #ffffff06;
}
.compact-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.compact-team-line,
.compact-kart-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.compact-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d5e0e3;
}
.compact-label {
  font-size: 0.7rem;
  line-height: 1;
  color: var(--pit-muted);
  font-weight: 500;
}
.compact-identity .compact-team-number,
.compact-identity .compact-kart-number {
  flex: none;
  min-width: 0;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.compact-identity .compact-team-number {
  font-size: 1.3rem;
  color: var(--pit-ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.compact-identity .compact-kart-number {
  font-size: 0.95rem;
  font-weight: 650;
  color: #bacbd0;
}
.compact-status {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.15;
  color: var(--pit-muted);
  font-variant-numeric: tabular-nums;
}
.compact-clock {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 650;
  color: #d5e0e3;
  white-space: nowrap;
}
.compact-stops {
  margin-left: auto;
  white-space: nowrap;
}
.compact-rating {
  display: inline-block;
  flex: none;
  align-self: center;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #71878e;
  font-size: 0;
  line-height: 0;
}
.rating-good .compact-rating {
  background: var(--pit-accent);
}
.rating-neutral .compact-rating {
  background: var(--pit-warning);
}
.rating-bad .compact-rating {
  background: #d2a1b9;
}
/* Narrow tiles: number and kart stacked, centered; the name only fits on wider tiles. */
@container (max-width: 104px) {
  .compact-open {
    padding: 3px;
    text-align: center;
    gap: 2px;
  }
  .compact-team-line,
  .compact-kart-line,
  .compact-status {
    justify-content: center;
    gap: 3px;
  }
  .compact-name,
  .compact-stops {
    display: none;
  }
  .compact-label {
    font-size: 0.6rem;
  }
  .compact-status {
    font-size: 0.7rem;
  }
}
/* Short tiles: one identity row plus the clock; the name gives way before the kart. */
@container (max-height: 58px) {
  .compact-identity {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }
  .compact-team-line {
    flex: 1 1 auto;
  }
  .compact-kart-line {
    flex: none;
  }
}
@container (max-height: 58px) and (max-width: 104px) {
  .compact-identity {
    justify-content: center;
  }
  .compact-kart-line .compact-label {
    display: none;
  }
  .compact-team-line {
    flex: none;
  }
}
@container (max-height: 58px) and (max-width: 150px) {
  .compact-name {
    display: none;
  }
}
/* Roomy tiles get larger numbers. */
@container (min-height: 80px) and (min-width: 150px) {
  .compact-identity .compact-team-number {
    font-size: 1.6rem;
  }
  .compact-name {
    font-size: 0.9rem;
  }
  .compact-status {
    font-size: 0.9rem;
  }
}
.compact-warning {
  display: none;
  flex: none;
  font-size: 0.625rem;
  line-height: 1;
  color: var(--pit-warning);
}
.compact-team.warn {
  border-color: var(--pit-warning);
}
.compact-team.over {
  border-color: var(--pit-danger);
}
.compact-team.warn .compact-warning,
.compact-team.over .compact-warning {
  display: inline;
}
.compact-team.warn .compact-clock {
  color: var(--pit-warning);
}
.compact-team.over .compact-clock,
.compact-team.over .compact-warning {
  color: var(--pit-danger);
}
.compact-team.is-mine {
  border-color: var(--pit-accent);
  box-shadow: inset 0 0 0 1px var(--pit-accent);
}
.compact-team.is-mine .compact-open::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--pit-accent);
}
.compact-team > .team-signal {
  position: static;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0 3px 4px;
  padding: 2px;
  font-size: 0.5625rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}
.compact-team > button.team-signal {
  min-height: 44px;
}
.quick-pit-layout {
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
}
.quick-toolbar {
  margin-right: 276px;
}
.quick-pit-karts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.quick-pit-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 4px;
  min-width: 0;
  align-items: stretch;
}
.quick-pit-entry.is-next {
  grid-column: 1/-1;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--pit-line);
}
.quick-pit-entry .quick-pit-kart {
  display: flex;
  grid-column: auto;
  grid-row: auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--pit-line);
  border-radius: 5px;
  background: #192b30;
  font-size: 0.875rem;
}
.quick-pit-entry.is-next .quick-pit-kart {
  min-height: 44px;
  border: 0;
  background: transparent;
}
.quick-pit-entry .quick-pit-kart strong {
  font-size: inherit;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.quick-pit-entry.is-next .quick-pit-kart strong {
  font-size: 1.6rem;
  font-weight: 600;
}
.quick-pit-entry .quick-pit-kart small {
  font-size: 0.5625rem;
  line-height: 1.15;
  color: var(--pit-muted);
}
.quick-rate {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--pit-line);
  border-radius: 6px;
  background: #22373c;
  color: var(--pit-muted);
  font: inherit;
  font-size: 0.625rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
  touch-action: manipulation;
}
.quick-rate.rating-good {
  color: var(--pit-accent);
  background: #173d3f;
}
.quick-rate.rating-neutral {
  color: var(--pit-warning);
  background: #3b3526;
}
.quick-rate.rating-bad {
  color: #e0b7cd;
  background: #3a2f3b;
}
.quick-rate:focus-visible {
  outline: 2px solid var(--pit-accent);
  outline-offset: 2px;
}
#view-race {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#view-race > .race-work {
  order: 0;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
}
#view-race > #pro-board {
  order: 2;
  margin: 0;
}
#view-race .race-work > .teams-section {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#view-race .race-work > .pit-section {
  grid-column: 2;
  grid-row: 1 / span 2;
}
#view-race .race-work > #timing-panel {
  grid-column: 1;
  grid-row: 2;
}
#view-race .teams-section > .section-top {
  min-height: 32px;
  margin: 0 0 6px;
  padding: 0;
  gap: 4px;
}
#view-race .teams-section > .section-top .small {
  font-size: 0.625rem;
}
#view-race .teams-section > .section-top h2 {
  font-size: 0.8125rem;
}
/* Tablets keep the pit lane beside the teams: a pit change must never need scrolling. */
@media (min-width: 601px) and (max-width: 1023px) {
  .quick-team-grid,
  .team-list {
    grid-template-columns: repeat(var(--team-columns, 6), minmax(0, 1fr));
  }
  .quick-pit-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px;
    gap: 12px;
  }
  .quick-toolbar {
    margin-right: 0;
  }
  .quick-pit-karts {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 1023px) {
  #view-race > .race-work {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  #view-race .race-work > .teams-section {
    order: 0;
    width: 100%;
  }
  #view-race .race-work > .pit-section {
    order: 1;
    position: static;
    max-height: none;
    width: 100%;
    overflow: visible;
    box-shadow: none;
  }
  #view-race .race-work > #timing-panel {
    order: 2;
    width: 100%;
  }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .quick-team-grid,
  .team-list {
    grid-template-columns: repeat(var(--team-columns, 6), minmax(0, 1fr));
  }
  .quick-pit-layout,
  #view-race > .race-work {
    grid-template-columns: minmax(0, 1fr) 224px;
    gap: 16px;
  }
  .quick-toolbar {
    margin-right: 240px;
  }
}
@media (min-width: 1280px) {
  .quick-team-grid,
  .team-list {
    grid-template-columns: repeat(var(--team-columns, 8), minmax(0, 1fr));
    gap: 6px;
  }
}
@media (max-width: 600px) {
  .quick-pit-mode .shell,
  .compact-race-mode .shell {
    padding: 0 12px calc(132px + env(safe-area-inset-bottom));
  }
  .compact-race-mode .header,
  .compact-race-mode .shell .header {
    min-height: 44px;
    padding: 0;
    gap: 6px;
  }
  .compact-race-mode .shell .header .brand {
    font-size: 0.875rem;
    gap: 7px;
  }
  .compact-race-mode .shell .header .pill {
    font-size: 0.5625rem;
    padding: 2px 5px;
  }
  .compact-race-mode .shell .header .mark {
    width: 24px;
    height: 24px;
  }
  .compact-race-mode .race-head,
  .compact-race-mode .shell .race-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 58px;
    padding: 6px 0;
    gap: 3px 8px;
    align-items: center;
  }
  .compact-race-mode .race-head h1,
  .compact-race-mode .shell .race-head h1 {
    font-size: 0.875rem;
    line-height: 1.2;
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .quick-pit-mode .race-meta,
  .compact-race-mode .shell .race-meta {
    gap: 3px 7px;
    margin-top: 3px;
  }
  .quick-pit-mode .race-meta .pill,
  .compact-race-mode .shell .race-meta .pill {
    font-size: 0.5625rem;
  }
  .compact-race-mode .shell .race-meta .pill:nth-child(n + 3) {
    display: none;
  }
  .compact-race-mode .clockbox,
  .compact-race-mode .shell .race-head .clockbox {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    align-self: center;
    min-width: 88px;
    padding: 0;
    gap: 1px;
    grid-row: 1;
    grid-column: 2;
    text-align: right;
  }
  .compact-race-mode .clockbox .clock,
  .compact-race-mode .shell .race-head .clock {
    font-size: 1.25rem;
    line-height: 1.1;
    letter-spacing: -0.025em;
  }
  .compact-race-mode .clockbox .small,
  .compact-race-mode .shell .race-head .clockbox .small {
    flex: 0 0 auto;
    font-size: 0.5rem;
    line-height: 1.2;
    max-width: 100px;
  }
  .quick-status {
    grid-column: 1/-1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px 8px;
    margin: 0;
    font-size: 0.5rem;
    line-height: 1.2;
  }
  .quick-status [data-quick-saved] {
    flex-basis: auto;
  }
  .quick-status button {
    min-height: 24px;
    padding: 2px 0;
    font-size: 0.5625rem;
  }
  .quick-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    margin: 0 0 8px;
  }
  .quick-search {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    width: auto;
    margin: 0;
  }
  .quick-search input {
    min-height: 44px;
    padding: 8px 6px 8px 26px;
    font-size: 0.6875rem;
  }
  .quick-search::before {
    left: 9px;
    width: 9px;
    height: 9px;
  }
  .quick-search::after {
    left: 18px;
    top: 27px;
    width: 5px;
  }
  .quick-filters {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    gap: 3px;
    min-width: 0;
  }
  .quick-filters button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 6px 5px;
    font-size: 0.625rem;
  }
  .quick-team-grid,
  .team-list {
    grid-template-columns: repeat(var(--team-columns, 5), minmax(0, 1fr));
    gap: 6px;
  }
  .quick-hint {
    font-size: 0.5625rem;
    margin-top: 6px;
  }
  #view-race .teams-section > .section-top {
    min-height: 24px;
    margin-bottom: 6px;
  }
  .quick-pit-entry .quick-pit-kart {
    padding: 4px 2px;
    font-size: 0.75rem;
  }
  .quick-pit-entry.is-next .quick-pit-kart strong {
    font-size: 1.5rem;
  }
  .quick-rate {
    font-size: 0.5625rem;
  }
  .compact-race-mode .practice-bar {
    min-height: 44px;
    margin-bottom: 6px;
    padding: 0 4px;
    gap: 4px;
  }
  .compact-race-mode .practice-bar .toolbar .btn,
  .compact-race-mode .practice-bar select {
    min-height: 44px;
  }
}
/* Pit timing uses the same bottom row without pushing out the kart rating. */
.compact-open > .team-signal {
  grid-column: 1;
  grid-row: 2;
  justify-self: stretch;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 0 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: right;
}
.compact-open:has(> .team-signal:not([hidden])) .compact-status {
  justify-content: flex-start;
}
.compact-open:has(> .team-signal:not([hidden])) .compact-clock,
.compact-open:has(> .team-signal:not([hidden])) .compact-warning {
  display: none;
}
.compact-open > .team-signal.pending {
  font-size: 0;
}
.compact-open > .team-signal.pending::after {
  content: 'Пит';
  font-size: 0.75rem;
}
:lang(en) .compact-open > .team-signal.pending::after {
  content: 'Pit';
}
.quick-rate .quick-kart-rating {
  position: static;
  display: block;
  flex: none;
  align-self: center;
  justify-self: auto;
  width: 6px;
  height: 6px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: #71878e;
  color: inherit;
  font-size: 0;
  line-height: 0;
}
.quick-pit-kart.rating-good + .quick-rate {
  color: var(--pit-accent);
}
.quick-pit-kart.rating-neutral + .quick-rate {
  color: var(--pit-warning);
}
.quick-pit-kart.rating-bad + .quick-rate {
  color: #e0b7cd;
}
.quick-pit-kart.rating-good + .quick-rate .quick-kart-rating {
  background: var(--pit-accent);
}
.quick-pit-kart.rating-neutral + .quick-rate .quick-kart-rating {
  background: var(--pit-warning);
}
.quick-pit-kart.rating-bad + .quick-rate .quick-kart-rating {
  background: #d2a1b9;
}
/* Two outer pit rows already divide phone width; keep each queue readable. */
@media (max-width: 600px) {
  .quick-pit-karts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The № sign comes from the text font: monospace fonts on some systems draw it as a wide ligature. */
.kart-no {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.7em;
  font-weight: 600;
  margin-right: 1px;
}

/* Next pit hint and quick actions live in the race header, so the team grid keeps its height. */
.race-now {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.next-pit {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #2c5a5a;
  border-radius: 8px;
  background: #102a2c;
  color: var(--pit-ink);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.next-pit[hidden] {
  display: none;
}
.next-pit > * {
  flex: none;
}
.next-pit-label {
  color: var(--pit-accent);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.next-pit strong {
  flex: 0 1 auto;
  min-width: 3ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
.next-pit-time {
  font-variant-numeric: tabular-nums;
  color: var(--pit-muted);
}
.next-pit.over .next-pit-time {
  color: var(--pit-danger);
}
.next-pit-kart {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.next-pit:hover {
  border-color: var(--pit-accent);
}
.quick-actions {
  display: flex;
  gap: 6px;
  flex: none;
}
.quick-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--pit-line);
  border-radius: 8px;
  background: var(--pit-card);
  color: var(--pit-ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 650;
  white-space: nowrap;
}
.quick-action::before {
  content: attr(data-icon);
}
.quick-action:disabled {
  opacity: 0.4;
}
@media (min-width: 1150px) {
  .compact-race-mode .race-head {
    grid-template-columns: minmax(240px, 1fr) minmax(0, 560px) auto 230px;
  }
  .compact-race-mode .race-head h1 {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .race-now {
    flex-wrap: wrap;
  }
  .race-now .next-pit {
    flex-basis: 100%;
  }
}
@media (max-width: 1149px) {
  .race-now {
    grid-column: 1/-1;
    grid-row: 3;
  }
  .next-pit-label {
    display: none;
  }
}
@media (max-width: 600px) {
  .race-now {
    margin-top: -2px;
  }
  .next-pit {
    min-height: 40px;
    padding: 6px 9px;
    font-size: 0.75rem;
    gap: 6px;
  }
  .quick-action {
    min-width: 44px;
    justify-content: center;
    padding: 4px 8px;
  }
  .quick-action {
    font-size: 0;
    gap: 0;
  }
  .quick-action::before {
    font-size: 1rem;
  }
  .next-pit-sub {
    display: none;
  }
}
/* During the race, messages appear over the header rather than over team cards and never block taps. */
.compact-race-mode .toast {
  top: max(10px, env(safe-area-inset-top));
  bottom: auto;
  pointer-events: none;
}
/* Home screen: three separate ways to start a race. */
.setup-path {
  margin: 0 0 14px;
}
.setup-path > h2 {
  margin: 0 0 4px;
}
.setup-path > .help {
  margin: 0 0 12px;
}
.setup-path > .toolbar {
  margin-top: 10px;
}
.setup-path > .toolbar + .help {
  margin: 10px 0 0;
}
.setup-submit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.setup-path .setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Lap pace entry inside team and kart cards. */
.pace-box {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--pit-line);
  border-radius: 10px;
  background: #101e23;
}
.pace-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}
.pace-field {
  display: grid;
  gap: 4px;
  flex: 1 1 120px;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--pit-muted);
}
.pace-field input,
.pace-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--pit-line);
  border-radius: 8px;
  background: #0b1519;
  color: var(--pit-ink);
  min-height: 44px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.pace-form .btn {
  min-height: 44px;
}
.pace-owner,
.pace-error {
  flex-basis: 100%;
  margin: 0;
}
.pace-error:empty {
  display: none;
}
.pace-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.pace-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  font-size: 0.8125rem;
  color: var(--pit-muted);
}
.pace-list strong {
  min-width: 4.5em;
  color: var(--pit-ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.pace-list span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pace-delete {
  min-width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--pit-muted);
  font-size: 1.1rem;
}
.pace-delete:hover {
  background: #ffffff10;
  color: var(--pit-danger);
}
.pace-ranking {
  margin: 0 0 14px;
}
.pace-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}
.pace-table th,
.pace-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--pit-line);
  text-align: left;
}
.pace-table th {
  font-size: 0.75rem;
  color: var(--pit-muted);
  font-weight: 600;
}
.pace-table td span {
  display: block;
  font-size: 0.75rem;
  color: var(--pit-muted);
}
.pace-ranking details {
  margin-top: 10px;
}
/* Stint progress along the bottom edge of a team tile. */
.compact-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: #ffffff12;
  pointer-events: none;
}
.compact-bar::after {
  content: '';
  display: block;
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  background: var(--pit-accent);
  opacity: 0.75;
}
.compact-bar[data-level='warn']::after {
  background: var(--pit-warning);
  opacity: 1;
}
.compact-bar[data-level='over']::after {
  background: var(--pit-danger);
  opacity: 1;
}
.compact-stops[data-window='on'] {
  color: var(--pit-ink);
}
.compact-stops[data-window='warn'] {
  color: var(--pit-warning);
  font-weight: 700;
}
.compact-stops[data-window='over'] {
  color: var(--pit-danger);
  font-weight: 700;
}
/* Undo offer after a pit: above the phone navigation, reachable with the thumb. */
#undo-bar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--pit-accent);
  border-radius: 10px;
  background: #0f2a2c;
  color: var(--pit-ink);
  font-size: 0.875rem;
  box-shadow: 0 8px 30px #000a;
}
#undo-bar[hidden] {
  display: none;
}
#undo-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#undo-bar .btn {
  flex: none;
  min-height: 40px;
  border-color: var(--pit-accent);
  color: var(--pit-accent);
}
@media (max-width: 600px) {
  #undo-bar {
    bottom: calc(132px + env(safe-area-inset-bottom));
  }
}
/* Day theme: brightness is inverted and hues kept, so every screen becomes dark-on-light for
   sunlight without a second palette. Dialogs live in the top layer and need their own filter. */
:root[data-theme='light'],
:root[data-theme='light'] dialog {
  filter: invert(1) hue-rotate(180deg);
}
:root[data-theme='light'] img,
:root[data-theme='light'] video,
:root[data-theme='light'] canvas {
  filter: invert(1) hue-rotate(180deg);
}
.theme-toggle {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--pit-line);
  border-radius: 8px;
  background: transparent;
  color: var(--pit-ink);
  font-size: 1.1rem;
  line-height: 1;
}
/* Desktop and tablet pit column: one compact line of kart chips per row so every row stays in view.
   The chip's right edge is its rating button; the dot shows the color. */
@media (min-width: 601px) {
  .quick-pit-row {
    padding: 7px 8px;
    margin-bottom: 6px;
  }
  .quick-pit-karts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .quick-pit-entry,
  .quick-pit-entry.is-next {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    margin: 0;
    border: 1px solid var(--pit-line);
    border-radius: 7px;
    overflow: hidden;
    background: #142126;
  }
  .quick-pit-entry.is-next {
    border-color: var(--pit-accent);
    box-shadow: inset 0 0 0 1px var(--pit-accent);
  }
  .quick-pit-entry .quick-pit-kart,
  .quick-pit-entry .quick-pit-kart.is-next {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 38px;
    margin: 0;
    padding: 2px 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .quick-pit-entry .quick-pit-kart strong,
  .quick-pit-entry.is-next .quick-pit-kart strong {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
  }
  .quick-pit-entry .quick-pit-kart small {
    display: none;
  }
  .quick-pit-entry .quick-rate {
    min-width: 24px;
    min-height: 38px;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--pit-line);
    border-radius: 0;
    background: #ffffff08;
    font-size: 0;
  }
  .quick-pit-entry .quick-rate .quick-kart-rating {
    width: 9px;
    height: 9px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    background: #71878e;
  }
  .quick-pit-entry .quick-rate.rating-good .quick-kart-rating {
    background: var(--pit-accent);
  }
  .quick-pit-entry .quick-rate.rating-neutral .quick-kart-rating {
    background: var(--pit-warning);
  }
  .quick-pit-entry .quick-rate.rating-bad .quick-kart-rating {
    background: #d2a1b9;
  }
}
/* Phone held sideways: header, race line and filters shrink to thin rows; the rest goes to teams. */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 601px) {
  .compact-race-mode .shell {
    padding: 0 10px 8px;
  }
  .compact-race-mode .header {
    position: relative;
    min-height: 40px;
    padding: 2px 0;
  }
  .compact-race-mode .header .brand {
    font-size: 0;
    gap: 0;
  }
  .compact-race-mode .header-right .small,
  .compact-race-mode .header-right #language-label {
    display: none;
  }
  .compact-race-mode .race-nav {
    position: absolute;
    top: 3px;
    left: 34px;
    width: max-content;
    margin: 0;
    z-index: 4;
  }
  .compact-race-mode .race-nav button {
    flex: none;
    min-height: 34px;
    padding: 4px 10px;
    font-size: 0.8125rem;
  }
  .compact-race-mode .theme-toggle {
    min-width: 34px;
    min-height: 34px;
  }
  .compact-race-mode .race-head {
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 0;
    padding: 4px 0;
  }
  .compact-race-mode .race-head h1 {
    font-size: 0.9375rem;
    max-width: 22vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .compact-race-mode .race-meta,
  .compact-race-mode .quick-status,
  .compact-race-mode .clockbox .small,
  .quick-hint,
  .next-pit-sub {
    display: none;
  }
  .compact-race-mode .race-now {
    grid-column: 2;
    grid-row: 1;
  }
  .compact-race-mode .clockbox {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
  }
  .compact-race-mode .clockbox .clock {
    font-size: 1.35rem;
  }
  .next-pit,
  .quick-action {
    min-height: 34px;
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  .quick-action {
    font-size: 0;
    gap: 0;
  }
  .quick-action::before {
    font-size: 0.95rem;
  }
  .quick-toolbar {
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0 0 4px;
  }
  .quick-filters {
    width: auto;
  }
  .quick-filters button {
    flex: none;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  .quick-toolbar .quick-search {
    flex: 1 1 120px;
  }
  .quick-search input {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .quick-pit-layout {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 8px;
  }
  .quick-pit-column {
    position: sticky;
    top: 4px;
    max-height: calc(100dvh - 8px);
    overflow-y: auto;
  }
  .quick-pit-column h2,
  .quick-session-rules {
    display: none;
  }
  #race-alerts {
    margin-bottom: 4px;
  }
}
.pace-source {
  flex: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: #173d3f;
  color: var(--pit-accent);
  font-size: 0.6875rem;
  font-style: normal;
}
.pace-kart-stat {
  margin: 8px 0 0;
}
/* Timing shows this team in the pit lane. */
.compact-team.timing-in-pit::before {
  content: 'ПИТ';
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  padding: 1px 5px;
  border-radius: 0 6px 0 6px;
  background: var(--pit-warning);
  color: #111;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  pointer-events: none;
}
:lang(en) .compact-team.timing-in-pit::before {
  content: 'PIT';
}
/* Shared "box this lap" call: impossible to miss on every device of the race. */
#pit-call {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  width: min(720px, calc(100vw - 16px));
  padding: 14px 16px;
  border: 2px solid #111;
  border-radius: 12px;
  background: var(--pit-warning);
  color: #111;
  box-shadow: 0 10px 40px #000c;
  animation: pit-call 0.8s ease-in-out 4;
}
#pit-call[hidden] {
  display: none;
}
#pit-call strong {
  font-size: 1.35rem;
  line-height: 1.2;
  text-align: center;
}
#pit-call.sent {
  background: #173d3f;
  color: var(--pit-ink);
  border-color: var(--pit-accent);
  animation: none;
}
#pit-call .btn {
  min-height: 44px;
  background: #111;
  color: #fff;
  border-color: #111;
}
#pit-call.sent .btn {
  background: transparent;
  border-color: var(--pit-accent);
  color: var(--pit-accent);
}
@keyframes pit-call {
  50% {
    transform: translateX(-50%) scale(1.03);
  }
}
@media (prefers-reduced-motion: reduce) {
  #pit-call {
    animation: none;
  }
}
