:root {
  --bg: #0f1012;
  --surface: #17191c;
  --surface-2: #1f2226;
  --line: #2b2f34;
  --text: #e8e6e1;
  --muted: #9a9ea5;
  --accent: #f0a83a;
  --accent-ink: #1a1206;
  --danger: #e2675a;
  --ok: #5fbf8a;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
h1 { font-size: 18px; margin: 0; font-weight: 600; }
h2 { font-size: 12px; margin: 0 0 8px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
p { margin: 0; }
.mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; padding: 16px; min-height: 100dvh; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.stage { position: relative; aspect-ratio: 16 / 9; background: #08090a; border-radius: var(--radius); overflow: hidden; }
.stage:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.player { opacity: 0; transition: opacity 1.5s ease; pointer-events: none; }
.player.visible { opacity: 1; }
.player iframe { width: 100%; height: 100%; border: 0; }
.caption { position: absolute; left: 4%; bottom: 6%; padding: 10px 14px; background: rgba(8, 9, 10, .72);
  border-left: 3px solid var(--accent); font-size: clamp(14px, 2vw, 26px); opacity: 0; transition: opacity .8s ease; max-width: 80%; }
.caption.show { opacity: 1; }
.caption small { display: block; font-size: .6em; color: var(--muted); }
.stage-bar { display: flex; gap: 12px; align-items: center; margin: 10px 0 16px; }

.log-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.log { list-style: none; margin: 0 0 8px; padding: 0; max-height: 220px; overflow: auto; font-size: 12px; }
.log li { padding: 3px 0; display: grid; grid-template-columns: 64px 80px 1fr; gap: 8px; }
.log li + li { border-top: 1px solid var(--line); }
.log .t { color: var(--muted); }
.log .e-match { color: var(--ok); }
.log .e-miss { color: var(--muted); }
.log .e-error { color: var(--danger); }
.log .e-switch { color: var(--accent); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; align-self: start; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.live { color: var(--ok); border-color: var(--ok); }
.badge.mock { color: var(--accent); border-color: var(--accent); }
.block { padding: 12px 0; border-top: 1px solid var(--line); }
.block:first-of-type { border-top: 0; }
details.block summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }
details.block[open] summary { margin-bottom: 8px; }

.field { display: grid; gap: 4px; margin: 6px 0; font-size: 12px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.row input[type=text] { flex: 1; min-width: 0; }

button, select, input[type=text], input[type=number] {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 10px; }
input[type=number] { width: 90px; }
select { width: 100%; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); margin-top: 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 4px; }
.seg button { border: 0; border-radius: 0; background: transparent; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.meter { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.meter div { height: 100%; width: 0; background: var(--ok); transition: width .1s linear; }
.np-title { font-size: 16px; font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 10px 0 0; }
.stats dt { font-size: 11px; color: var(--muted); }
.stats dd { margin: 0; overflow-wrap: anywhere; }
.file-box { margin-top: 4px; }

.lock { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.lock[hidden] { display: none; }
.lock-card { width: 100%; max-width: 340px; display: grid; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.lock-card input { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 10px; }
#lockMsg { color: var(--danger); min-height: 1em; }
