:root {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: #17203a;
  background: #f3f5fb;
  --ink: #17203a;
  --muted: #505c74;
  --line: #dbe1ee;
  --violet: #5140d4;
  --navy: #1b2440;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.shell { width: min(1216px, calc(100% - 72px)); margin-inline: auto; }
.topbar { color: #fff; background: #141b34; box-shadow: 0 1px 0 #343b64; }
.topbar-inner, .brand { display: flex; align-items: center; }
.topbar-inner { min-height: 70px; justify-content: space-between; gap: 16px; }
.brand { gap: 11px; font-size: 1.18rem; font-weight: 740; letter-spacing: -.028em; }
.credit { color: #d3d9ee; font-size: .875rem; text-align: right; }
.credit span { margin-inline: 4px; }
.intro { padding: 38px 0 26px; }
h1 { font-size: clamp(2.05rem, 5vw, 3.45rem); letter-spacing: -.063em; font-weight: 760; line-height: 1.05; margin: 0 0 10px; }
.intro p { margin: 0; color: var(--muted); max-width: 47rem; line-height: 1.5; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.panel { background: white; border: 1px solid var(--line); border-radius: 17px; overflow: hidden; box-shadow: 0 9px 28px #263c6710; }
.panel-heading { padding: 18px 19px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2 { font-size: 1.1rem; margin: 0; letter-spacing: -.018em; }
.source { color: #4232a6; background: #eeeaff; border-radius: 100px; padding: 6px 11px; font-size: .875rem; font-weight: 670; }
.source[data-live="true"] { color: #16543e; background: #d9f5e8; }
.stage { aspect-ratio: 16/9; position: relative; margin-inline: 16px; border-radius: 11px; background: #1a2133; overflow: hidden; }
.stage:has(canvas:not([hidden])) { aspect-ratio: var(--frame-ratio, 16/9); max-height: 65vh; }
.stage canvas, .stage video, .hint, .hint img { width: 100%; height: 100%; display: block; }
.stage canvas, .stage video, .hint { position: absolute; inset: 0; object-fit: contain; }
.hint img { object-fit: cover; }
.hint span { position: absolute; left: 12px; bottom: 12px; padding: 6px 9px; border-radius: 6px; background: #141b34ed; color: #fff; font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 15px 16px 9px; }
button, input { font: inherit; }
button { min-height: 42px; color: var(--ink); background: #fff; border: 1px solid #cbd3e5; border-radius: 8px; padding: 8px 12px; font-size: .9rem; font-weight: 680; cursor: pointer; }
button:hover { background: #f0f2fc; }
button.primary { color: #fff; background: var(--violet); border-color: var(--violet); }
button.primary:hover { background: #4031b3; }
button.quiet { background: transparent; border-color: transparent; color: #4232a6; }
button.quiet:hover { background: #f0edff; }
button:disabled { color: #57647d; background: #f2f4f9; cursor: default; }
.reset { margin-left: auto; }
:focus-visible { outline: 3px solid #6554f0; outline-offset: 2px; }
.status { min-height: 2.8rem; padding: 0 16px 14px; margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.43; }
.results { padding-bottom: 16px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-inline: 16px; }
.metric { display: grid; gap: 9px; align-content: center; background: #e2f6ed; color: #154f3c; border-radius: 11px; padding: 13px 14px; min-height: 96px; }
.metric-violet { background: #eeeaff; color: #4736aa; }
.metric span { font-size: .875rem; font-weight: 700; }
.metric output { font-size: 2.35rem; font-weight: 760; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.table-wrap { margin: 13px 16px; }
.table-wrap:has(table[hidden]) { margin: 13px 0 0; }
table { border-collapse: collapse; width: 100%; font-size: .91rem; }
thead { font-size: .875rem; color: var(--muted); }
th, td { border-bottom: 1px solid #e2e6f0; padding: 9px 4px; text-align: left; }
td, thead th:not(:first-child) { text-align: center; }
tbody th { font-weight: 650; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 1px; }
.seen { font-weight: 740; font-variant-numeric: tabular-nums; }
input { color: var(--navy); background: #fff; border: 1px solid #cbd3e5; border-radius: 7px; min-height: 37px; padding: 6px 8px; min-width: 0; }
td input { width: 64px; max-width: 100%; text-align: center; }
td input[aria-invalid="true"] { border-color: #a2471d; }
.audit { margin: 0 16px; padding: 11px 12px; background: #f0f3fa; color: #44516d; font-size: .875rem; line-height: 1.45; border-radius: 8px; }
.audit p { margin: 0; }
.audit ul { margin: 0; padding-inline-start: 18px; }
.audit.warning { background: #fff0df; color: #743814; }
.review-area { margin: 13px 16px 0; }
.review-area > button { width: 100%; color: #4232a6; border-color: #d5cef7; }
#reviewed { margin-top: 13px; padding: 13px; border-radius: 8px; background: #e2f6ed; color: #154f3c; }
#reviewed h3 { font-size: 1rem; margin: 0; }
#reviewed ul { padding-inline-start: 20px; margin: 7px 0; }
#reviewed p { margin: 0; font-weight: 700; }
footer { display: flex; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; color: var(--muted); font-size: .875rem; padding: 17px 0 24px; }
footer a { color: #4232a6; text-underline-offset: 3px; }
dialog { width: min(510px, calc(100% - 30px)); border: 1px solid var(--line); border-radius: 14px; padding: 22px; color: var(--ink); max-height: 85vh; }
dialog::backdrop { background: #10172eae; }
dialog p { margin: 8px 0 18px; line-height: 1.45; color: var(--muted); }
.review-fields { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) 94px; margin-bottom: 11px; }
.review-fields label { display: grid; gap: 4px; font-size: .875rem; font-weight: 650; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
@media (max-width: 830px) {
  .shell { width: calc(100% - 34px); }
  .workspace { grid-template-columns: 1fr; gap: 15px; }
  .intro { padding: 28px 0 21px; }
}
@media (max-width: 440px) {
  .shell { width: calc(100% - 24px); }
  .credit { max-width: 140px; line-height: 1.25; }
  .credit span { margin-inline: 1px; }
  .actions { gap: 6px; }
  .reset { margin-left: 0; }
}
