:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #111;
  --line: #2a2a2a;
  --text: #f1f0eb;
  --muted: #96958f;
  --live: #bcff42;
  --warm: #ffd84a;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
button, input { font: inherit; }
button { border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: #171717; padding: .6rem 1rem; cursor: pointer; }
button:hover, button.active { border-color: #696969; background: #292929; }
.topbar { min-height: 100px; padding: 1.2rem 2rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.5rem, 3vw, 2.6rem); font-weight: 500; }
h2 { margin-bottom: 0; font-size: 1.25rem; font-weight: 500; }
.eyebrow, .panel-label { margin-bottom: .4rem; color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .15em; }
.topbar-status, .view-controls, .audio-controls { display: flex; align-items: center; gap: .55rem; }
.status-dot::before { content: ""; display: inline-block; width: .55rem; height: .55rem; margin-right: .5rem; border-radius: 50%; background: #777; }
.status-dot.live::before { background: var(--live); box-shadow: 0 0 14px color-mix(in srgb, var(--live) 60%, transparent); }
.quiet { padding: .4rem .8rem; background: transparent; }
.view-controls { padding: .8rem 2rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .8fr); gap: 1rem; padding: 1rem; min-height: calc(100vh - 165px); }
.layout.view-camera { grid-template-columns: 1fr; }
.layout.view-camera .telemetry-panel, .layout.view-telemetry .media-panel { display: none; }
.layout.view-telemetry { grid-template-columns: minmax(0, 900px); justify-content: center; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 78px; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.pill { max-width: 55%; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .65rem; color: var(--muted); font-size: .74rem; text-overflow: ellipsis; white-space: nowrap; }
.pill.live { color: var(--live); border-color: #587425; }
.media-panel { display: flex; flex-direction: column; }
.video-shell { position: relative; flex: 1; min-height: 420px; background: #050505; }
.video-shell iframe { width: 100%; height: 100%; min-height: 420px; border: 0; }
.video-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.video-placeholder[hidden] { display: none; }
.audio-controls { min-height: 72px; padding: .8rem 1rem; border-top: 1px solid var(--line); overflow-x: auto; }
.audio-controls > span { color: var(--muted); font-size: .8rem; }
.telemetry-panel { display: flex; flex-direction: column; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.metrics div { padding: .9rem; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.metrics strong { font-size: 1.1rem; font-weight: 500; }
.progress { height: 3px; background: #232323; }
.progress span { display: block; height: 100%; width: 0; background: var(--live); transition: width .2s linear; }
article { padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line); }
.live-copy { min-height: 3.8em; margin-bottom: 0; font-size: clamp(1rem, 1.8vw, 1.3rem); line-height: 1.3; }
.script { flex: 1; }
.script #script { margin-bottom: 0; color: var(--warm); line-height: 1.45; }
.telemetry-panel footer { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1.2rem; color: var(--muted); font-size: .72rem; }
.login-body { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.login-card { width: min(430px, 100%); padding: 2rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.login-copy { color: var(--muted); line-height: 1.5; }
.login-error { padding: .8rem; border: 1px solid #743b36; border-radius: 8px; color: #ffaaa0; background: #261412; }
.login-card label { display: block; margin: 1rem 0; color: var(--muted); font-size: .8rem; }
.login-card input { width: 100%; margin-top: .4rem; padding: .8rem; border: 1px solid var(--line); border-radius: 8px; background: #080808; color: var(--text); }
.login-card button { width: 100%; margin-top: .5rem; }

@media (max-width: 900px) {
  .topbar { padding: 1rem; }
  .view-controls { padding: .7rem 1rem; }
  .layout { grid-template-columns: 1fr; }
  .video-shell, .video-shell iframe { min-height: 52vw; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
