:root {
  --bg: #121318; --panel: #1b1d24; --line: #2c2f3a; --text: #e9e8ef; --dim: #9a9cab; --accent: #ff5a4d; --ok: #3ee089; --warn: #ffb02e; --mark: #ffd34d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: var(--text); background: #2a2d38; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: #4a4e5e; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
input, select, textarea { font: inherit; color: var(--text); background: #0e0f13; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.dim { color: var(--dim); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.err { color: #ff8a80; } .grow { flex: 1; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); white-space: nowrap; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.err { color: #ff8a80; border-color: #ff8a80; }

body.login { display: grid; place-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(360px, calc(100vw - 32px)); display: grid; gap: 12px; }
.card h1 { margin: 0; font-size: 22px; } .card label { display: grid; gap: 4px; } .card p { margin: 0; }

header { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
main { display: grid; grid-template-columns: 210px minmax(0, 1fr) 330px; height: calc(100% - 50px); }
nav, aside { overflow: auto; padding: 10px; border-right: 1px solid var(--line); }
aside { border-right: 0; border-left: 1px solid var(--line); }
#center { padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.item { display: block; width: 100%; text-align: left; margin: 4px 0; position: relative; }
.item.on, .chip.on { border-color: var(--accent); background: #3a2422; }
.board { margin: 8px 0; } .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { padding: 3px 7px; position: relative; }
.badge { background: var(--accent); color: #fff; border-radius: 8px; font-size: 11px; padding: 0 5px; margin-left: 4px; }

#stage { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; width: 100%; max-height: 64vh; }
#stage video, #stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#stage [hidden] { display: none; }
#overlay { position: absolute; cursor: crosshair; touch-action: none; }
#transport, #stillnav, .tools, .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#transport[hidden], #stillnav[hidden] { display: none; }
#scrub { flex: 1; min-width: 160px; }
#caption { flex: 1; font-size: 13px; }
.words { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-height: 2.2em; }
.words mark { background: var(--mark); color: #111; border-radius: 3px; padding: 0 2px; }
.setup { font-weight: 700; color: var(--mark); margin-right: 6px; }
#compose { display: grid; gap: 6px; }
.tool.on { border-color: var(--accent); background: #3a2422; }
.dot { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.dot.on { border-color: #fff; }
#text { flex: 1; min-width: 200px; }
#msg { margin: 0; min-height: 1.4em; }

.aside-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.note { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; cursor: pointer; display: grid; gap: 3px; background: var(--panel); }
.note.focus { border-color: var(--mark); }
.note img { width: 100%; max-height: 180px; object-fit: contain; background: #000; border-radius: 4px; }
.note .text { font-weight: 600; }
.note.fixed .st { color: var(--warn); } .note.accepted .st { color: var(--ok); } .note.reopened .st, .note.open .st { color: #ff8a80; }
.note.accepted { opacity: .75; }
.fix { background: #11251b; border-radius: 6px; padding: 5px 7px; } .fix a { color: var(--ok); }
.acts { display: flex; gap: 6px; } .acts:empty { display: none; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; width: min(640px, calc(100vw - 32px)); }
dialog textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
dialog h2 { margin-top: 0; font-size: 18px; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; height: auto; }
  nav, aside { border: 0; border-bottom: 1px solid var(--line); max-height: none; }
  #stage { max-height: none; }
}
