/* Bad Takes on the web — mobile first.
 *
 * The token names are the desktop app's on purpose (--bg, --surface, --accent,
 * --hot, --on-accent …): the palette is the brand, and two vocabularies for
 * the same colours is how a web page slowly stops looking like the app.
 *
 * The layout is not the desktop's, and should not be. The desktop is a fixed
 * two-panel viewport that never scrolls; a phone is one column that does.
 */

:root {
  /* The desktop app's tokens, verbatim. The palette IS the brand, and an
     approximation of it is exactly what makes a second surface look like a
     knock-off of the first. Same names too, so a rule can be moved between
     the two stylesheets without translation. */
  --bg: #1a1626;
  --surface: #241e33;
  --surface-2: #2d2640;
  --accent: #ffb84d;
  --hot: #ff4f79;
  --text: #f2ede4;
  --dim: #8e85a3;
  --on-accent: #1a1626;
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.35);
  --glow: rgba(255, 184, 77, 0.45);
  --wave-bg: rgba(26, 22, 38, 0.7);
  --raised: #3a3350;
  --accent-text: var(--accent);
  --accent-split: rgba(26, 22, 38, 0.3);
  /* The booth's three card states. */
  --rec-wash: #2a1c2c;
  --rec-halo-1: rgba(255, 79, 121, 0.13);
  --rec-halo-2: rgba(255, 79, 121, 0.18);
  --wave-rec-bg: rgba(26, 22, 38, 0.55);
  --wave-rec-border: rgba(255, 79, 121, 0.5);
  --still-rec-filter: brightness(0.6);
  --still-scored-bg: #000;
  --still-scored-filter: brightness(0.26) saturate(0.55);
  --donut-track: #3a3350;
  --donut-face: #241e33;
  --donut-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --danger: #ff6b6b;
  --line: #3a3350;

  /* Futura is the wordmark's face and the app's display type — losing it is
     most of why a copy stops looking like the app. */
  --display: "Futura", "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "SF Mono", "Menlo", "Consolas", monospace;

  --radius: 14px;
  /* What the rooms subtract to fill the window: the topbar and the workflow
     header, as they actually measure here. */
  --topbar-h: 49px;
  --wh-h: 62px;
  /* Touch targets. 44px is the documented floor on both mobile platforms and
     the record button is the one control people hit while performing. */
  --tap: 44px;
  color-scheme: dark;
}

body.light {
  --bg: #f6f1e6;
  --surface: #fffdf7;
  --surface-2: #e7dfcd;
  --accent: #f0a63c;
  --hot: #e0335f;
  --text: #2a2438;
  --dim: #837b96;
  --on-accent: #241e33;
  --shadow-card: 0 18px 50px rgba(42, 36, 56, 0.14);
  --glow: rgba(240, 166, 60, 0.5);
  --wave-bg: rgba(246, 241, 230, 0.7);
  --raised: #d8cdb6;
  --accent-text: #b06a1e;
  --accent-split: rgba(36, 30, 51, 0.3);
  --rec-wash: #fff5f2;
  --rec-halo-1: rgba(224, 51, 95, 0.1);
  --rec-halo-2: rgba(224, 51, 95, 0.12);
  --wave-rec-bg: rgba(255, 253, 247, 0.75);
  --wave-rec-border: rgba(224, 51, 95, 0.45);
  /* Light washes the still *out* rather than darkening it: a dark block
     fights the cream page. */
  --still-rec-filter: saturate(0.85) opacity(0.8);
  --still-scored-bg: var(--surface);
  --still-scored-filter: opacity(0.22) saturate(0.4);
  --donut-track: #e7dfcd;
  --donut-face: #fffdf7;
  --donut-shadow: 0 10px 30px rgba(42, 36, 56, 0.14);
  --danger: #c8353a;
  --line: #d8cdb6;
  color-scheme: light;
}
:root:has(body.light) { color-scheme: light; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  /* iOS: keep content clear of the notch and the home indicator. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

.hidden { display: none !important; }
code { font-family: var(--mono); font-size: .92em; }

/* ---------- chrome ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 14px; min-height: 48px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand-lockup {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 0; color: inherit; cursor: pointer;
  /* The home button, so it gets a full tap target like every other control. */
  padding: 4px 8px; min-height: var(--tap);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-size: 17px;
  letter-spacing: .06em; display: flex; gap: 6px;
}
.wordmark-bad { color: var(--text); }
.wordmark-takes {
  color: var(--on-accent); background: var(--accent);
  padding: 0 6px; border-radius: 4px; box-shadow: 0 0 18px var(--glow);
}
.topbar-right { display: flex; gap: 4px; }

.icon-btn {
  display: grid; place-items: center;
  width: var(--tap); height: var(--tap);
  background: none; border: 0; border-radius: 10px;
  color: var(--dim); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--surface); }
.icon-sun { display: none; }
body.light .icon-sun { display: block; }
body.light .icon-moon { display: none; }

.workflow-header {
  position: sticky; top: 48px; z-index: 19;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wh-navlink {
  background: none; border: 0; color: var(--dim);
  font: inherit; cursor: pointer; padding: 8px 4px; min-height: var(--tap);
  /* flex:none + nowrap or a narrow phone squeezes "‹ Exit" onto two lines
     and the header grows to a block. The title is the only thing here that
     may shrink, and it ellipsises. */
  flex: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.wh-navlink:hover { color: var(--text); }
.wh-title { font-weight: 600; font-size: 13px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-stage { color: var(--dim); font-weight: 400; }
.wh-stage:not(:empty)::before { content: " · "; }
.wh-grow { flex: 0 0 auto; }
.wh-next { flex: none; white-space: nowrap; padding: 8px 14px; font-size: 13px; min-height: 38px; }

.view { padding: 16px 14px 48px; max-width: 1180px; margin: 0 auto; }
/* The library is the one screen that fills the window rather than flowing:
   the rail scrolls inside itself, the way the desktop's does. */
#view-library { display: flex; flex-direction: column; }
/* The library spans the window rather than the reading column the other views
   use: it is a two-panel workspace, and 1180px would leave the rail and the
   casting call crowded on a wide screen while the page sat in a letterbox. */
#view-library { max-width: none; }
#view-library:not(.hidden) { height: calc(100vh - 62px); }
.view-title { font-family: var(--display); font-size: 24px; font-weight: 700; margin: 0 0 6px; letter-spacing: .01em; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 24px 0 8px; }
.hint { color: var(--dim); font-size: 13px; margin: 6px 0; }
.mono-meta { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.eyebrow { color: var(--accent); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 0; }

/* ---------- buttons ---------- */

.primary-btn, .ghost-btn, .record-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 12px; min-height: var(--tap);
  padding: 11px 16px;
  /* A tap on a phone must not select the label or fire the 300ms zoom path. */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.primary-btn { background: var(--accent); color: var(--on-accent); border: 0; }
.primary-btn:hover:not(:disabled) { filter: brightness(1.07); }
.ghost-btn { background: transparent; color: var(--text); border: 1px solid var(--line); }
.ghost-btn:hover:not(:disabled) { background: var(--surface); }
.ghost-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.primary-btn:disabled, .ghost-btn:disabled { opacity: .4; cursor: default; }
.wide { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- library: the rail + the casting call ----------
   The desktop's structure and class names. It is a fixed two-panel viewport
   there; here the same grid collapses to one column under 900px, because a
   phone has to scroll and a 280px rail beside a detail panel does not fit. */

.library-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 26px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.pack-list-panel {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.list-head {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 10px; border-bottom: 1px solid var(--surface-2);
}
.search-input {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--surface-2);
  color: var(--text);
  border-radius: 10px; padding: 8px 12px;
  font-size: 13px; font-family: inherit;
  flex: 1; min-width: 0;
}
.search-input::placeholder { color: var(--dim); }

.filter-wrap { position: relative; flex: none; }
.filter-btn {
  display: flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--surface-2);
  color: var(--text);
  border-radius: 10px; padding: 8px 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.filter-btn:hover { border-color: var(--dim); }
.filter-btn.active { border-color: var(--accent); color: var(--accent); }
.filter-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--surface-2);
  border-radius: 10px; padding: 6px; min-width: 170px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  z-index: 8; display: flex; flex-direction: column; gap: 2px;
}
.filter-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: none; border: 0; color: var(--text);
  font: inherit; font-size: 13px; text-align: left;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.filter-item:hover { background: var(--surface-2); }
.filter-item .count { color: var(--dim); font-size: 12px; font-family: var(--mono); }
.filter-item.on { color: var(--accent); }
.filter-cats { border-top: 1px solid var(--surface-2); margin-top: 4px; padding-top: 4px; }

.browse-list { list-style: none; margin: 0; padding: 6px; flex: 1; min-height: 0; overflow-y: auto; }
.browse-group {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--dim); padding: 10px 8px 4px;
}
.browse-title {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text);
  font: inherit; cursor: pointer;
  padding: 8px 10px; border-radius: 8px;
  border-left: 3px solid transparent;
}
.browse-title:hover { background: var(--surface-2); }
.browse-title.on { background: var(--surface-2); border-left-color: var(--accent); }
.browse-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.browse-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
/* A fixed-width slot on every row (empty for uncategorized/v1 scenes) so every
   title lines up in one column regardless of which rows carry an icon. */
.browse-cat { width: 14px; flex: none; display: inline-flex; justify-content: center; color: var(--accent); }
.browse-cat svg { display: block; }
.browse-sub {
  font-size: 11.5px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-left: 22px;
}
.browse-sb {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim); border: 1px solid var(--surface-2);
  border-radius: 4px; padding: 1px 4px; flex: none;
}

.list-foot {
  flex: none; display: flex; gap: 6px;
  border-top: 1px solid var(--surface-2); padding: 6px; position: relative;
}
.add-packs-btn {
  display: flex; flex: 1 1 0; min-width: 0;
  align-items: center; justify-content: center; gap: 7px;
  background: none;
  /* Outlined rather than filled on purpose: "Enter scene →" is the filled
     amber CTA on this screen and stays the loudest thing on it. */
  border: 1px solid var(--accent); color: var(--accent);
  padding: 9px 8px; border-radius: 8px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  cursor: pointer; font-family: inherit;
}
.add-packs-btn svg { flex: none; }
.add-packs-btn:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.add-tooltip {
  display: none; position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%); white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--surface-2); border-radius: 8px;
  padding: 7px 12px; font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); z-index: 6;
}
.add-packs-btn:hover ~ .add-tooltip { display: block; }
.list-none-hint { padding: 0 12px 10px; }

.pack-detail-panel {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; height: 100%;
  background: var(--surface); border: 1px solid var(--surface-2);
  border-radius: 12px; overflow: hidden;
}
/* 75/25: the casting call gets the room, "Your takes" gets a strip that
   scrolls inside itself — the desktop's split. */
.detail-top { min-height: 0; flex: 0 0 75%; padding: 22px 24px; display: flex; flex-direction: column; overflow: hidden; }
.detail-grid {
  display: grid; grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px; align-items: stretch; flex: 1; min-height: 0;
}
.poster-col { display: flex; flex-direction: column; min-height: 0; gap: 14px; }
.pack-poster {
  width: 100%; border-radius: 12px;
  border: 1px solid var(--surface-2); background: var(--bg);
  aspect-ratio: 16 / 9; object-fit: cover;
}
.pack-poster[src=""] { display: none; }
/* The entry row. Deliberately NOT `overflow: hidden` with a radius on the
   wrapper: the global focus ring is an amber outline at 2px offset, and
   clipping the wrapper would hide keyboard focus. Corners are per segment. */
.poster-col .entry-row { margin-top: auto; display: flex; }
.entry-row .primary-btn { flex: 1; padding: 13px 12px; border-radius: 10px; white-space: nowrap; }
.entry-row .primary-btn:hover { filter: brightness(1.07); }

.pack-actions { display: flex; gap: 8px; }
.pack-actions .labelled-action {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  flex: 1; padding: 10px 8px; white-space: nowrap;
}
.pack-actions .labelled-action svg { display: block; flex: none; }

.meta-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow-y: auto; }
.pack-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(22px, 2.6vw, 32px); line-height: 1.1; margin: 0;
}
.pack-subtitle {
  font-family: var(--display); font-style: italic; font-size: 16px;
  color: var(--text); opacity: .85; margin: 6px 0 0; line-height: 1.4;
}
.pack-byline {
  font-size: 12px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .1em; margin: 10px 0 0;
}
.pack-byline .author { color: var(--accent); }
.pack-source { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); margin: 10px 0 0; }
.cat-badge {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--accent); color: var(--accent);
  border-radius: 999px; padding: 2px 9px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
}
.cat-badge svg { display: block; }
.pack-meta {
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
  font-size: 12.5px; font-weight: 500; color: var(--dim); margin: 14px 0 0;
}
.meta-col .section-label { font-size: 13px; margin: 20px 0 8px; }
.readme-panel {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--surface-2); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; line-height: 1.6; color: var(--text);
}
.readme-panel p { margin: 8px 0 0; }
.readme-panel p:first-child { margin-top: 0; }

.detail-bottom {
  min-width: 0; flex: 1 1 0; min-height: 0;
  display: flex; flex-direction: column;
  border-top: 1px solid var(--surface-2); padding: 14px 24px 18px;
}
.detail-bottom .section-label { margin: 0 0 10px; flex: none; }
.scene-list { flex: 1; min-height: 0; overflow-y: auto; }
.scene-list .scene-row {
  position: relative; display: flex; gap: 12px; align-items: center;
  padding: 10px; border-bottom: 1px solid var(--surface-2);
  font-size: 13px; border-radius: 8px; cursor: pointer;
  background: none; border-left: 0; border-right: 0; border-top: 0;
  color: inherit; font-family: inherit; width: 100%; text-align: left;
}
.scene-list .scene-row:hover { background: var(--surface-2); }
.scene-list .row-open {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: 0; padding: 0;
  color: inherit; font: inherit; cursor: pointer;
}
.scene-list .row-btn {
  background: none; border: 1px solid var(--surface-2); color: var(--dim);
  border-radius: 8px; width: 34px; height: 34px;
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.scene-list .row-btn:hover { color: var(--text); border-color: var(--dim); }
.scene-list .row-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.empty-state { text-align: center; padding: 32px 0; }
.empty-title { font-weight: 600; margin: 0 0 4px; }

/* ---------- screening + table read ----------
   Both rooms fill the window: stage column anchored left, script panel
   scrolling on the right, so the picture and the lines are always both on
   screen. The desktop's blocks, with its class names. */

#view-screening,
#view-tableread {
  max-width: none;
  height: calc(100vh - var(--topbar-h) - var(--wh-h));
  padding: 18px 32px 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.screening {
  flex: 1; min-height: 0; width: 100%; max-width: 1360px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 22px;
}
.screening-stagecol { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }
.screening-side { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; }
.screening-side > .screening-script { flex: 1; }

.stage-wrap { flex: 1; min-height: 160px; min-width: 0; display: grid; place-items: center; cursor: pointer; }
.stage {
  position: relative; background: #000; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--surface-2);
  width: 100%; max-height: 100%; aspect-ratio: 16 / 9;
  display: grid; place-items: center;
}
.stage video, .stage img { width: 100%; height: 100%; object-fit: contain; }
.stage img[src=""] { display: none; }
.play-overlay {
  position: absolute; inset: 0; margin: auto;
  width: 74px; height: 74px; display: grid; place-items: center;
  padding: 0 0 0 6px; border: none; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #f2ede4; cursor: pointer; z-index: 4;
  -webkit-tap-highlight-color: transparent;
}
.play-overlay svg { display: block; }
.play-overlay:hover { background: rgba(0, 0, 0, .72); }
.stage-wrap.playing .play-overlay { display: none; }
.stage-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 40px 24px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  text-align: center; font-family: var(--display); font-size: 18px; font-weight: 700;
  text-shadow: 0 1px 4px #000; min-height: 30px; color: #f2ede4;
  pointer-events: none;
}
.stage-caption:empty { display: none; }
.stage-nameplate {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 13px 20px 34px; text-align: left; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, .78), transparent);
}
.stage-nameplate span {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--display); font-size: 20px; font-weight: 800; line-height: 1.2;
  letter-spacing: .11em; color: var(--accent); text-shadow: 0 1px 4px #000;
}

.seek-strip {
  position: relative; flex: none; height: 46px; border-radius: 8px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--surface-2); cursor: pointer;
  touch-action: none;
}
.seek-strip canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-right: 2px solid var(--accent); pointer-events: none;
}

.tr-cast { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tr-cast-label {
  font-family: var(--display); font-size: 12px; letter-spacing: .28em;
  text-transform: uppercase; color: var(--accent); margin-right: 4px;
}
.tr-cast-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-cast-hint { margin-left: auto; font-size: 11px; color: var(--dim); }
.pill {
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; min-height: 0;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pill .count { color: color-mix(in srgb, var(--on-accent) 65%, transparent); font-weight: 400; margin-left: 6px; font-size: 11px; }
.pill:hover { filter: brightness(1.08); }
.pill.off { border-color: var(--surface-2); background: color-mix(in srgb, var(--bg) 55%, transparent); color: var(--dim); }
.pill.off .count { color: var(--dim); }
.pill.off:hover { border-color: var(--accent); filter: none; }

.screening-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; flex: none; }
.screening-controls .filter-menu { left: 0; right: auto; }
.primary-btn.big { font-size: 17px; padding: 14px 30px; display: inline-flex; align-items: center; gap: 6px; }
.primary-btn.big svg { display: block; }
.progress-note { font-family: var(--mono); font-size: 12px; color: var(--dim); margin-left: auto; }
.icon-only-action { display: grid; place-items: center; padding: 9px 11px; }
.icon-only-action svg { display: block; }
.filter-menu.menu-up { top: auto; bottom: calc(100% + 6px); }
.export-menu { width: max-content; min-width: 150px; }
.export-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 7px; padding: 9px 12px;
  color: var(--text); font-size: 13px; font-weight: 650; font-family: inherit; cursor: pointer;
}
.export-item:hover { background: var(--surface-2); }
.export-item .ico { display: grid; place-items: center; color: var(--accent); }
.menu-note { color: var(--dim); font-weight: 500; font-size: 12px; cursor: default; }
.menu-note:hover { background: transparent; }

.screening-script {
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: 14px;
  min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.script-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--surface-2);
  font-family: var(--display); font-size: 12px; letter-spacing: .28em;
  text-transform: uppercase; color: var(--accent);
}
.script-hint { font-family: var(--body); font-size: 11px; letter-spacing: normal; text-transform: none; color: var(--dim); }
.script-filter .filter-btn { padding: 5px 9px; font-size: 11px; letter-spacing: normal; text-transform: none; gap: 4px; }
.timeline { list-style: none; flex: 1; overflow-y: auto; padding: 8px; margin: 0; }
.timeline li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--dim); cursor: pointer;
}
.timeline li:hover { background: var(--surface-2); color: var(--text); }
.timeline li.active { background: var(--surface-2); color: var(--text); }
.timeline li.active .who { color: var(--accent); }
.timeline li .line-text { flex: 1; min-width: 0; }
.timeline li .line-top { display: flex; gap: 10px; align-items: baseline; }
.timeline li .when { font-variant-numeric: tabular-nums; letter-spacing: .01em; font-size: 11.5px; font-weight: 500; }
.timeline li .who { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.timeline li .what { margin-top: 2px; line-height: 1.4; }
.timeline li .src { margin-left: auto; flex: none; display: grid; place-items: center; }
.timeline li .line-score { flex: none; font: 500 11px/1 var(--mono); color: var(--dim); font-variant-numeric: tabular-nums; }
.timeline li.skip { opacity: .5; }
.timeline li.skip:hover { opacity: 1; }

/* ---------- scene score panel ---------- */

.scene-score {
  flex: none; background: var(--surface); border: 1px solid var(--surface-2);
  border-radius: 14px; overflow: hidden; --ring: var(--hot);
}
.scene-score-takes { font-family: var(--mono); font-size: 11px; letter-spacing: normal; text-transform: none; color: var(--dim); }
.scene-score-body { padding: 16px; display: flex; gap: 16px; align-items: flex-start; }
.score-donut {
  position: relative; width: 186px; height: 186px; border-radius: 50%;
  display: grid; place-items: center; box-shadow: var(--donut-shadow);
  background: conic-gradient(var(--ring) 0 calc(var(--score-pct, 0) * 1%), var(--donut-track) calc(var(--score-pct, 0) * 1%) 100%);
  transition: --score-pct .6s ease-out;
}
.score-donut-face { position: absolute; inset: 14px; border-radius: 50%; background: var(--donut-face); }
.score-readout { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.score-percent { font-family: var(--display); font-size: 52px; font-weight: 800; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.score-band { font-family: var(--display); font-size: 11px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--ring); }
.scene-donut { width: 118px; height: 118px; flex: none; --donut-track: var(--surface-2); box-shadow: none; }
.scene-donut .score-donut-face { inset: 11px; background: var(--surface); }
.scene-donut .score-percent { font-size: 34px; }
.scene-donut .score-band { font-size: 9px; letter-spacing: .2em; text-align: center; line-height: 1.15; }
.scene-donut .score-readout { max-width: 96px; }
.scene-score.unscored .score-percent { color: var(--dim); }
.scene-score.unscored .score-band { display: none; }
.scene-cast {
  list-style: none; margin: 0; padding: 0 6px 0 0; flex: 1; min-width: 0;
  max-height: 118px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.scene-cast li { display: flex; flex-direction: column; gap: 5px; }
.scene-cast li.original { opacity: .55; }
.scene-cast-top { display: flex; align-items: baseline; gap: 8px; }
.scene-cast-name { font: 600 13px/1 var(--body); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-cast-meta { font: 500 10.5px/1 var(--mono); color: var(--dim); flex: none; }
.scene-cast-val { margin-left: auto; flex: none; font-family: var(--display); font-size: 17px; font-weight: 800; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.scene-cast li.original .scene-cast-val { color: var(--dim); }
.scene-cast-bar { height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.scene-cast-bar > span { display: block; height: 100%; background: var(--hot); border-radius: inherit; }

/* ---------- the recording room ---------- */

.booth { max-width: 720px; margin: 0 auto; text-align: center; }
#view-booth { padding-top: 16px; padding-bottom: 210px; max-width: none; }
.booth-progress { display: flex; align-items: center; justify-content: center; gap: 5px; margin-bottom: 20px; flex-wrap: wrap; min-height: 22px; }
.booth-progress .dot { width: 5px; height: 12px; border-radius: 999px; background: var(--surface-2); border: none; padding: 0; cursor: pointer; }
.booth-progress .dot.recorded { background: var(--accent); }
.booth-progress .dot.current { height: 22px; background: var(--hot); }

.cue-card {
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: 18px;
  overflow: hidden; box-shadow: var(--shadow-card);
  transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.cue-card.recording {
  background: var(--rec-wash); border-color: var(--hot);
  box-shadow: var(--shadow-card), 0 0 0 5px var(--rec-halo-1), 0 0 60px var(--rec-halo-2);
}
.cue-card.scored { border-color: var(--raised); }
.cue-media { position: relative; }
.cue-media img { width: 100%; height: 300px; object-fit: contain; background: #000; display: block; transition: filter .2s ease; }
.cue-card.recording .cue-media img { filter: var(--still-rec-filter); }
.cue-card.scored .cue-media img { filter: var(--still-scored-filter); background: var(--still-scored-bg); }
.cue-nameplate {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 44px 26px 16px;
  text-align: left; pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, .8), transparent);
}
.cue-nameplate span {
  font-family: var(--display); font-size: 27px; font-weight: 800; line-height: 1;
  letter-spacing: .13em; text-transform: uppercase; color: #ffb84d;
}
.cue-nameplate span:empty { display: none; }
.cue-card.recording .cue-nameplate span { opacity: .75; }
.cue-card.scored .cue-nameplate { background: none; }
.cue-card.scored .cue-nameplate span { opacity: .5; }
.rec-chip {
  position: absolute; top: 14px; right: 14px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--hot); border-radius: 999px; padding: 6px 13px; pointer-events: none;
}
.rec-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }
.rec-chip-label { font: 700 10.5px/1 var(--mono); letter-spacing: .16em; color: #fff; }
.rec-chip-time { font: 700 11.5px/1 var(--mono); color: #fff; font-variant-numeric: tabular-nums; }
.take-score { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; --ring: var(--hot); }
.take-score.unscored .score-percent { font-size: 44px; color: var(--dim); }
.take-score.unscored .score-band { display: none; }
.scrap-pill {
  display: inline-flex; align-items: center; gap: 6px; color: var(--dim);
  font: 500 12px/1 var(--body); border: 1px solid var(--raised); background: var(--donut-face);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; min-height: 0;
  transition: color .15s ease, border-color .15s ease;
}
.scrap-pill:hover { color: var(--hot); border-color: var(--hot); }
.cue-caption {
  font-family: var(--display); font-size: 38px; line-height: 1.2; font-weight: 700;
  padding: 26px 40px 24px; margin: 0; text-align: center; text-wrap: pretty; transition: opacity .2s ease;
}
.cue-card.scored .cue-caption { opacity: .45; }
.waveform-wrap { padding: 0 22px 22px; }
#booth-wave {
  width: 100%; height: 148px; display: block;
  background: var(--wave-bg); border: 1px solid var(--surface-2); border-radius: 12px;
}
.cue-card.recording #booth-wave { background: var(--wave-rec-bg); border-color: var(--wave-rec-border); }

.booth-dock {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100vw - 48px)); z-index: 4;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  padding: 12px 0 calc(14px + env(safe-area-inset-bottom));
}
.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 26px; }
.transport-side { display: flex; align-items: center; gap: 12px; }
.transport-left { justify-content: flex-end; }
.transport-right { justify-content: flex-start; }
.transport-center { position: relative; display: grid; place-items: center; }
.transport .nav-side { padding: 8px 14px; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; min-height: 0; }
.transport-btn {
  background: var(--surface); border: 1px solid var(--surface-2); color: var(--text);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; font-family: inherit; cursor: pointer;
}
.transport-btn svg { display: block; }
.transport-btn:hover:not(:disabled) { border-color: var(--dim); }
.transport-btn:disabled { opacity: .35; cursor: default; }
.booth-dock.recording .transport-side > * { opacity: .35; pointer-events: none; }
.record-btn {
  position: relative; width: 68px; height: 68px; border-radius: 50%; border: none;
  background: var(--surface-2); display: grid; place-items: center; cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.record-ring {
  position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--surface-2);
  transition: border-color .15s ease;
  box-shadow: 0 0 0 calc(var(--level, 0) * 16px) color-mix(in srgb, var(--hot) 30%, transparent);
}
.record-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--hot); transition: border-radius .15s ease, width .15s ease, height .15s ease; }
.record-btn:hover .record-ring { border-color: var(--hot); }
.record-btn.armed .record-dot { border-radius: 7px; width: 24px; height: 24px; }
.record-btn.armed .record-ring {
  border-color: var(--hot);
  box-shadow: 0 0 0 12px color-mix(in srgb, var(--hot) 28%, transparent);
  animation: pulse 1.2s ease-in-out infinite;
}
.booth-dock.scored .record-ring { border-color: var(--accent); }
.record-caption {
  position: absolute; top: 76px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font: 400 11.5px/1 var(--body); color: var(--dim);
}
.booth-dock.recording .record-caption { color: var(--hot); font-weight: 600; }
.booth-dock.scored .record-caption { color: var(--accent-text); font-weight: 600; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.booth-keys { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 32px; font-size: 12px; color: var(--dim); flex-wrap: wrap; }
.booth-keys svg { display: block; }
.booth-keys .key-step { display: inline-flex; align-items: center; gap: 5px; }
.booth-keys .key-step.on { color: var(--accent-text); font-weight: 600; }
.booth-keys .key-sep { color: var(--surface-2); }
.booth-keys.recording .key-step.on { color: var(--dim); font-weight: 400; }
.booth-keys.recording .key-step[data-step="1"] { color: var(--hot); font-weight: 600; }
.mic-note { margin: 8px 0 0; font-size: 12px; color: var(--dim); min-height: 1em; }
.mic-note:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .record-btn.armed .record-ring, .rec-chip-dot { animation: none; } }

/* Both rooms and the booth collapse for a phone: one column, the script
   capped so the stage stays reachable, the dock's side buttons losing their
   labels so the transport fits 375px. */
@media (max-width: 920px) {
  #view-screening, #view-tableread { height: auto; overflow: visible; padding: 14px 14px 22px; }
  .screening { grid-template-columns: 1fr; }
  .stage-wrap { flex: none; min-height: 0; }
  .screening-script { max-height: 45vh; }
  .tr-cast-hint { display: none; }
  #view-booth { padding-left: 10px; padding-right: 10px; }
  .cue-media img { height: 220px; }
  .cue-caption { font-size: 26px; padding: 18px 18px 16px; }
  .waveform-wrap { padding: 0 12px 12px; }
  #booth-wave { height: 120px; }
  .booth-dock { width: calc(100vw - 20px); }
  /* Five controls and a 68px record button do not fit 375px with their
     words on: the side buttons go icon-only, each still a full tap target,
     and their titles carry the words. Next keeps its label — it is the one
     that changes meaning (Next → Screening) and the one people look for. */
  .transport { column-gap: 10px; }
  .transport-side { gap: 6px; }
  .transport .nav-side, .transport-btn { padding: 0; min-width: var(--tap); min-height: var(--tap); justify-content: center; font-size: 12px; }
  .transport .nav-side svg, .transport-btn svg { width: 14px; height: 14px; }
  .transport .lbl { display: none; }
  #btn-next-line { padding: 0 12px; }
  .booth-keys { display: none; }
}

/* ---------- settings ---------- */

.settings-field { margin-bottom: 22px; }
.settings-field label, .field-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.select {
  width: 100%; font: inherit; padding: 11px 12px; min-height: var(--tap);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
}

/* ---------- toast + drop veil ---------- */

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 60; max-width: min(92vw, 460px);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; box-shadow: 0 12px 34px rgba(0,0,0,.4);
}
.toast.err { border-color: var(--danger); }
.drop-veil {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border: 3px dashed var(--accent);
  font-size: 18px; font-weight: 600;
}

/* ---------- wider screens ----------
   The phone layout is the base. A desktop gets two columns where the content
   genuinely pairs — never a rebuild. */

/* Under 900px the two panels stack: a 280px rail beside a detail panel does
   not fit a phone, and the rail becomes a short scrollable list above the
   scene it selects. */
@media (max-width: 899px) {
  .library-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .browse-list { max-height: 40vh; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  /* Stacked, the title has to come first: side by side it reads first anyway,
     but in one column the poster and the CTA would otherwise bury it and the
     panel opens on a picture with no name. */
  .meta-col { order: -1; }
  .poster-col { gap: 10px; }
  /* margin-top:auto pins the CTA to the bottom of a full-height column; in a
     stacked column there is no height to push against, so it just adds a gap. */
  .poster-col .entry-row { margin-top: 0; }
  .pack-poster { max-height: 34vh; }
  .detail-top { padding: 16px; }
  .detail-bottom { padding: 12px 16px 16px; }
  #view-library:not(.hidden) { height: auto; }
  .detail-top { flex: 0 0 auto; overflow: visible; }
  .detail-bottom { flex: 0 0 auto; }
  .scene-list { overflow: visible; }
  .meta-col { overflow: visible; }
  .pack-detail-panel { height: auto; }
}

@media (min-width: 760px) {
  .view { padding: 24px 24px 64px; }
  .view-title { font-size: 28px; }
  .stage-wrap { margin: 0 0 12px; }
  .stage { border-radius: var(--radius); }
}

/* ---------- camera ---------- */

/* The camera is a session mode, not a per-take action, so it lives in the
   workflow header. The OFF/ON chip is the readout: an icon that only changes
   colour is not a toggle anyone reads at a glance. */
.wh-camera {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--surface-2); color: var(--dim);
  border-radius: 9px; padding: 6px 10px; font: 600 12px/1 var(--body);
  cursor: pointer; white-space: nowrap; flex: none;
}
.wh-camera svg { display: block; }
.wh-camera-state { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--dim); }
.wh-camera[aria-pressed="true"] { border-color: var(--hot); color: var(--text); }
.wh-camera[aria-pressed="true"] .wh-camera-state { color: var(--hot); }

.cue-media:has(#cue-cam:not(.hidden)) { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#cue-cam { width: 100%; height: 300px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
#cue-cam.mirrored { transform: scaleX(-1); }
@media (max-width: 920px) { #cue-cam { height: 220px; } }

/* The booth-cam card in the screening room: always above the scene, pinned
   to a corner rather than draggable — a phone has no room to move it. */
.cam-card {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  width: 28%; max-width: 260px; aspect-ratio: 4 / 3;
  border-radius: 10px; overflow: hidden;
  background: var(--surface-2); box-shadow: var(--shadow-card);
}
.cam-card video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- export progress ---------- */

.export-progress {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60;
  min-width: 260px; max-width: min(92vw, 460px);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 12px 34px rgba(0,0,0,.4);
}
.export-progress .label { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.export-progress .bar { height: 6px; border-radius: 3px; background: var(--wave-bg); overflow: hidden; }
.export-progress .bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.export-progress .bar.indeterminate > span { width: 30%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* ---------- the scene editor ---------- */

.editor { max-width: 1100px; margin: 0 auto; }
.ed-stage video { width: 100%; max-height: 46vh; background: #000; border-radius: 12px; display: block; }
.ed-strip {
  position: relative; height: 64px; margin: 12px 0 8px;
  background: var(--wave-bg); border: 1px solid var(--surface-2); border-radius: 10px;
  overflow: hidden; cursor: pointer; touch-action: none;
}
.ed-strip canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ed-spans { position: absolute; inset: 0; pointer-events: none; }
.ed-span {
  position: absolute; top: 6px; bottom: 6px;
  background: color-mix(in srgb, var(--hot) 32%, transparent);
  border: 1px solid var(--hot); border-radius: 4px; pointer-events: auto; cursor: pointer;
}
.ed-span.off { opacity: .35; border-style: dashed; }
.ed-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); pointer-events: none; }
.ed-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.ed-toolbar .add-packs-btn { flex: none; }
.ed-lines { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.ed-line {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--surface-2); border-left: 3px solid transparent;
  border-radius: 10px; padding: 10px;
}
.ed-line.active { border-left-color: var(--accent); }
.ed-line.off { opacity: .55; }
.ed-input {
  font: inherit; font-size: 13px; color: var(--text);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--surface-2); border-radius: 8px; padding: 8px 10px; min-width: 0; width: 100%;
}
.ed-who { font-weight: 600; }
.ed-times { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ed-timeset { display: inline-flex; align-items: center; gap: 6px; }
.ed-timeset code { font-family: var(--mono); font-size: 12px; color: var(--dim); min-width: 62px; }
.ed-mini { padding: 5px 9px; font-size: 12px; min-height: 0; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-off { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--dim); }
.ed-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 8px; }
.ed-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--dim); font-weight: 600; }
.ed-field.ed-wide { grid-column: 1 / -1; }
.ed-check { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
@media (max-width: 760px) {
  .ed-line { grid-template-columns: minmax(0, 1fr); }
  .ed-form { grid-template-columns: 1fr; }
}

/* ---------- modals: sign-in, collab, join ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(6px); padding: 16px;
}
.modal-card {
  width: min(520px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: 16px;
  padding: 18px 20px 20px; box-shadow: var(--shadow-card);
}
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-head h2 { font-family: var(--display); font-size: 20px; margin: 0; flex: 1; }
.modal-close { background: none; border: 0; color: var(--dim); font-size: 16px; cursor: pointer; width: var(--tap); height: var(--tap); }
.modal-copy { margin: 0 0 10px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.signin-form { display: grid; gap: 10px; margin-top: 10px; }
.signin-form .search-input { padding: 11px 12px; font-size: 15px; }
.plan-line { margin: 0 0 4px; font-weight: 600; }

/* ---------- the sign-in gate ---------- */
/* The desktop's activate view: a reading column, not a modal. body.locked is
   the desktop's class too — Settings goes, the workflow header goes, and
   showView keeps every other view off screen. */
.activate-wrap { max-width: 440px; margin: 7vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.activate-wrap .view-title { margin-bottom: 4px; }
.activate-lede { margin-top: 0; font-size: 14px; line-height: 1.5; }
.signin-status { min-height: 20px; }
body.locked #btn-settings, body.locked .workflow-header { display: none; }
/* Nothing of the app rides over the gate. The modals, the drop veil and the
   export card are fixed overlays outside the views, so this is where they go. */
body.locked .modal-backdrop, body.locked #drop-veil, body.locked .export-progress { display: none !important; }
/* ---------- the collab panel (the desktop's, mobile-first) ---------- */

/* The house loading indicator: five bars keeping time, drawn rather than
   spun, because a scene is a waveform everywhere else in this app. */
.wave-loader { display: inline-flex; align-items: center; gap: 2px; height: 1em; vertical-align: middle; }
.wave-loader i {
  display: block; width: 2px; height: 100%; border-radius: 1px; background: currentColor;
  transform-origin: center; animation: wave-loader 900ms ease-in-out infinite;
}
.wave-loader i:nth-child(2) { animation-delay: 120ms; }
.wave-loader i:nth-child(3) { animation-delay: 240ms; }
.wave-loader i:nth-child(4) { animation-delay: 360ms; }
.wave-loader i:nth-child(5) { animation-delay: 480ms; }
@keyframes wave-loader { 0%, 100% { transform: scaleY(0.28); opacity: 0.55; } 50% { transform: scaleY(1); opacity: 1; } }

/* The scene-upload meter: amber sent, grey to go; indeterminate while packing. */
.collab-meter { height: 6px; border-radius: 3px; background: var(--wave-bg); overflow: hidden; margin: 8px 0 10px; }
.collab-meter > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.collab-meter.indeterminate > span { width: 30%; animation: slide 1.2s ease-in-out infinite; }

.collab-card { width: min(460px, 100%); }
.collab-card.setup { width: min(620px, 100%); }
.collab-card.session { padding: 0; overflow: hidden; }

/* The session header: full-bleed amber, and the screen's one pulsing element. */
.collab-session-head { display: flex; align-items: center; gap: 12px; background: var(--accent); color: var(--on-accent); padding: 14px 20px; }
.collab-session-title { font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
.collab-session-code {
  margin-left: auto; flex: none; font-family: var(--mono); font-size: 15px; letter-spacing: .12em;
  background: color-mix(in srgb, var(--on-accent) 14%, transparent); border-radius: 6px; padding: 3px 9px;
}
.collab-session-loader { color: var(--hot); flex: none; }
.collab-session-check { display: inline-flex; flex: none; }
.collab-session-check svg { display: block; }
.collab-session-close { color: var(--on-accent); flex: none; }
.collab-session-code.hidden ~ .collab-session-close { margin-left: auto; }
.collab-session-head button:focus-visible { outline-color: var(--on-accent); }
.collab-session-body { padding: 16px 20px 20px; }
.collab-live-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--hot); flex: none; animation: livepulse 1.6s ease-out infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hot) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.collab-public-chip {
  margin-left: auto; margin-right: 8px; flex: none; font: 700 9.5px/1 var(--body); letter-spacing: .09em; text-transform: uppercase;
  color: var(--dim); border: 1px solid var(--surface-2); border-radius: 999px; padding: 4px 8px; white-space: nowrap;
}

/* Setup: the cast column and the room box. */
.collab-setup-grid { display: grid; grid-template-columns: 1fr 210px; gap: 18px; align-items: start; }
.collab-setup-label { font-size: 12px; margin: 0 0 8px; }
.collab-castable { display: flex; flex-direction: column; gap: 6px; }
.collab-castable-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.collab-castable-row.off { background: color-mix(in srgb, var(--surface-2) 45%, transparent); color: var(--dim); }
.collab-castable-row input { flex: none; }
.collab-castable-row .cast-name { font-weight: 600; font-size: 13.5px; }
.collab-castable-row .cast-lines { margin-left: auto; font-size: 12px; color: var(--dim); }
.collab-room-box { border: 1px solid var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.collab-multi-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 0; cursor: pointer; }
.collab-multi-row input { margin-left: auto; flex: none; }
.collab-public-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--surface-2); border-radius: 10px; cursor: pointer; }
.collab-public-row input { transform: scale(1.25); flex: none; }
.collab-public-row > span { font-size: 14px; font-weight: 600; }
.collab-public-row small { display: block; font-weight: 400; font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.collab-setup-actions { margin-top: 14px; align-items: center; }
.collab-setup-actions .primary-btn { margin-left: auto; }
@media (max-width: 560px) { .collab-setup-grid { grid-template-columns: 1fr; } }

/* The room: code row, cast rows, the sync line. */
.collab-code-note { margin: 8px 0 0; font-size: 12.5px; color: var(--dim); }
.collab-code-note.warn { color: var(--hot); }
.collab-room-caption { margin: 0 0 10px; }
.collab-room-hint { margin: 0 0 4px; }
.collab-sync { margin: 10px 0 0; font-size: 12.5px; color: var(--dim); min-height: 1.2em; }
.collab-code-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.collab-code-label { margin: 0; flex: none; }
.collab-code { font-family: var(--mono); font-size: 17px; font-weight: 700; letter-spacing: .12em; padding: 4px 10px; background: var(--surface-2); border-radius: 6px; color: var(--accent); }
.collab-code-row .icon-btn { flex: none; border: 1px solid var(--line); }
.collab-code-row .ghost-btn:disabled { opacity: .4; cursor: default; }
.collab-cast { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.collab-cast li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); flex-wrap: wrap; }
.collab-cast .cast-name { font-weight: 600; }
.collab-cast .cast-lines { color: var(--dim); font-size: 12px; }
.collab-cast .cast-owner { margin-left: auto; color: var(--dim); font-size: 13px; flex: none; }
.collab-cast .cast-owner.mine { color: var(--accent); }
.collab-cast .cast-owner.done { color: var(--accent-text); }
.collab-cast .cast-owner.rec { color: var(--hot); }
.collab-cast .cast-ico { display: inline-flex; align-items: center; color: var(--dim); flex: none; }
.collab-cast .cast-ico svg { display: block; }
.collab-cast .cast-ico.done { color: var(--accent); }
.collab-cast .cast-ico.rec { color: var(--hot); }
.collab-cast .cast-record { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 12px; min-height: 0; white-space: nowrap; }
.collab-cast .cast-record.mine { border-color: var(--accent); }
.collab-cast .cast-record svg { display: block; }
.collab-cast .cast-owner + .cast-record { margin-left: 0; }
.collab-cast li:has(.cast-record) .cast-owner { margin-left: auto; margin-right: 0; }
.collab-cast .cast-lost { flex-basis: 100%; font-size: 11.5px; color: var(--hot); }

/* Session cast rows: a top line plus a full-width progress bar. */
.collab-session-cast li { flex-direction: column; align-items: stretch; gap: 7px; }
.collab-session-cast .cast-top { display: flex; align-items: center; gap: 10px; }
.collab-session-cast .cast-top .cast-owner, .collab-session-cast .cast-top .cast-record { margin-left: auto; }
.collab-session-cast li.locked { opacity: .55; }
.cast-bar { display: block; width: 100%; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--bg) 45%, var(--surface-2)); overflow: hidden; }
.cast-bar-fill { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.cast-bar-fill.hot { background: var(--hot); }
.collab-session-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.collab-session-hint { margin: 0; flex: 1 1 auto; }
.collab-session-foot .ghost-btn { flex: none; }
.collab-end { border-color: color-mix(in srgb, var(--hot) 50%, transparent); color: var(--hot); margin-left: auto; }
.collab-watch { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-top: 12px; }
.collab-watch svg { display: block; }
.collab-session-status { margin-top: 10px; }
.collab-leave { margin-left: auto; }

/* Join: the code row, the public list, your rooms. */
.collab-join-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.collab-join-row input { flex: 1; text-transform: uppercase; letter-spacing: .08em; padding: 11px 12px; font-size: 15px; }
.join-public { margin-top: 16px; border-top: 1px solid var(--surface-2); padding-top: 12px; }
.join-public-head { margin: 0 0 8px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); }
.join-public-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.join-public-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.join-public-list li:hover { background: var(--surface-2); }
.join-public-list li[aria-disabled="true"] { opacity: .5; cursor: default; }
.join-public-thumb { flex: none; width: 56px; height: 34px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.join-public-main { min-width: 0; flex: 1 1 auto; }
.join-public-title { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.join-public-host { display: block; font-size: 12px; color: var(--dim); }
.join-public-cast { display: block; margin-top: 2px; font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.join-public-parts { flex: none; font-size: 12px; color: var(--accent); font-family: var(--mono); }
.join-public-parts.full { color: var(--dim); }
.join-public-live { flex: none; display: inline-flex; align-items: center; gap: 5px; font: 700 9.5px/1 var(--body); letter-spacing: .1em; color: var(--hot); }
.join-live-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--hot); animation: livepulse 1.6s ease-out infinite; }
.join-public-phase { flex: none; font: 700 9.5px/1 var(--body); letter-spacing: .1em; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); color: var(--dim); }

/* The entry segment's hosted-session state — LIVE, and nothing else. */
.entry-row .entry-collab.live { background: var(--hot); color: #fff; }
.entry-live-dot { width: 7px; height: 7px; border-radius: 999px; background: #fff; flex: none; animation: livepulse 1.6s ease-out infinite; }

/* The recording room's session strip: fixed height, single line, so no
   state change here can ever move the cue card. */
.booth-collab-strip {
  display: flex; align-items: center; gap: 10px; min-height: 36px; margin: 0 0 12px; padding: 6px 12px;
  border: 1px solid var(--surface-2); border-radius: 10px; background: var(--surface); text-align: left;
}
.booth-collab-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--dim); }
.booth-collab-strip.warn .booth-collab-text { color: var(--hot); }
.booth-collab-link { flex: none; background: none; border: none; padding: 4px 6px; font: 600 12.5px/1 var(--body); color: var(--accent-text); white-space: nowrap; cursor: pointer; }
.booth-collab-link:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .wave-loader i { animation: none; transform: scaleY(0.6); }
  .collab-live-dot, .entry-live-dot, .join-live-dot { animation: none; }
}
