/* Compact race HUD — Archival Paper & Swiss Timing Protocol (Light-Only).
   The camera reserve never changes with disclosure state. */
.stage { --hud-reserve: 0px; }
.stage .race-hud {
  --hud-ink: #0D2433;
  --hud-muted: #50697A;
  position: absolute;
  z-index: 30;
  top: 14px;
  right: 14px;
  width: 220px;
  display: block;
  padding: 5px;
  border: 1.5px solid #0D2433;
  border-radius: 2px;
  color: var(--hud-ink);
  background: rgba(248, 251, 251, 0.96);
  box-shadow: 0 4px 14px rgba(13, 36, 51, 0.10);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.stage .race-hud[data-expanded="true"] { width: 310px; }
.race-hud .hud-toggle {
  display: block;
  width: 100%;
  min-height: 82px;
  margin: 0;
  padding: 11px 12px 9px;
  border: 1px solid #C8D7DB;
  border-radius: 2px;
  color: var(--hud-ink);
  background: #FFFFFF;
  font-family: var(--font-mono);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, border-color 120ms ease;
}
.race-hud .hud-toggle:hover { border-color: #0D2433; background: #F2F7F9; }
.race-hud .hud-toggle:focus-visible { outline: 2px solid #0D2433; outline-offset: 2px; }
.race-hud[data-expanded="true"] .hud-toggle { background: #EEF4F5; border-color: #0D2433; }
.race-hud .hud-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.race-hud .hud-stat { display: grid; gap: 4px; }
.race-hud .hud-stat--time { text-align: right; }
.race-hud .hud-label { font-size: 9px; line-height: 1.3; color: var(--hud-muted); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.race-hud .hud-value { font-size: 23px; font-weight: 600; line-height: 1.15; letter-spacing: -.04em; color: var(--hud-ink); white-space: nowrap; }
.race-hud .hud-position { color: #B87800; }
.race-hud .hud-clock { font-size: 20px; letter-spacing: -.04em; color: var(--hud-ink); }
.race-hud .hud-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; border-top: 1px solid #E3ECEE; padding-top: 6px; }
.race-hud .hud-context { min-width: 0; color: var(--hud-muted); font-size: 9px; line-height: 1.4; }
.race-hud .hud-action { display: inline-flex; gap: 3px; align-items: center; flex-shrink: 0; color: var(--hud-ink); font-size: 9px; font-weight: 600; line-height: 1.4; }
.race-hud[data-expanded="true"] .hud-action svg { transform: rotate(180deg); }
.race-hud .hud-details {
  display: grid;
  gap: 11px;
  margin-top: 5px;
  padding: 10px;
  border: 1px solid #C8D7DB;
  border-radius: 2px;
  background: #FFFFFF;
  max-height: min(390px, calc(100dvh - 200px));
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 140ms ease, transform 140ms ease;
}
@starting-style {
  .race-hud .hud-details:not([hidden]) { opacity: 0; transform: translateY(-3px); }
}
.race-hud .hud-mode { margin: 0; color: var(--hud-muted); font-size: 9px; line-height: 1.5; letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.race-hud .hud-mode::before { content: ""; flex-shrink: 0; width: 6px; height: 6px; background: #138A74; }
.stage[data-mode="replay"] .race-hud .hud-mode::before { background: transparent; box-shadow: inset 0 0 0 1.5px #50697A; }
.race-hud ol { gap: 3px; color: var(--hud-ink); font-size: 11px; line-height: 1.5; margin: 0; padding: 0; list-style: none; display: grid; }
.race-hud li { min-height: 27px; padding: 3px 6px; display: grid; grid-template-columns: 14px 8px minmax(0, 1fr) auto; align-items: center; gap: 6px; border-radius: 2px; border-bottom: 1px solid #EEF4F5; }
.race-hud li.is-jacek { color: #0D2433; font-weight: 600; background: rgba(184, 120, 0, 0.12); border-left: 2px solid #B87800; }
.race-hud .hud-pos { color: var(--hud-muted); }
.race-hud .hud-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race-hud .hud-gap { font-size: 10px; color: var(--hud-muted); }
.race-hud .swatch { width: 5px; height: 11px; border-radius: 1px; box-shadow: none; display: inline-block; }
.race-hud .hud-foot { margin: 0; color: var(--hud-muted); font-size: 10px; line-height: 1.5; }
.race-hud[data-keyboard="true"] .hud-toggle,
.race-hud[data-keyboard="true"] .hud-details { transition: none; }

@media (min-width: 980px) {
  .stage { --hud-reserve: 248px; }
  .stage .btn-fullscreen { right: calc(14px + var(--hud-reserve)); transition: right 140ms ease; }
  .stage:has(.race-hud[data-expanded="true"]) .btn-fullscreen { right: 336px; }
  .stage .p3d-chip { max-width: min(520px, calc(100% - 78px - var(--hud-reserve))); }
}
@media (max-width: 979px) {
  .stage .race-hud,
  .stage .race-hud[data-expanded="true"] { position: relative; top: auto; right: auto; width: auto; margin: 12px; }
  .race-hud .hud-toggle { min-height: 82px; padding: 11px 14px 10px; }
  .race-hud .hud-label { font-size: 10px; }
  .race-hud .hud-value { font-size: 25px; }
  .race-hud .hud-clock { font-size: 23px; }
  .race-hud .hud-context, .race-hud .hud-action { font-size: 10px; }
  .race-hud .hud-details { max-height: none; }
  .race-hud ol { font-size: 12px; }
  .stage .p3d-chip { position: static; max-width: none; margin: 10px 12px 0; }
  .stage .p3d-cams { position: static; margin: 10px 12px 0; }
  .stage .btn-fullscreen { right: 12px; }
  .viz-module:fullscreen .p3d,
  .viz-module:-webkit-full-screen .p3d,
  .viz-module.is-fullscreen .p3d { height: auto; }
  .viz-module:fullscreen .p3d-viewport,
  .viz-module:-webkit-full-screen .p3d-viewport,
  .viz-module.is-fullscreen .p3d-viewport { height: max(260px, min(52dvh, 480px)); }
}
@media (prefers-reduced-motion: reduce) {
  .race-hud .hud-toggle, .race-hud .hud-details { transition: none; }
  @starting-style { .race-hud .hud-details:not([hidden]) { opacity: 1; transform: none; } }
}
@media (prefers-reduced-transparency: reduce) {
  .stage .race-hud { background: #F8FBFB; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .race-hud .hud-toggle,
  .race-hud[data-expanded="true"] .hud-toggle,
  .race-hud .hud-details { background: #FFFFFF; }
}
