/* bridgenotes. Used in a dark grading theater: no bright surfaces, dim text.
   The guest page is a plain document; laptop is the primary screen.
   The operator page shares the base tokens. */
:root {
  --bg: #0b0b0b;
  --panel: #111;
  --panel-2: #151515;
  --line: #1f1f1f;
  --line-2: #2c2c2c;
  --text: #8a8a8a;            /* note text */
  --text-strong: #a6a6a6;     /* the line being written */
  --text-dim: #4e4e4e;        /* saved timecodes */
  --held: #8a6a2e;            /* live timecode while notes are on hold */
  --near: #8a7442;            /* timecodes of notes close to the playhead */
  --ok: #4c8a5c;
  --no: #a05555;
  --err: #a05555;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, "DejaVu Sans Mono", Consolas, monospace;
  --gutter: 9.5rem;           /* left margin that carries the timecodes */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 17px/1.5 -apple-system, system-ui, "Segoe UI", Roboto, "Noto Sans", sans-serif; -webkit-text-size-adjust: 100%; }
button {
  font: inherit; font-size: 15px; color: var(--text-strong); background: #181818; border: 1px solid var(--line-2);
  border-radius: 8px; padding: 8px 16px; min-height: 40px; cursor: pointer;
}
button:disabled { color: var(--text-dim); border-color: var(--line); background: #0e0e0e; cursor: default; }
button.ghost { background: transparent; }
button.small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
input, select, .op textarea {
  font: inherit; color: var(--text-strong); background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 10px 12px;
}
input:focus, button:focus-visible { outline: 1px solid #444; outline-offset: 1px; }
[hidden] { display: none !important; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: var(--text-dim); }
h2 { font-size: 13px; font-weight: 600; color: var(--text-dim); margin: 0 0 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--err); display: inline-block; flex: none; }
.dot.on { background: var(--ok); }
.tc { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- guest: the document */
.top {
  position: fixed; top: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
}
.status { font-size: 13px; color: var(--held); }
.status[data-state="OFFLINE"] { color: var(--text-dim); }

.doc { max-width: 58rem; margin: 0 auto; padding: 12vh 28px 60vh; }
.title {
  margin: 0 0 1.6rem var(--gutter); font-size: 2.1rem; line-height: 1.2; font-weight: 700; color: var(--text-strong);
  letter-spacing: -0.01em; overflow-wrap: anywhere;
}
.blocks { list-style: none; margin: 0; padding: 0; }

.blk { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr) 4.5rem; align-items: baseline; padding: 5px 0; }
.blk > .tc { font-size: 13px; color: var(--text-dim); text-align: right; padding-right: 1.4rem; user-select: none; white-space: nowrap; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; min-height: 1.5em; }
#after .note.near > .tc { color: var(--near); }   /* coming up soon */
.note.pending > .tc::before { content: "•"; margin-right: .4em; color: var(--held); }
.note.failed > .tc { color: var(--err); }
.note.failed > .tc::before { content: "!"; margin-right: .4em; }
.note.editing > .tc { color: var(--text); }
body.ended .note-text { cursor: default; }

.blk textarea {
  display: block; width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent;
  font: inherit; color: var(--text-strong); caret-color: #c8c8c8; resize: none; overflow: hidden; outline: none;
}
.blk.live > .tc { color: var(--text-strong); }
.blk.live[data-mode="held"] > .tc { color: var(--held); }
.blk.live textarea:disabled { cursor: default; }
body.ended .blk.live { display: none; }

.acts { display: flex; gap: 2px; justify-content: flex-end; align-self: start; }
.act { min-height: 0; width: 28px; height: 26px; padding: 0; border: 0; background: transparent; border-radius: 6px; display: grid; place-items: center; }
.act svg { width: 15px; height: 15px; }
.act.ok { color: var(--ok); }
.act.no { color: var(--no); }
.act:hover { background: #1a1a1a; }

.live-pill {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6;
  display: flex; align-items: baseline; gap: 10px; border-radius: 99px; padding: 6px 16px; min-height: 0;
  font-size: 13px; background: #161616; color: var(--text);
}
.live-pill .tc { color: var(--text-strong); }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 20; padding: 16px; }
.dialog { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 18px; width: min(360px, 100%); display: grid; gap: 12px; }
.dialog label { color: var(--text-strong); font-weight: 600; }
.code-row { display: grid; gap: 12px; }
.code-row input { font-family: var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.join-msg { margin: 0; font-size: 14px; color: var(--no); }
.toast {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: #161616; border: 1px solid var(--line-2); color: var(--text-strong); padding: 8px 14px; border-radius: 8px;
  z-index: 30; max-width: calc(100% - 32px); font-size: 14px;
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .doc { padding: 64px 16px 55vh; }
  .title { margin-left: 0; font-size: 1.6rem; }
  .blk { grid-template-columns: minmax(0, 1fr) auto; padding: 7px 0; }
  .blk > .tc { grid-column: 1 / -1; text-align: left; padding: 0; font-size: 12px; }
  .act { width: 40px; height: 36px; }
  .act svg { width: 18px; height: 18px; }
}

/* ---------------------------------------------------------------- operator */
.op { font-size: 16px; }
.op main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.op h1 { font-size: 18px; color: var(--text-strong); margin: 0; }
.op .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px; }
.card h2 { margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }
.big-tc { font: 34px/1.1 var(--mono); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.tc-inline { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text-strong); }
.count { color: var(--text-dim); font-weight: 400; }
.pause-btn { width: 100%; font-size: 20px; min-height: 64px; font-weight: 600; }
.pause-btn.paused { background: #1d150a; border-color: #5a4320; color: #d0a860; }
.warn-box { border: 1px solid #4a3818; background: #140f07; color: #c09a58; border-radius: 8px; padding: 10px; font-size: 14px; }
.err-box { border: 1px solid #4a1f1f; background: #140808; color: #c07070; border-radius: 8px; padding: 10px; font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; }
td.tcc { font-family: var(--mono); white-space: nowrap; color: var(--text-strong); }
td.txt { white-space: pre-wrap; color: var(--text-strong); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.qr { background: #fff; padding: 8px; border-radius: 8px; width: 220px; height: 220px; display: block; }
.qr-big { position: fixed; inset: 0; background: #000; display: grid; place-items: center; z-index: 40; cursor: zoom-out; }
.qr-big img { width: min(80vmin, 640px); height: auto; background: #fff; padding: 16px; border-radius: 12px; }
.qr-big .url { font: 28px var(--mono); color: #bbb; margin-top: 16px; text-align: center; }

@media print {
  :root { --bg: #fff; --text: #000; --text-strong: #000; --text-dim: #555; --line: #ccc; --panel: #fff; }
  body.op { background: #fff; color: #000; }
  .op .no-print, .op .grid { display: none !important; }
  .op #collect { border: none; padding: 0; }
  td, th { border-color: #ccc; }
}
