/* Race control surfaces share the Garage's paper, ink and enamel. Keep the centre free for cars. */
:root { --paper:#e9e3d4; --yellow:#d8b855; --bench:#242923; }
.watch-hud { z-index:2; } /* Keep controls above the canvas-only depth blur (z=1). */
.watch-hud .watch-director-console {
  display:grid !important; width:224px; padding:12px; gap:10px !important; align-items:stretch;
  grid-template-columns:minmax(0,2fr) minmax(0,1fr);
  grid-template-areas:"label label" "shuttle shuttle" "camera camera" "exits volume" "entry entry";
}
.watch-hud .watch-director-label { grid-area:label; display:block; margin:0; padding:0 0 8px; }
.watch-hud .watch-shuttle { grid-area:shuttle; display:grid; grid-template-columns:1fr 1fr; border:0; box-shadow:none; background:none; padding:0; gap:1px; }
.watch-hud .watch-camera-bank { grid-area:camera; display:grid; grid-template-columns:1fr 1fr; gap:4px; }
.watch-hud .watch-director-console button {
  min-width:0 !important; min-height:44px !important; padding:8px 6px !important; margin:0;
  font:600 14px/1.2 var(--face-body); cursor:pointer; transform:none;
}
.watch-hud .watch-shuttle button { display:flex; justify-content:center; align-items:center; gap:6px; }
.watch-hud .watch-shuttle button > span { font:400 26px/1 var(--face-body); }
.watch-hud .watch-shuttle button::before,
.watch-hud .watch-exits :is(a,button)::before,
.watch-hud .watch-exits :is(a,button)::after { display:none; }
.watch-hud .watch-exits { grid-area:exits; display:grid; grid-template-columns:1fr 1fr; margin:0; padding:0; gap:4px; border:0; }
.watch-hud .watch-exits button { width:100%; font-size:13px; }
.watch-hud .player-volume-control { grid-area:volume; width:100%; }
.watch-hud .watch-entry { grid-area:entry; display:grid; margin:0; padding:0; border:0; gap:4px; }
.watch-hud .watch-entry:not(:has(button:not([hidden]))) { display:none; }
.watch-hud .watch-entry button { clip-path:none; }
.watch-hud .drive-top { flex-wrap:wrap; max-width:calc(100% - 300px); gap:6px; }
/* The way out (Sean 2026-10-17): a plain labelled key in the corner, the first thing on the top row. */
.watch-hud .watch-back { display:inline-flex; align-items:center; min-height:44px; padding:0 14px; border:1px solid #677068;
  border-radius:2px; background:#202723; color:#f2ead9; font:600 15px/1.2 var(--face-body); text-decoration:none; white-space:nowrap;
  position:relative; z-index:3; pointer-events:auto; }
.watch-hud .watch-back:hover { background:#353f38; }
.watch-hud .watch-back:focus-visible { outline:2px solid #f2ead9; outline-offset:2px; }
.watch-hud .drive-heat-rule { transform:none; box-shadow:none; border:0; padding:8px; }
.watch-hud .drive-heat-rule span { font-size:12px; letter-spacing:0; }
.watch-hud .drive-track, .watch-card, .watch-standings { border-radius:0; }
.drive-cue { left:16px; top:104px; width:280px; transform:none; justify-items:stretch; }
.drive-cue .drive-wait { padding:12px; border:0; text-align:left; }
.drive-cue .drive-wait strong { font-size:28px; }
.drive-cue .drive-controls-card { border:0; padding:12px; }
.drive-cue .drive-controls-card::before { display:none; }
.drive-controls-card .drive-key-columns { grid-template-columns:1fr; }
.drive-cue .drive-hint { margin:0; }
.drive-instrument-switches { border:0; border-radius:0; box-shadow:none; }
.drive-instrument-switches > button { min-height:44px !important; font-size:14px; }
.drive-instrument-switches > .drive-camera { padding:10px 8px !important; min-height:44px !important; }
.drive-instrument-switches > .drive-camera::before,
.drive-instrument-switches > .drive-camera::after { display:none; }
/* Native driving actions: each label owns a cell instead of shrinking inside a fixed-width flex row. */
.drive-hud:not(.watch-hud) .drive-instrument-switches { display:grid; grid-template-columns:minmax(0,1fr); gap:4px; }
.drive-hud:not(.watch-hud) .drive-instrument-switches > button { width:100%; min-height:44px !important; }
.drive-hud:not(.watch-hud) .drive-mixer {
  box-sizing:border-box; max-height:calc(100dvh - 100px); overflow-y:auto; overscroll-behavior:contain; align-content:start;
}
.drive-mix-controls { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; }
.drive-mix-controls > button { min-height:44px; padding:8px 12px; border:1px solid #8b8173; border-radius:2px;
  color:inherit; background:transparent; font:600 14px/1.2 var(--face-body); cursor:pointer; }
.drive-hud:not(.watch-hud)[data-phase="finished"] .drive-result { max-height:calc(100% - 112px); top:calc(50% - 40px); }
.drive-hud[data-phase="finished"] .drive-trigger { display:none; }
.drive-hud:not(.watch-hud):has(.heat-format:not([hidden])) .drive-top { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:6px; }
.drive-hud:not(.watch-hud):has(.heat-format:not([hidden])) .drive-track { min-width:0; }
.drive-hud:not(.watch-hud):has(.heat-format:not([hidden])) .drive-free-heat { display:none; }
.drive-hud:not(.watch-hud) .drive-top > .heat-format { grid-column:1 / -1; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; }
.drive-hud:not(.watch-hud) .heat-format > .drive-exit { position:static; transform:none; min-height:32px; padding:4px 8px; }
.drive-hud:not(.watch-hud) .drive-top > .heat-format :is(p,dt) { display:none; }
.drive-hud:not(.watch-hud):has(.heat-format:not([hidden])) :is(.drive-cue,.drive-lights) { top:calc(var(--drive-header-bottom,120px) + 8px); }
.drive-hud[data-phase="finished"] .drive-top > .heat-format { display:none; }
@media (min-width:641px) {
  .drive-hud[data-touch="true"]:not(.watch-hud) .drive-instrument-switches {
    width:200px; grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (min-width:641px) and (max-height:520px) {
  .drive-hud[data-touch="true"]:not(.watch-hud)[data-phase="finished"] .drive-instrument-switches {
    width:400px; grid-template-columns:repeat(4,minmax(0,1fr));
  }
}
/* A perimeter circuit surrounds its timing desk. Chase/director views retain the edge controls. */
.watch-infield[hidden] { display:none; }
.watch-hud[data-overview="perimeter"] .watch-infield {
  position:absolute; left:50%; top:60%; transform:translate(-50%,-50%);
  display:grid; grid-template-columns:180px 248px; gap:8px; width:436px;
}
.watch-hud[data-overview="perimeter"] :is(.drive-top,.watch-card,.watch-standings,.drive-bottom) {
  position:static; inset:auto; max-width:none; width:auto; transform:none; margin:0;
}
.watch-hud[data-overview="perimeter"] .drive-top { grid-column:1 / -1; display:flex; flex-wrap:nowrap; }
.watch-hud[data-overview="perimeter"] .drive-track { flex:1; max-width:none; }
.watch-hud[data-overview="perimeter"] .watch-card { padding:8px 12px; }
.watch-hud[data-overview="perimeter"] .watch-standings { min-width:0; align-self:start; }
.watch-hud[data-overview="perimeter"] .drive-bottom { grid-column:1 / -1; display:block; }
.watch-hud[data-overview="perimeter"] .watch-director-console {
  position:static !important; inset:auto !important; transform:none !important; margin:0;
  width:100%; display:grid; grid-template-columns:2fr 1fr; gap:8px !important;
  grid-template-areas:"label label" "shuttle camera" "exits volume" "entry entry";
}
.watch-hud[data-overview="perimeter"] .watch-shuttle { grid-area:shuttle; }
.watch-hud[data-overview="perimeter"] .watch-standings li > span { max-width:100%; }
.watch-hud[data-overview="perimeter"] .watch-standings { max-height:160px; overflow-y:auto; pointer-events:auto; }
.watch-stream[data-overview="perimeter"] .drive-bottom { display:none; }
.watch-hud[data-overview="perimeter"] .watch-camera-bank { grid-area:camera; }
.watch-hud[data-overview="perimeter"] .watch-exits { grid-area:exits; }
.watch-hud[data-overview="perimeter"] .watch-entry { grid-area:entry; grid-template-columns:1fr 1fr; }
@media (max-width:640px) {
  .drive-hud:not(.watch-hud) .drive-bottom { grid-template-columns:minmax(0,1fr); grid-template-areas:"dash" "controls" "buttons"; }
  .drive-hud:not(.watch-hud):has(.heat-format:not([hidden])) .drive-top { left:8px; right:8px; }
  .drive-hud:not(.watch-hud) .drive-hand-controller { grid-template-columns:62px auto; justify-self:start; }
  .drive-hud:not(.watch-hud) .drive-instrument-switches {
    width:100%; margin:0; padding:4px; grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .drive-hud:not(.watch-hud) .drive-instrument-switches:has(.drive-camera[hidden]) { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .drive-hud:not(.watch-hud) .drive-mixer { top:auto; bottom:76px; max-height:calc(100dvh - 92px); }
  .drive-hud:not(.watch-hud) .drive-mix-row { grid-template-columns:minmax(0,1fr) minmax(64px,1fr) 38px; gap:8px; }
  .watch-hud .drive-top { left:8px; right:auto; top:8px; max-width:calc(48% - 12px); display:grid; gap:6px; }
  .watch-hud[data-card="true"] .drive-track { max-width:none; width:100%; padding:8px; }
  .watch-hud .drive-track strong { font-size:22px; overflow-wrap:anywhere; }
  .watch-hud .drive-heat-rule { width:100%; }
  .watch-hud .watch-card { right:8px; top:8px; width:calc(52% - 12px); max-width:none; padding:8px; }
  .watch-hud .watch-card-name { font-size:15px; }
  .watch-hud .watch-director-console {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    grid-template-areas:"label shuttle shuttle" "camera camera camera" "exits exits volume" "entry entry entry" !important;
    width:100% !important; padding:8px; gap:6px !important;
  }
  .watch-hud .watch-director-label { border:0; align-self:center; padding:0; }
  .watch-hud .watch-shuttle { grid-template-columns:1fr 1fr; }
  .watch-hud .watch-shuttle button { font-size:13px; }
  .watch-hud .watch-camera-bank { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .watch-hud .watch-exits { display:grid; grid-template-columns:1fr 1fr; gap:4px; }
  .watch-hud .watch-exits :is(a,button) { min-height:44px !important; }
  .watch-hud .watch-standings { bottom:184px !important; right:8px; font-size:14px; padding:8px 8px 8px 28px; max-width:55%; }
  .watch-hud:has(.watch-entry > button:not([hidden])) .watch-standings { bottom:232px !important; }
  .drive-cue { top:116px; left:8px; width:calc(50% - 16px); }
  .drive-cue .drive-wait { padding:10px; }
  .drive-cue .drive-wait strong { font-size:24px; }
  .drive-cue .drive-controls-card { display:none; }
  .watch-hud[data-overview="perimeter"] .watch-infield {
    left:39.5%; top:54%; width:200px; grid-template-columns:1fr; gap:6px;
  }
  .watch-hud[data-overview="perimeter"] .drive-top { display:grid; grid-column:auto; gap:4px; }
  .watch-hud[data-overview="perimeter"] .drive-track { padding:6px 8px; }
  .watch-hud[data-overview="perimeter"] .drive-track strong { font-size:18px; }
  .watch-hud[data-overview="perimeter"] .drive-heat-rule { display:none; }
  .watch-hud[data-overview="perimeter"] .watch-standings { bottom:auto !important; max-width:none; font-size:13px; padding:6px 8px 6px 28px; }
  .watch-hud[data-overview="perimeter"] .watch-standings { max-height:64px; }
  .watch-hud[data-overview="perimeter"]:has(.watch-entry > button:not([hidden])) .watch-card { display:none; }
  .watch-hud[data-overview="perimeter"]:has(.watch-entry > button:not([hidden])) .watch-standings { max-height:52px; }
  .watch-hud[data-overview="perimeter"] .watch-card { grid-row:2; padding:6px 8px; }
  .watch-hud[data-overview="perimeter"] :is(.watch-instruments,.watch-card-gap,.watch-card-lap,.watch-onstream) { display:none; }
  .watch-hud[data-overview="perimeter"] .drive-bottom { grid-column:auto; }
  .watch-hud[data-overview="perimeter"] .watch-director-console {
    grid-template-columns:2fr 1fr !important; grid-template-areas:"label label" "shuttle shuttle" "camera camera" "exits volume" "entry entry" !important;
  }
  .watch-hud[data-overview="perimeter"] .watch-camera-bank { grid-template-columns:1fr 1fr; }
}
@media (max-height:650px) and (min-width:641px) {
  .watch-hud[data-overview="perimeter"] .watch-infield {
    left:8px; top:50%; transform:translateY(-50%); width:200px; grid-template-columns:1fr;
  }
  .watch-hud[data-overview="perimeter"] .drive-top { display:grid; gap:4px; }
  .watch-hud[data-overview="perimeter"] .drive-track { padding:6px 8px; }
  .watch-hud[data-overview="perimeter"] .drive-track strong { font-size:18px; }
  .watch-hud[data-overview="perimeter"] :is(.watch-card,.drive-heat-rule,.watch-onstream) { display:none; }
  .watch-hud[data-overview="perimeter"] .watch-standings { min-width:0; max-height:64px; font-size:13px; padding:6px 8px 6px 28px; }
  .watch-hud[data-overview="perimeter"] .watch-director-console {
    grid-template-columns:2fr 1fr !important; grid-template-areas:"label label" "shuttle shuttle" "camera camera" "exits volume" "entry entry" !important;
  }
}
@media (max-height:650px) and (max-width:640px) {
  .watch-hud[data-overview="perimeter"] .watch-infield { top:56%; width:200px; grid-template-columns:1fr; gap:4px; }
  .watch-hud[data-overview="perimeter"] .watch-card { display:none; }
  .watch-hud[data-overview="perimeter"] .watch-standings { max-height:36px; padding-top:4px; padding-bottom:4px; }
  .watch-hud[data-overview="perimeter"]:has(.watch-entry > button:not([hidden])) .watch-standings { max-height:36px; }
  .watch-hud[data-overview="perimeter"] .drive-track { padding:4px 8px; }
  .watch-hud[data-overview="perimeter"] .drive-track strong { font-size:17px; }
  .watch-hud[data-overview="perimeter"] .watch-director-console { padding:4px; gap:2px !important; }
  .watch-hud[data-overview="perimeter"] .watch-director-console :is(button,a) {
    font-size:13px !important; padding:6px 4px !important;
  }
}
