/* Workspace layout; both viewers use the same height at every breakpoint. */
:root { --muted: #96a2aa; --preview-height: clamp(280px, 40vh, 480px); }
body { overflow-x: auto; }
.app-shell { width: min(1600px, calc(100% - 64px)); padding: 30px 0 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
h1 { font-size: clamp(24px, 2.2vw, 30px); line-height: 1.2; letter-spacing: -.035em; }
.eyebrow { font-size: 10px; letter-spacing: .14em; margin-bottom: 8px; }
.app-subtitle { margin: 9px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.service-status { display: inline-flex; flex-shrink: 0; align-items: center; gap: 8px; padding: 8px 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 7px; background: #10151a; font-size: 12px; }
.service-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.service-status[data-state="offline"] { color: #dec282; }
.service-status[data-state="ready"] { color: var(--green); }
.upload-toolbar { border: 1px solid var(--line); border-radius: 12px; background: #11171c; overflow: hidden; }
#upload-form { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px; }
.file-control { display: flex; align-items: center; min-width: 0; gap: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.file-button { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 0 15px; border: 1px solid #46535d; border-radius: 8px; background: #1a232b; font-size: 13px; font-weight: 550; cursor: pointer; }
.file-button:hover, .empty-file-button:hover { background: #25312e; border-color: var(--green); }
#local-file:focus-visible + .file-button { outline: 2px solid var(--green); outline-offset: 3px; }
#local-file:disabled + .file-button { opacity: .45; cursor: wait; pointer-events: none; }
.file-details { display: grid; min-width: 0; gap: 5px; }
#selected-file-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#selected-file-info { font-size: 11px; line-height: 1.4; color: var(--muted); }
.upload-actions { display: flex; align-items: center; flex-shrink: 0; gap: 12px; }
.decode-control { display: flex; align-items: center; gap: 9px; }
.decode-control label { font-size: 12px; color: var(--muted); }
.decode-control select { min-height: 42px; padding: 0 30px 0 11px; font-size: 13px; }
.analyse-button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-height: 42px; padding: 0 17px; border: 1px solid var(--green); border-radius: 8px; background: var(--green); color: #0b2416; font-size: 13px; font-weight: 650; }
.analyse-button:hover:not(:disabled) { background: #8befb9; }
button:disabled { opacity: .4; cursor: not-allowed; }
.analyse-button:disabled { background: #23352c; border-color: #364a3d; color: #8aa896; opacity: 1; }
.upload-status-row { display: flex; justify-content: space-between; gap: 16px; margin: 11px 2px 20px; min-height: 18px; }
#local-status, .session-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.session-note { flex-shrink: 0; }
.session-picker { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.session-picker label { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.session-picker select { padding: 8px 30px 8px 12px; min-width: 0; max-width: 600px; flex: 1; font-size: 12px; }
.workspace { grid-template-columns: minmax(0, 1fr); }
.viewer-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 16px; }
.panel { box-shadow: none; border-color: #29333b; background: #10161b; }
.panel-heading { min-height: 50px; flex-shrink: 0; gap: 10px; padding: 0 16px; }
h2 { font-size: 14px; }
.panel-index { color: #778b80; }
.status-pill { font-size: 9px; letter-spacing: .035em; white-space: nowrap; }
.video-frame, .scene { height: var(--preview-height); min-height: 0; max-height: none; flex: none; }
.video-frame { position: relative; background: #080b0d; }
/* Keep the replaced element out of intrinsic grid sizing; letterbox the complete frame. */
.video-frame video { position: absolute; inset: 8px; display: block; width: calc(100% - 16px); height: calc(100% - 16px); min-width: 0; min-height: 0; max-width: calc(100% - 16px); max-height: calc(100% - 16px); object-fit: contain; object-position: center; border-radius: 0; }
.video-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; background: radial-gradient(ellipse at center, #141e23 0%, #080b0d 68%); }
.empty-video-icon { display: grid; place-items: center; width: 60px; height: 60px; border: 1px solid #32403f; border-radius: 16px; background: #18221f; color: #a2cbb5; margin-bottom: 20px; }
.video-empty h3 { margin: 0 0 8px; font-size: 18px; font-weight: 550; letter-spacing: -.02em; }
.video-empty p { margin: 0 0 22px; font-size: 13px; color: var(--muted); }
.empty-file-button { display: inline-flex; gap: 20px; align-items: center; min-height: 38px; padding: 0 15px; border: 1px solid #3e5548; border-radius: 7px; color: #bce5cf; font-size: 12px; cursor: pointer; }
.overlay-play:disabled { display: none; }
.scene-empty { position: absolute; z-index: 2; bottom: 54px; left: 16px; right: 16px; text-align: center; pointer-events: none; }
.empty-kicker { font-size: 9px; font-weight: 600; letter-spacing: .13em; color: #728f81; }
.scene-empty p { margin: 7px 0 0; color: #c0cec6; font-size: 13px; }
.scene-hint { left: 14px; right: 14px; text-align: center; font-size: 10px; }
.scene-key { top: 16px; left: 14px; font-size: 10px; gap: 12px; }
.zoom-readout { top: 12px; right: 12px; font-size: 9px; border-color: #314139; color: #a5bcb0; }
.transport, .scene-controls { height: 100px; min-height: 100px; padding: 13px 16px; background: #10161b; }
.transport { display: grid; grid-template-columns: auto auto auto 1fr auto auto auto; grid-template-rows: 12px 38px; gap: 12px 8px; align-content: center; }
.seek-bar { grid-column: 1 / -1; grid-row: 1; min-width: 0; margin: 0; }
#step-back { grid-row: 2; grid-column: 1; }
#play-button { grid-row: 2; grid-column: 2; }
#step-forward { grid-row: 2; grid-column: 3; }
.transport .timecode { display: block; min-width: 0; font-size: 10px; grid-row: 2; }
#current-time { grid-column: 4; justify-self: end; }
.time-separator { grid-row: 2; grid-column: 5; font-size: 10px; color: #66737b; }
#duration { grid-column: 6; }
#speed-select { grid-row: 2; grid-column: 7; margin-left: 6px; }
.icon-button { min-width: 32px; height: 34px; padding: 0; font: 22px system-ui; }
.play-button { min-width: 60px; height: 34px; padding: 0 12px; font-size: 12px; }
.scene-controls { display: grid; grid-template-columns: auto 1fr auto auto; grid-template-rows: 32px 20px; align-content: center; gap: 12px; }
.toggle { font-size: 11px; gap: 7px; }
.toggle:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 3px; }
.scale-control { display: grid; grid-row: 2; grid-column: 1 / -1; grid-template-columns: auto minmax(0,1fr) 26px; gap: 12px; min-width: 0; width: 100%; order: initial; }
.scale-control label { font-size: 9px; letter-spacing: .07em; }
.scale-control output { grid-row: 1; grid-column: 3; text-align: right; }
.scale-control input { min-width: 0; margin: 0; }
.secondary-button { min-height: 32px; padding: 0 10px; font-size: 11px; }
.telemetry { grid-column: 1 / -1; }
.telemetry-heading { min-height: 44px; padding: 10px 16px; }
.telemetry-heading h2 { font-size: 13px; }
.telemetry-heading p { font-size: 10px; }
.metrics-grid { grid-template-columns: repeat(7,minmax(0,1fr)); }
.metric { min-height: 78px; padding: 15px 16px; border-bottom: 0; }
.metric span { font-size: 9px; letter-spacing: .06em; white-space: nowrap; margin-bottom: 10px; }
.metric strong { font-size: 19px; color: #d1dad6; }
.zoom-metric strong { color: var(--green); }
#attention-panel { grid-column: 1 / -1; }
.technique-picker { padding: 12px 16px; }
[hidden], .technique-picker[hidden], #local-cancel[hidden], .video-empty[hidden], .scene-empty[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .app-shell { width: calc(100% - 40px); padding-top: 24px; }
  .topbar > div:first-child { grid-column: auto; }
  .metrics-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .metric { border-bottom: 1px solid var(--line); }
  .metric:nth-child(4) { border-right: 0; }
  .metric:nth-child(n+5) { border-bottom: 0; }
  .metric:last-child { grid-column: span 2; }
  .decode-control label { display: none; }
  .scene-key { font-size: 9px; gap: 8px; }
  .zoom-readout { top: 38px; }
}
@media (max-width: 820px) {
  :root { --preview-height: clamp(260px, 52vw, 420px); }
  .viewer-stack { grid-template-columns: minmax(0,1fr); }
  .topbar { align-items: flex-start; }
  .file-control { flex: 1; }
  .file-details { max-width: 250px; }
  #upload-form { flex-wrap: wrap; gap: 16px; }
  .upload-actions { margin-left: auto; }
  .zoom-readout { top: 12px; }
  .scene-key { font-size: 10px; }
  .session-note { display: none; }
}
@media (max-width: 540px) {
  .app-shell { width: calc(100% - 28px); padding: 20px 0; }
  .topbar { flex-direction: column; gap: 14px; margin-bottom: 18px; }
  h1 { font-size: 25px; }
  .app-subtitle { font-size: 12px; }
  .service-status { font-size: 11px; padding: 6px 9px; }
  #upload-form { padding: 14px; gap: 16px; }
  .file-control { flex-basis: 100%; gap: 12px; }
  .file-button { padding: 0 11px; font-size: 12px; }
  #selected-file-info { font-size: 10px; }
  .upload-actions { width: 100%; gap: 10px; }
  .decode-control { flex: 1; }
  .decode-control select { width: 100%; }
  .analyse-button { flex: 1; padding: 0 12px; }
  .upload-status-row { margin-bottom: 16px; }
  #local-status { font-size: 11px; }
  .panel-heading { padding: 0 12px; }
  .panel-heading > div { gap: 8px; }
  .status-pill { font-size: 8px; padding: 5px 6px; }
  .transport, .scene-controls { padding-inline: 12px; gap: 10px 6px; }
  .transport { grid-template-columns: auto auto auto 1fr auto auto auto; }
  .transport .timecode { font-size: 9px; }
  #speed-select { padding: 7px 3px; margin-left: 2px; }
  .scene-controls { grid-template-columns: auto 1fr auto auto; }
  .toggle { font-size: 10px; gap: 5px; }
  .secondary-button { font-size: 10px; padding: 0 7px; }
  .zoom-readout { top: 38px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric:nth-child(n) { border-bottom: 1px solid var(--line); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:last-child { border-bottom: 0; }
  .telemetry-heading p { width: 100%; margin-left: 24px; }
  .session-picker { flex-wrap: wrap; }
  .session-picker select { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
