/* ============================================================
   Lastslate — animated demo clips
   Real components, scripted like film clips.

   Every component below is lifted VERBATIM from the Electron
   app's renderer stylesheet (screenplay-app/src/renderer/css/
   app.css) and scoped under .lsdemo: titlebar, branch badge +
   dropdown, screenplay page + element classes, status bar, AI
   pane (tabs, bubbles, chat-status, composer, role pill +
   popover), slash menu, new-draft modal, comment sidebar,
   presence avatars, and y-prosemirror remote cursors.

   Deviations from the app, on purpose:
   - traffic-light dots are visible (macOS draws the real ones)
   - the page uses a scaled inch (--in) so a US-Letter page fits
     a marketing clip; all element indents keep their exact
     inch-based proportions
   - the page's top margin is cropped, film-style

   Pairs with demos.js. Clips loop on screen, pause off screen,
   have a pause control, and freeze to a finished still under
   prefers-reduced-motion.
   ============================================================ */

/* -------- Mat: painterly backdrop the windows sit on -------- */
.lsdemo {
  position: relative;
  margin: 0;
  padding: 46px 48px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  overflow: hidden;
  background-color: #221d18;
  background-size: cover;
  background-position: center;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;

  /* App tokens the marketing stylesheet doesn't define. Values
     are the app's own (dark theme). */
  --page-text: #d4d4ce;
  --bg-page: #1e1e1d;
  --text-tertiary: #636366;
  --control-border: #757571;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
html[data-theme="light"] .lsdemo {
  --page-text: #33332c;
  --bg-page: #faf8f1;
}
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .lsdemo {
    --page-text: #33332c;
    --bg-page: #faf8f1;
  }
}

/* Three backdrops — warm dawn, muted dusk, cool slate. Hand-drawn
   SVG: gradient sky, low glow, blurred hills, film grain. */
.lsdemo.mat-dawn {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 620' preserveAspectRatio='xMidYMid slice'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23463122'/%3E%3Cstop offset='.13' stop-color='%23bd8852'/%3E%3Cstop offset='.3' stop-color='%236b4730'/%3E%3Cstop offset='.62' stop-color='%232c211a'/%3E%3Cstop offset='1' stop-color='%23191410'/%3E%3C/linearGradient%3E%3CradialGradient id='b' cx='.5' cy='.12' r='.6'%3E%3Cstop offset='0' stop-color='%23f0c490' stop-opacity='.55'/%3E%3Cstop offset='1' stop-color='%23f0c490' stop-opacity='0'/%3E%3C/radialGradient%3E%3Cfilter id='c' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeGaussianBlur stdDeviation='14'/%3E%3C/filter%3E%3Cfilter id='d'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='1000' height='620' fill='url(%23a)'/%3E%3Cellipse cx='500' cy='80' rx='620' ry='250' fill='url(%23b)'/%3E%3Cpath d='M0 488 Q180 458 360 478 T700 472 T1000 464 V620 H0Z' fill='%2320170f' opacity='.75' filter='url(%23c)'/%3E%3Cpath d='M0 540 Q240 510 480 528 T1000 522 V620 H0Z' fill='%23120d09' opacity='.9' filter='url(%23c)'/%3E%3Crect width='1000' height='620' filter='url(%23d)'/%3E%3C/svg%3E");
  background-color: #2c211a;
}
.lsdemo.mat-dusk {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 620' preserveAspectRatio='xMidYMid slice'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23402a3a'/%3E%3Cstop offset='.13' stop-color='%23b06f86'/%3E%3Cstop offset='.3' stop-color='%23613b50'/%3E%3Cstop offset='.62' stop-color='%23261c25'/%3E%3Cstop offset='1' stop-color='%23161118'/%3E%3C/linearGradient%3E%3CradialGradient id='b' cx='.5' cy='.12' r='.6'%3E%3Cstop offset='0' stop-color='%23eeb0c2' stop-opacity='.5'/%3E%3Cstop offset='1' stop-color='%23eeb0c2' stop-opacity='0'/%3E%3C/radialGradient%3E%3Cfilter id='c' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeGaussianBlur stdDeviation='14'/%3E%3C/filter%3E%3Cfilter id='d'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='1000' height='620' fill='url(%23a)'/%3E%3Cellipse cx='500' cy='80' rx='620' ry='250' fill='url(%23b)'/%3E%3Cpath d='M0 488 Q180 458 360 478 T700 472 T1000 464 V620 H0Z' fill='%231f1420' opacity='.75' filter='url(%23c)'/%3E%3Cpath d='M0 540 Q240 510 480 528 T1000 522 V620 H0Z' fill='%23120c12' opacity='.9' filter='url(%23c)'/%3E%3Crect width='1000' height='620' filter='url(%23d)'/%3E%3C/svg%3E");
  background-color: #261c25;
}
.lsdemo.mat-slate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 620' preserveAspectRatio='xMidYMid slice'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23293745'/%3E%3Cstop offset='.13' stop-color='%237fa0b6'/%3E%3Cstop offset='.3' stop-color='%23415466'/%3E%3Cstop offset='.62' stop-color='%231d242b'/%3E%3Cstop offset='1' stop-color='%23121519'/%3E%3C/linearGradient%3E%3CradialGradient id='b' cx='.5' cy='.12' r='.6'%3E%3Cstop offset='0' stop-color='%23cfe2ee' stop-opacity='.42'/%3E%3Cstop offset='1' stop-color='%23cfe2ee' stop-opacity='0'/%3E%3C/radialGradient%3E%3Cfilter id='c' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeGaussianBlur stdDeviation='14'/%3E%3C/filter%3E%3Cfilter id='d'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='1000' height='620' fill='url(%23a)'/%3E%3Cellipse cx='500' cy='80' rx='620' ry='250' fill='url(%23b)'/%3E%3Cpath d='M0 488 Q180 458 360 478 T700 472 T1000 464 V620 H0Z' fill='%23141b21' opacity='.75' filter='url(%23c)'/%3E%3Cpath d='M0 540 Q240 510 480 528 T1000 522 V620 H0Z' fill='%230d1115' opacity='.9' filter='url(%23c)'/%3E%3Crect width='1000' height='620' filter='url(%23d)'/%3E%3C/svg%3E");
  background-color: #1d242b;
}

/* -------- Window shell -------- */
.lsdemo .lsd-window {
  border: 1px solid rgba(0, 0, 0, 0.55);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-base);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.12) inset,
    0 28px 70px rgba(0, 0, 0, 0.55);
}
.lsdemo .lsd-canvas { display: flex; flex-direction: column; height: 308px; position: relative; }
.lsdemo.tall .lsd-canvas { height: 386px; }
.lsdemo .lsd-body { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; }

/* Two-window scene (review): editor in back, browser in front. */
.lsdemo .lsd-scene { position: relative; height: 398px; }
.lsdemo .lsd-scene .lsd-window { position: absolute; display: flex; flex-direction: column; }
.lsdemo .lsd-window.back { top: 0; left: 0; right: 15%; bottom: 58px; }
.lsdemo .lsd-window.front { right: 0; bottom: 0; width: 62%; z-index: 2; }

/* Browser chrome for the reviewer window. */
.lsdemo .lsd-browserbar {
  height: 34px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  flex-shrink: 0;
}
.lsdemo .lsd-urlwrap { flex: 1; display: flex; justify-content: center; min-width: 0; }
.lsdemo .lsd-url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  padding: 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lsdemo .lsd-bar-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ============================================================
   REAL COMPONENT: titlebar  (app.css ~1400)
   ============================================================ */
.lsdemo .titlebar {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
  position: relative;
  z-index: 5;
}
.lsdemo .titlebar-left { display: flex; align-items: center; gap: 8px; }
.lsdemo .titlebar-traffic { display: flex; gap: 8px; }
.lsdemo .titlebar .dot { width: 12px; height: 12px; border-radius: 50%; }
.lsdemo .dot-close { background: #ff5f57; }
.lsdemo .dot-min { background: #ffbd2e; }
.lsdemo .dot-max { background: #28c840; }
.lsdemo .titlebar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
}
.lsdemo .titlebar-chev { color: var(--text-secondary); font-size: 9px; }
.lsdemo .titlebar-actions { display: flex; align-items: center; gap: 8px; position: relative; }

/* REAL COMPONENT: branch badge + dropdown (drafts) */
.lsdemo .branch-wrap { position: relative; }
.lsdemo .branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  white-space: nowrap;
}
.lsdemo .branch-badge.flash {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(145, 145, 141, 0.2);
}
.lsdemo .branch-badge-caret { color: var(--text-secondary); font-size: 9px; }
.lsdemo .branch-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 200;
  padding: 4px;
}
.lsdemo .branch-dropdown-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  padding: 6px 10px 4px;
}
.lsdemo .branch-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  transition: background 0.2s;
}
.lsdemo .branch-dropdown-item.is-hover { background: var(--bg-hover); }
.lsdemo .branch-dropdown-check {
  width: 12px;
  display: inline-flex;
  justify-content: center;
  color: var(--accent);
  font-size: 11px;
}
.lsdemo .branch-dropdown-name { flex: 1; white-space: nowrap; }
.lsdemo .branch-dropdown-item.is-current .branch-dropdown-name { font-weight: 600; }
.lsdemo .branch-dropdown-separator { height: 1px; background: var(--border); margin: 4px 0; }
.lsdemo .branch-dropdown-item.new-draft { color: var(--accent); font-weight: 500; }

/* REAL COMPONENT: presence avatars */
.lsdemo .presence-stack { display: inline-flex; align-items: center; margin-right: 8px; }
.lsdemo .presence-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  border: 1.5px solid var(--bg-base);
  margin-left: -6px;
  box-sizing: border-box;
}
.lsdemo .presence-avatar:first-child { margin-left: 0; }

/* ============================================================
   REAL COMPONENT: the page  (app.css ~2039)
   Scaled inch: --in below; the app runs --in: 96px.
   ============================================================ */
.lsdemo .editor-scroll {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 22px 24px 0;
  background: var(--bg-base);
}
.lsdemo .page-container { --in: 58px; position: relative; width: calc(8.5 * var(--in)); margin: 0 auto; }
.lsdemo .screenplay-page {
  --in: 58px;
  position: relative;
  min-height: 320px; /* taller than the crop, so the page reads as a page */
  padding: calc(0.5 * var(--in)) calc(1 * var(--in)) calc(1 * var(--in)) calc(1.5 * var(--in));
  background-color: var(--bg-page);
  font-family: var(--font-script);
  font-size: 12px;
  line-height: 1.5;
  color: var(--page-text);
  caret-color: var(--accent);
}
.lsdemo .screenplay-page > div { margin: 0.9em 0 0; min-height: 1.5em; }
.lsdemo .screenplay-page > div:first-child { margin-top: 0; }
.lsdemo .screenplay-page .scene-heading { font-weight: bold; text-transform: uppercase; }
.lsdemo .screenplay-page .character {
  text-transform: uppercase;
  padding-left: calc(2 * var(--in));
  padding-right: calc(0.25 * var(--in));
}
.lsdemo .screenplay-page .dialogue {
  padding-left: calc(1 * var(--in));
  padding-right: calc(1.5 * var(--in));
}
.lsdemo .screenplay-page .parenthetical {
  padding-left: calc(1.5 * var(--in));
  padding-right: calc(2 * var(--in));
  font-style: italic;
  color: var(--text-secondary);
}
.lsdemo .screenplay-page .transition {
  padding-left: calc(4 * var(--in));
  text-align: right;
  text-transform: uppercase;
}

/* REAL COMPONENT: status bar  (app.css ~2927) */
.lsdemo .editor-statusbar {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 14px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}
.lsdemo .statusbar-segment { white-space: nowrap; }
.lsdemo .statusbar-separator { color: var(--text-muted); opacity: 0.4; }
.lsdemo .statusbar-segment.status-unsaved { color: var(--accent); }
.lsdemo .statusbar-segment.status-saved { color: var(--text-secondary); }
.lsdemo .statusbar-flex { flex: 1; }

/* ============================================================
   REAL COMPONENT: AI pane  (app.css ~5055)
   ============================================================ */
.lsdemo .ai-pane {
  flex: 1;
  min-width: 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
}
.lsdemo .ai-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.lsdemo .ai-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  font-family: var(--font-ui);
  text-align: center;
}
.lsdemo .ai-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.lsdemo .ai-tab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
}
.lsdemo .chat-messages {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* pinned to the latest, like a chat scrolled to bottom */
  gap: 12px;
  margin-bottom: 10px;
}
.lsdemo .chat-msg {
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 8px;
  max-width: 100%;
  word-wrap: break-word;
}
.lsdemo .chat-msg.user {
  background: var(--user-bubble-bg);
  border: 1px solid var(--user-bubble-border);
  color: var(--user-bubble-text);
  align-self: flex-end;
}
.lsdemo .chat-msg.assistant {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.lsdemo .chat-msg.assistant p { margin: 0 0 6px; }
.lsdemo .chat-msg.assistant p:last-child { margin-bottom: 0; }
.lsdemo .chat-msg.assistant ul { margin: 0; padding-left: 18px; }
.lsdemo .chat-msg-wrap { display: flex; flex-direction: column; max-width: 88%; }
.lsdemo .chat-msg-wrap.user { align-self: flex-end; align-items: flex-end; }
.lsdemo .chat-msg-wrap.assistant { align-self: flex-start; align-items: flex-start; }

/* REAL COMPONENT: chat status (the "Reading your script" phases) */
.lsdemo .chat-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--text-muted);
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  align-self: flex-start;
  max-width: 100%;
}
.lsdemo .chat-status-dots { display: inline-flex; align-items: center; gap: 4px; }
.lsdemo .chat-status-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  opacity: 0.4;
  animation: lsd-status-bounce 1.2s infinite ease-in-out;
}
.lsdemo .chat-status-dots span:nth-child(2) { animation-delay: 0.18s; }
.lsdemo .chat-status-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes lsd-status-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-3px); opacity: 1; }
}
.lsdemo .chat-status-label { font-weight: 600; color: var(--text-primary); transition: opacity 0.14s ease; }
.lsdemo .chat-status-hint { color: var(--text-muted); transition: opacity 0.14s ease; }
.lsdemo .chat-status-label.fade,
.lsdemo .chat-status-hint.fade { opacity: 0; }

/* REAL COMPONENT: composer + role pill + popover */
.lsdemo .chat-composer {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  position: relative;
  flex-shrink: 0;
}
.lsdemo .chat-input {
  color: var(--text-primary);
  padding: 4px 4px 6px;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  min-height: 22px;
  position: relative;
}
.lsdemo .chat-input .lsd-ph { color: var(--text-muted); opacity: 0.8; }
.lsdemo .composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  gap: 8px;
}
.lsdemo .role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.lsdemo .role-pill.is-open { color: var(--text-primary); border-color: var(--control-border); }
.lsdemo .role-pill-glyph { font-size: 13px; line-height: 1; }
.lsdemo .role-pill-chev { opacity: 0.7; font-size: 9px; }
.lsdemo .role-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 230px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}
.lsdemo .role-popover-filter {
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 8px 10px;
}
.lsdemo .role-popover-list { padding: 4px 0; }
.lsdemo .role-popover-group {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}
.lsdemo .role-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12.5px;
  padding: 6px 12px;
  transition: background 0.15s ease;
}
.lsdemo .role-popover-item.role-popover-item--highlight {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.lsdemo .role-popover-item-glyph { font-size: 14px; line-height: 1; width: 16px; text-align: center; flex: 0 0 auto; }
.lsdemo .role-popover-item-body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.lsdemo .role-popover-item-name { font-size: 12.5px; line-height: 1.3; }
.lsdemo .role-popover-item-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lsdemo .role-popover-item-check { color: var(--accent); font-size: 12px; margin-left: 6px; flex: 0 0 auto; }

/* REAL COMPONENT: slash menu (skills) */
.lsdemo .slash-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  z-index: 40;
  padding: 5px;
}
.lsdemo .slash-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 9px;
  border-radius: 7px;
  transition: background 0.15s, opacity 0.2s;
}
.lsdemo .slash-item.is-active { background: color-mix(in srgb, var(--accent) 12%, var(--bg-elevated)); }
.lsdemo .slash-item-cmd {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.lsdemo .slash-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lsdemo .slash-add {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding: 7px 9px;
  font-size: 11.5px;
  color: var(--accent);
  border-radius: 7px;
}

/* ============================================================
   REAL COMPONENT: new-draft modal  (settings-modal family)
   ============================================================ */
.lsdemo .settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  backdrop-filter: blur(4px);
}
.lsdemo .settings-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  width: 78%;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.lsdemo .settings-header { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); }
.lsdemo .settings-explainer { font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; margin: 0 0 12px; }
.lsdemo .settings-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.lsdemo .lsd-modal-input {
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 12.5px;
  padding: 7px 10px;
  min-height: 1.45em;
}
.lsdemo .lsd-modal-input .lsd-ph { color: var(--text-muted); opacity: 0.7; }
.lsdemo .settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.lsdemo .btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  transition: all 0.15s ease;
  display: inline-block;
}
.lsdemo .btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.lsdemo .btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border); }
.lsdemo .btn.is-off { opacity: 0.45; }
.lsdemo .btn.pressed { transform: scale(0.96); opacity: 0.8; }

/* ============================================================
   REAL COMPONENT: review comments  (app.css ~8243)
   ============================================================ */
.lsdemo .review-comment-highlight {
  border-radius: 2px;
  background: transparent;
  transition: background 0.45s;
}
.lsdemo .review-comment-highlight.is-on { background: rgba(255, 46, 139, 0.28); }
.lsdemo .comment-sidebar {
  width: 44%;
  min-width: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lsdemo .comment-sidebar-header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lsdemo .comment-sidebar-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.lsdemo .comment-count-badge {
  background: rgba(255, 46, 139, 0.25);
  color: var(--text-primary);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}
.lsdemo .comment-card { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.lsdemo .comment-card.is-active { background: rgba(255, 46, 139, 0.08); }
.lsdemo .comment-card-quote {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-base);
  border-left: 2px solid rgba(255, 46, 139, 0.5);
  border-radius: 0 4px 4px 0;
  padding: 3px 8px;
  margin-bottom: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lsdemo .comment-card-author { font-size: 11px; font-weight: 600; color: var(--text-primary); }
.lsdemo .comment-card-body { font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; margin-top: 4px; }
.lsdemo .comment-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-tertiary);
}
.lsdemo .comment-replies { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.lsdemo .comment-reply-item { padding: 4px 0 4px 10px; border-left: 2px solid var(--border); margin-left: 4px; }
.lsdemo .comment-reply-author { font-size: 10.5px; font-weight: 600; color: var(--text-primary); }
.lsdemo .comment-reply-body { font-size: 11px; color: var(--text-secondary); line-height: 1.45; margin-top: 2px; }

/* The reviewer's browser page: the script on a light page, the way
   the share link renders it. */
.lsdemo .lsd-reviewpage {
  background: #faf8f1;
  color: #33332c;
  padding: 16px 22px;
  font-family: var(--font-script);
  font-size: 11.5px;
  line-height: 1.6;
  overflow: hidden;
}
.lsdemo .lsd-reviewpage .scene-heading { font-weight: bold; text-transform: uppercase; }
.lsdemo .lsd-reviewpage > p { margin: 0 0 8px; }
.lsdemo .lsd-reviewpage mark.lsd-mark {
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  background-color: transparent;
  background-image: linear-gradient(rgba(255, 46, 139, 0.30), rgba(255, 46, 139, 0.30));
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size 0.65s var(--ease-out, ease);
}
.lsdemo .lsd-reviewpage mark.lsd-mark.is-on { background-size: 100% 100%; }
.lsdemo .lsd-webcard {
  margin-top: 12px;
  background: #fff;
  border: 1px solid #e6e3dd;
  border-left: 3px solid #ff2e8b;
  border-radius: 8px;
  padding: 9px 11px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  font-family: var(--font-ui);
}
.lsdemo .lsd-webcard-author { font-size: 11.5px; font-weight: 600; color: #1a1a19; }
.lsdemo .lsd-webcard-body { font-size: 11.5px; color: #3c4043; margin-top: 2px; line-height: 1.45; min-height: 2.9em; }
.lsdemo .lsd-webcard-foot { margin-top: 7px; font-size: 10.5px; color: #8a8a84; }
.lsdemo .lsd-webcard .lsd-post {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 6px;
  background: #1f1f1e;
  color: #fafaf7;
  font-size: 11px;
  font-weight: 500;
  transition: transform 0.1s, opacity 0.2s;
}
.lsdemo .lsd-webcard .lsd-post.pressed { transform: scale(0.96); opacity: 0.75; }

/* REAL COMPONENT: scenes sidebar  (app.css ~1880) */
.lsdemo .sidebar {
  width: 200px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.lsdemo .sidebar-header {
  padding: 14px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.lsdemo .act-header {
  padding: 14px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.lsdemo .scene-item {
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 2px solid transparent;
}
.lsdemo .scene-item.active {
  background: var(--bg-selected);
  border-left-color: var(--accent);
  color: var(--text-primary);
}
.lsdemo .scene-number {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  min-width: 22px;
}
.lsdemo .scene-item.active .scene-number { color: var(--text-primary); }
.lsdemo .scene-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* REAL COMPONENT: chat empty state  (app.css ~5100) */
.lsdemo .chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 12px 8px;
  gap: 8px;
  color: var(--text-muted);
}
.lsdemo .chat-empty-glyph { font-size: 30px; line-height: 1; margin-bottom: 4px; }
.lsdemo .chat-empty-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.lsdemo .chat-empty-body { font-size: 12px; line-height: 1.5; max-width: 240px; margin: 2px 0 10px; }
.lsdemo .chat-empty-body-emphasis { font-weight: 600; color: var(--text-secondary); }
.lsdemo .chat-empty-prompts-label { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.lsdemo .chat-empty-prompts { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 230px; }
.lsdemo .chat-empty-prompt {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-family: var(--font-ui);
  font-size: 12px;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.lsdemo .chat-empty-prompt.sel {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated));
  border-color: var(--accent);
}

/* Hero clip — the full three-pane app, replacing the hero video. */
.lsdemo.heroclip { margin-top: 56px; padding: 56px; }
.lsdemo.heroclip .lsd-canvas { height: 560px; }
.lsdemo.heroclip .ai-pane { width: 290px; flex: none; border-left: 1px solid var(--border); }
.lsdemo .lsd-edcol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lsdemo .lsd-edcol .editor-scroll { flex: 1; min-height: 0; }
@media (max-width: 980px) {
  .lsdemo.heroclip { padding: 30px; }
  .lsdemo.heroclip .sidebar { display: none; }
}
@media (max-width: 640px) {
  .lsdemo.heroclip { padding: 18px 14px; margin-top: 40px; }
  .lsdemo.heroclip .ai-pane { display: none; }
  .lsdemo.heroclip .lsd-canvas { height: 420px; }
}

/* REAL COMPONENT: remote cursor (y-prosemirror awareness) */
.lsdemo .ProseMirror-yjs-cursor {
  position: relative;
  margin-left: -1px;
  margin-right: -1px;
  border-left: 1px solid;
  border-right: 1px solid;
  border-color: inherit;
  word-break: normal;
}
.lsdemo .ProseMirror-yjs-cursor > div {
  position: absolute;
  top: -1.35em;
  left: -1px;
  font-size: 10px;
  font-family: var(--font-ui);
  font-style: normal;
  font-weight: 600;
  line-height: normal;
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px 4px 4px 0;
  white-space: nowrap;
  z-index: 20;
}

/* ============================================================
   REAL COMPONENT: Beat Board  (app.css ~9076–9868)
   ============================================================ */
.lsdemo {
  --beat-stone: #91918d;
  --beat-terracotta: #c27b66;
  --beat-ochre: #c2a05a;
  --beat-moss: #8fa371;
  --beat-teal: #6fa3a0;
  --beat-slate: #7c90ad;
  --beat-plum: #a282a8;
  --beat-rose: #b5838f;
}
html[data-theme="light"] .lsdemo {
  --beat-stone: #757571;
  --beat-terracotta: #a65a45;
  --beat-ochre: #8f7335;
  --beat-moss: #6b7f4e;
  --beat-teal: #44807c;
  --beat-slate: #5a6e8c;
  --beat-plum: #7e5b85;
  --beat-rose: #91606e;
}
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .lsdemo {
    --beat-stone: #757571;
    --beat-terracotta: #a65a45;
    --beat-ochre: #8f7335;
    --beat-moss: #6b7f4e;
    --beat-teal: #44807c;
    --beat-slate: #5a6e8c;
    --beat-plum: #7e5b85;
    --beat-rose: #91606e;
  }
}

.lsdemo .board-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-base); font-family: var(--font-ui); }
.lsdemo .board-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lsdemo .view-mode-switch { display: flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; margin-right: 8px; flex-shrink: 0; }
.lsdemo .view-mode-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 4px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
}
.lsdemo .view-mode-btn + .view-mode-btn { border-left: 1px solid var(--border); }
.lsdemo .view-mode-btn[aria-pressed="true"] { background: var(--accent-bg); color: var(--text-primary); }
.lsdemo .board-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--bg-base);
  background-image: radial-gradient(var(--border-soft) 1px, transparent 1px);
  background-size: 24px 24px;
}
.lsdemo .board-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

.lsdemo .board-card {
  position: absolute;
  width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px 9px 15px;
  box-sizing: border-box;
}
.lsdemo .board-card.selected { outline: 2px solid var(--accent-border); outline-offset: 2px; }
.lsdemo .board-card-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 8px 0 0 8px; }
.lsdemo .board-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; margin-bottom: 3px; overflow-wrap: anywhere; }
.lsdemo .board-card-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.lsdemo .board-card-body p { margin: 0 0 4px; }
.lsdemo .board-card-body p:last-child { margin-bottom: 0; }
.lsdemo .board-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.lsdemo .board-scene-chip {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lsdemo .board-card-conncount { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.lsdemo .board-port {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--control-border);
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 5;
  box-sizing: border-box;
}
.lsdemo .board-card.selected .board-port { opacity: 1; }
.lsdemo .board-port.port-top { top: -5px; left: 50%; transform: translateX(-50%); }
.lsdemo .board-port.port-bottom { bottom: -5px; left: 50%; transform: translateX(-50%); }
.lsdemo .board-port.port-left { left: -5px; top: 50%; transform: translateY(-50%); }
.lsdemo .board-port.port-right { right: -5px; top: 50%; transform: translateY(-50%); }

/* In-place editing (no modals) */
.lsdemo .board-card-title-input,
.lsdemo .board-card-body-input {
  font-family: var(--font-ui);
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--control-border);
  border-radius: 5px;
  color: var(--text-primary);
  padding: 3px 6px;
  box-sizing: border-box;
}
.lsdemo .board-card-title-input { font-size: 13px; font-weight: 600; }
.lsdemo .board-card-body-input { font-size: 12px; line-height: 1.45; min-height: 50px; margin-top: 4px; }
.lsdemo .board-card-body-input .lsd-ph,
.lsdemo .board-card-title-input .lsd-ph { color: var(--text-muted); opacity: 0.7; font-weight: 400; }
.lsdemo .board-card-edit-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Connections */
.lsdemo .board-conns { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.lsdemo .board-conn { fill: none; stroke-width: 1.5px; }
.lsdemo .board-conn.lsd-path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.65s var(--ease-out, ease); }
.lsdemo .board-conn.lsd-path.is-on { stroke-dashoffset: 0; }
.lsdemo .board-conn-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 8px;
  white-space: nowrap;
}
.lsdemo .board-conn-label.lsd-h { transform: translate(-50%, -50%) translateY(5px); }
.lsdemo .board-conn-label.lsd-h.is-on { transform: translate(-50%, -50%); }

/* Image strip on a beat (real: .board-card-media, full-bleed top, max 120px) */
.lsdemo .board-card-media {
  margin: -9px -11px 8px -15px;
  border-radius: 7px 7px 0 0;
  overflow: hidden;
  background: var(--bg-hover);
}
.lsdemo .board-card-media img { display: block; width: 100%; max-height: 120px; object-fit: cover; }
.lsdemo .board-card-media.lsd-media { max-height: 0; transition: max-height 0.45s var(--ease-out, ease); }
.lsdemo .board-card-media.lsd-media.is-on { max-height: 120px; }
/* Drop-in ghost: the image flying onto the card */
.lsdemo .lsd-dropghost {
  position: absolute;
  width: 96px;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 40;
  opacity: 0;
  transform: translate(150px, -120px) scale(0.92) rotate(4deg);
  transition: transform 0.55s var(--ease-out, ease), opacity 0.3s;
  pointer-events: none;
}
.lsdemo .lsd-dropghost.is-on { opacity: 0.95; transform: none; }
.lsdemo .board-card.drop-target { outline: 2px dashed var(--accent-border); outline-offset: 2px; }

.lsdemo .board-zoom-chip {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 9px;
  z-index: 25;
}

/* -------- Pause / play control (WCAG 2.2.2) -------- */
.lsdemo .lsd-ctl {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 18, 16, 0.55);
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  opacity: 0.65;
  transition: opacity 0.15s;
  cursor: pointer;
  z-index: 10;
}
.lsdemo .lsd-ctl:hover, .lsdemo .lsd-ctl:focus-visible { opacity: 1; }
.lsdemo .lsd-ctl svg { display: block; }
.lsdemo .lsd-ctl .i-play { display: none; }
.lsdemo .lsd-ctl[aria-pressed="true"] .i-pause { display: none; }
.lsdemo .lsd-ctl[aria-pressed="true"] .i-play { display: block; }

/* -------- Animation utilities (demos.js) -------- */
.lsdemo .lsd-h {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.35s var(--ease-out, ease), transform 0.35s var(--ease-out, ease);
}
.lsdemo .lsd-h.is-on { opacity: 1; transform: none; }
.lsdemo .lsd-pop { transform: none; } /* menus pop, they don't slide */
.lsdemo .lsd-gone { display: none !important; }
.lsdemo .lsd-typing::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 1px;
  background: var(--accent);
  vertical-align: -0.15em;
  animation: lsd-blink 1s steps(2, start) infinite;
}
@keyframes lsd-blink { 50% { opacity: 0; } }
.lsdemo .lsd-swap { display: grid; }
.lsdemo .lsd-swap > span { grid-area: 1 / 1; transition: opacity 0.45s var(--ease-out, ease); }
.lsdemo .lsd-swap > .alt2 { opacity: 0; }
.lsdemo .lsd-swap.alt > .alt1 { opacity: 0; }
.lsdemo .lsd-swap.alt > .alt2 { opacity: 1; }

/* -------- Reduced motion: land on the finished frame -------- */
@media (prefers-reduced-motion: reduce) {
  .lsdemo .lsd-h, .lsdemo .lsd-swap > span, .lsdemo .lsd-reviewpage mark.lsd-mark,
  .lsdemo .review-comment-highlight, .lsdemo .slash-item, .lsdemo .branch-dropdown-item,
  .lsdemo .role-popover-item, .lsdemo .branch-badge, .lsdemo .btn { transition: none !important; }
  .lsdemo .lsd-typing::after, .lsdemo .chat-status-dots span { animation: none !important; }
}

/* -------- Small screens -------- */
@media (max-width: 640px) {
  .lsdemo { padding: 22px 16px; border-radius: 13px; }
  .lsdemo .lsd-canvas { height: 290px; }
  .lsdemo.tall .lsd-canvas { height: 360px; }
  .lsdemo .page-container, .lsdemo .screenplay-page { --in: 42px; }
  .lsdemo .screenplay-page { font-size: 10.5px; }
  .lsdemo .editor-scroll { padding: 14px 10px 0; }
  .lsdemo .lsd-scene { height: 380px; }
  .lsdemo .lsd-window.back { right: 3%; bottom: 80px; }
  .lsdemo .lsd-window.front { width: 84%; }
  .lsdemo .lsd-bar-tag { display: none; }
  .lsdemo .titlebar-title { display: none; }
  .lsdemo .comment-sidebar { width: 52%; }
  .lsdemo .editor-statusbar { padding: 0 10px; font-size: 10px; gap: 6px; }
}
