/* dnode tokens — from office.dnode.app */
:root {
  color-scheme: dark;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #17151b; --surface: #1f1d24; --border: #3a3742; --text: #eee9e3; --muted: #9a94a3;
  --accent: #6b34e8; --error: #ff6b5e;
  --program: #e5251b; --preview: #2fc94e; --off: #2a2730;
  --r: 10px; --r-btn: 8px; --tap: 44px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f6; --surface: #ffffff; --border: #d8d4cc; --text: #23212a; --muted: #6e6976;
  --off: #e7e3dc; --error: #b3261e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); }
h1, h2, h3 { letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 22px; } h2 { font-size: 17px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--error); font-size: 13px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > label { min-width: 120px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; }
input, select { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px; min-height: var(--tap); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
button, .btn { font: 600 15px var(--font); min-height: var(--tap); padding: 0 16px; border-radius: var(--r-btn);
  border: 0; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: .5; cursor: default; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--preview); } .dot.bad { background: var(--program); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); }
.hidden { display: none !important; }

/* Operator */
.op { min-height: 100dvh; display: flex; flex-direction: column; gap: 12px; padding: 12px; max-width: 720px; margin: 0 auto; }
.op-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.op-head .title { display: flex; flex-direction: column; }
.op-head .title b { color: var(--accent); filter: brightness(1.4); }
.banner { border-radius: var(--r); padding: 22px 16px; text-align: center; background: var(--off);
  color: var(--text); transition: background-color 60ms linear; user-select: none; cursor: pointer; }
.banner .state { font-size: clamp(22px, 7vw, 34px); font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; }
.banner .sub { font-size: 13px; opacity: .85; margin-top: 4px; }
.banner.program { background: var(--program); color: #fff; }
.banner.preview { background: var(--preview); color: #06210d; }
.banner.nosignal { background: repeating-linear-gradient(45deg, var(--off) 0 12px, var(--surface) 12px 24px); }
.op.full .banner { position: fixed; inset: 0; border-radius: 0; display: grid; place-content: center; z-index: 10; }
.op.full .banner .state { font-size: clamp(40px, 14vw, 96px); }
.feed { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border);
  background: #000; aspect-ratio: 16 / 9; }
.feed video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; opacity: 0; }
.feed video.live { opacity: 1; }
.feed .hint { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 16px; text-align: center; }
.clock { display: flex; justify-content: space-between; align-items: baseline; }
.clock .time { font: 700 28px/1 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
.comms iframe { width: 100%; height: 60dvh; border: 0; border-radius: var(--r); }
.cam-list { display: grid; gap: 8px; }

/* Director */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile { border-radius: var(--r); padding: 12px; background: var(--off); min-height: 70px; display: flex;
  flex-direction: column; justify-content: space-between; }
.tile.program { background: var(--program); color: #fff; }
.tile.preview { background: var(--preview); color: #06210d; }
.tile .num { font-size: 12px; opacity: .8; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat b { display: block; font-size: 20px; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); padding: 12px; }
@media (prefers-reduced-motion: reduce) { .banner { transition: none; } }

/* Sideline: one DOM, layout by orientation. Tones: calm / amber / red / play / live. */
.side { --bgc: var(--off); --fg: var(--text); min-height: 100dvh; display: flex; flex-direction: column; gap: 12px;
  padding: 12px; max-width: 720px; margin: 0 auto; }
.tone-calm { --bgc: #2a2730; --fg: #eee9e3; } .tone-amber { --bgc: #e6a100; --fg: #2b1d00; }
.tone-red { --bgc: #e5251b; --fg: #fff; } .tone-play { --bgc: #2fc94e; --fg: #06210d; }
.side-top { display: none; }
.side-full { position: fixed; right: 12px; bottom: 12px; z-index: 5; min-height: 40px; width: 40px; padding: 0; opacity: .6; background: rgb(0 0 0 / .4); color: #fff; }
.phase-live .side-top, .phase-play .side-top { display: block; font-weight: 600; font-size: 13px; color: var(--muted); }
.side-count { border-radius: var(--r); padding: 20px 16px; text-align: center; background: var(--bgc); color: var(--fg); }
.tone-live .side-count, .phase-live .side-count { display: none; }
.tone-nosignal .side-count { background: repeating-linear-gradient(45deg, var(--off) 0 12px, var(--surface) 12px 24px); color: var(--text); }
.side-state { font-weight: 700; text-transform: uppercase; letter-spacing: .02em; font-size: 14px; }
.side-big { font: 800 clamp(64px, 24vw, 140px)/1 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; margin: 8px 0; }
.side-bar { height: 8px; border-radius: 4px; background: rgb(0 0 0 / .25); overflow: hidden; }
.side-bar i { display: block; height: 100%; background: currentColor; transition: width 250ms linear; }
.side-back { color: inherit; opacity: .85; margin-top: 8px; }
.side-coming { font-weight: 700; text-align: center; }
.phase-break .side-feed, .phase-standby .side-feed, .phase-nosignal .side-feed { display: none; }
@media (orientation: landscape) {
  .side { max-width: none; min-height: 100dvh; padding: 0; gap: 0; background: var(--bgc); color: var(--fg); }
  .side-head, .side-coming { display: none; }
  .side-count { flex: 1; display: grid; place-content: center; border-radius: 0; background: none; }
  .side-big { font-size: clamp(80px, 42vh, 360px); margin: 0; }
  .phase-live .side-feed, .phase-play .side-feed { position: fixed; inset: 0; border: 0; border-radius: 0; aspect-ratio: auto; z-index: 1; }
  .phase-play .side-count { position: fixed; inset: 0; z-index: 2; animation: side-fade 5s linear forwards; background: var(--bgc); }
  .phase-live .side-top, .phase-play .side-top { display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 3;
    padding: 4px 12px; background: rgb(0 0 0 / .55); color: #fff; font-weight: 700; font-size: 14px; }
}
@media (orientation: portrait) { .phase-play .side-count { animation: side-fade 5s linear forwards; } }
@keyframes side-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .side-bar i { transition: none; } }
