/* ============================================================
   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: the desk the window sits on --------
   Flat, one step below the app's own base, the way the redesigned app
   sits its page on a desk. No painted sky: the product is the picture. */
.lsdemo {
  position: relative;
  margin: 0;
  padding: 46px 48px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-desk);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  /* The clip's modals and menus stack inside the clip: without this a
     New Draft dialog paints over the site nav and the chapter bar. */
  isolation: isolate;

  /* App tokens the marketing stylesheet doesn't define. Values
     are the app's own (dark theme). */
  --page-text: #d4d4ce;
  --text-tertiary: #636366;
  --control-border: #757571;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --window-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 24px 60px rgba(0, 0, 0, 0.5);
}
html[data-theme="light"] .lsdemo { --page-text: #33332c; --control-border: #8d8d86; --window-shadow: 0 0 0 1px rgba(31, 31, 30, 0.06), 0 24px 60px rgba(31, 31, 30, 0.16); }
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .lsdemo { --page-text: #33332c; --control-border: #8d8d86; --window-shadow: 0 0 0 1px rgba(31, 31, 30, 0.06), 0 24px 60px rgba(31, 31, 30, 0.16); }
}

/* -------- Window shell -------- */
.lsdemo .lsd-window {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-base);
  box-shadow: var(--window-shadow);
}
.lsdemo .lsd-canvas { display: flex; flex-direction: column; height: 308px; position: relative; }
/* The window is the query container: the title bar below adapts to the
   window's width (a container can't restyle itself, so not the bar). */
.lsdemo .lsd-window { container-type: inline-size; }
.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; }
/* Each window is its own stacking context, so the back window's title
   bar (z-index 5 inside it) can never cover the front window. */
.lsdemo .lsd-window.back { top: 0; left: 0; right: 15%; bottom: 58px; z-index: 1; }
.lsdemo .lsd-window.front { right: 0; bottom: 0; width: 62%; z-index: 2; }

/* Companion Mode scene: the writer's own editor in back, the compact
   Lastslate window in front. Narrower front pane than the review scene —
   the real companion window is 420pt wide beside a full editor. */
.lsdemo .lsd-scene.comp { height: 420px; }
.lsdemo .lsd-scene.comp .lsd-window.back { right: 40%; bottom: 20px; }
.lsdemo .lsd-scene.comp .lsd-window.front { width: 56%; top: 30px; bottom: 0; }

/* The companion pane is half a half-column wide — everything inside it
   runs a step smaller than the full-window demos. */
.lsdemo .lsd-scene.comp .chat-msg { font-size: 11.5px; line-height: 1.45; }
.lsdemo .lsd-scene.comp .chat-msg-wrap { max-width: 94%; }
.lsdemo .lsd-scene.comp .chat-input { font-size: 11.5px; }
.lsdemo .lsd-scene.comp .ai-tab-panel { padding: 10px; }
.lsdemo .lsd-scene.comp .chat-messages { gap: 9px; }
.lsdemo .lsd-scene.comp .chat-status { font-size: 10.5px; }

/* The other editor is deliberately generic: a plain monospace file, no
   screenplay layout, nothing that reads as a specific product. */
.lsdemo .lsd-plainwrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-page);
  padding: 16px 20px 10px;
  /* Pinned to the last line, the way an editor sits after you type. */
  display: flex;
  align-items: flex-end;
}
.lsdemo .lsd-plainpage {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--page-text);
  opacity: 0.85;
  white-space: pre-wrap;
}

/* Companion window chrome. */
.lsdemo .lsd-compbar {
  height: 34px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  flex-shrink: 0;
}
.lsdemo .lsd-compmark { width: 14px; height: 14px; flex-shrink: 0; display: block; }
.lsdemo .lsd-compname {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lsdemo .lsd-compstatus {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.lsdemo .lsd-compdot { width: 6px; height: 6px; border-radius: 3px; background: #3fa86a; }

/* REAL COMPONENT: the external-save notice (companion.css ~637). */
.lsdemo .lsd-sysnote {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  font-size: 10.5px;
  color: var(--text-secondary);
  text-align: center;
}
.lsdemo .lsd-sysnote::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: #3fa86a;
}

/* 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: title bar  (app.css .titlebar, develop f5b2d90)
   One 44px bar: traffic lights, project title and draft badge on the
   left, Script / Board / Split centred, Share and the panel toggle on
   the right. Scaled to 40px here so a half-column clip keeps its page.
   ============================================================ */
.lsdemo .titlebar {
  height: 40px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  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; min-width: 0; }
.lsdemo .titlebar-traffic { display: flex; gap: 7px; margin-right: 4px; flex-shrink: 0; }
.lsdemo .titlebar .dot { width: 11px; height: 11px; border-radius: 50%; }
.lsdemo .dot-close { background: #ff5f57; }
.lsdemo .dot-min { background: #ffbd2e; }
.lsdemo .dot-max { background: #28c840; }
.lsdemo .titlebar-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.lsdemo .titlebar-title > span { overflow: hidden; text-overflow: ellipsis; }
.lsdemo .titlebar-project-icon { flex-shrink: 0; color: var(--text-muted); }
.lsdemo .titlebar-center { justify-self: center; }
.lsdemo .titlebar-actions { display: flex; align-items: center; justify-content: flex-end; justify-self: end; gap: 4px; position: relative; }
/* The generic editor in the Companion clip keeps a centred file name. */
.lsdemo .titlebar:not(:has(.titlebar-center)) { display: flex; }
.lsdemo .titlebar:not(:has(.titlebar-center)) .titlebar-title { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 500; }

.lsdemo .view-mode-switch { display: flex; gap: 2px; padding: 2px; margin: 0; border: 0; border-radius: 8px; background: var(--bg-hover); overflow: visible; }
.lsdemo .view-mode-btn { font-size: 11px; font-weight: 500; line-height: 14px; padding: 3px 10px; border: 0; border-radius: 6px; color: var(--text-secondary); background: none; }
.lsdemo .view-mode-btn[aria-pressed="true"] { background: var(--bg-elevated); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border); }

.lsdemo .toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 7px;
  white-space: nowrap;
}
.lsdemo .tb-icon { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--text-muted); }
.lsdemo .tb-icon.is-active { background: var(--accent-bg); color: var(--text-primary); }
.lsdemo .tb-icon .panel-fill { fill: transparent; }
.lsdemo .tb-icon.is-active .panel-fill { fill: currentColor; }

/* Narrower windows drop what the real window would truncate first, and
   become a flex row whose ends never shrink — in the grid the left group
   could collapse and the switch slid over the draft badge. */
@container (max-width: 680px) {
  .lsdemo .titlebar { display: flex; }
  .lsdemo .titlebar-left, .lsdemo .titlebar-actions { flex: 0 0 auto; }
  .lsdemo .titlebar-center { margin: 0 auto; }
  .lsdemo .titlebar .tb-icon, .lsdemo .titlebar .titlebar-project-icon,
  .lsdemo .titlebar .titlebar-title { display: none; }
  .lsdemo .view-mode-btn { padding: 3px 7px; }
}
/* No room for the switch: the draft badge and Share matter more here,
   and the co-writing clip needs the space for its presence pills. */
@container (max-width: 400px) {
  .lsdemo .titlebar-center { display: none; }
  .lsdemo .titlebar-actions { margin-left: auto; }
}
@container (max-width: 480px) {
  .lsdemo .titlebar:has(.presence-stack) .titlebar-center { display: none; }
  .lsdemo .titlebar:has(.presence-stack) .titlebar-actions { margin-left: auto; }
}
@container (max-width: 320px) {
  .lsdemo .titlebar:has(.presence-stack) .toolbar-btn { display: none; }
}
@container (max-width: 260px) {
  .lsdemo .titlebar .toolbar-btn { display: none; }
}

/* REAL COMPONENT: icon rail (app.css .rail) */
.lsdemo .rail {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
}
.lsdemo .rail-mark { width: 20px; height: 20px; margin: 1px 0 8px; }
.lsdemo .rail-flex { flex: 1; }
.lsdemo .rail-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--text-muted); }
.lsdemo .rail-btn.is-active { background: var(--bg-hover); color: var(--text-primary); }

/* REAL COMPONENT: branch badge + dropdown (drafts) */
.lsdemo .branch-wrap { position: relative; }
.lsdemo .branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid transparent;
  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-icon { flex-shrink: 0; color: var(--text-muted); }
.lsdemo .branch-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 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 .editor-statusbar) — one bar
   across the whole window: element type, position and count on the
   left, save state on the right. */
.lsdemo .editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 28px;
  padding: 0 12px 0 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.lsdemo .statusbar-left, .lsdemo .statusbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lsdemo .statusbar-left { overflow: hidden; }
.lsdemo .statusbar-segment { white-space: nowrap; }
.lsdemo .statusbar-separator { color: var(--text-muted); opacity: 0.4; }
.lsdemo .statusbar-segment.status-unsaved { color: var(--text-secondary); }
.lsdemo .statusbar-segment.status-saved { color: var(--text-muted); }
.lsdemo .statusbar-flex { flex: 1; }
.lsdemo .element-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  padding: 3px 5px 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
}
.lsdemo .element-menu-caret { color: var(--text-secondary); }

/* ============================================================
   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; display: inline-flex; }
.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: 12px 14px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.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 { line-height: 0; margin-bottom: 6px; color: var(--text-secondary); }
.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 .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 var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  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) {
  /* Bottom room for the pause control so it never sits on the window. */
  .lsdemo { padding: 22px 16px 50px; 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%; }
  /* The comp rules above are more specific, so they need their own
     narrow-screen answer or the companion pane stays 40% wide. */
  .lsdemo .lsd-scene.comp .lsd-window.back { right: 3%; bottom: 104px; }
  .lsdemo .lsd-scene.comp .lsd-window.front { width: 86%; top: auto; }
  .lsdemo .lsd-plainpage { font-size: 10px; line-height: 1.6; }
  .lsdemo .lsd-plainwrap { padding: 12px 12px 0; }
  .lsdemo .lsd-compname { font-size: 10px; }
  .lsdemo .lsd-compstatus { display: none; }
  .lsdemo .lsd-bar-tag { display: none; }
  .lsdemo .comment-sidebar { width: 52%; }
  .lsdemo .editor-statusbar { padding: 0 8px; font-size: 10px; gap: 6px; }
  .lsdemo .rail { display: none; }
}
