:root {
  /* Slate: black and chalk, so the footage brings the colour. Tally red means a camera is rolling, and nothing else. */
  --bg: #0e0e0e;
  --panel: #171716;
  --field: #121211;
  --line: #2a2927;
  --text: #edeae3;
  --muted: #8a8780;
  --red: #e5251b;
  --green: #8fbf6a;
  --radius: 6px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.45 "Instrument Sans", -apple-system, system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }

/* ---- shared ---- */
.label { font: 500 11px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.mark { display: block; color: var(--text); }

/* ---- home ---- */
.home { min-height: 100%; max-width: 440px; margin: 0 auto; padding: calc(var(--safe-top) + 48px) 24px calc(var(--safe-bottom) + 32px); display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: flex-end; gap: 14px; }
.brand .mark { width: 66px; height: 44px; }
.brand h1 { margin: 0 0 -6px; font: 700 52px/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.tagline { margin: -10px 0 4px; color: var(--muted); font-size: 17px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font: 500 11px/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.18em; }
.field { width: 100%; padding: 14px 16px; border-radius: 4px; border: 1px solid var(--line); background: var(--field); outline: none; }
.field:focus { border-color: var(--muted); }
.field::placeholder { color: #5c5a55; }
.code-field { text-transform: uppercase; letter-spacing: 0.4em; text-align: center; font: 700 26px/1 var(--display); }
.btn { padding: 14px 18px; border-radius: 4px; background: #262523; font-weight: 600; text-align: center; }
.btn.primary { background: var(--text); color: var(--bg); }
.btn.red { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.4; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.check { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--text); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list button { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: 4px; background: var(--field); border: 1px solid var(--line); }
.muted { color: var(--muted); font-size: 14px; }
.error { color: #ff8a80; font-size: 14px; }

/* ---- shoot ---- */
.shoot { position: fixed; inset: 0; overflow: hidden; background: #000; }
/* Tally light: when a take is rolling the whole screen edge goes red, on every phone at once. */
.shoot::after { content: ""; position: absolute; inset: 0; border: 0 solid var(--red); pointer-events: none; transition: border-width .15s ease; z-index: 5; }
.shoot.rolling::after { border-width: 6px; }
.shoot video.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shoot .shade-top, .shoot .shade-bottom { position: absolute; left: 0; right: 0; pointer-events: none; }
.shoot .shade-top { top: 0; height: 170px; background: linear-gradient(#0e0e0edd, #0e0e0e00); }
.shoot .shade-bottom { bottom: 0; height: 260px; background: linear-gradient(#0e0e0e00, #0e0e0ee6); }
.topbar { position: absolute; top: calc(var(--safe-top) + 12px); left: 16px; right: 16px; display: flex; flex-direction: column; gap: 10px; }
.topbar .line { display: flex; align-items: center; gap: 10px; }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title b { display: block; font: 700 24px/1.05 var(--display); letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font: 500 11px/1.6 var(--mono); color: #edeae3b0; letter-spacing: 0.16em; }
.pill { padding: 9px 14px; border-radius: 4px; background: #0e0e0e99; border: 1px solid #edeae330; font: 700 15px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.people { display: flex; gap: 6px; flex-wrap: wrap; }
.person { display: flex; align-items: center; gap: 6px; padding: 5px 9px 5px 7px; border-radius: 4px; background: #0e0e0e99; font-size: 13px; }
.person .dot { width: 7px; height: 7px; border-radius: 50%; background: #5c5a55; }
.person.online .dot { background: var(--text); }
.person.recording .dot { background: var(--red); }
.person .cam { font: 500 10px/1 var(--mono); color: var(--muted); letter-spacing: 0.08em; }
.bottombar { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.status { font-size: 13px; color: #edeae3cc; min-height: 18px; text-align: center; padding: 0 20px; }
.status.big { font: 700 22px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); }
.controls { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 28px; }
.controls .side { display: flex; justify-content: center; }
.round { width: 52px; height: 52px; border-radius: 50%; background: #0e0e0e99; border: 1px solid #edeae330; display: grid; place-items: center; }
.round svg { width: 24px; height: 24px; }
.rec { width: 84px; height: 84px; border-radius: 50%; border: 5px solid var(--text); display: grid; place-items: center; }
.rec i { width: 64px; height: 64px; border-radius: 50%; background: var(--red); transition: all .2s ease; }
.rec.on i { width: 32px; height: 32px; border-radius: 4px; }
.rollall { display: flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 4px; background: #0e0e0e99; font: 700 15px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.rollall input { accent-color: var(--red); width: 18px; height: 18px; }
/* Timecode from the shared clock, so every phone in the shoot shows the same numbers. */
.timer { position: absolute; top: calc(var(--safe-top) + 112px); left: 50%; transform: translateX(-50%); padding: 4px 10px; border-radius: 3px; background: #0e0e0ecc; color: var(--red); font: 700 17px/1.2 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font: 700 200px/1 var(--display); text-shadow: 0 4px 40px #000a; pointer-events: none; }
.no-camera { position: absolute; inset: 0; display: grid; place-items: center; padding: 40px; text-align: center; color: var(--muted); }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px; border-radius: 3px; background: var(--text); color: var(--bg); font: 700 12px/1.4 var(--mono); }

.sheet-wrap { position: absolute; inset: 0; background: #000a; display: flex; align-items: flex-end; z-index: 6; }
.sheet { width: 100%; max-height: 88%; overflow: auto; background: var(--panel); border-top: 1px solid var(--line); border-radius: 10px 10px 0 0; padding: 22px 20px calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; gap: 14px; }
.sheet header { display: flex; justify-content: space-between; align-items: center; }
.sheet h3 { margin: 0; font: 700 28px/1 var(--display); letter-spacing: 0.03em; text-transform: uppercase; }
.link { text-align: center; color: var(--muted); font: 12px/1.4 var(--mono); word-break: break-all; }

/* Invite: every shoot gets a slate. */
.slate { background: var(--text); color: var(--bg); border-radius: 3px; overflow: hidden; }
.slate .band { height: 30px; background: repeating-linear-gradient(-60deg, var(--bg) 0 14px, var(--text) 14px 30px); }
.slate .cell { padding: 10px 14px 12px; border-top: 2px solid var(--bg); }
.slate .cell .label { color: #5c5a55; display: block; margin-bottom: 6px; }
.slate .cell b { display: block; font: 700 30px/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.slate .split { display: grid; grid-template-columns: 1fr 1fr; }
.slate .split > .cell + .cell { border-left: 2px solid var(--bg); }
.slate .join { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.slate .join b { color: var(--red); font-size: 64px; letter-spacing: 0.12em; }
.slate .join small { display: block; margin-top: 8px; font-size: 12px; color: #3a3833; }
.slate .qr { width: 132px; height: 132px; }
.slate .qr img { width: 100%; height: 100%; display: block; mix-blend-mode: multiply; }

.clip-row { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 4px; background: var(--field); border: 1px solid var(--line); font-size: 14px; }
.clip-row .st { color: var(--muted); font: 12px/1.6 var(--mono); }
.clip-row .st.ok { color: var(--text); }
.result video { width: 100%; border-radius: 4px; background: #000; max-height: 60vh; }
.sync-table { width: 100%; border-collapse: collapse; font: 12px/1.4 var(--mono); color: var(--muted); }
.sync-table td { padding: 7px 4px; border-top: 1px solid var(--line); }
.sync-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; background: var(--field); padding: 4px; border-radius: 4px; }
.tabs button { flex: 1; padding: 8px; border-radius: 3px; font-size: 14px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: #262523; color: var(--text); }

/* ---- editor ---- */
.pill.red { background: var(--red); border-color: var(--red); color: #fff; }
.pill.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.pill:disabled { opacity: .5; }
.editor { min-height: 100%; max-width: 760px; margin: 0 auto; padding: calc(var(--safe-top) + 10px) 14px calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; gap: 12px; }
.ed-head { display: flex; align-items: center; justify-content: space-between; }
.ed-head b { margin: 0; font: 700 22px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.ed-stage { position: relative; height: min(46vh, 520px); max-width: 100%; margin: 0 auto; background: #000; border-radius: 4px; overflow: hidden; }
.ed-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.ed-label { position: absolute; top: 10px; left: 10px; padding: 4px 8px; border-radius: 3px; font: 700 14px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bg); }
.ed-out { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: repeating-linear-gradient(-60deg, #121211 0 10px, #1b1b1a 10px 20px); font: 700 18px/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; }
.ed-transport { display: flex; align-items: center; gap: 10px; }
.ed-transport .round { width: 46px; height: 46px; font-size: 16px; background: #262523; border: 0; }
.ed-transport .round.small { width: 38px; height: 38px; font-size: 20px; }
.ed-transport .spacer { flex: 1; }
.ed-time { font: 13px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.ed-hint { color: var(--muted); font-size: 13px; margin-bottom: -4px; }
.ed-angles { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-angles button { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 4px; background: var(--field); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.ed-angles button i { width: 10px; height: 10px; border-radius: 2px; background: var(--c, #666); }
.ed-angles button.on { border-color: var(--c, var(--text)); background: #262523; }
.ed-angles button:disabled { opacity: .3; }
.ed-timeline { overflow-x: auto; overflow-y: hidden; background: var(--field); border: 1px solid var(--line); border-radius: 4px; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.ed-inner { position: relative; padding: 8px 0; min-width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.ed-cutlane { position: relative; height: 44px; margin-bottom: 6px; }
.ed-seg { position: absolute; top: 0; bottom: 0; background: var(--c); border-right: 2px solid var(--field); overflow: hidden; display: flex; align-items: center; padding-left: 6px; color: var(--bg); font: 700 13px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.ed-seg.out { background: repeating-linear-gradient(-60deg, #262523 0 6px, #1b1b1a 6px 12px); color: var(--muted); }
.ed-seg.partial { background-image: repeating-linear-gradient(-60deg, #0000 0 6px, #0006 6px 12px); }
.ed-seg.sel { box-shadow: inset 0 0 0 3px var(--text); }
.ed-handle { position: absolute; top: -4px; width: 22px; height: 52px; margin-left: -11px; z-index: 2; cursor: ew-resize; }
.ed-handle::after { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 4px; border-radius: 1px; background: var(--text); box-shadow: 0 0 0 1px #000; }
.ed-lane { position: relative; height: 18px; margin-top: 4px; }
.ed-lane div { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: color-mix(in srgb, var(--c) 40%, #0e0e0e); font: 10px/18px var(--mono); padding-left: 5px; color: var(--text); white-space: nowrap; overflow: hidden; }
.ed-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; z-index: 3; }
.ed-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ed-foot { display: flex; gap: 10px; }
.ed-foot .btn { flex: 1; font-size: 14px; }
.ed-status { color: var(--muted); font-size: 14px; text-align: center; min-height: 20px; }
.editor .sheet-wrap { position: fixed; z-index: 10; }
.versions { display: flex; gap: 6px; flex-wrap: wrap; }
.versions button { padding: 7px 12px; border-radius: 4px; background: var(--field); border: 1px solid var(--line); font: 700 14px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.versions button.on { background: #262523; color: var(--text); border-color: var(--muted); }
.add-videos { display: block; cursor: pointer; }
