:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1b1f24; --muted: #5d6673;
  --border: #dfe3e8; --accent: #2563eb; --accent-soft: #dbe7ff; --ok: #16a34a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #171b21; --text: #e7eaee; --muted: #98a2b0;
    --border: #2a313a; --accent: #6b9bff; --accent-soft: #1d2b46; --ok: #4ade80;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { max-width: 1200px; margin: 0 auto; padding: 24px 16px 8px; }
h1 { margin: 0 0 4px; font-size: 1.6rem; }
h2 { margin: 0; font-size: 1rem; }
header p { margin: 0; color: var(--muted); }
main { max-width: 1200px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; } }
.stage { display: flex; flex-direction: column; gap: 12px; }
.video-wrap { position: relative; aspect-ratio: 4 / 3; background: #000; border-radius: 12px; overflow: hidden; }
video, canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.status { position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: .85rem; }
.live { position: absolute; right: 12px; top: 12px; width: 84px; height: 84px; display: grid; place-items: center; background: rgba(0,0,0,.6); border-radius: 50%; color: #fff; }
.live span { font-size: 1.5rem; font-weight: 700; z-index: 1; text-align: center; line-height: 1.1; }
.ring { position: absolute; inset: 4px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: #4ade80; stroke-width: 2.5; stroke-dasharray: 100.5; stroke-dashoffset: 100.5; transition: stroke-dashoffset .08s linear; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 12px; }
button:disabled { opacity: .5; cursor: default; }
.side { display: flex; flex-direction: column; gap: 20px; }
.output-card, .ref { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.output-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.actions { display: flex; gap: 6px; }
.output { min-height: 96px; font-size: 1.8rem; font-weight: 600; letter-spacing: .04em; word-break: break-word; }
.output::after { content: "▍"; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ref ul { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ref li { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: .85rem; color: var(--muted); transition: background .15s; }
.ref li b { display: block; font-size: 1.1rem; color: var(--text); }
.ref li.active { background: var(--accent-soft); border-color: var(--accent); }
.note { margin: 0; font-size: .85rem; color: var(--muted); }
