:root {
  --bg: #0e1116; --panel: #171b22; --panel-2: #1f242d; --line: #2a303b;
  --text: #e8ebf0; --dim: #98a1b0; --accent: #4fd1a5; --accent-ink: #06231a;
  --warn: #f0b45a; --danger: #ef6b6b; --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f5f6f8; --panel: #fff; --panel-2: #eef0f3; --line: #dcdfe5; --text: #171a20; --dim: #5d6573; --accent: #0f9d74; --accent-ink: #fff; color-scheme: light; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
#app { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
#app.wide { max-width: 1280px; }
h1 { font-size: 28px; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 28px 0 10px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
p { margin: 0; }
.tagline { color: var(--accent); margin-top: 4px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 200px; min-width: 0; }
.stack { display: grid; gap: 12px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 10px; }
.card > .row + .row { margin-top: 12px; }
.card h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }

button, .btn { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--dim); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--danger); }
button.on { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link { background: none; border: none; padding: 4px 6px; color: var(--dim); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { display: grid; gap: 4px; font-size: 13px; color: var(--dim); }
input[type=text], input[type=datetime-local], select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--text); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.pill.live { color: var(--accent); border-color: var(--accent); }
.pill.warn { color: var(--warn); border-color: var(--warn); }

/* room */
.room-head { margin-bottom: 14px; }
.room-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
@media (max-width: 800px) { .room-body { grid-template-columns: 1fr; } }
.stage { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stage.empty { min-height: 260px; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--dim); text-align: center; padding: 24px; }
.tile { background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative; }
.tile video { width: 100%; display: block; max-height: 72vh; object-fit: contain; background: #000; }
.tile span { position: absolute; left: 8px; bottom: 8px; font-size: 12px; padding: 2px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.65); color: #fff; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.people li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--panel-2); border-radius: 10px; }
.people .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knock { border-color: var(--warn); }
.controls { position: sticky; bottom: 12px; margin-top: 16px; justify-content: center; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 8px; width: fit-content; margin-inline: auto; }
.center { text-align: center; padding: 48px 16px; }
.code { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; font-weight: 600; color: var(--text); }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s; max-width: 90vw; }
#toast.show { opacity: 1; }
