/* Dashcam 2 (3 Oct 2026): the player dialog. Parts are Primer's (Overlay, BtnGroup, form-select); this file places
 * them and draws the three things that are the player's own — the footage stage, the sealed-window timeline and
 * the log line. Every colour is a token (css/tokens.css), so the player follows light / dark / auto. */
dialog.dc { width: min(1240px, 96vw); height: min(800px, 92vh); max-width: none; max-height: none; display: none; flex-direction: column; overflow: hidden; }
dialog.dc[open] { display: flex; }
.dc-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--color-border-default); }
.dc-plate { font-weight: 600; font-size: 14px; white-space: nowrap; }
.dc-name { color: var(--color-fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-live { margin-left: auto; font-size: 12px; white-space: nowrap; color: var(--color-fg-muted); }
.dc-live.up { color: var(--x-green); } .dc-live.down, .dc-live.rec { color: var(--x-amber); }
.dc-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; flex: 1; }
.dc-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--color-border-default); }
.dc-canvas { flex: 1; min-height: 160px; width: 100%; display: block; background: var(--color-canvas-default); cursor: pointer; }
.dc-muted { color: var(--color-fg-muted); }
.dc .ok { color: var(--x-green); } .dc .bad { color: var(--x-red); } .dc .warn { color: var(--x-amber); }

/* the timeline: one cell per sealed window, filled by how much it holds; a label under every sixth */
.dc-seals { display: flex; gap: 3px; align-items: flex-start; overflow-x: auto; padding: 10px 16px 22px; border-top: 1px solid var(--color-border-default); min-height: 52px; font-size: 12px; }
.dc-seal { position: relative; flex: 0 0 12px; width: 12px; height: 20px; padding: 0; border: 1px solid var(--x-green); border-radius: 3px; background: transparent; cursor: pointer; }
.dc-seal.full { background: linear-gradient(to top, var(--x-green) var(--fill, 100%), transparent var(--fill, 100%)); }
.dc-seal.empty { border-color: var(--color-border-default); }
.dc-seal:hover { outline: 2px solid var(--color-accent-emphasis); outline-offset: 1px; }
.dc-seal.past { opacity: .45; }
.dc-seal.now { outline: 2px solid var(--x-amber); outline-offset: 1px; opacity: 1; }
.dc-seal[data-t]::after { content: attr(data-t); position: absolute; top: 22px; left: 0; font-size: 10px; font-family: var(--x-mono); color: var(--color-fg-muted); white-space: nowrap; }

.dc-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--color-border-default); background: var(--color-canvas-subtle); }
.dc-bar .form-select { width: auto; }
.dc-bar .BtnGroup-item.selected { background: var(--color-accent-subtle); color: var(--color-accent-fg); }
.dc-status { flex: 1; margin-left: 4px; font-size: 12px; font-family: var(--x-mono); color: var(--color-fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dc-verify { padding: 8px 16px; border-top: 1px solid var(--color-border-default); font-size: 12.5px; }
.dc-problems { margin-top: 4px; }

/* the log: one line per recorded action — a dot for what the gate decided, a mark where a person answered */
.dc-side { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dc-log, .dc-detail { flex: 1; overflow-y: auto; min-height: 0; }
.dc-log[hidden], .dc-detail[hidden] { display: none; }
.dc-row { display: grid; grid-template-columns: 12px 58px minmax(0, 1fr); gap: 8px; align-items: baseline; width: 100%; padding: 5px 12px; border: 0; border-bottom: 1px solid var(--color-border-muted); background: none; text-align: left; font: inherit; font-size: 12px; color: var(--color-fg-default); cursor: pointer; }
.dc-row:hover { background: var(--color-canvas-subtle); }
.dc-row.hl { background: var(--color-accent-subtle); }
.dc-row.fault { box-shadow: inset 3px 0 0 var(--x-red); background: var(--x-red-bg); }
.dc-dot { width: 8px; height: 8px; border-radius: 50%; align-self: center; background: var(--x-grey); }
.dc-mark { font-weight: 700; line-height: 1; }
.dc-dot.d-allow { background: var(--x-green); } .dc-dot.d-attest { background: var(--x-magenta); } .dc-dot.d-forbid { background: var(--x-red); } .dc-dot.d-expired { background: var(--x-amber); }
.dc-mark.d-approved { color: var(--x-blue); } .dc-mark.d-denied { color: var(--x-red); }
.dc-t { font-family: var(--x-mono); font-size: 11px; color: var(--color-fg-muted); }
.dc-s { font-family: var(--x-mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-tag { color: var(--color-fg-muted); }
.dc-s.c-danger { color: var(--x-red); } .dc-s.c-ssh { color: var(--x-blue); } .dc-s.c-mut { color: var(--x-amber); } .dc-s.c-edit { color: var(--color-fg-muted); }
.dc-detail { padding: 12px 16px; font-size: 13px; }
.dc-detail h4 { margin: 8px 0; font-size: 14px; }
.dc-detail pre { margin: 8px 0 0; padding: 10px; border: 1px solid var(--color-border-default); border-radius: 6px; background: var(--color-canvas-subtle); font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-hash { font-size: 11px; overflow-wrap: anywhere; color: var(--color-fg-muted); }

@media (max-width: 860px) {
  /* opened non-modally on a phone (dashcam-player.js), so it is an ordinary fixed panel: the full screen less the
     host page's bottom bar, whose height the host states in --x-bottom-bar (0 where there is none) */
  dialog.dc { position: fixed; inset: 0 0 var(--x-bottom-bar, 0px) 0; width: 100vw; height: auto; margin: 0; border: 0; border-radius: 0; z-index: 5; }
  .dc-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .dc-stage { border-right: 0; border-bottom: 1px solid var(--color-border-default); }
  .dc-bar { flex-wrap: wrap; }
}
