:root {
  color-scheme: dark;
  --ink: #f5f7ff;
  --muted: #9ca7bc;
  --panel: #111722;
  --panel-2: #171f2d;
  --line: #2a3548;
  --blue: #58d8ff;
  --orange: #ffad42;
  --red: #ff6278;
  --green: #66eda5;
}

* { box-sizing: border-box; }
body { margin: 0; background: #090d14; color: var(--ink); font: 14px/1.45 Inter, ui-sans-serif, system-ui, sans-serif; }
button, select { font: inherit; }
.audit-header { display: flex; justify-content: space-between; gap: 32px; align-items: end; padding: 26px 32px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #121a28, #0b1019); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(27px, 4vw, 46px); line-height: 1; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 22px; }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .18em; }
.lede { max-width: 760px; margin-bottom: 0; color: var(--muted); }
.header-actions, .engine-controls { display: flex; gap: 9px; align-items: end; }
.button { min-height: 38px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--panel-2); text-decoration: none; cursor: pointer; font-weight: 800; white-space: nowrap; }
.button:hover { border-color: var(--blue); }
.button.primary { color: #061018; background: var(--blue); border-color: var(--blue); }
.button.secondary { background: transparent; }
.button.compact { width: 40px; padding: 8px; }
.button:disabled { opacity: .45; cursor: wait; }
.audit-layout { display: grid; grid-template-columns: minmax(620px, 2fr) minmax(290px, .75fr); gap: 18px; padding: 18px; }
.engine-panel, .summary-panel, .results-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head strong { display: block; font-size: 18px; }
.fighter-label { color: var(--orange); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.frame-readout { color: var(--blue); font: 12px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; }
.engine-shell { background: #020407; aspect-ratio: 4 / 3; }
#gameFrame { display: block; width: 100%; height: 100%; border: 0; }
.engine-controls { padding: 12px; border-top: 1px solid var(--line); }
label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
label.grow { flex: 1; }
select { min-height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; color: var(--ink); background: #0c111a; }
.filmstrip { display: flex; gap: 8px; min-height: 104px; padding: 10px 12px; overflow-x: auto; border-top: 1px solid var(--line); }
.filmstrip button { position: relative; flex: 0 0 150px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 6px; background: #06090e; cursor: pointer; }
.filmstrip button.active { border-color: var(--blue); }
.filmstrip img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: fill; image-rendering: pixelated; }
.filmstrip span { position: absolute; right: 4px; bottom: 3px; padding: 2px 5px; border-radius: 3px; color: white; background: #000b; font: 10px ui-monospace, monospace; }
.summary-panel { padding: 18px; align-self: start; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-grid div { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.summary-grid span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.summary-grid strong { display: block; margin-top: 3px; font-size: 20px; }
.progress-track { height: 7px; margin-top: 15px; overflow: hidden; border-radius: 9px; background: #070a10; }
#progressBar { width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .12s linear; }
.status-text { min-height: 42px; margin: 12px 0 4px; color: var(--muted); }
.legend { display: flex; gap: 15px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; gap: 5px; align-items: center; }
.legend i, .result-status { width: 8px; height: 8px; border-radius: 50%; }
.pass { background: var(--green); }.review { background: var(--orange); }.fail { background: var(--red); }
.results-panel { grid-column: 1 / -1; }
.results-head { display: flex; justify-content: space-between; align-items: end; padding: 18px; border-bottom: 1px solid var(--line); }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 1px; background: var(--line); }
.result-card { min-width: 0; padding: 10px; border: 0; color: var(--ink); background: var(--panel); text-align: left; cursor: pointer; }
.result-card:hover { background: #1b2535; }
.result-card img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: fill; border-radius: 5px; background: #04070b; image-rendering: pixelated; }
.result-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 8px; font-weight: 900; }
.result-meta { display: flex; justify-content: space-between; margin-top: 3px; color: var(--muted); font: 10px ui-monospace, monospace; }
.result-issues { min-height: 30px; margin-top: 6px; color: var(--orange); font-size: 11px; }
.empty-state { grid-column: 1/-1; padding: 55px; color: var(--muted); background: var(--panel); text-align: center; }
body.running .result-card { pointer-events: none; }

@media (max-width: 980px) {
  .audit-header { align-items: stretch; flex-direction: column; }
  .audit-layout { grid-template-columns: 1fr; padding: 10px; }
  .summary-panel, .results-panel { grid-column: 1; }
  .engine-controls { flex-wrap: wrap; }
  label.grow { min-width: 55%; }
}
