/* The two fonts, served from this site (public/fonts; SIL Open Font
   License, see LICENSES.md) rather than Google Fonts since 2026-10-16: the
   offline worker handing back Google's files made Safari's Dock app draw
   each font with the other's file. Latin only (as the PDF is); other
   letters fall back to the next font in --ui / --script. Inter is one
   variable file for every weight. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-variable.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/courier-prime-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Courier Prime"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/courier-prime-400-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/courier-prime-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root, [data-theme-preview="light"] {
  --bg: #e8ecf4;
  --surface: #ffffff;
  --paper: #ffffff;
  --ink: #16181d;
  --ink-soft: #5b6270;
  --ink-faint: #a3a9b4;
  --line: #dde1e7;
  --hover: #f2f4f7;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --sidebar: #f6f7fb;
  --accent-soft: #e6ebff;
  --accent-text: #2f49c2;
  --hit: #f59f00;        /* search hits: drawn on page thumbnails */
  --hit-soft: #ffe8a3;   /* and behind matched text */
  --note: #7048e8;       /* notes (notes.js): pins, the open note */
  --note-soft: rgb(112 72 232 / 0.12); /* and behind noted text */
  --ok: #2b9a47;
  --warn: #d9820b;
  --danger: #d23c3c;
  --focus-mark: #3b5bdb;
  --shadow: 0 1px 2px rgb(20 24 31 / 0.06), 0 8px 24px rgb(20 24 31 / 0.06);
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --script: "Courier Prime", "Courier New", Courier, monospace;
  color-scheme: light;
  /* The script's font size and the page grid it gives (paginate.js
     pageGrid), set by app.js for the open script; these are 12pt's.
     Positions are in characters: where each part starts and how wide it is. */
  --script-size: 12pt;
  --script-scale: 1;
  --script-line: var(--script-size);
  --cols: 60;
  /* The paper (US Letter unless the script is on A4): the right margin is
     what's left beside the 1.5in left margin and 6in column, the page body
     the paper less 1in at the top and the foot. */
  --paper-width: 8.5in; --paper-height: 11in; --page-body: 9in; --margin-right: 1in;
  --character-at: 22; --character-width: 30;
  --parenthetical-at: 16; --parenthetical-width: 20;
  --dialogue-at: 10; --dialogue-width: 35;
  --dual-cols: 29; --dual-gap: 2;
  --dual-character-at: 8; --dual-character-width: 20;
  --dual-parenthetical-at: 3; --dual-parenthetical-width: 22;
  --dual-dialogue-width: 28;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1218;
    --surface: #1a1d23;
    --paper: #1e2128;
    --ink: #e7e9ee;
    --ink-soft: #a0a7b4;
    --ink-faint: #5d6472;
    --line: #2c3039;
    --hover: #252932;
    --accent: #7c95f5;
    --accent-ink: #10131a;
    --sidebar: #161a21;
    --accent-soft: rgb(124 149 245 / 0.16);
    --accent-text: #a3b4ff;
    --hit: #ffd43b;
    --hit-soft: rgb(255 212 59 / 0.28);
    --note: #a48bff;
    --note-soft: rgb(164 139 255 / 0.2);
    --ok: #4cc76a;
    --warn: #f2b33d;
    --danger: #f26b6b;
    --focus-mark: #7c95f5;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"], [data-theme-preview="dark"] {
  --bg: #0f1218;
  --surface: #1a1d23;
  --paper: #1e2128;
  --ink: #e7e9ee;
  --ink-soft: #a0a7b4;
  --ink-faint: #5d6472;
  --line: #2c3039;
  --hover: #252932;
  --accent: #7c95f5;
  --accent-ink: #10131a;
  --sidebar: #161a21;
  --accent-soft: rgb(124 149 245 / 0.16);
  --accent-text: #a3b4ff;
  --hit: #ffd43b;
  --hit-soft: rgb(255 212 59 / 0.28);
  --note: #a48bff;
  --note-soft: rgb(164 139 255 / 0.2);
  --ok: #4cc76a;
  --warn: #f2b33d;
  --danger: #f26b6b;
  --focus-mark: #7c95f5;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

/* More themes (account menu › View › More themes). Each sets every token
   above; app.js THEMES has their top-bar colours for the browser's bar. */

/* Warm: parchment paper, brown ink, a sienna accent. */
:root[data-theme="warm"], [data-theme-preview="warm"] {
  --bg: #e9dfca;
  --surface: #faf5ea;
  --paper: #fbf3e1;
  --ink: #2b2218;
  --ink-soft: #6b5c49;
  --ink-faint: #a8987f;
  --line: #ddd0b6;
  --hover: #f1e7d3;
  --accent: #9c4f2a;
  --accent-ink: #ffffff;
  --sidebar: #f4ebd8;
  --accent-soft: #f2dfcd;
  --accent-text: #86401f;
  --hit: #d98e04;
  --hit-soft: #f6d98f;
  --note: #7d4fa8;
  --note-soft: rgb(125 79 168 / 0.14);
  --ok: #4f8a3a;
  --warn: #c4790a;
  --danger: #b83a2a;
  --focus-mark: #9c4f2a;
  --shadow: 0 1px 2px rgb(60 40 15 / 0.08), 0 8px 24px rgb(60 40 15 / 0.08);
  color-scheme: light;
}

/* Cool: blue-grey paper and a teal accent. */
:root[data-theme="cool"], [data-theme-preview="cool"] {
  --bg: #dfe8ef;
  --surface: #f7fafc;
  --paper: #f8fbfd;
  --ink: #142029;
  --ink-soft: #4d6070;
  --ink-faint: #97a7b4;
  --line: #d0dbe4;
  --hover: #eaf0f5;
  --accent: #1a7590;
  --accent-ink: #ffffff;
  --sidebar: #edf3f7;
  --accent-soft: #d9ebf1;
  --accent-text: #125f76;
  --hit: #f08c00;
  --hit-soft: #ffe2a3;
  --note: #5f4bd8;
  --note-soft: rgb(95 75 216 / 0.12);
  --ok: #2b8a5e;
  --warn: #c97a0b;
  --danger: #c9384a;
  --focus-mark: #1a7590;
  --shadow: 0 1px 2px rgb(15 35 55 / 0.07), 0 8px 24px rgb(15 35 55 / 0.07);
  color-scheme: light;
}

/* Light contrast: black on white, firm lines, a deep red accent. */
:root[data-theme="light-contrast"], [data-theme-preview="light-contrast"] {
  --bg: #e4e4e4;
  --surface: #ffffff;
  --paper: #ffffff;
  --ink: #000000;
  --ink-soft: #2b2b2b;
  --ink-faint: #666666;
  --line: #8c8c8c;
  --hover: #ebebeb;
  --accent: #a3141a;
  --accent-ink: #ffffff;
  --sidebar: #f7f7f7;
  --accent-soft: #f7dada;
  --accent-text: #8e0f14;
  --hit: #e67700;
  --hit-soft: #ffd43b;
  --note: #5b36c2;
  --note-soft: rgb(91 54 194 / 0.16);
  --ok: #1d7a33;
  --warn: #a35b00;
  --danger: #c00000;
  --focus-mark: #a3141a;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 8px 24px rgb(0 0 0 / 0.12);
  color-scheme: light;
}

/* Console: a dark screen with soft green type; the green is kept
   muted so long sessions stay easy on the eyes. */
:root[data-theme="console"], [data-theme-preview="console"] {
  --bg: #090d0a;
  --surface: #101611;
  --paper: #0e140f;
  --ink: #b5d6bb;
  --ink-soft: #7c9a83;
  --ink-faint: #4a5e4f;
  --line: #1e2a21;
  --hover: #17211a;
  --accent: #5bbd76;
  --accent-ink: #07100a;
  --sidebar: #0c120d;
  --accent-soft: rgb(91 189 118 / 0.14);
  --accent-text: #8cd9a1;
  --hit: #d9bd57;
  --hit-soft: rgb(217 189 87 / 0.25);
  --note: #3b8ea6;
  --note-soft: rgb(59 142 166 / 0.22);
  --ok: #5bbd76;
  --warn: #d9a845;
  --danger: #e0695c;
  --focus-mark: #5bbd76;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

/* Dark contrast: white on black, firm lines, a strong red accent. */
:root[data-theme="dark-contrast"], [data-theme-preview="dark-contrast"] {
  --bg: #000000;
  --surface: #0a0a0a;
  --paper: #111111;
  --ink: #ffffff;
  --ink-soft: #c8c8c8;
  --ink-faint: #808080;
  --line: #3d3d3d;
  --hover: #1d1d1d;
  --accent: #d0202b;
  --accent-ink: #ffffff;
  --sidebar: #050505;
  --accent-soft: rgb(224 49 49 / 0.24);
  --accent-text: #ff6b6b;
  --hit: #ffd400;
  --hit-soft: rgb(255 212 0 / 0.35);
  --note: #9b4dff;
  --note-soft: rgb(155 77 255 / 0.28);
  --ok: #40c057;
  --warn: #fab005;
  --danger: #ff4d4d;
  --focus-mark: #ff3b3b;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.5), 0 8px 24px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

/* Sepia: an old paperback, browner and dimmer than Warm. */
:root[data-theme="sepia"], [data-theme-preview="sepia"] {
  --bg: #e0cfb2;
  --surface: #f3e7d2;
  --paper: #f4e6cc;
  --ink: #3b2a1a;
  --ink-soft: #6e573e;
  --ink-faint: #a68d6d;
  --line: #d6c19f;
  --hover: #ebdcc1;
  --accent: #8b5a2b;
  --accent-ink: #ffffff;
  --sidebar: #eee0c6;
  --accent-soft: #e8d3b8;
  --accent-text: #74481f;
  --hit: #c98a0b;
  --hit-soft: #eed087;
  --note: #8a4a8a;
  --note-soft: rgb(138 74 138 / 0.14);
  --ok: #5a7d2e;
  --warn: #b8730a;
  --danger: #a83a2a;
  --focus-mark: #8b5a2b;
  --shadow: 0 1px 2px rgb(60 40 15 / 0.1), 0 8px 24px rgb(60 40 15 / 0.1);
  color-scheme: light;
}

/* Solarized light: Ethan Schoonover's low-glare cream and its accents. */
:root[data-theme="solarized-light"], [data-theme-preview="solarized-light"] {
  --bg: #eee8d5;
  --surface: #fdf6e3;
  --paper: #fdf6e3;
  --ink: #073642;
  --ink-soft: #586e75;
  --ink-faint: #93a1a1;
  --line: #e0d9c3;
  --hover: #f3ecd8;
  --accent: #268bd2;
  --accent-ink: #fdf6e3;
  --sidebar: #f6efdb;
  --accent-soft: rgb(38 139 210 / 0.14);
  --accent-text: #1f6fa8;
  --hit: #b58900;
  --hit-soft: rgb(181 137 0 / 0.25);
  --note: #6c71c4;
  --note-soft: rgb(108 113 196 / 0.15);
  --ok: #859900;
  --warn: #cb4b16;
  --danger: #dc322f;
  --focus-mark: #268bd2;
  --shadow: 0 1px 2px rgb(0 43 54 / 0.08), 0 8px 24px rgb(0 43 54 / 0.08);
  color-scheme: light;
}

/* Typewriter: off-white paper, near-black type, next to no colour. */
:root[data-theme="typewriter"], [data-theme-preview="typewriter"] {
  --bg: #e9e9e6;
  --surface: #fbfbf9;
  --paper: #fdfdfb;
  --ink: #1a1a1a;
  --ink-soft: #595959;
  --ink-faint: #a3a3a0;
  --line: #dadad6;
  --hover: #f0f0ed;
  --accent: #2b2b2b;
  --accent-ink: #ffffff;
  --sidebar: #f5f5f2;
  --accent-soft: #e4e4e0;
  --accent-text: #1a1a1a;
  --hit: #e0a800;
  --hit-soft: #fbe7a1;
  --note: #555555;
  --note-soft: rgb(0 0 0 / 0.08);
  --ok: #3d7a3d;
  --warn: #a86b00;
  --danger: #b02a2a;
  --focus-mark: #2b2b2b;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.06);
  color-scheme: light;
}

/* Solarized dark: the same accents on deep teal. */
:root[data-theme="solarized-dark"], [data-theme-preview="solarized-dark"] {
  --bg: #001f27;
  --surface: #002b36;
  --paper: #002b36;
  --ink: #93a1a1;
  --ink-soft: #758a8f;
  --ink-faint: #4f666c;
  --line: #0a3d4a;
  --hover: #073642;
  --accent: #268bd2;
  --accent-ink: #fdf6e3;
  --sidebar: #00252f;
  --accent-soft: rgb(38 139 210 / 0.2);
  --accent-text: #5aa9e6;
  --hit: #b58900;
  --hit-soft: rgb(181 137 0 / 0.3);
  --note: #6c71c4;
  --note-soft: rgb(108 113 196 / 0.25);
  --ok: #859900;
  --warn: #cb4b16;
  --danger: #dc322f;
  --focus-mark: #268bd2;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 8px 24px rgb(0 0 0 / 0.3);
  color-scheme: dark;
}

/* Midnight: deep navy and soft blue-white, gentler than grey-black. */
:root[data-theme="midnight"], [data-theme-preview="midnight"] {
  --bg: #070b1a;
  --surface: #0d1428;
  --paper: #111a33;
  --ink: #dbe4ff;
  --ink-soft: #8f9bc2;
  --ink-faint: #4f5a80;
  --line: #1e2846;
  --hover: #18213d;
  --accent: #6d8cff;
  --accent-ink: #070b1a;
  --sidebar: #0a1022;
  --accent-soft: rgb(109 140 255 / 0.18);
  --accent-text: #a5b8ff;
  --hit: #ffd166;
  --hit-soft: rgb(255 209 102 / 0.28);
  --note: #7a5af0;
  --note-soft: rgb(122 90 240 / 0.25);
  --ok: #4fd1a5;
  --warn: #f2b33d;
  --danger: #ff6b81;
  --focus-mark: #6d8cff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

/* Nordic: frosty blue-grey night with ice-blue accents. */
:root[data-theme="nordic"], [data-theme-preview="nordic"] {
  --bg: #242933;
  --surface: #2e3440;
  --paper: #353c4a;
  --ink: #eceff4;
  --ink-soft: #aeb7c7;
  --ink-faint: #6b7589;
  --line: #434c5e;
  --hover: #3b4252;
  --accent: #88c0d0;
  --accent-ink: #242933;
  --sidebar: #2a303b;
  --accent-soft: rgb(136 192 208 / 0.18);
  --accent-text: #8fbcbb;
  --hit: #ebcb8b;
  --hit-soft: rgb(235 203 139 / 0.3);
  --note: #5e81ac;
  --note-soft: rgb(129 161 193 / 0.25);
  --ok: #a3be8c;
  --warn: #d08770;
  --danger: #bf616a;
  --focus-mark: #88c0d0;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

/* Dusk: dark plum with rose and gold. */
:root[data-theme="dusk"], [data-theme-preview="dusk"] {
  --bg: #191320;
  --surface: #221a2b;
  --paper: #261d30;
  --ink: #f0e2ea;
  --ink-soft: #b49cb0;
  --ink-faint: #6e5a6e;
  --line: #3a2c40;
  --hover: #2e2337;
  --accent: #eb6f92;
  --accent-ink: #191320;
  --sidebar: #1e1726;
  --accent-soft: rgb(235 111 146 / 0.18);
  --accent-text: #f5a3b9;
  --hit: #f6c177;
  --hit-soft: rgb(246 193 119 / 0.28);
  --note: #9c6fd6;
  --note-soft: rgb(156 111 214 / 0.25);
  --ok: #8ccf9e;
  --warn: #f6c177;
  --danger: #ff6b7a;
  --focus-mark: #eb6f92;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 var(--ui);
  display: flex;
  flex-direction: column;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* ---- top bar ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Left: Script Library, undo / redo, the title. The gap pushes the rest right:
   the script as a file (history, settings, export), a rule, then people
   (faces, Share, account). */
.title-wrap { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar__gap { flex: 1; }
.topbar__rule { align-self: stretch; width: 1px; margin: 4px 4px; background: var(--line); }
.title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* An episode's series over its title (app.js showEpisode): the series opens
   it in the Script Library, the arrows go to the episodes either side. */
.series-line { display: flex; align-items: center; gap: 2px; min-width: 0; padding: 0 8px; font-size: 11px; line-height: 16px; color: var(--ink-soft); }
.series-line[hidden] { display: none; }
.series-line__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; padding: 0 4px 0 0; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
.series-line__name:hover { text-decoration: underline; }
.series-line__step { flex: none; display: inline-grid; place-items: center; width: 18px; height: 16px; border: 0; border-radius: 4px; background: none; color: var(--ink-soft); cursor: pointer; padding: 0; }
.series-line__step:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.series-line__step:disabled { opacity: 0.35; cursor: default; }
.series-line__number { flex: none; font-variant-numeric: tabular-nums; }
/* A script opened to read only (a viewer, or a link opened signed out). */
.access { flex: none; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 2px 6px; }
.access[hidden] { display: none; }
.access--draft { color: var(--accent-ink); background: var(--accent); max-width: 18em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access { margin-left: 9px; }
/* Beside a draft's chip, for its readers (drafts.js DraftChangesDialog). */
.draft-changes-button { flex: none; margin-left: 6px; border: 0; background: none; padding: 0; font: 600 12px/1.4 var(--ui); color: var(--accent-text); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.draft-changes-button[hidden] { display: none; }
.draft-note__state.is-same { color: var(--ink-soft); }
#draft-changes-dialog .drafts__review { flex: 1; min-height: 0; }
.drafts__notes[hidden] { display: none; }
.access:not([hidden]) + .status { padding-left: 0; }
/* Scene numbers locked for production (app.js showProduction): the access
   chip's look, as a button that opens Production. */
.locked-chip { display: inline-flex; align-items: center; gap: 4px; border: 0; font-family: var(--ui); line-height: 1.4; cursor: pointer; white-space: nowrap; }
.locked-chip:hover { background: var(--accent); color: var(--accent-ink); }
.locked-chip[hidden] { display: none; }
.locked-chip svg { flex: none; }
/* After a revision: its colour beside its name ("Blue revision"). */
.locked-chip__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 35%, transparent); }
.locked-chip__dot[hidden] { display: none; }
@media (max-width: 600px) {
  .locked-chip__label { display: none; } /* the lock alone, so the title keeps its room */
}
.title-line .status { min-width: 0; }
.share-button { display: inline-flex; align-items: center; gap: 6px; }
.export-button { display: inline-flex; align-items: center; gap: 4px; }
/* Notes, Drafts and History: icon and word, bordered like Export, since
   their icons don't say what they are. Between 700 and 1100px the words
   go (the title needs the room) and they're icons again; under 700px
   Drafts and History fold into the ⋯ menu. */
.tool-button { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 8px; flex: none; }
.tool-button .tab-count { position: static; margin: 0; }
.tool-button .drafts-dot { position: static; box-shadow: none; }
@media (max-width: 1100px) {
  .tool-button { padding: 0 7px; gap: 4px; }
  .tool-button__label { display: none; }
}
/* Table read (reading.js): Read as… with the parts' colours as dots, and
   ‹ "3 of 41" › through the reader's lines once there are parts. */
.reading-bar { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.reading-bar[hidden], .reading-bar [hidden] { display: none; }
.reading-dots { display: inline-flex; }
.reading-dots:empty { display: none; }
.reading-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--read); box-shadow: 0 0 0 1.5px var(--surface); }
.reading-dot + .reading-dot { margin-left: -3px; }
.reading-count { font: 500 12px var(--ui); color: var(--ink-soft); white-space: nowrap; min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; }
/* On the page: the part's colour behind its text, like a marker (not the
   fields' boxes, which run on to the margin), mixed with the paper. On
   light paper a light tint; on dark paper (every theme sets color-scheme)
   a deeper version of the colour (--read-dark, reading.js darkOf), a
   little of it, so it stays dark under the light text, with a line of it
   under the text to tell the parts apart. */
.read-text { background: color-mix(in srgb, var(--read) 60%, var(--paper)); padding: 0.1em 0; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.read-text {
  background: light-dark(color-mix(in srgb, var(--read) 60%, var(--paper)), color-mix(in srgb, var(--read-dark) 30%, var(--paper)));
  box-shadow: inset 0 -2px light-dark(transparent, var(--read-dark));
}
/* The line ‹ › went to pulses twice so the eye finds it after the page
   jumps: a glow in the part's colour spreading out from the highlight, and
   the highlight a step deeper meanwhile (dark mode stays dark enough for
   its light text; going lighter there washed the words out). */
.read-text.read-current { animation: read-current 0.9s ease-out 2; }
@keyframes read-current {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--read) 80%, transparent); }
  30% { background: light-dark(var(--read), color-mix(in srgb, var(--read-dark) 55%, var(--paper))); }
  100% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--read) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .read-text.read-current { animation: none; } }
.reading-parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.reading-part { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 6px; }
.reading-part:hover { background: var(--hover); }
.reading-part--stage { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; padding-top: 10px; }
.reading-part__pick { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.reading-part__pick input { margin: 0; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.reading-part__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reading-part__name small { color: var(--ink-soft); font-weight: 400; }
.reading-part__lines { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.reading-part__swatch { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--read); cursor: pointer; }
/* (A legend sits on a fieldset's top border, so no border here.) */
.reading-fields { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 6px 0 0; padding: 0; border: 0; }
.reading-fields__label { float: left; width: 100%; padding: 0 10px 2px; font-size: 12px; color: var(--ink-soft); }
.reading-fields .menu__check { padding: 6px 10px; }
.reading-part__swatch[hidden] { display: inline-block; visibility: hidden; }
.reading-part__swatch[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--read); }
.reading-part__colours { grid-column: 1 / -1; justify-content: flex-end; align-items: center; padding: 2px 0 4px; }
.reading-part__other { position: relative; display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.reading-part__other::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(#ff6b6b, #ffd43b, #69db7c, #4dabf7, #b197fc, #ff6b6b); box-shadow: 0 0 0 1px var(--line); }
.reading-part__other.is-chosen::before { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink-soft); }
.reading-part__other input { position: absolute; left: 0; top: 0; width: 18px; height: 18px; opacity: 0; cursor: pointer; }

/* History, settings and Export sit in the bar on wide screens and fold
   into one menu (#more-menu) on phones. */
.narrow-only { display: none; }
@media (max-width: 700px) {
  .wide-only { display: none !important; }
  .narrow-only { display: block; }
  /* Table read… is in the ⋯ menu here; the bar keeps only ‹ 3 / 34 ›,
     once there are parts to step through. */
  #read-as { display: none; }
  .reading-bar:not(:has(#reading-next:not([hidden]))) { display: none; }
}
.share-button[hidden] { display: none; }
/* Named, not just an icon: people didn't find their saved scripts behind
   the bare icon. Narrower windows keep a word too, "Library", Share keeps
   its icon and Sign in goes (it's in the account menu beside it), so the
   script's title keeps room to be read: from 960px down, not only on
   phones (2026-10-20, at 760px the title was cut to five letters). */
.scripts-button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 8px; flex: none; }
@media (max-width: 960px) {
  .scripts-button { padding: 0 8px 0 6px; }
  .scripts-button__script { display: none; }
  #sign-in { display: none; }
  .share-button span { display: none; }
}

/* Viewing only: nothing on the page offers to change it. */
.read-only .front-sheet__actions, .read-only .thumb--add { display: none; }
.read-only .type-chip, .read-only .type-dock { display: none !important; }

.title {
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.title:hover { background: var(--hover); }
.title:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: transparent; }
.title::placeholder { color: var(--ink-faint); }

/* Sits under the title, lined up with its text. Always one line tall so the
   bar doesn't jump while it's empty. */
.status {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 16px;
  min-height: 16px;
  padding: 0 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* A dot for the save state: green saved, amber saving, red trouble. */
.status[data-state=saved]::before, .status[data-state=saving]::before, .status[data-state=error]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
  background: var(--ok);
}
.status[data-state=saving]::before { background: var(--warn); }
.status[data-state=error]::before { background: var(--danger); }
.status[data-state=error] { color: var(--danger); }
/* Offline, signed in: saved on this device, a crossed-out cloud in place of the dot. */
:root { --icon-offline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.5 19H9a7 7 0 0 1-6.7-9M6.6 6.6A7 7 0 0 1 15.7 9h1.8a4.5 4.5 0 0 1 2.9 8'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E"); }
.status[data-state=offline]::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 5px;
  vertical-align: -3px;
  background: currentColor;
  -webkit-mask: var(--icon-offline) center / contain no-repeat;
  mask: var(--icon-offline) center / contain no-repeat;
}
/* It opens the version history. */
button.status { border: 0; background: none; padding: 0; font-family: inherit; text-align: left; cursor: pointer; }
button.status:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

.btn, .select {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 20px;
}
.btn:hover, .select:hover { background: var(--hover); }
.btn:disabled { opacity: 0.4; cursor: default; background: var(--surface); }
.history, .btn--bare { border-color: transparent; }
.btn:focus-visible, .select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Sign in (top bar and account menu), as Google's own button looks
   (2026-10-30, the user asked): the coloured G, white with a grey outline
   on light themes, near-black on dark ones, in a pill. */
.google-sign-in {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 34px; padding: 0 14px 0 12px; flex: none;
  border: 1px solid light-dark(#747775, #8e918f); border-radius: 17px;
  background: light-dark(#fff, #131314); color: light-dark(#1f1f1f, #e3e3e3);
  font: 500 14px/20px var(--ui); white-space: nowrap; cursor: pointer;
}
.google-sign-in:hover { background: light-dark(#f2f2f2, #1f1f20); }
.google-sign-in:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.google-sign-in[hidden] { display: none; }
.google-sign-in__logo { flex: none; }
.menu__items .google-sign-in { display: flex; margin: 4px 6px; padding: 0 14px 0 12px; border: 1px solid light-dark(#747775, #8e918f); border-radius: 17px; background: light-dark(#fff, #131314); text-align: center; }
.menu__items .google-sign-in[hidden] { display: none; }
.menu__items .google-sign-in:hover { background: light-dark(#f2f2f2, #1f1f20); }

.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); }
/* Faded but still filled: .btn:disabled's plain background left only the
   border, with the white text on it. */
.btn--primary:disabled { background: var(--accent); filter: none; }
.btn--soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 500; }
.btn--soft:hover { background: var(--accent-soft); filter: brightness(0.97); }
/* Destructive actions warn on hover. */
.btn[data-remove]:hover, .btn[data-remove-author]:hover { color: var(--danger); }
.btn--icon { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; }
.btn[hidden] { display: none; } /* (.btn--icon's display would show a hidden one: the History button did, to a draft's readers) */
/* The account button's picture, or a coloured letter (app.js showAvatar). */
#account > summary { overflow: hidden; border-radius: 50%; }
.avatar { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--letter { color: #fff; font-weight: 600; font-size: 14px; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__items {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.menu__items button {
  text-align: left;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.menu__items button:hover { background: var(--hover); }.menu__items small { color: var(--ink-soft); margin-left: 4px; }
.menu__label { margin: 0; padding: 6px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.menu__rule { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu__check { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 5px; cursor: pointer; }
.menu__check:hover { background: var(--hover); }
.menu__check input { margin: 0; accent-color: var(--accent); }
.menu__field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; }
.menu__field select { font: 13px/1.3 var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.menu__sublabel { margin: 4px 0 0; padding: 4px 10px 0; font-size: 12px; color: var(--ink-soft); }
/* Theme: Auto (the system's) / Light / Dark, side by side. */
.menu__theme { display: flex; gap: 2px; margin: 4px 6px 6px; padding: 2px; border-radius: 7px; background: var(--hover); }
.menu__items .menu__theme button { flex: 1; text-align: center; padding: 5px 8px; font-size: 12px; color: var(--ink-soft); }
.menu__items .menu__theme button[aria-checked=true] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.15); }
/* "More themes…" opens the Themes dialog. A theme picked there takes the
   bar's place: its colours, its name and "Change…" (opens the dialog). */
.menu__items .menu__more { font-size: 13px; }
.menu__theme[hidden], .menu__items button[hidden] { display: none; }
/* Which release this is (app.js, version.js): small, at the very foot. */
.menu__version { display: block; margin: 4px 10px 2px; padding-top: 8px; border-top: 1px solid var(--line); text-align: center; font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; text-decoration: none; }
.menu__version:hover { color: var(--ink-soft); text-decoration: underline; }
.menu__version[hidden] { display: none; }
.menu__items .menu__theme-current { display: flex; align-items: center; gap: 8px; margin: 4px 6px 6px; padding: 6px 10px; border-radius: 7px; background: var(--hover); font-size: 12px; }
.menu__items .menu__theme-current:hover { background: var(--line); }
.theme-current__name { flex: 1; font-weight: 600; }
.menu__items .menu__theme-current small { color: var(--accent-text); }
.theme-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line); background: linear-gradient(135deg, var(--paper) 50%, var(--accent) 50%); }

/* The Themes dialog (themes.js): a card per theme with a small picture of
   the app drawn in that theme's tokens (data-theme-preview). */
.dialog.themes-dialog { width: min(720px, calc(100vw - 32px)); overflow: auto; }
.themes__group { margin: 10px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.themes__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.theme-card:hover { background: var(--hover); }
.theme-card[aria-checked=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card__name { padding: 4px 2px 0; font-size: 13px; font-weight: 600; }
.theme-card[aria-checked=true] .theme-card__name { color: var(--accent-text); }
.theme-card__about { padding: 0 2px 2px; font-size: 11px; color: var(--ink-soft); }
.theme-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.theme-thumb__split { display: block; position: absolute; inset: 0; }
.theme-thumb__split .tt + .tt { clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.tt { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.tt :where(i, span) { display: block; }
.tt-bar { display: flex; justify-content: flex-end; align-items: center; height: 15%; padding: 0 6%; background: var(--surface); border-bottom: 1px solid var(--line); }
.tt-bar i { width: 16%; height: 50%; border-radius: 3px; background: var(--accent); }
.tt-body { display: flex; flex: 1; min-height: 0; }
.tt-side { display: flex; flex-direction: column; gap: 6px; width: 24%; padding: 8% 4%; background: var(--sidebar); border-right: 1px solid var(--line); }
.tt-side i { height: 3px; border-radius: 2px; background: var(--ink-faint); }
.tt-side i:first-child { height: 7px; background: var(--accent-soft); }
.tt-desk { flex: 1; padding: 7% 12% 0; overflow: hidden; }
.tt-page { display: flex; flex-direction: column; gap: 5px; height: 100%; padding: 12% 12%; background: var(--paper); box-shadow: var(--shadow); }
.tt-page i { height: 3px; border-radius: 1px; background: var(--ink); opacity: 0.7; }
.tt-page .tt-head { width: 70%; opacity: 1; }
.tt-page .tt-short { width: 55%; }
.tt-page .tt-name { width: 24%; margin-left: 32%; }
.tt-page .tt-dlg { width: 52%; margin-left: 18%; }


#account-signed-in[hidden], #account-session[hidden] { display: none; }
#account-session { display: flex; flex-direction: column; }
#account-initial { display: grid; place-items: center; width: 100%; height: 100%; }
.menu__who { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.menu__who span { font-size: 12px; color: var(--ink-soft); }
.menu__who span:empty, .menu__who strong:empty { display: none; }

/* ---- layout ------------------------------------------------------------- */

.layout { flex: 1; display: flex; min-height: 0; position: relative; }
/* Folded away (the top bar's first button) to give the page the room. */
@media (min-width: 801px) { .sidebar-collapsed .sidebar { display: none; } }

/* Notes on the right (notes.js): beside the page where there's room for
   both sidebars and the page (1380px), over the desk's right edge where
   there isn't, a drawer on phones. */
.notes-side { display: none; width: 260px; flex-shrink: 0; flex-direction: column; gap: 10px; padding: 12px; background: var(--sidebar); border-left: 1px solid var(--line); overflow-y: auto; }
.notes-open .notes-side { display: flex; }
.notes-side__head { display: flex; align-items: center; justify-content: space-between; margin: -4px -4px 0 0; }
.notes-side__title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
@media (max-width: 1380px) and (min-width: 801px) {
  .notes-side { position: absolute; top: 0; right: 0; bottom: 0; z-index: 15; box-shadow: var(--shadow); }
}
.notes-toggle { position: relative; }
.notes-toggle[aria-expanded=true] { background: var(--accent-soft); color: var(--accent-text); }
.notes-toggle[hidden] { display: none; }
#toggle-sidebar[aria-expanded=true] { color: var(--accent-text); }

/* Tabs sticking out of the sidebars' inner edges, to fold them away and
   back (app.js edgeTab). Closed, they sit at the layout's edges; the
   right one inside the desk's scroll bar. */
.edge-tab {
  position: absolute; top: 50%; z-index: 16;
  width: 16px; height: 48px; margin-top: -24px; padding: 0;
  display: grid; place-items: center;
  background: var(--sidebar); color: var(--ink-soft);
  border: 1px solid var(--line); cursor: pointer;
}
.edge-tab:hover { color: var(--ink); }
.edge-tab[hidden] { display: none; }
.edge-tab svg { transition: transform 0.2s; }
.edge-tab--left { left: var(--sidebar-width, 240px); border-left: 0; border-radius: 0 8px 8px 0; }
.sidebar-collapsed .edge-tab--left { left: 0; }
.edge-tab--left[aria-expanded=false] svg,
.edge-tab--right[aria-expanded=false] svg { transform: rotate(180deg); }
.edge-tab--right { right: var(--desk-bar, 0px); border-right: 0; border-radius: 8px 0 0 8px; }
.notes-open .edge-tab--right { right: 260px; }

.sidebar {
  width: var(--sidebar-width, 240px);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}


/* The sidebar's right edge, dragged to widen it (app.js sidebarWidth);
   240px is the narrowest. Wider screens only, not while folded away. */
.sidebar-resize {
  position: absolute; top: 0; bottom: 0; z-index: 15;
  left: calc(var(--sidebar-width, 240px) - 3px); width: 7px;
  cursor: col-resize; touch-action: none;
}
.sidebar-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; transition: background 0.15s; }
.sidebar-resize:hover::after, .resizing-sidebar .sidebar-resize::after { left: 2px; width: 3px; background: var(--accent); }
.sidebar-resize:focus-visible { outline: none; }
.sidebar-resize:focus-visible::after { left: 2px; width: 3px; background: var(--accent); }
.sidebar-collapsed .sidebar-resize { display: none; }
@media (max-width: 800px) { .sidebar-resize { display: none; } }
.resizing-sidebar, .resizing-sidebar * { cursor: col-resize !important; user-select: none !important; }

.hint { color: var(--ink-soft); font-size: 12px; margin: auto 0 0; }

/* ---- sidebar tabs and panels --------------------------------------------- */

/* The tabs and the search box stay at the top while the panel scrolls. */
.sidebar__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--sidebar);
  padding-bottom: 4px;
  box-shadow: 0 -16px 0 var(--sidebar); /* covers what scrolls under it */
}
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--hover);
}
.tabs [role=tab] {
  flex: 1;
  border: 0;
  background: none;
  border-radius: 6px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.tabs [role=tab]:hover { color: var(--ink); }
.tabs [role=tab][aria-selected=true] { background: var(--surface); color: var(--accent-text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.tabs [role=tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Search (views.js): matches marked in both panels, the rest faded. */
.search {
  width: 100%;
  font: 13px/1.3 var(--ui);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  outline: none;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.search::placeholder { color: var(--ink-faint); }
.search-nav { display: flex; align-items: center; gap: 2px; margin-top: -2px; }
.search-nav[hidden] { display: none; }
.search-nav__count { flex: 1; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.search-nav__step { display: grid; place-items: center; width: 28px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--ink-soft); cursor: pointer; }
.search-nav__step:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.search-nav__step:disabled { opacity: 0.35; cursor: default; }
.search-nav__toggle { border: 0; background: none; padding: 4px 6px; border-radius: 6px; font: 500 12px/1 var(--ui); color: var(--accent-text); cursor: pointer; }
.search-nav__toggle:hover { background: var(--hover); }
.search-nav__toggle[aria-expanded=true] { background: var(--accent-soft); }
.search-nav__toggle[hidden], .replace-row[hidden] { display: none; }
.replace-row { display: flex; flex-direction: column; gap: 6px; }
.replace-row__actions { display: flex; gap: 6px; }
/* In the editor (editor.js searchHits): every hit, the current one stronger. */
/* Other people's carets (presence.js): a bar in their colour with their
   first name above it, and their selection tinted. */
.rich .peer-caret { position: relative; display: inline; border-left: 2px solid var(--peer); margin-left: -1px; margin-right: -1px; pointer-events: none; }
.rich .peer-caret__name { position: absolute; left: -2px; bottom: 100%; padding: 0 4px; border-radius: 3px 3px 3px 0; background: var(--peer); color: #fff; font: 600 10px/1.5 var(--ui); white-space: nowrap; text-transform: none; letter-spacing: 0; text-decoration: none; user-select: none; }
.rich .peer-sel { background: color-mix(in srgb, var(--peer) 22%, transparent); }
/* Their faces in the top bar. */
.peers { display: flex; align-items: center; padding-left: 4px; }
.peers[hidden] { display: none; }
.peers button { width: 28px; height: 28px; padding: 0; margin-left: -6px; border: 2px solid var(--peer); border-radius: 50%; background: var(--surface); cursor: pointer; overflow: hidden; }
.peers button:first-child { margin-left: 0; }
.peers .avatar--letter { background: var(--peer); font-size: 12px; }
.peers__more { margin-left: 4px; font-size: 12px; color: var(--ink-soft); }
@media (max-width: 600px) { .peers button:nth-child(n+4) { display: none; } }

.rich .search-hit { background: var(--hit-soft); border-radius: 2px; box-shadow: 0 0 0 1px var(--hit-soft); }
.rich .search-hit.is-current { background: var(--hit); box-shadow: 0 0 0 2px var(--hit); color: #16181d; }
mark.hit { background: var(--hit-soft); color: inherit; border-radius: 2px; box-shadow: 0 0 0 1px var(--hit-soft); }
.thumb.is-miss canvas, .scene.is-miss, .outline-act.is-miss { opacity: 0.4; }
.thumb.is-hit canvas { box-shadow: 0 0 0 2px var(--hit); }
.thumb.is-hit.is-current canvas { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--hit); }

.panel { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.panel[hidden] { display: none; }
.panel__label { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.btn--small { padding: 4px 10px; font-size: 12px; line-height: 18px; flex: 1; }
.panel__count { margin: 0; color: var(--ink-soft); font-size: 12px; }

/* Stats (views.js renderStats): totals, then groups of rows that fold away;
   each row a title with its figure, a line under it and a bar for its share
   of the group's largest. */
.stats-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.stats-summary div { padding: 7px 9px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stats-summary dt { font-size: 11px; color: var(--ink-faint); }
.stats-summary dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.stats { display: flex; flex-direction: column; gap: 10px; }
.stats-group > summary { display: flex; align-items: center; gap: 4px; padding: 4px 2px; border-radius: 6px; cursor: pointer; list-style: none; user-select: none; }
.stats-group > summary::-webkit-details-marker { display: none; }
.stats-group > summary:hover { background: var(--hover); }
.stats-group__chevron { display: grid; color: var(--ink-soft); }
.stats-group__chevron svg { transition: transform 0.15s; }
.stats-group[open] .stats-group__chevron svg { transform: rotate(90deg); }
.stats-group__name { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.stats-group__count { margin-left: auto; font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; padding-right: 4px; }
.stats-sort { display: block; margin: 4px 0 4px 2px; font: 12px var(--ui); color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.stats-list { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.stats-empty { padding: 4px 8px; font-size: 12px; color: var(--ink-faint); }
.stat__row { display: flex; flex-direction: column; gap: 2px; width: 100%; border: 0; background: none; text-align: left; padding: 6px 8px 7px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.stat__row:hover { background: var(--hover); }
.stat.is-current .stat__row { background: var(--accent-soft); }
.stat.is-current .stat__title { color: var(--accent-text); font-weight: 600; }
.stat__top { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.stat__chevron { display: grid; align-self: center; color: var(--ink-soft); margin-left: -4px; }
.stat__chevron svg { transition: transform 0.15s; }
.stat.is-open .stat__chevron svg { transform: rotate(90deg); }
.stat__title { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; text-transform: uppercase; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.stat__value { flex-shrink: 0; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 11px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat__sub:empty { display: none; }
.stat__bar { display: block; height: 3px; border-radius: 2px; background: var(--hover); overflow: hidden; margin-top: 2px; }
.stat__bar span { display: block; height: 100%; border-radius: 2px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.stat__more { display: none; padding: 2px 8px 8px 18px; }
.stat.is-open .stat__more { display: flex; flex-direction: column; gap: 6px; }
.stat__line { margin: 0; font-size: 12px; color: var(--ink-soft); }
.stat__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.stat__chip { min-width: 24px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--accent-text); font: 600 11px/17px var(--ui); font-variant-numeric: tabular-nums; cursor: pointer; }
.stat__chip:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Notes (notes.js): the Notes tab's threads, the new note being written,
   and in the editor the noted text, the pins in the right margin and the
   Note button over a selection. Private notes are dashed. */
.tab-count { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 2px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 600 10px/16px var(--ui); vertical-align: 1px; }
.tab-count[hidden] { display: none; }
.notes__head { display: flex; align-items: center; gap: 8px; }
.notes__filter { flex: 1; min-width: 0; font: 13px var(--ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; }
.notes__add { flex: 0 0 auto; }
.notes__add[hidden] { display: none; }
.notes__composer, .note { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.notes__composer { border-color: var(--note-c, var(--note)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--note-c, var(--note)) 14%, transparent); }
.notes__composer[hidden] { display: none; }
.notes__quote, .note__quote { margin: 0; padding: 0 0 0 8px; border: 0; border-left: 3px solid var(--note-c, var(--note)); background: none; font: 12px/1.4 var(--script); color: var(--ink-soft); text-align: left; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.note__quote { cursor: pointer; }
.note__quote:hover { color: var(--ink); }
.note.is-private .note__quote, .notes__composer .notes__quote { border-left-style: solid; }
.note.is-private { border-style: dashed; }
.note.is-private .note__quote { border-left-style: dashed; }
.notes__input { width: 100%; resize: vertical; font: 13px/1.4 var(--ui); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; outline: none; }
.notes__input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.notes__private { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); }
.notes__private[hidden] { display: none; }
.notes__who { margin: -2px 0 0; font-size: 11px; color: var(--ink-soft); }
.notes__form-actions { display: flex; gap: 6px; justify-content: flex-end; }
.notes__form-actions .btn--small { flex: 0 0 auto; }
.notes__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notes__empty { margin: 0; font-size: 12px; color: var(--ink-soft); }
.notes__empty[hidden] { display: none; }
.note { cursor: default; }
/* Each card edged in its note's colour; the open ones (a pin's notes
   together) filled with a muted wash of it. */
.note { border-left: 3px solid var(--note-c, var(--note)); }
.note.is-active { background: color-mix(in srgb, var(--note-c, var(--note)) 18%, var(--surface)); border-color: var(--note-c, var(--note)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--note-c, var(--note)) 30%, transparent); }
.note.is-resolved { opacity: 0.7; }
.note__gone { margin: 0; font-size: 11px; color: var(--warn); }
.note__page { margin: 0; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
/* On a template page (sheetnotes.js): in the sheet's own right margin. */
.front-sheet__page { position: relative; }
.note-pin--sheet { left: auto; right: 0.4in; }
.note__entry { display: flex; flex-direction: column; gap: 2px; }
.note__entry--reply { padding-left: 10px; border-left: 2px solid var(--line); margin-left: 2px; }
.note__head { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; }
.note__face { flex: 0 0 auto; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; overflow: hidden; background: var(--hover); }
.note__face img { width: 100%; height: 100%; object-fit: cover; }
.note__face--letter { background: var(--note-c, var(--note)); color: #fff; font: 600 10px/1 var(--ui); }
.note__swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.note__swatch { width: 18px; height: 18px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.note__swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--swatch); }
.note__swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note__who { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note__when { color: var(--ink-faint); white-space: nowrap; }
.note__badge { padding: 0 5px; border-radius: 4px; background: var(--hover); color: var(--ink-soft); font-size: 10px; line-height: 16px; white-space: nowrap; }
.note__badge--resolved { color: var(--ok); }
.note__tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity 0.1s; }
.note__tools--first { order: 1; }
.note__head > .note__colour { margin-left: auto; order: 2; }
/* The row is face, who-over-when, badges, then Edit / Delete (taking their
   room even while hidden) and the colour dot: the dot was pushed past the
   card's edge when one line held everything (2026-10-16, worst with the
   Mac's wider font). The name and time give way first, with an ellipsis. */
.note__head > .note__face, .note__head > .note__tools, .note__head > .note__colour { flex-shrink: 0; }
.note__byline { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.note__byline > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note__when { font-size: 11px; }
.note__head > .note__badge { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.note__head:has(.note__tools--first) > .note__colour { margin-left: 4px; }
.note__colour { flex: 0 0 auto; width: 14px; height: 14px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px color-mix(in srgb, var(--swatch) 60%, var(--line)); }
button.note__colour { cursor: pointer; }
button.note__colour:hover, button.note__colour[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--swatch); }
.note:hover .note__tools, .note__tools:focus-within { opacity: 1; }
@media (hover: none) { .note__tools { opacity: 1; } }
.note__tool, .note__action { border: 0; background: none; padding: 2px 5px; border-radius: 5px; font: 500 11px/1.3 var(--ui); color: var(--ink-soft); cursor: pointer; }
.note__tool:hover, .note__action:hover { background: var(--hover); color: var(--ink); }
.note__tool--danger:hover { color: var(--danger); }
.note__action { color: var(--accent-text); font-size: 12px; }
.note__actions { display: flex; gap: 4px; margin: 0 -5px -4px; }
/* To check (clashes.js): lines both sides changed, above the notes, edged
   in the warning colour, with Use theirs / Keep mine. */
.notes__check { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.notes__check[hidden] { display: none; }
.notes__check-head h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.notes__check-head p { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); }
.note--clash { --note-c: var(--warn); }
/* Offline (notes.js): what that means for notes, at the panel's top. */
/* Like the status line's offline state: the crossed-out cloud, quiet grey,
   no box (a tinted one read as an alarm, 2026-10-16). */
.notes__offline { display: flex; align-items: center; gap: 6px; margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-soft); }
.notes__offline::before { content: ""; flex: none; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--icon-offline) center / contain no-repeat; mask: var(--icon-offline) center / contain no-repeat; }
.notes__offline[hidden] { display: none; }
.note__badge--pending { color: var(--warn); }
/* Offline: what needs a connection is dimmed (app.js offlineFor says why
   when it's clicked). */
body.is-offline :is(#share, #history-button, #drafts-button, [data-drafts-open], [data-history], [data-drive], [data-import-drive]) { opacity: 0.45; }
.note__clash-who { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.note__clash-who .note__when { font-weight: 400; margin-left: 4px; }
/* The two versions to pick from: each a button with what it is and its words. */
.clash__choices { display: flex; flex-direction: column; gap: 6px; }
.clash__option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.clash__option:hover { border-color: var(--accent); background: var(--accent-soft); }
.clash__label { font-size: 11px; font-weight: 600; color: var(--accent-text); }
.clash__text { font-family: var(--script); font-size: 13px; overflow-wrap: anywhere; }
.note--clash .note__actions { gap: 6px; margin: 4px 0 0; }
.note__text { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.note__edited { color: var(--ink-faint); font-size: 11px; }
.note__form { display: flex; flex-direction: column; gap: 6px; }

.rich .note-mark { background: color-mix(in srgb, var(--note-c, var(--note)) 24%, transparent); border-bottom: 2px solid color-mix(in srgb, var(--note-c, var(--note)) 80%, transparent); cursor: pointer; }
.rich .note-mark.is-private { background: color-mix(in srgb, var(--note-c, var(--note)) 10%, transparent); border-bottom: 2px dashed var(--note-c, var(--note)); }
.rich .note-mark.is-active { background: color-mix(in srgb, var(--note-c, var(--note)) 50%, transparent); border-bottom: 2px solid var(--note-c, var(--note)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--note-c, var(--note)) 50%, transparent); border-radius: 2px; }
.note-pin { position: absolute; top: 0; left: calc(100% + 0.62in); display: grid; place-items: center; min-width: 20px; height: 18px; padding: 0 4px; border-radius: 9px 9px 9px 2px; background: var(--note-c, var(--note)); color: #fff; font: 600 10px/1 var(--ui); text-transform: none; text-decoration: none; letter-spacing: 0; cursor: pointer; user-select: none; }
.note-pin:empty::before { content: ""; width: 8px; height: 2px; border-radius: 1px; background: #fff; box-shadow: 0 -3px 0 #fff; }
.note-pin.is-private { background: var(--surface); color: var(--note-c, var(--note)); border: 1.5px dashed var(--note-c, var(--note)); }
.note-pin.is-private:empty::before { background: var(--note-c, var(--note)); box-shadow: 0 -3px 0 var(--note-c, var(--note)); }
.note-pin.is-active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--note-c, var(--note)) 22%, transparent); }
.block.dual-left .note-pin { display: none; } /* its half ends mid-page; the right half's pin shows */
/* Only with the Notes panel open (app.js showNotes); otherwise the page stays plain. */
body:not(.notes-open) .rich .note-mark { background: none; border-bottom: 0; cursor: auto; }
body:not(.notes-open) .note-pin { display: none; }
.note-float { position: fixed; z-index: 40; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font: 600 12px/1 var(--ui); box-shadow: var(--shadow); cursor: pointer; }
.note-float[hidden] { display: none; }

/* Pages: thumbnails, two columns at the narrowest and more as the
   sidebar widens; the caret's page outlined. */
.page-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 12px; }
.thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 11px;
}
.thumb canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--line);
}
.thumb:hover canvas { box-shadow: 0 0 0 1px var(--ink-faint); }
.thumb.is-current canvas { box-shadow: 0 0 0 2px var(--accent); }
.thumb.is-current { color: var(--accent); font-weight: 600; }
.thumb:focus-visible { outline: none; }
.thumb:focus-visible canvas { box-shadow: 0 0 0 2px var(--accent); }
.thumb__blank {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 8.5 / 11;
  border-radius: 2px;
  border: 1px dashed var(--ink-faint);
  color: var(--ink-soft);
}
.thumb--add:hover .thumb__blank { border-color: var(--accent); color: var(--accent); background: var(--hover); }
.thumb--add:focus-visible .thumb__blank { border: 2px solid var(--accent); }

/* Outline: one row per scene, opening to its lines. */
.scene-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.scene__row { display: flex; align-items: flex-start; border-radius: 6px; }
.scene__row:hover { background: var(--hover); }
.scene.is-current .scene__row { background: var(--accent-soft); }
.scene.is-current .scene__heading { color: var(--accent-text); }
.scene__toggle {
  border: 0;
  background: none;
  color: var(--ink-soft);
  padding: 9px 2px 9px 4px;
  cursor: pointer;
  display: grid;
}
.scene__toggle svg { transition: transform 0.15s; }
.scene.is-open .scene__toggle svg { transform: rotate(90deg); }
.scene__toggle:disabled { visibility: hidden; }
.scene__jump {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  text-align: left;
  padding: 7px 8px 7px 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scene__top { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.scene__number {
  flex: none;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.scene__number:empty { display: none; }
.scene__heading {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  font-size: 13px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.scene.is-current .scene__heading { font-weight: 600; }
.scene__page { color: var(--ink-faint); font-size: 11px; flex-shrink: 0; }
.scene__cast { color: var(--ink-soft); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 20px; }
.scene__cast:empty { display: none; }
.scene__lines { list-style: none; margin: 0 0 6px; padding: 0 0 0 22px; display: none; }
.scene.is-open .scene__lines { display: block; }
.outline-line {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.outline-line:hover { background: var(--hover); color: var(--ink); }
.outline-line__name { font-weight: 600; color: var(--ink); }
.outline-line--transition { text-align: right; text-transform: uppercase; }
.outline-line--shot { text-transform: uppercase; }
.outline-line--centered { text-align: center; }
/* Template pages (views.js renderTemplates): one row each in the Pages
   tab. Added ones read normally, with a pencil (or an eye) at the end; the
   rest are greyed, with what they're for and Add. */
.templates { display: flex; flex-direction: column; gap: 6px; }
.templates[hidden] { display: none; }
.template-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.template-row { display: flex; align-items: center; }
.template-row + .template-row { border-top: 1px solid var(--line); }
.template-row:hover { background: var(--hover); }
.template-row__main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 9px; border: 0; background: none; padding: 7px 4px 7px 10px; text-align: left; cursor: pointer; color: var(--ink); }
.template-row__main svg, .template-row__action svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.template-row__main svg { color: var(--accent-text); margin-top: 1px; }
.template-row__text { min-width: 0; display: flex; flex-direction: column; }
/* Wrapped, not cut: the sidebar is too narrow for most of them on one line. */
.template-row__name { font-size: 13px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.template-row__about { display: none; margin-top: 1px; font-size: 11px; line-height: 1.35; color: var(--ink-faint); }
.template-row:not(.is-added) .template-row__main { color: var(--ink-soft); }
.template-row:not(.is-added) .template-row__main svg { color: var(--ink-faint); }
.template-row:not(.is-added) .template-row__about { display: block; }
.template-row__action { flex: none; display: grid; place-items: center; min-width: 28px; height: 26px; margin-right: 6px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--ink-soft); font: 500 12px var(--ui); cursor: pointer; }
.template-row__action:hover { background: var(--surface); color: var(--ink); }
.template-row:not(.is-added) .template-row__action { color: var(--accent-text); background: var(--accent-soft); }
.template-row:not(.is-added) .template-row__action:hover { filter: brightness(0.97); }

/* Template pages in the outline, before and after the scenes. */
.outline-page { display: flex; align-items: center; border-radius: 6px; }
.outline-page:hover { background: var(--hover); }
.outline-page__jump { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 8px; text-align: left; cursor: pointer; color: var(--ink-soft); font-size: 13px; }
.outline-page__jump:hover { color: var(--ink); }
.outline-page__jump svg, .outline-page__edit svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.outline-page__edit { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin-right: 2px; border: 0; border-radius: 5px; background: none; color: var(--ink-faint); cursor: pointer; opacity: 0; }
.outline-page:hover .outline-page__edit, .outline-page__edit:focus-visible { opacity: 1; }
.outline-page__edit:hover { color: var(--ink); background: var(--surface); }
@media (hover: none) { .outline-page__edit { opacity: 1; } }
.outline-rule { height: 1px; background: var(--line); margin: 6px 8px; }

/* Moving scenes (views.js sceneTools; docs/scene-moves.md). Hovering
   changes nothing's size (2026-10-29, the user: tools taking room on hover
   rewrapped the heading and moved things about): the ⋯ lies over the page
   number's column, which is kept wide enough for it on rows that can move,
   and the page number hides under it; the "+" sits on the gap under the
   scene. The row itself is what drags (no grip since 2026-10-30). Without
   hover, the ⋯ is a column of its own, always there, and the "+" is left
   out. */
.scene { position: relative; }
.scene__row { position: relative; }
.scene.is-movable .scene__page { min-width: 24px; text-align: right; }
.scene__tools { position: absolute; top: 4px; right: 4px; display: flex; align-items: center; opacity: 0; pointer-events: none; }
.scene.is-movable:hover .scene__tools, .scene.is-movable:focus-within .scene__tools { opacity: 1; pointer-events: auto; }
.scene.is-movable:hover .scene__page, .scene.is-movable:focus-within .scene__page { visibility: hidden; }
.scene__more { display: grid; place-items: center; width: 20px; height: 24px; border: 0; border-radius: 5px; background: none; color: var(--ink-faint); cursor: pointer; }
.scene__more circle { fill: currentColor; }
.scene__more:hover { color: var(--ink); background: var(--surface); }
.scene__more:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.scene__add { position: absolute; left: 6px; bottom: -9px; z-index: 1; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-soft); cursor: pointer; opacity: 0; pointer-events: none; }
.scene__add path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.scene__add:hover { color: var(--accent-text); border-color: var(--accent); }
.scene.is-movable:hover .scene__add, .scene__add:focus-visible { opacity: 1; pointer-events: auto; }
.scene.is-dragged { opacity: 0.4; }
.scene.is-drop-before { box-shadow: 0 -2px 0 var(--accent); }
.scene.is-drop-after, .outline-act.is-drop-after { box-shadow: 0 2px 0 var(--accent); }
@media (hover: none) {
  .scene.is-movable .scene__page { min-width: 0; }
  .scene__tools { position: static; flex: none; padding: 5px 4px 0 0; opacity: 1; pointer-events: auto; }
  .scene.is-movable:hover .scene__page, .scene.is-movable:focus-within .scene__page { visibility: visible; }
  .scene__add { display: none; }
}
.scene-menu { position: fixed; inset: auto; margin: 0; z-index: 10; min-width: 200px; color: var(--ink); }
.scene-menu:not(:popover-open) { display: none; } /* (.menu__items' display: flex outranks the browser's hiding) */
.scene-menu button { display: flex; align-items: baseline; gap: 8px; color: var(--ink); font: 14px/1.4 var(--ui); }
.scene-menu button:disabled { color: var(--ink-faint); cursor: default; background: none; }
.scene-menu button[aria-checked=true]::before { content: "✓"; }

/* Scene cards (scenecards.js): a colour down the row's edge, the summary
   under the heading, and the ⋯ menu's summary box and colours. Every theme
   draws the same eight, deeper on dark paper (light-dark, with each theme's
   color-scheme). */
:root {
  --card-red: light-dark(#e03131, #ff6b6b);
  --card-orange: light-dark(#e8590c, #ff922b);
  --card-yellow: light-dark(#f08c00, #fcc419);
  --card-green: light-dark(#2f9e44, #51cf66);
  --card-teal: light-dark(#0c8599, #3bc9db);
  --card-blue: light-dark(#1971c2, #4dabf7);
  --card-purple: light-dark(#7048e8, #9775fa);
  --card-pink: light-dark(#c2255c, #f06595);
}
.scene[data-colour] > .scene__row { box-shadow: inset 3px 0 0 var(--card); }
.scene__summary { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; padding-left: 20px; margin-top: 2px; color: var(--ink-soft); font-size: 12px; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }
.scene__summary:empty, .scene.is-editing .scene__summary { display: none; }
.scene__summary-edit { display: block; box-sizing: border-box; width: calc(100% - 26px); margin: 2px 4px 6px 22px; padding: 5px 7px; resize: none; overflow: hidden; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--ink); font: 12px/1.4 var(--ui); }
.scene__summary-edit:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.scene-menu .scene-menu__colours { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px 4px; }
.scene-menu .scene-menu__colour { display: block; width: 18px; height: 18px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card, var(--surface)); cursor: pointer; }
.scene-menu .scene-menu__colour:not([style]) { background: linear-gradient(135deg, transparent 45%, var(--ink-faint) 45%, var(--ink-faint) 55%, transparent 55%), var(--surface); }
.scene-menu .scene-menu__colour[aria-checked=true] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.scene-menu .scene-menu__colour[aria-checked=true]::before { content: none; }
.scene-menu .scene-menu__colour:hover { transform: scale(1.12); background-color: var(--card, var(--surface)); }

.outline-act { margin: 10px 0 2px; }
.outline-act:first-child { margin-top: 0; }
.outline-act__jump {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: none;
  padding: 4px 8px;
  border-radius: 5px;
  text-align: left;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-text);
}
.outline-act__jump:hover { background: var(--hover); }

.desk { flex: 1; min-width: 0; overflow-y: auto; padding: 32px 16px 48px; }

.keys { text-align: center; color: var(--ink-soft); font-size: 12px; margin: 16px 0 0; }
/* Support, privacy and terms: a quiet line at the very end of the page. */
/* Account (account menu › Account…): who, the data, then deleting it
   set apart in a red-edged box. */
.account__who { display: flex; align-items: center; gap: 12px; overflow-wrap: anywhere; }
.account__who > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.account__who span:not(.account__photo) { font-size: 13px; color: var(--ink-soft); }
.account__who strong:empty { display: none; }
.account__photo { flex: none; width: 44px; height: 44px; }
.account__photo .avatar--letter { font-size: 18px; }
.account__section { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.account__section h3 { margin: 0; font-size: 14px; font-weight: 600; }
.account__danger { border: 1px solid var(--danger); border-radius: 8px; padding: 12px 14px; }
.account__danger h3 { color: var(--danger); }
.btn--danger-outline { color: var(--danger); border-color: var(--danger); }
.btn--danger-outline:hover { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
#account-dialog .dialog__foot { justify-content: flex-end; }

/* Get the desktop app (offline.js): ticked perks, then how, on a tint. */
.install-dialog { width: min(440px, calc(100vw - 32px)); }
.install-dialog .dialog__foot { justify-content: flex-end; }
.install__perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.install__perks li { position: relative; padding-left: 28px; color: var(--ink); }
.install__perks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 16%, transparent);
}
.install__perks li::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  width: 10px;
  height: 10px;
  background: var(--ok);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.install__how { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--ink); }
.install__how:empty { display: none; }
.install__how h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.install__how ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.install__how p { margin: 6px 0 0; }
.install__how h3 + p { margin-top: 0; }
/* Deleting the account: what goes, then typing DELETE. */
.delete-account__list { margin: 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.delete-account__confirm { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.delete-account__confirm input { font: 14px/1.3 var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
:root, [data-theme-preview] { --danger-fill: color-mix(in srgb, var(--danger) 76%, #000); }
/* Filled red with white text: each theme's red made deeper, since --danger
   is chosen to read as text, and the dark themes' is a light red that
   white on it barely reads (2026-11-02). */
.btn--danger { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.btn--danger:disabled { opacity: 0.45; cursor: default; }
#delete-account-download { align-self: flex-start; }

/* The first visit's welcome (index.html #welcome-dialog). */
.dialog.welcome { width: min(460px, calc(100vw - 32px)); }
.welcome h2 { margin: 0; font-size: 20px; font-weight: 600; }
.welcome__icon { border-radius: 11px; }
.welcome__lead { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.welcome__tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; }
@media (max-width: 480px) { .welcome .dialog__foot { flex-direction: column-reverse; } }

.site-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin: 28px 0 0; color: var(--ink-soft); font-size: 12px; }
/* App Check's reCAPTCHA (firebase-config.js): its corner badge would sit over
   the toasts, so it's hidden and Google's required line is in the foot instead. */
.recaptcha-note { display: none; flex-basis: 100%; text-align: center; }
.has-recaptcha .recaptcha-note { display: block; }
.grecaptcha-badge { visibility: hidden; }
.site-foot a { color: inherit; text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
kbd { font: inherit; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); }

/* ---- the page ------------------------------------------------------------
   Screenplay layout on a 6in text column: 60 characters of 12pt Courier,
   or --cols at the script's font size (16px on screen is 12pt).
   Indents are percentages of that column so the page scales down on phones:
   character 2.2in, parenthetical 1.6in, dialogue 1in wide 3.5in.          */

.paper {
  max-width: calc(var(--cols) * 1ch + 1.5in + var(--margin-right));
  margin: 0 auto;
  background: var(--paper);
  box-shadow: var(--shadow);
  border-radius: 4px;
  padding: 1in var(--margin-right) 1in 1.5in;
  min-height: var(--paper-height);
  font: calc(16px * var(--script-scale))/1.25 var(--script);
}

.print-pages { display: none; }

.page { max-width: calc(var(--cols) * 1ch + 0.5px); display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(var(--dual-gap) * 1ch); }
.page > .block { grid-column: 1 / -1; min-width: 0; }

/* Dual dialogue: a pair side by side, each half 29 of the 60 columns (at
   12pt) with its own indents (paginate.js pageGrid dualFormat). */
.page > .block.dual-left { grid-column: 1; }
.page > .block.dual-right { grid-column: 2; }
.block.dual-left .field--character, .block.dual-right .field--character { margin-left: calc(var(--dual-character-at) / var(--dual-cols) * 100%); width: calc(var(--dual-character-width) / var(--dual-cols) * 100% + 0.5px); }
.block.dual-left .field--parenthetical, .block.dual-right .field--parenthetical { margin-left: calc(var(--dual-parenthetical-at) / var(--dual-cols) * 100%); width: calc(var(--dual-parenthetical-width) / var(--dual-cols) * 100% + 0.5px); }
.block.dual-left .field--text, .block.dual-right .field--text { margin-left: 0; width: calc(var(--dual-dialogue-width) / var(--dual-cols) * 100% + 0.5px); }

.block { position: relative; margin-top: 1.25em; }
.block:first-child { margin-top: 0; }
.block--heading { margin-top: 2.5em; }
.block--heading .field { font-weight: 700; text-transform: uppercase; }
.block--transition .field { text-align: right; text-transform: uppercase; }
.block--shot .field { text-transform: uppercase; }
.block--centered .field { text-align: center; }
.block--act .field { text-align: center; text-transform: uppercase; font-weight: 700; text-decoration: underline; }

/* Exact fractions of the column (paginate.js pageGrid's format), plus
   half a pixel so rounding never wraps a line a character early. */
.block--dialogue .field--character { margin-left: calc(var(--character-at) / var(--cols) * 100%); width: calc(var(--character-width) / var(--cols) * 100% + 0.5px); text-transform: uppercase; }
.block--dialogue .field--parenthetical { margin-left: calc(var(--parenthetical-at) / var(--cols) * 100%); width: calc(var(--parenthetical-width) / var(--cols) * 100% + 0.5px); }
.block--dialogue .field--text { margin-left: calc(var(--dialogue-at) / var(--cols) * 100%); width: calc(var(--dialogue-width) / var(--cols) * 100% + 0.5px); }

.field {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  font: inherit;
  line-height: 1.25;
  resize: none;
  outline: none;
  min-height: 1.25em;
}

/* Block type beside the current line (typepicker.js): a chip in the left
   margin that opens the four types, with what Tab would do under it. The
   paper is its positioning box; 1.5in is the paper's left padding. */
.paper { position: relative; }
/* Where a jump landed (editor.js landed): a tint over the line that fades. */
.landed { position: absolute; z-index: 2; pointer-events: none; border-radius: 6px; background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent); animation: landed 1.8s ease-out forwards; }
@keyframes landed { 0%, 35% { opacity: 1; } 100% { opacity: 0; } }
@media print { .landed { display: none; } }
.type-chip {
  position: absolute;
  right: calc(100% - 1.5in + 12px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  z-index: 5;
}
.type-chip[hidden] { display: none; }
.type-chip__button {
  border: 0;
  background: none;
  padding: 2px 4px 2px 6px;
  margin-top: -1px;
  border-radius: 4px;
  font: 500 11px/16px var(--ui);
  color: var(--focus-mark);
  cursor: pointer;
  white-space: nowrap;
}
.type-chip__button::after { content: " ▾"; font-size: 9px; }
.type-chip__button { background: var(--accent-soft); color: var(--accent-text); }
.type-chip__button:hover, .type-chip__button[aria-expanded=true] { background: var(--accent-soft); filter: brightness(0.95); }
.type-chip__hint { font: 500 11px/1 var(--ui); color: var(--ink-faint); white-space: nowrap; padding-right: 4px; }
.type-chip__hint:empty { display: none; }
.type-chip__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 190px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.type-chip__menu[hidden] { display: none; }
.type-chip__option {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  background: none;
  text-align: left;
  padding: 7px 10px;
  border-radius: 5px;
  font: 13px/1.3 var(--ui);
  color: var(--ink);
  cursor: pointer;
}
.type-chip__option:hover { background: var(--hover); }
.type-chip__option[aria-checked=true] { color: var(--accent); font-weight: 600; }
.type-chip__more { margin: 4px 0 0; padding: 6px 10px 2px; border-top: 1px solid var(--line); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.type-chip__dual { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 5px 5px; }
.type-chip__dual[aria-checked=true] { color: var(--accent); font-weight: 600; }
.type-chip__dual[hidden], .type-dock__dual[hidden] { display: none; }
.type-chip__option kbd { border: 0; background: none; padding: 0; color: var(--ink-faint); font: 12px var(--ui); }

/* On phones: the types in a bar above the keyboard, with undo and redo. */
.type-dock { display: none; }

/* Autocomplete suggestions (autocomplete.js), under the field being typed in. */
.suggest {
  position: fixed;
  z-index: 40;
  min-width: 160px;
  max-width: min(360px, calc(100vw - 16px));
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.suggest[hidden] { display: none; }
.suggest li {
  padding: 6px 10px;
  border-radius: 5px;
  font: 14px/1.3 var(--script);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.suggest li:hover { background: var(--hover); }
.suggest li[aria-selected=true] { background: var(--accent); color: var(--accent-ink); }
.suggest li small { float: right; margin-left: 12px; font: 500 11px/18px var(--ui); opacity: 0.7; }

/* From the script's settings: (CONT'D) after a returning speaker's name, and
   scene numbers in both margins beside headings. */
.contd-mark { position: absolute; color: var(--ink-faint); white-space: nowrap; pointer-events: none; }
.scene-number { position: absolute; top: 0; font-weight: 700; color: var(--ink-soft); pointer-events: none; }
.scene-number--left { right: calc(100% + 0.5in); }
.scene-number--right { left: calc(100% + 0.3in); }

/* Notices: Saving to Google Drive…, Saved, Couldn't save. A card in the
   theme's own colours with a round icon for its kind (data-kind: info, ok,
   warn), rising into place. */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none; /* only the cards take clicks */
  /* (A popover, for the top layer: none of the browser's popover box.) */
  top: auto;
  right: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  overflow: visible;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(460px, calc(100vw - 32px));
  padding: 10px 8px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 12px 32px rgb(0 0 0 / 0.14);
  font: 13px/1.4 var(--ui);
  animation: toast-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
.toast__link[hidden] { display: none; }
.toast__icon {
  --toast-tint: var(--accent);
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--toast-tint) 16%, transparent);
  color: var(--toast-tint);
}
.toast__icon::before {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--toast-glyph) center / contain no-repeat;
  mask: var(--toast-glyph) center / contain no-repeat;
}
.toast[data-kind=info] .toast__icon { --toast-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 11v6M12 7.5v.01'/%3E%3C/svg%3E"); }
.toast[data-kind=ok] .toast__icon { --toast-tint: var(--ok); --toast-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
/* A progress notice: a ring turning in place of the glyph (still, a ring
   with a gap, with reduced motion). */
.toast[data-kind=busy] .toast__icon::before {
  width: 14px;
  height: 14px;
  background: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  -webkit-mask: none;
  mask: none;
  animation: toast-spin 0.8s linear infinite;
}
@keyframes toast-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .toast[data-kind=busy] .toast__icon::before { animation: none; } }
.toast[data-kind=warn] .toast__icon { --toast-tint: var(--warn); --toast-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 7v6M12 16.5v.01'/%3E%3C/svg%3E"); }
.toast__text { flex: 1; min-width: 0; }
.toast__close {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.toast__close:hover { background: var(--accent-soft); color: var(--ink); }

/* Export (and the phone's ⋯ menu): Download and Save to Google Drive each
   open a list of formats. Beside the menu on wide screens (to its left,
   since the menu sits at the right), under the row on phones. */
.submenu > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.submenu > summary::-webkit-details-marker { display: none; }
.submenu > summary:hover, .submenu[open] > summary { background: var(--hover); }
.submenu__chevron { margin-left: auto; color: var(--ink-faint); transition: transform 0.15s; }
.submenu__items { display: flex; flex-direction: column; }
.menu__items .menu__with-icon { display: flex; align-items: center; gap: 10px; }
.menu__icon { flex: none; }
#export-menu .submenu { position: relative; }
#export-menu .submenu__chevron { transform: rotate(180deg); order: -1; margin: 0 -4px 0 -6px; }
#export-menu .submenu > summary { padding-left: 8px; }
#export-menu .submenu__items {
  position: absolute;
  right: calc(100% + 8px);
  top: -5px;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
}
/* Fills the gap to the menu, so the pointer crossing it is still in the list. */
#export-menu .submenu__items::after { content: ""; position: absolute; top: 0; bottom: 0; left: 100%; width: 10px; }
#more-menu .submenu[open] .submenu__chevron { transform: rotate(90deg); }
/* Export › Revision pages: a page set per revision, a submenu like the
   others (app.js showRevisionMenus), its colour where the others have an
   icon and its page count beside the name, as the formats show theirs. */
.revision-set__swatch { width: 12px; height: 15px; margin: 0 2px; border-radius: 2px; border: 1px solid var(--line); background: var(--swatch); }
.submenu > summary small { color: var(--ink-soft); }
#more-menu .submenu__items { padding-left: 26px; }

/* A button that reads as a link, inside a sentence. */
.btn.btn--link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.btn.btn--link:hover { background: none; }

/* Starting up (app.js started): in place of the pages until the first
   script is open, a small script page writing itself line by line, then
   what's happening. Stopped and faded if startup stops short
   (.starting--failed). The pages keep their layout, only hidden, so sheets
   measure right when they're drawn. */
.starting:not(body) { display: none; } /* body has the class too, while starting */
body.starting .starting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 96px 16px 72px;
  text-align: center;
  color: var(--ink-soft);
  font: 14px/1.5 var(--ui);
}
.starting p { margin: 0; max-width: 34em; }
.starting .starting__text { color: var(--ink); font-weight: 500; margin-top: 18px; }
.starting__page {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 92px;
  height: 120px;
  box-sizing: border-box;
  padding: 16px 12px 0 18px;
  background: var(--paper);
  border-radius: 4px;
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
}
.starting__line {
  display: block;
  height: 4px;
  width: 100%;
  border-radius: 2px;
  background: var(--ink-faint);
  opacity: 0.45;
  transform-origin: left;
  animation: starting-write 2.4s ease-in-out infinite;
}
.starting__line--heading { opacity: 0.8; background: var(--ink-soft); }
.starting__line--short { width: 60%; }
.starting__line--name { width: 30%; margin: 4px 0 0 28%; }
.starting__line--speech { width: 62%; margin-left: 14%; }
.starting__line:nth-child(2) { animation-delay: 0.15s; }
.starting__line:nth-child(3) { animation-delay: 0.3s; }
.starting__line:nth-child(4) { animation-delay: 0.45s; }
.starting__line:nth-child(5) { animation-delay: 0.6s; }
.starting__line:nth-child(6) { animation-delay: 0.75s; }
@keyframes starting-write {
  0% { transform: scaleX(0); }
  35%, 80% { transform: scaleX(1); }
  100% { transform: scaleX(1); opacity: 0; }
}
.starting--failed .starting__line { animation: none; }
.starting--failed .starting__page { opacity: 0.5; }
.starting__reload { margin-top: 10px; }
.starting__reload[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .starting__line { animation: none; } }
body.starting .desk > :not(.starting) { visibility: hidden; }
/* No script open (app.js showNothing): this in place of the pages. */
.no-script { display: none; }
body.nothing-open:not(.starting) .no-script { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 96px 16px 72px; text-align: center; font: 14px/1.5 var(--ui); color: var(--ink-soft); }
.no-script p { margin: 0; max-width: 34em; }
.no-script__why:empty { display: none; }
.no-script__text { color: var(--ink); font-size: 16px; font-weight: 500; }
.no-script__actions { display: flex; gap: 8px; margin-top: 6px; }
.no-script__actions[hidden] { display: none; }
body.nothing-open .desk > :not(.no-script):not(.site-foot) { display: none; }
body.nothing-open :is(#title, .title-line, #share, #notes-toggle, #notes-tab, #history-button, #settings-button, #export-menu, #more-menu, #drafts-button, .topbar__rule) { visibility: hidden; }

/* A file dragged over the page (app.js, import). */
.drop-zone { display: none; }
body.dropping .drop-zone {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 3px dashed var(--accent);
}
.drop-zone p {
  font: 600 16px/1.4 var(--ui);
  color: var(--accent-ink);
  background: var(--accent);
  padding: 12px 20px;
  border-radius: 10px;
  margin: 0;
}
.toast__link { color: var(--accent-text); font-weight: 600; white-space: nowrap; }
.toast__action { flex: none; border: 0; background: none; padding: 4px 6px; border-radius: 6px; font: 600 13px var(--ui); color: var(--accent-text); cursor: pointer; white-space: nowrap; }
.toast__action:hover { background: var(--accent-soft); }
.toast__action[hidden] { display: none; }
@media (max-width: 800px) { .editing .toasts { bottom: 80px; } } /* above the phone bar */

/* ---- the editor (editor.js) ----------------------------------------------------
   One editable document; each element is a .block like the line-by-line
   editor's, laid out to the same exact fractions of the page's columns. */
.page.rich { display: block; }
.rich .rich-doc { outline: none; white-space: pre-wrap; word-wrap: break-word; }
.rich .el { min-height: 1.25em; line-height: 1.25; margin-top: 1.25em; }
.rich .el:first-child { margin-top: 0; }
.rich .el-heading { font-weight: 700; text-transform: uppercase; margin-top: 2.5em; }
.rich .el-transition { text-align: right; text-transform: uppercase; }
.rich .el-shot { text-transform: uppercase; }
.rich .el-centered { text-align: center; }
.rich .el-act { text-align: center; text-transform: uppercase; font-weight: 700; text-decoration: underline; }
.rich .el-speech > .field { display: block; min-height: 1.25em; line-height: 1.25; }
.rich .el-character { margin-left: calc(var(--character-at) / var(--cols) * 100%); width: calc(var(--character-width) / var(--cols) * 100% + 0.5px); text-transform: uppercase; }
.rich .el-parenthetical { margin-left: calc(var(--parenthetical-at) / var(--cols) * 100%); width: calc(var(--parenthetical-width) / var(--cols) * 100% + 0.5px); }
.rich .el-line { margin-left: calc(var(--dialogue-at) / var(--cols) * 100%); width: calc(var(--dialogue-width) / var(--cols) * 100% + 0.5px); }
/* Dual dialogue: the page is a two-column grid; a pair takes a column each,
   with the half-column indents (paginate.js DUAL_FORMAT). */
.rich .rich-doc { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(var(--dual-gap) * 1ch); align-items: start; }
.rich .rich-doc > .el { grid-column: 1 / -1; min-width: 0; }
.rich .rich-doc > .dual-left { grid-column: 1; }
.rich .rich-doc > .dual-right { grid-column: 2; }
.rich .dual-left .el-character, .rich .dual-right .el-character { margin-left: calc(var(--dual-character-at) / var(--dual-cols) * 100%); width: calc(var(--dual-character-width) / var(--dual-cols) * 100% + 0.5px); }
.rich .dual-left .el-parenthetical, .rich .dual-right .el-parenthetical { margin-left: calc(var(--dual-parenthetical-at) / var(--dual-cols) * 100%); width: calc(var(--dual-parenthetical-width) / var(--dual-cols) * 100% + 0.5px); }
.rich .dual-left .el-line, .rich .dual-right .el-line { margin-left: 0; width: calc(var(--dual-dialogue-width) / var(--dual-cols) * 100% + 0.5px); }
/* (The line-by-line editor hides an empty parenthetical; here one only
   exists while it has something in it.) */
.rich .block--dialogue .el-parenthetical.field--parenthetical { display: block; }
.rich u { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.rich .is-empty::before { content: attr(data-placeholder); color: var(--ink-faint); pointer-events: none; height: 0; float: left; }
.rich .el-transition.is-empty::before { float: right; }
.rich .el-centered.is-empty::before, .rich .el-act.is-empty::before { float: none; display: block; text-align: center; }
/* Pages as sheets (editor.js sheetGap): between two pages, the foot
   of one, the desk, the top of the next, drawn out to the paper's edges. */
.paper.sheets { min-height: 0; }
.rich .el.starts-page { margin-top: 0; }
.rich .rich-doc > .sheet-gap { grid-column: 1 / -1; }
/* A locked script's cut scene (editor.js, production.js): set like a
   heading, a line of its own, its label in both margins. One a page starts
   with sits right under the sheet gap; the heading after it keeps its
   space even when the page is said to start there. */
.rich .rich-doc > .omitted-line { grid-column: 1 / -1; position: relative; min-height: 1.25em; line-height: 1.25; margin-top: 2.5em; user-select: none; }
.rich .rich-doc > .omitted-line:first-child, .rich .sheet-gap + .omitted-line { margin-top: 0; }
.rich .omitted-line + .el.starts-page { margin-top: 2.5em; }
.scene--omitted .scene__heading { color: var(--ink-soft); }
.scene--omitted .scene__jump:disabled { cursor: default; }
.rich .omitted-line.is-actionable { cursor: pointer; }
.rich .omitted-line.is-actionable:hover { color: var(--accent-text); }
/* A line changed since the last issued revision (editor.js, production.js):
   an asterisk in the right margin, inside the scene numbers. */
.revision-mark { position: absolute; top: 0; left: calc(100% + 0.1in); color: var(--accent-text); font-weight: 700; pointer-events: none; user-select: none; text-decoration: none; }
@media (max-width: 600px) {
  .revision-mark { display: none; } /* no margin for it there */
}

/* Locked pages in their revision's colour (editor.js drawPageTints): layers
   behind the text, inside the paper's own stacking context. */
.paper.has-tints { isolation: isolate; }
.page-tint { position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none; }
/* A Pages tile waiting to go out in the next revision. */
.thumb.is-pending canvas { outline: 2px dashed var(--accent); outline-offset: 1px; }

/* Production dialog (app.js showProduction): a line on where things stand
   (the rest behind its ?), the revisions so far, then the next one. */
.production__lead { margin-bottom: 0; }
.production__rounds { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
.production__round, .production__next { display: flex; align-items: center; gap: 10px; min-height: 34px; font-size: 13px; }
.production__swatch { flex: none; width: 14px; height: 18px; border-radius: 2px; border: 1px solid var(--line); background: var(--swatch); }
.production__swatch--next { border-style: dashed; background: color-mix(in srgb, var(--swatch) 45%, transparent); }
.production__next-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.production__round-name { font-weight: 600; }
.production__round-meta { color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.production__round-download { flex: none; }
.production__next { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.production__next[hidden], .production__legacy[hidden], .production__tint[hidden] { display: none; }
.production__date { flex: none; font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.production__legacy { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.production__tint { margin-top: 12px; font-size: 13px; }
/* Stop revisions on the left; Done, then the main button, on the right. */
.production__foot-gap { flex: 1; }

/* A ? that shows an explanation kept out of the way (app.js, .help-toggle
   with aria-controls naming the .help it opens). */
.help-toggle { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 2px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-soft); font: 600 11px/1 var(--ui); vertical-align: 1px; cursor: pointer; }
.help-toggle:hover, .help-toggle[aria-expanded="true"] { color: var(--accent-text); border-color: var(--accent); }
.help { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--hover); font-size: 13px; color: var(--ink-soft); }
.help[hidden] { display: none; }
.help p { margin: 0; }
.help p + p { margin-top: 6px; }
.sheet-gap { position: relative; display: block; user-select: none; }
.sheet-gap__inner { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; pointer-events: none; text-transform: none; font-weight: 400; text-decoration: none; text-align: left; }
.sheet-gap__end, .sheet-gap__top { position: relative; flex: none; background: var(--paper); }
.sheet-gap__end { border-radius: 0 0 4px 4px; }
.sheet-gap__top { border-radius: 4px 4px 0 0; }
.sheet-gap__desk { flex: none; height: 24px; background: var(--bg); box-shadow: inset 0 7px 8px -8px rgb(0 0 0 / 0.25), inset 0 -7px 8px -8px rgb(0 0 0 / 0.25); }
.sheet-gap__line { line-height: 1.25; text-transform: uppercase; color: var(--ink); white-space: pre; }
.sheet-gap__number { position: absolute; color: var(--ink-soft); line-height: 1.25; white-space: pre; }
/* The draft at the top of the first page (Draft on every page; the others
   have it in their sheet gap's number). */
.paper__header { position: absolute; color: var(--ink-soft); line-height: 1.25; white-space: pre; pointer-events: none; }
.paper__header[hidden] { display: none; }
.sheet-gap__label { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font: 500 10px/1 var(--ui); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.sheet-end { position: relative; display: block; grid-column: 1 / -1; }

/* A shared draft's watermark (watermark.js): the reader's name and email
   across each page and a line at its foot, faint on any theme. The text is
   drawn from data-text, so it's never part of the page's text. */
.watermark { position: absolute; left: 0; top: 0; overflow: hidden; pointer-events: none; user-select: none; }
.watermark__mark { position: absolute; left: 50%; top: 50%; white-space: pre; text-align: center; font-family: Inter, Helvetica, Arial, sans-serif; font-weight: 600; line-height: 1.2; color: rgb(128 128 128 / 0.14); }
.watermark__line--sub { font-size: 0.55em; } /* watermark.js SUB_SCALE */
.watermark__foot { position: absolute; left: 0; right: 0; padding: 0 0.5in; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 7.5pt/1.2 var(--ui); color: rgb(128 128 128 / 0.8); }
.watermark__line::after, .watermark__line--sub::after, .watermark__foot::after { content: attr(data-text); }
.history__page { position: relative; }
/* The editor's pages (editor.js): page 1's in the paper, the others in the
   sheet gap leading into them, the feet at each page's end; with page
   breaks hidden, a tile repeated down the paper. */
.paper .watermark { z-index: 1; } /* over the next page's foot and blank lines, which are drawn in paper colour */
.is-watermarked [data-export="docx"], .is-watermarked [data-export="fountain"], .is-watermarked [data-export="scriptreadr"],
.is-watermarked [data-export="fdx"], .is-watermarked [data-drive="fdx"],
.is-watermarked [data-drive="docx"], .is-watermarked [data-drive="fountain"] { display: none; } /* app.js MARKED_EXPORTS */
.paper.watermarked:not(.sheets) { background-image: var(--watermark-tile); background-size: 100% auto; background-repeat: repeat-y; }
.rich .contd-mark { position: static; margin-left: 1ch; user-select: none; }
.rich .ProseMirror-focused .has-caret .scene-number--left { visibility: hidden; } /* the type chip sits there */


/* Bold / italic / underline beside the type chip. */
.type-chip__format { display: flex; gap: 2px; margin-top: 2px; }
.type-chip__mark {
  width: 24px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink-soft);
  font: 600 12px/1 var(--script);
  cursor: pointer;
}
.type-chip__mark--italic { font-style: italic; }
.type-chip__mark--underline { text-decoration: underline; }
.type-chip__mark:hover { background: var(--hover); color: var(--ink); }
.type-chip__mark[aria-pressed=true] { background: var(--accent-soft); color: var(--accent-text); }
.type-chip__mark:disabled { opacity: 0.35; cursor: default; background: none; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.check input { margin: 0; accent-color: var(--accent); }

/* ---- Share (share.js) ------------------------------------------------------- */

.share-dialog h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-dialog .dialog__head form { display: contents; }
.share__invite, .share__link { display: flex; gap: 8px; }
.share__invite input, .share__invite select, .share__link select, .share__role-select {
  font: 14px/1.4 var(--ui);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  min-width: 0;
}
.share__invite input { flex: 1; }
.share__link select { flex: 1; }
.share__invite input:focus, .share__invite select:focus, .share__link select:focus, .share__role-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.share__sent { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; color: var(--ink); }
.share__sent a { color: var(--accent-text); font-weight: 600; }
.share__label { margin: 4px 0 -6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.share__people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.share__update { display: flex; align-items: center; gap: 8px; }
.share__update[hidden] { display: none; }
.share__saved { flex: 1; margin: 0; font-size: 12px; color: var(--ok); }
.share__saved:not(:empty)[data-state=""]::before { content: "✓ "; }
.share__saved[data-state="pending"] { color: var(--ink-soft); }
.share__saved[data-state="error"] { color: var(--danger); }
.share__person.is-changed .share__role-select, .share__link select.is-changed { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.share__person { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.share__avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.share__avatar img { width: 100%; height: 100%; object-fit: cover; }
.share__who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.share__name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share__detail { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share__role { font-size: 13px; color: var(--ink-soft); }
.share__role-select { padding: 5px 8px; font-size: 13px; }
@media (max-width: 600px) {
  .share__invite { flex-wrap: wrap; }
  .share__invite input { flex-basis: 100%; }
  .share__invite select { flex: 1; }
}

/* Fixed drafts (drafts.js): the list in Share, and the draft dialog. */
.share__drafts, .share-dialog [data-step] { display: flex; flex-direction: column; gap: 14px; }
.share__drafts[hidden], .share-dialog [data-step][hidden] { display: none; }
.drafts__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.drafts__list:empty { display: none; }
.drafts__history { align-self: flex-start; flex: none; display: inline-flex; align-items: center; gap: 6px; } /* with the top bar's History clock */
.drafts__choices { display: flex; flex-direction: column; gap: 8px; }
.drafts__choice { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.drafts__choice:hover, .drafts__choice:focus-visible { border-color: var(--accent); }
.drafts__choice-title { font-size: 14px; font-weight: 600; }
.drafts__choice-about { font-size: 12px; color: var(--ink-soft); }
/* In place of a draft that's out: a box with its ticks and its own button. */
.drafts__choice--box { gap: 8px; cursor: default; }
.drafts__choice--box:hover { border-color: var(--line); }
.drafts__choice--box:focus-within { border-color: var(--accent); }
.drafts__choice--box .drafts__choice-about { margin-top: -6px; }
.drafts__choice--box .btn { align-self: flex-start; margin-top: 2px; }
.drafts__notify { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-soft); }
.drafts__notify[hidden] { display: none; }
/* The Share draft dialog's watermark: a small page showing it, with the owner's own name. */
.draft-mark { display: flex; gap: 12px; align-items: flex-start; }
.draft-mark__about { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.draft-mark__about .dialog__note { margin: 0; }
.draft-mark__preview { position: relative; flex: none; width: 68px; height: 88px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 9px, color-mix(in srgb, var(--ink) 12%, transparent) 9px 11px); background-size: 70% 100%; background-position: 50% 14px; background-repeat: no-repeat; }
.draft-mark__preview.is-off .watermark { display: none; }
.draft-mark__preview .watermark__mark { color: rgb(128 128 128 / 0.45); }
.draft-mark__preview .watermark__foot { padding: 0 4px; font-size: 3px; }
.drafts__remove { flex: none; }
.share-dialog [data-step] .dialog__foot form { display: contents; }

/* ---- Your scripts (scripts.js) --------------------------------------------- */

.dialog.scripts-dialog { width: min(760px, calc(100vw - 32px)); height: min(720px, calc(100vh - 64px)); }
.scripts-dialog .dialog__body { height: 100%; min-height: 0; }
.scripts-dialog .dialog__head form { display: contents; }
/* The search keeps room to read what's typed (2026-10-20: with six controls
   it shrank to a few letters); the rest wrap under it when the dialog is narrow. */
.scripts-dialog__bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Heading row: where you are, then Import and New, then ×. */
.scripts-dialog .dialog__head { gap: 8px; }
.scripts-dialog__adds { flex: none; margin-left: auto; display: flex; gap: 8px; align-items: center; }
[data-new-folder][hidden] { display: none; }
.import-menu .menu__items { z-index: 5; min-width: 200px; }
.import-menu .menu__items button { display: flex; align-items: center; gap: 10px; }
.menu__icon { flex: none; }
.scripts-dialog__search, .scripts-dialog__sort {
  font: 14px/1.4 var(--ui);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  min-width: 0;
}
.scripts-dialog__search { flex: 1 1 240px; }
.scripts-dialog__search:focus, .scripts-dialog__sort:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.script-cards { list-style: none; margin: 0 -8px; padding: 0 8px; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.script-card { position: relative; display: flex; align-items: center; border-radius: 10px; }
.script-card { flex-wrap: wrap; }
.script-card:hover, .script-card[aria-selected=true] { background: var(--hover); }
.script-card[aria-selected=true] { box-shadow: inset 0 0 0 1px var(--line); }
/* The selected card opens up (scripts.js more): the whole logline, then
   who edited it last, who has it, the main characters, and Open. */
.script-card[aria-selected=true] .script-card__logline { display: block; }
.script-card--mine[aria-selected=true]:has(.script-card__people) .script-card__shared { display: none; }
.script-card:not([aria-selected=true]) .script-card__more { display: none; } /* (built once, kept) */
.script-card__more { flex-basis: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 12px 12px 82px; font-size: 12px; color: var(--ink-soft); }
.script-card__people, .script-card__cast { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.script-card__person { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 2px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); }
.script-card__person--invited { border-style: dashed; }
.script-card__person--link { padding: 3px 9px; color: var(--ink-soft); }
.script-card__face { position: relative; overflow: hidden; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 10px; font-weight: 600; }
.script-card__face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.script-card__label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); margin-right: 2px; }
.script-card__character { font-family: "Courier Prime", "Courier New", monospace; font-size: 12px; color: var(--ink); }
.script-card__lines { margin-left: 4px; font-family: inherit; color: var(--ink-faint); }
.script-card__character:not(:last-child)::after { content: "·"; margin-left: 6px; color: var(--ink-faint); }
.script-card__go { flex: none; margin-top: 2px; }
.script-card__more-cast { padding: 0 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-soft); font: inherit; font-size: 11px; line-height: 18px; cursor: pointer; }
.script-card__more-cast:hover { color: var(--ink); border-color: var(--ink-faint); }
.script-card.is-open { background: var(--accent-soft); }
.script-card__open { flex: 1; min-width: 0; display: flex; gap: 14px; align-items: center; padding: 10px; border: 0; background: none; text-align: left; color: inherit; cursor: pointer; border-radius: 10px; }
.script-card__cover { flex: none; width: 58px; aspect-ratio: 8.5 / 11; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgb(0 0 0 / 0.12); }
.script-card__cover canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; } /* an A4 page is a little taller than the box */
.script-card__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.script-card__title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-card__badge { flex: none; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-text); background: var(--surface); border-radius: 4px; padding: 2px 6px; }
.script-card__by { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-card__logline { font-size: 13px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.script-card__meta { font-size: 12px; color: var(--ink-faint); }
.script-card__shared { font-size: 12px; color: var(--accent-text); }
/* What a card is (scripts.js): a draft someone sent, a script shared with
   me; New on what's been shared since I last opened it. */
.script-card__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.script-card__kind { flex: none; font-size: 11px; font-weight: 600; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; }
.script-card__kind--draft { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.script-card--draft .script-card__cover { outline: 2px solid var(--accent); outline-offset: 2px; }
.script-card__new { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--accent-text); }
.script-card__new::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.scripts-button { position: relative; }
.scripts-dot { position: absolute; top: -6px; right: -6px; margin: 0; box-shadow: 0 0 0 2px var(--surface); }
.scripts-dot[hidden] { display: none; }
/* Edits kept on this device, not in the account yet: the status line's crossed-out cloud. */
.script-card__unsynced { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.script-card__unsynced::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 5px;
  vertical-align: -2px;
  background: currentColor;
  -webkit-mask: var(--icon-offline) center / contain no-repeat;
  mask: var(--icon-offline) center / contain no-repeat;
}
.script-card__draft { font-size: 12px; color: var(--ink-soft); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-card__actions { flex: none; display: flex; gap: 2px; padding-right: 8px; opacity: 0; }
.script-card:hover .script-card__actions, .script-card[aria-selected=true] .script-card__actions, .script-card__actions:focus-within { opacity: 1; }
.script-card__action { border-color: transparent; background: none; color: var(--ink-soft); }
.script-card__action[hidden] { display: none; }
.script-card__action:hover { color: var(--ink); background: var(--surface); }
.script-card__delete:hover { color: var(--danger); }
.script-cards__empty { text-align: center; padding: 32px 0; }
/* Show › Trash (trash.js): the cards can't be opened, only restored or
   deleted for good, so those two always show. */
.script-cards--trash .script-card__open { cursor: default; }
.script-cards--trash .script-card__cover { opacity: 0.6; }
.script-cards--trash .script-card__actions { opacity: 1; }
.scripts-dialog__trash { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.scripts-dialog__trash[hidden] { display: none; }
.scripts-dialog__trash .btn { flex: none; }
/* The foot: where the scripts are kept (signed out) and the Trash link. */
.scripts-dialog__foot { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.scripts-dialog__foot:not(:has(> :not([hidden]))) { display: none; }
.scripts-dialog__trash-link { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.scripts-dialog__trash-link[hidden] { display: none; }
.scripts-dialog__count { min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--hover); color: var(--ink-soft); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
/* Folders (scripts.js, folders.js): a folder's card has a folder where
   a script's has its first page; opened, its name heads the list and the
   Show / sort menus go. */
.folder-card__folder { flex: none; position: relative; display: grid; place-items: center; width: 58px; aspect-ratio: 8.5 / 11; }
.folder-card__folder svg { width: 58px; height: auto; overflow: visible; }
.folder-card__back { fill: color-mix(in srgb, var(--accent) 55%, var(--surface)); }
.folder-card__front { fill: var(--accent); }
.script-cards--trash .folder-card__folder { opacity: 0.6; }
.folder-card__titles { white-space: nowrap; }
.script-card__kind--folder { color: var(--accent-text); border-color: var(--accent-soft); background: var(--accent-soft); }
.script-card.is-drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.script-card.is-dragged { opacity: 0.5; }
.script-card.is-drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.script-card.is-drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.script-cards__season { padding: 10px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
/* Inside a folder, the heading says where you are: ‹ Script Library /
   Game of Thrones · Series ⋯ (the ⋯ holds Rename and Move to Trash). */
.library-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.library-crumbs[hidden], .scripts-dialog #scripts-heading[hidden] { display: none; }
/* (Also by the class: the heading and New folder never show inside a
   folder, whatever script a cached page runs.) */
.scripts-dialog.is-in-folder #scripts-heading, .scripts-dialog.is-in-folder [data-new-folder] { display: none; }
/* The way back is just ‹, so the folder's name gets the room (2026-10-20:
   with "‹ Script Library /" before it, it was cut to "Game of …"). */
.library-crumbs__back { flex: none; margin-left: -6px; color: var(--ink-soft); }
.library-crumbs__back:hover { color: var(--ink); }
.dialog__head .library-crumbs__name { flex: 0 1 auto; min-width: 0; line-height: 1.25; overflow-wrap: anywhere; } /* (a long one wraps rather than being cut) */
.library-crumbs .script-card__kind { flex: none; }
.library-crumbs__menu { flex: none; }
.library-crumbs__menu .menu__items { right: 0; z-index: 6; min-width: 180px; } /* (opens leftwards: on a phone the ⋯ is near the edge) */
.menu__items .menu__danger { color: var(--danger); }
.scripts-dialog.is-in-folder [data-show], .scripts-dialog.is-in-folder [data-sort-by] { display: none; }
.folder-menu { position: fixed; inset: auto; margin: 0; z-index: 10; min-width: 220px; max-height: 60vh; overflow-y: auto; color: var(--ink); }
.folder-menu:not(:popover-open) { display: none; } /* (as .scene-menu: .menu__items' display: flex outranks the browser's hiding) */
.folder-menu button { display: flex; align-items: baseline; gap: 8px; color: var(--ink); font: 14px/1.4 var(--ui); }
.folder-menu button[aria-checked=true] { font-weight: 600; cursor: default; }
.folder-menu button[aria-checked=true]::before { content: "✓"; }
.folder-menu small { margin-left: auto; }
.folder-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; border: 0; }
.folder-kind { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.folder-kind:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.folder-kind input { margin: 2px 0 0; accent-color: var(--accent); }
.folder-kind__name { font-weight: 600; }
.folder-kind__about { grid-column: 2; font-size: 12px; color: var(--ink-soft); }
@media (max-width: 600px) {
  .folder-kinds { grid-template-columns: 1fr; }
  .folder-card__folder, .folder-card__folder svg { width: 46px; }
  .dialog.scripts-dialog { height: 100dvh; }
  .scripts-dialog__bar { flex-wrap: wrap; }
  .scripts-dialog__search { flex-basis: 100%; }
  /* (Import and New under the heading, not squeezed beside it.) */
  .scripts-dialog .dialog__head { flex-wrap: wrap; }
  .scripts-dialog__adds { order: 3; flex-basis: 100%; justify-content: flex-end; }
  /* A card's buttons under its text, which then has the width to read. */
  .script-card__actions { flex-basis: 100%; justify-content: flex-end; padding: 0 8px 8px; }
  .script-card__title { flex-wrap: wrap; white-space: normal; }
  .script-card__name { overflow: visible; overflow-wrap: anywhere; }
  .scripts-dialog__sort { flex: 1; }
  .script-card__actions { opacity: 1; }
  .script-card__cover { width: 46px; }
}

/* ---- dialogs: title page, character breakdown ---------------------------- */

.dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.dialog--wide { width: min(640px, calc(100vw - 32px)); }
/* Importing (app.js busy): the whole window, in the desk's colour, with
   the starting screen's page writing itself, what's happening and how far
   along (a bar by pages). */
.busy-dialog {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--ink-soft);
}
.busy-dialog[open] { display: flex; align-items: center; justify-content: center; }
.busy-dialog::backdrop { background: var(--bg); }
.busy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  padding-bottom: 8vh;
  text-align: center;
  font: 14px/1.5 var(--ui);
}
.busy__heading { margin: 18px 0 0; color: var(--ink); font: 500 14px/1.5 var(--ui); overflow-wrap: anywhere; }
.busy__text { margin: 0; min-height: 1.5em; }
.busy__bar {
  width: 160px;
  height: 3px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.busy__bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
.busy__bar[hidden] { display: block; visibility: hidden; } /* (keeps its place, so nothing jumps) */
.busy .btn { margin-top: 14px; }
/* Are you sure? (app.js ask) */
.dialog.ask-dialog { width: min(420px, calc(100vw - 32px)); }
.ask-dialog .dialog__note { color: var(--ink); font-size: 14px; line-height: 1.5; white-space: pre-line; }
.ask-dialog .dialog__foot { justify-content: flex-end; }
.ask__list { margin: 0 0 12px; padding-left: 20px; font-size: 14px; color: var(--ink-soft); }
.ask__list[hidden] { display: none; }
.ask__list li + li { margin-top: 4px; }

/* Script settings: one row each, what it does under its name. */
.setting { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.setting[hidden] { display: none; }
.setting__input { width: 6em; font: 14px/20px var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.setting__input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.setting__wide { grid-column: 1 / -1; justify-self: start; }
.setting__wide[hidden] { display: none; }
.setting__main { font-size: 14px; font-weight: 500; color: var(--ink); }
.setting__control { display: flex; gap: 8px; align-items: center; }
.setting__control .btn--small { flex: none; }
.setting__about { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--ink-soft); }
.setting--check { grid-template-columns: auto 1fr; cursor: pointer; }
.setting--check input { margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.setting--check .setting__about { grid-column: 2; }
.settings__readonly[hidden] { display: none; }

/* ---- version history (history.js) ------------------------------------------
   The versions down the left, the chosen one's pages on the right (on
   phones, one above the other). Sheets are laid out at full size, as they
   print, and scaled down to fit. */
.history-dialog { width: min(1100px, calc(100vw - 32px)); height: calc(100vh - 64px); }
.history-dialog__body { height: 100%; box-sizing: border-box; min-height: 0; }
.history__save { display: flex; gap: 8px; }
.history__save[hidden] { display: none; }
.history__save input { flex: 1; min-width: 0; font: 14px/1.4 var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
.history__save input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.history__body { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.history__side { min-height: 0; overflow-y: auto; border-right: 1px solid var(--line); padding-right: 8px; }
.history__status[hidden] { display: none; }
.history__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.history__day { margin: 10px 0 2px; padding: 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
.history__empty { padding: 8px; font-size: 13px; color: var(--ink-soft); }
.history__pick { width: 100%; display: flex; flex-direction: column; gap: 2px; border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.history__pick:hover { background: var(--hover); }
.history__pick[aria-current=true] { background: var(--accent-soft); }
.history__when { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; font-size: 13px; font-weight: 500; }
.history__name { font-weight: 600; color: var(--accent-text); overflow-wrap: anywhere; }
.history__name--restore { font-weight: 500; color: var(--ink-soft); }
.history__draft { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--accent-text); }
.history__draft::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.history__facts { font-size: 12px; color: var(--ink-soft); }
.history__preview { min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.history__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.history__heading { min-width: 0; }
.history__title { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.history__meta { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); }
.history__rename { font: 600 15px/1.3 var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; width: min(360px, 100%); }
.history__actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* Show changes (history.js, diff.js). */
.history__compare { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--ink-soft); }
.history__compare[hidden], .history__compare [hidden] { display: none; }
.history__toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); cursor: pointer; }
.history__compare select { font: inherit; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.history__summary { font-weight: 500; }
.history__steps { display: inline-flex; align-items: center; gap: 4px; }
.history__steps[hidden] { display: none; }
.history__steps .btn--icon { width: 26px; height: 26px; font-size: 16px; line-height: 1; }
.history__steps [data-change-at] { min-width: 4.5em; text-align: center; font-variant-numeric: tabular-nums; }
/* The change stepped to: a soft band behind its lines. */
.history__sheets .print-line.is-current { box-shadow: 0 0 0 3px rgb(59 91 219 / 0.35); border-radius: 2px; background: rgb(59 91 219 / 0.08); }
.history__count { color: var(--ink-soft); }
/* On the pages: always black on white paper, so fixed colours. */
.history__sheets ins { text-decoration: none; background: #c3f0cc; color: #0b5d1e; }
.history__sheets del { text-decoration: line-through; text-decoration-thickness: 1.5px; color: #c92a2a; background: #ffe3e3; }
.history__sheets .print-line--added::before, .history__sheets .print-line--removed::before, .history__sheets .print-line--changed::before, .history__sheets .print-line--moved::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 4px; left: calc(-0.3in - var(--indent-at, 0in)); background: #f59f00;
}
.history__sheets .print-line--added::before { background: #2f9e44; }
.history__sheets .print-line--removed::before { background: #e03131; }
.history__sheets .print-line--moved::before { background: #9c36b5; } /* (a scene moved, nothing in it changed) */
.history__actions .btn--small { flex: none; }
.history__actions [hidden] { display: none; }
.history__sheets { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 4px 1px 16px; background: var(--bg); border-radius: 8px; }
.history__sheet { flex: none; }
.history__page { width: var(--paper-width); min-height: var(--paper-height); box-sizing: border-box; padding: 0.5in var(--margin-right) 1in 1.5in; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); border-radius: 4px; transform-origin: top left; }
/* A script page, as print lays it out (the @media print rules below). */
.history__page .print-sheet { position: relative; height: calc(var(--page-body) + 0.5in); font: var(--script-size)/1 var(--script); }
.history__page .print-sheet__number { position: absolute; top: 0.25in; right: 0; white-space: pre; }
.history__page .print-sheet__body { position: absolute; top: 0.5in; left: 0; width: 6in; height: var(--page-body); }
.history__page .print-line { position: absolute; white-space: pre; line-height: var(--script-line); }
.history__page .print-line--heading { font-weight: 700; }
.history__page .print-line--act { font-weight: 700; text-decoration: underline; }
.history__page .print-scene-number { position: absolute; font-weight: 700; line-height: var(--script-line); }
.history__page .print-scene-number--left { right: calc(100% + 0.5in); }
.history__page .print-scene-number--right { left: calc(100% + 0.3in); }
.history__page .print-revised { position: absolute; left: calc(100% + 0.1in); line-height: var(--script-line); }
@media (max-width: 700px) {
  .history__body { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 35%) 1fr; }
  .history__side { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
}

/* ---- drafts (drafts.js) --------------------------------------------------
   The top bar's Drafts button, with a dot for readers' notes not seen yet;
   the Drafts dialog laid out like the history, the chosen draft's pages
   beside its notes. */
.drafts-button { position: relative; }
.drafts-button[hidden], [data-drafts-open][hidden] { display: none; }
.drafts-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.drafts-dot[hidden] { display: none; }
.drafts-dialog { width: min(1320px, calc(100vw - 32px)); }
.drafts__intro { margin: -4px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.drafts__intro[hidden], .history__save[hidden] { display: none; }
.drafts__editors { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); cursor: pointer; }
.drafts__status[hidden] { display: none; }
.drafts__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.drafts__empty { padding: 8px; font-size: 13px; color: var(--ink-soft); }
.drafts__pick { width: 100%; display: flex; flex-direction: column; gap: 2px; border: 0; background: none; text-align: left; padding: 8px; border-radius: 6px; cursor: pointer; color: var(--ink); font: inherit; }
.drafts__pick:hover { background: var(--hover); }
.drafts__pick[aria-current=true] { background: var(--accent-soft); }
.drafts__row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.drafts__row-name { font-size: 14px; font-weight: 600; color: var(--accent-text); overflow-wrap: anywhere; }
.drafts__row-date, .drafts__facts { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.drafts__reach { font-size: 12px; color: var(--ink-soft); font-style: italic; }
.drafts__reach.is-sent { color: var(--ink); font-style: normal; }
.drafts__notes-line { font-size: 12px; color: var(--ink-soft); }
.drafts__notes-line:empty { display: none; }
.drafts__notes-line.has-new { color: var(--accent-text); font-weight: 600; }
.drafts__preview[hidden] { display: none; }
.drafts__review { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
.drafts__notes { min-height: 0; display: flex; flex-direction: column; gap: 8px; border-left: 1px solid var(--line); padding-left: 12px; }
.drafts__notes-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.drafts__notes-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.drafts__filters { display: inline-flex; gap: 4px; }
.drafts__filters .btn[aria-pressed=true] { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.drafts__notes-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.draft-note { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.draft-note.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.draft-note.is-resolved { opacity: 0.7; }
.draft-note__quote { border: 0; background: none; padding: 0; text-align: left; font: italic 12px/1.4 var(--ui); color: var(--ink-soft); cursor: pointer; overflow-wrap: anywhere; }
.draft-note__quote:hover { color: var(--ink); }
.draft-note__entry + .draft-note__entry { border-top: 1px solid var(--line); padding-top: 6px; }
.draft-note__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12px; }
.draft-note__by { font-weight: 600; }
.draft-note__at { color: var(--ink-soft); }
.draft-note__new { padding: 0 6px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 600; line-height: 16px; }
.draft-note__private { color: var(--ink-soft); font-style: italic; }
.draft-note__text { margin: 2px 0 0; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.draft-note__state { margin: 0; font-size: 12px; color: var(--warn); }
.draft-note__actions { display: flex; flex-wrap: wrap; gap: 4px; }
.draft-note__reply { display: flex; flex-direction: column; gap: 6px; }
.draft-note__reply textarea { font: 13px/1.4 var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.drafts__sheets .print-line.is-noted { background: color-mix(in srgb, var(--warn) 18%, transparent); border-radius: 2px; cursor: pointer; }
.drafts__sheets .print-line.is-noted.is-active { background: color-mix(in srgb, var(--warn) 38%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 60%, transparent); }
#draft-dialog .dialog__foot form { margin-left: auto; }
.share__drafts-access { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.share__drafts-access.is-changed { color: var(--accent-text); font-weight: 500; }
#draft-dialog [data-draft-stop][hidden] { display: none; }
@media (max-width: 1000px) {
  .drafts__review { grid-template-columns: 1fr; grid-template-rows: 1fr minmax(160px, 40%); }
  .drafts__notes { border-left: 0; border-top: 1px solid var(--line); padding: 8px 0 0; }
}
@media (max-width: 700px) {
  .drafts-dialog .history__body { grid-template-rows: minmax(100px, 25%) 1fr; }
}
.dialog::backdrop { background: rgb(10 12 16 / 0.45); }
.dialog__body { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; }
.dialog__head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.dialog__head .btn--icon { border-color: transparent; }
.dialog__foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.btn--quiet { border-color: transparent; color: var(--ink-soft); }
.btn--quiet:hover { color: var(--ink); }
/* Remove page in the template page dialogs: a real button, red on hover
   (the page goes, what was written stays). */
.btn--remove { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.btn--remove:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.dialog__note { margin: 0; color: var(--ink-soft); font-size: 13px; }

.form-row { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-weight: 400; color: var(--ink-faint); margin-top: -2px; }
.form-hint:empty { display: none; }
.form-check { display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }
.form-row .form-check input { padding: 0; margin: 0; }
.authors { display: flex; flex-direction: column; gap: 6px; }
.authors__row { display: grid; grid-template-columns: 9.5em 1fr 30px; gap: 6px; align-items: center; }
.authors__row select, .authors__row input { font: 14px/1.4 var(--ui); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
.authors__row select:focus, .authors__row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.authors__row .btn--icon { width: 30px; height: 30px; border-color: transparent; }
.authors__row .btn--icon[hidden] { display: none; }
.authors__add { align-self: flex-start; }
.form-row input, .form-row textarea, .breakdown textarea {
  font: 14px/1.4 var(--ui);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  resize: vertical;
}
.form-row input:focus, .form-row textarea:focus, .breakdown textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.breakdown__person { display: flex; flex-direction: column; gap: 4px; }
.breakdown__head { display: flex; align-items: flex-start; gap: 6px; }
.breakdown__who { flex: 1; min-width: 0; }
/* Drag handle: arrow keys move too (dialogs.js openCharacters). */
.breakdown__handle { flex: none; display: grid; place-items: center; width: 24px; height: 30px; margin-left: -6px; border: 0; border-radius: 5px; background: none; color: var(--ink-faint); cursor: grab; touch-action: none; }
.breakdown__handle path { stroke-width: 3; }
.breakdown__handle:hover { background: var(--hover); color: var(--ink); }
.breakdown__handle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.breakdown__actions { display: flex; align-items: center; gap: 2px; flex: none; }
.breakdown__pick { font-size: 12px; padding: 4px 6px; }
.breakdown__actions .btn--icon { width: 30px; height: 30px; border-color: transparent; }
.breakdown__person.is-dragging { position: relative; z-index: 1; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); outline: 1px solid var(--line); }
.breakdown__person.is-dragging .breakdown__handle { cursor: grabbing; }
.breakdown__person.is-off .breakdown__name, .breakdown__person.is-off textarea { opacity: 0.55; }
.breakdown__group { margin-top: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.breakdown__group:first-child { margin-top: 0; }
.breakdown__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.breakdown__sort { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.breakdown__sort .btn--small { flex: none; }
.breakdown__sort .btn[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-text); }
.breakdown__sort-label, .breakdown__own { font-size: 12px; color: var(--ink-soft); }
.breakdown__own[hidden] { display: none; }
.breakdown__name { font: 700 14px var(--script); text-transform: uppercase; }
/* Rename sits on the name's line, so it reads as being about the name. */
.breakdown__title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.breakdown__rename-button { border: 0; background: none; padding: 2px 6px; border-radius: 5px; font: 500 12px/1.2 var(--ui); color: var(--accent-text); cursor: pointer; }
.breakdown__rename-button:hover { background: var(--accent-soft); }
.breakdown__stats { font-size: 12px; color: var(--ink-soft); }
/* Other names the person speaks under (Same person as…). */
.breakdown__aliases { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.breakdown__aliases:empty { display: none; }
.breakdown__alias { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.breakdown__alias-name { font-family: var(--script); }
/* Same person as…: a dropdown that reads like the Rename link beside it;
   "Another name…" swaps in the small box in its place. */
.breakdown__same { max-width: 11em; border: 0; background: none; padding: 2px 4px; border-radius: 5px; font: 500 12px/1.2 var(--ui); color: var(--accent-text); cursor: pointer; }
.breakdown__same:hover { background: var(--accent-soft); }
.breakdown__same:focus-visible, .breakdown__same-name:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.breakdown__same option { color: var(--ink); background: var(--surface); }
/* One line when empty, growing as it's written (dialogs.js fit where
   field-sizing is missing). */
.breakdown textarea { field-sizing: content; min-height: 2.4em; resize: none; overflow: hidden; }
.breakdown__more .menu__items { min-width: 190px; z-index: 2; }
.breakdown__more summary { width: 30px; height: 30px; border-color: transparent; }
.breakdown__show-lines { margin-right: auto; margin-left: 4px; }
@media (max-width: 600px) {
  /* The group and ⋯ go under the name and stats, so the name keeps the line. */
  .breakdown__head { flex-wrap: wrap; }
  .breakdown__actions { order: 3; width: 100%; padding-left: 18px; }
  .breakdown__pick { flex: 1; max-width: 220px; }
  .breakdown__more { margin-left: auto; }
  .breakdown__tools, .dialog__foot:has(.breakdown__show-lines) { flex-wrap: wrap; }
}
.breakdown__same-name { width: 11em; padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--ink); font: 700 12px/1.3 var(--script); text-transform: uppercase; }
.breakdown__empty[hidden], .breakdown__done[hidden] { display: none; }
.breakdown__done { color: var(--ok); }
.breakdown__rename { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 8px; background: var(--hover); }
.breakdown__rename input[type=text] { font: 700 14px/1.4 var(--script); text-transform: uppercase; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
.breakdown__rename input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.breakdown__rename-actions { display: flex; gap: 6px; }
.breakdown__rename-actions .btn--small { flex: none; }

/* ---- small screens ------------------------------------------------------- */

@media (max-width: 800px) {
  .type-chip { display: none; }
  .scene-number { display: none; } /* no room in the margins */
  .note-pin { display: none; } /* nor for notes' pins: the Notes tab lists them */
  .history { display: none; } /* undo / redo move to the bar over the keyboard */
  .title-wrap { flex: 1; } /* nothing beside it on the left, so it takes the room as before */
  .topbar__gap { display: none; }
  .type-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .type-dock[hidden] { display: none; }
  .type-dock__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 32px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--ink);
  }
  .type-dock__icon:disabled { opacity: 0.35; }
  .type-dock__gap { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--line); }
  .type-dock__format { display: flex; flex: none; }
  .type-dock__format .type-chip__mark { width: 26px; height: 34px; font-size: 14px; }
  /* Each takes room by its word (Dialogue needs more than Scene); a word that
     still doesn't fit ends in "…" inside its own highlight, never past it. */
  .type-dock__type {
    flex: 1 1 auto;
    min-width: 0;
    height: 34px;
    border: 0;
    border-radius: 6px;
    background: none;
    padding: 0 4px;
    font-size: 12px;
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .type-dock__menu {
    position: absolute;
    right: 8px;
    bottom: calc(100% + 6px);
    min-width: 170px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
  }
  .type-dock__menu[hidden] { display: none; }
  .type-dock__option { border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 6px; font-size: 14px; color: var(--ink); }
  .type-dock__option[aria-checked=true] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
  .type-dock__type[aria-pressed=true] { background: var(--accent-soft); color: var(--accent-text); text-shadow: 0 0 0.5px currentColor; } /* bold without getting wider */
  .editing .desk { padding-bottom: 72px; }
  #toggle-sidebar { display: inline-grid; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(280px, 85vw);
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: var(--shadow);
  }
  .sidebar-open .sidebar { transform: none; }
  .notes-side {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 30;
    width: min(300px, 88vw);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.2s, visibility 0.2s;
    box-shadow: var(--shadow);
  }
  .notes-open .notes-side { transform: none; visibility: visible; }
  /* Phones: a tab only on an open drawer's edge (the top bar opens them). */
  .edge-tab { position: fixed; z-index: 30; display: none; transition: none; }
  .sidebar-open .edge-tab--left { display: grid; left: min(280px, 85vw); }
  .sidebar-collapsed .edge-tab--left { left: min(280px, 85vw); }
  .notes-open .edge-tab--right:not([hidden]) { display: grid; right: min(300px, 88vw); }
  .paper { padding: 0.75in 0.5in 0.75in 1in; min-height: 0; }
}

@media (max-width: 600px) {
  /* Two rows on purpose: the buttons along the top, then the title and
     status with whoever else is here, so the title isn't squeezed. */
  .topbar { flex-wrap: wrap; gap: 4px; padding: 8px 12px; }
  .topbar::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
  .topbar__gap { display: block; }
  .title-wrap { order: 2; flex: 1 1 0; }
  .peers { order: 2; }
  .dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  /* The welcome is short: a centred card, not a whole screen of blank. */
  /* fit-content, not auto: a modal dialog is pinned top and bottom, so auto stretches it. */
  .dialog.welcome { width: calc(100vw - 32px); height: fit-content; max-height: calc(100dvh - 32px); margin: auto; border: 1px solid var(--line); border-radius: 12px; }
  .form-pair { grid-template-columns: 1fr; }
  .desk { padding: 16px 0 32px; }
  /* Room at each page's top for its number or draft line (drawn at half the
     top padding), which 24px left sitting on the first line. */
  .paper { border-radius: 0; padding: 44px 16px 24px; font-size: calc(14px * var(--script-scale)); }
  .watermark__foot { padding: 0 16px; }
  /* Table read's ‹ Read as › floats at the foot, under the thumb, instead
     of crowding the top bar; above the type bar while that's up. */
  .reading-bar {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 24;
    bottom: calc(16px + env(safe-area-inset-bottom));
    gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); box-shadow: var(--shadow);
  }
  .editing .reading-bar { bottom: calc(62px + env(safe-area-inset-bottom)); }
  .reading-bar .btn--icon { width: 44px; height: 40px; border-radius: 999px; }
  .reading-bar .tool-button { height: 40px; border: 0; border-radius: 999px; padding: 0 12px; }
  .reading-bar .tool-button__label { display: inline; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body:has(.reading-bar:not([hidden])) .desk { padding-bottom: 96px; }
  /* No room side by side: a pair stacks, marked with a bar. */
  .page > .block.dual-left, .page > .block.dual-right { grid-column: 1 / -1; border-left: 3px solid var(--accent-soft); padding-left: 10px; }
  .page > .block.dual-right { margin-top: 0.5em; }
  .block--dialogue .field--character, .block.dual-left .field--character, .block.dual-right .field--character { margin-left: 25%; width: 70%; }
  .rich .rich-doc > .dual-left, .rich .rich-doc > .dual-right { grid-column: 1 / -1; border-left: 3px solid var(--accent-soft); padding-left: 10px; }
  .rich .el-character, .rich .dual-left .el-character, .rich .dual-right .el-character { margin-left: 25%; width: 70%; }
  .rich .el-parenthetical, .rich .dual-left .el-parenthetical, .rich .dual-right .el-parenthetical { margin-left: 15%; width: 70%; }
  .rich .el-line, .rich .dual-left .el-line, .rich .dual-right .el-line { margin-left: 8%; width: 84%; }
  .block--dialogue .field--parenthetical, .block.dual-left .field--parenthetical, .block.dual-right .field--parenthetical { margin-left: 15%; width: 70%; }
  .block--dialogue .field--text, .block.dual-left .field--text, .block.dual-right .field--text { margin-left: 8%; width: 84%; }
  .keys { display: none; }
}

/* ---- title and character pages ---------------------------------------------
   Laid out by print.js in inches, the same on screen (above the script, in
   .front-sheet) as on paper. */

.front-pages { display: flex; flex-direction: column; align-items: center; gap: 24px; margin-bottom: 24px; }
.front-pages:empty { display: none; }
.front-sheet { position: relative; }
.front-sheet--editable { cursor: default; }
.back-pages { margin: 24px 0 0; }
.front-sheet__page {
  width: var(--paper-width);
  min-height: var(--paper-height);
  padding: 0.5in var(--margin-right) 1in 1.5in;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  border-radius: 4px;
  transform-origin: top left;
}
/* Typing on a sheet: the parts that can be typed in, and what goes in the
   empty ones (on screen only). */
.front-sheet [data-field] { outline: none; border-radius: 2px; cursor: text; min-height: var(--script-line); }
.front-sheet [data-field]:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.front-sheet [data-field]:focus { box-shadow: 0 0 0 2px var(--accent); }
.front-sheet [data-field][data-lines=multi] { white-space: pre-wrap; }
.front-sheet [data-field]:empty::before { content: attr(data-placeholder); color: var(--ink-faint); font-weight: 400; text-decoration: none; display: inline-block; }
.front-sheet [data-opens-editor] { cursor: pointer; }
.front-sheet .print-cover__auto:empty::before { content: attr(data-placeholder); color: var(--ink-faint); display: inline-block; }
/* A character's name on the breakdown sheet: Rename on hover (print.js). */
.front-sheet [data-rename] { cursor: pointer; border-radius: 2px; }
.front-sheet [data-rename]:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.print-extra__rename { display: none; margin-left: 10px; padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-text); font: 500 11px/1.4 var(--ui); vertical-align: 1px; }
.front-sheet [data-rename]:hover .print-extra__rename { display: inline-block; }
.front-sheet [data-opens-editor]:hover { box-shadow: 0 0 0 3px var(--accent-soft); border-radius: 2px; }
.front-sheet--editable:hover .front-sheet__page { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.front-sheet__actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s; }
.front-sheet:hover .front-sheet__actions, .front-sheet:focus-within .front-sheet__actions { opacity: 1; }
@media (hover: none) { .front-sheet__actions { opacity: 1; } }
.front-sheet__actions .btn--small { flex: none; }

.print-cover { position: relative; height: calc(var(--page-body) + 0.5in); font: var(--script-size)/1 var(--script); text-align: center; overflow-wrap: anywhere; } /* long words break, as frontmatter.js wraps them */
.print-cover__main { position: absolute; top: 3in; left: 0; right: 0; line-height: var(--script-line); }
.print-cover__title { font-weight: 700; text-transform: uppercase; text-decoration: underline; }
.print-cover__subtitle { margin-top: var(--script-line); }
/* An episode's title and number (folders.js coverOf), run on into any subtitle as frontmatter.js lays them out. */
.print-cover__episode { white-space: pre-line; }
.print-cover__episode + .print-cover__subtitle { margin-top: 0; }
.print-cover__credit { margin-top: var(--script-line); }
.print-cover__title + .print-cover__credit { margin-top: calc(3 * var(--script-line)); }
.print-cover__author { margin-top: var(--script-line); }
.print-cover__source { margin-top: calc(2 * var(--script-line)); white-space: pre-line; }
.print-cover__foot { position: absolute; bottom: 0; left: 0; right: 0; line-height: var(--script-line); }
.print-cover__columns { display: flex; justify-content: space-between; align-items: flex-end; gap: 0.5in; }
.print-cover__contact { text-align: left; white-space: pre-line; }
.print-cover__right { text-align: right; white-space: pre-line; }
.print-cover__representation { margin-bottom: var(--script-line); }
.print-cover__copyright { margin-top: var(--script-line); text-align: center; }

.print-extra { break-after: page; font: var(--script-size)/var(--script-line) var(--script); padding-top: 0.5in; overflow-wrap: anywhere; }
.print-extra__title { margin: 0 0 calc(2 * var(--script-line)); font: 700 var(--script-size) var(--script); text-align: center; text-transform: uppercase; text-decoration: underline; }
.print-extra__label { margin: 0; font: 700 var(--script-size) var(--script); text-transform: uppercase; }
.print-extra__text { margin: 0 0 var(--script-line); white-space: pre-line; }
.print-extra__entry { break-inside: avoid; margin-bottom: var(--script-line); }
.print-extra__name { font-weight: 700; }
.print-extra__count { font-weight: 400; }
/* Main characters / Supporting / …: a blank line under it, as frontmatter.js has it. */
.print-extra__group { margin-bottom: var(--script-line); break-after: avoid; }
.print-extra__total { margin: var(--script-line) 0 0; }
.print-table { width: 100%; border-collapse: collapse; font-size: calc(10pt * var(--script-scale)); line-height: 1.3; }
.print-table th { text-align: left; font-weight: 700; text-transform: uppercase; border-bottom: 1px solid currentColor; padding: 0 6pt 3pt 0; }
.print-table td { vertical-align: top; padding: 4pt 6pt 4pt 0; border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent); }
.print-table tr { break-inside: avoid; }
.print-table .num { text-align: right; white-space: nowrap; }
.print-table__sub { font-size: calc(9pt * var(--script-scale)); opacity: 0.75; }

/* ---- print / PDF ---------------------------------------------------------
   Printing shows only #print-pages, built by print.js from the same page
   layout as the Pages view. Each sheet is the 6in x 9.5in area inside the
   script's margins (1.5in left, 1in right): a half-inch band for the page
   number, then the lines (54 at 12pt). On A4 it's taller (--page-body) and
   app.js showFontSize puts the paper in an @page rule of its own. The printable area reaches further out than that
   (0.75in left, 0.5in right) only so scene numbers can sit in the margins;
   anything placed left of the printable area doesn't print. The foot's
   margin is a little short of 1in so the area is a touch taller than a
   sheet: Firefox placed some sheets a hundredth of an inch low, and the
   overflow became a blank page (2026-10-20).                            */

@page { size: letter; margin: 0.5in 0.5in 0.9in 0.75in; }

@media (max-width: 600px) {
  /* Template sheets as the script's pages are here: the paper's width, no
     margins, the same text size (app.js fitExtras doesn't scale them). */
  .front-sheet { width: 100%; }
  .front-sheet__page {
    width: 100%; min-height: 0; padding: 24px 16px; border-radius: 0;
    --script-size: calc(14px * var(--script-scale)); --script-line: calc(1.25 * var(--script-size));
  }
  .print-extra { padding-top: 0; }
  /* The title page stacks its parts instead of placing them on an 11in page. */
  .front-sheet .print-cover { height: auto; display: flex; flex-direction: column; gap: calc(4 * var(--script-line)); padding: calc(3 * var(--script-line)) 0 var(--script-line); }
  .front-sheet .print-cover__main, .front-sheet .print-cover__foot { position: static; }
  .front-sheet .print-cover__columns { flex-direction: column; align-items: stretch; gap: var(--script-line); }
  .front-sheet .print-cover__right { text-align: left; }
  .note-pin--sheet { display: none; } /* no margin for them; the Notes panel lists them */
}

@media print {
  body { background: #fff; color: #000; display: block; }
  body > :not(.print-pages) { display: none !important; }
  .print-pages { display: block; }
  .print-pages > * { width: 6in; margin-left: 0.75in; }

  .print-cover, .print-sheet {
    position: relative;
    height: calc(var(--page-body) + 0.5in);
    break-after: page;
    font: var(--script-size)/1 var(--script);
    color: #000;
  }
  .print-pages > :last-child { break-after: auto; }
  .print-extra { color: #000; }

  .print-sheet__number { position: absolute; top: 0.25in; right: 0; white-space: pre; }
  .print-sheet__body { position: absolute; top: 0.5in; left: 0; width: 6in; height: var(--page-body); }
  .print-line { position: absolute; white-space: pre; line-height: var(--script-line); }
  .print-line--heading { font-weight: 700; }
  /* Table read: the reader's lines on their part's tint (reading.js). */
  .print-line--read { background: var(--read); box-shadow: 0 0 0 0.03in var(--read); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-scene-number { position: absolute; font-weight: 700; line-height: var(--script-line); }
  .print-scene-number--left { right: calc(100% + 0.5in); }
  .print-scene-number--right { left: calc(100% + 0.3in); }
  .print-revised { position: absolute; left: calc(100% + 0.1in); line-height: var(--script-line); } /* a revision's asterisk (production.js) */  .print-line--act { font-weight: 700; text-decoration: underline; }
  /* A shared draft's mark, fixed so it's on every printed page (watermark.js printStamp). */
  .print-pages > .watermark--print { position: fixed; left: 0; top: 0; width: calc(var(--paper-width) - 1.25in); margin: 0; z-index: 1; }
  .watermark__mark { color: rgb(128 128 128 / 0.16); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* The beat board (boardview.js): in place of the desk, columns of cards
   that scroll sideways. A card's colour is a band along its top. */
/* Script | Board: two buttons joined, the one showing pressed. */
.view-switch { display: inline-flex; flex: none; }
.view-switch .tool-button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.view-switch .tool-button:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.view-switch .tool-button[aria-pressed=true] { position: relative; z-index: 1; background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-soft); }
.nothing-open .view-switch { display: none; }
@media (min-width: 701px) { .board__back { display: none; } }
.board-open .desk { display: none; }
.board { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.board[hidden] { display: none; }
.board__head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 12px; flex-wrap: wrap; }
.board__intro { flex: 1; min-width: 200px; }
.board__title { margin: 0; font: 600 17px/1.3 var(--ui); color: var(--ink); }
.board__hint { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
.board__columns { flex: 1; min-height: 0; display: flex; align-items: flex-start; gap: 14px; padding: 4px 20px 24px; overflow: auto; scroll-snap-type: x proximity; scroll-padding-inline: 20px; } /* (snapping leaves the padding, else it pulls 20px in from the far left) */
.board-col { flex: none; width: 272px; max-height: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; scroll-snap-align: start; }
/* A column on screen is a stack of lists (board.js stacksOf): one list
   alone scrolls its own cards; two or more scroll together. */
.board-stack { position: relative; flex: none; width: 272px; max-height: 100%; display: flex; flex-direction: column; min-height: 0; scroll-snap-align: start; }
.board-stack__lists { display: flex; flex-direction: column; gap: 12px; min-height: 0; max-height: 100%; padding-block: 6px; margin-block: -6px; }
.board-stack__lists > .board-col { width: auto; flex: 0 1 auto; min-height: 0; scroll-snap-align: none; }
.board-stack.is-stacked .board-stack__lists { overflow-y: auto; }
.board-stack.is-stacked .board-stack__lists > .board-col { flex: none; max-height: none; }
.board-stack.is-stacked .board-col__cards { overflow: visible; }
.board.is-one-column .board-stack { width: min(720px, 100%); }
/* Under a stack's lists, the rest of the column's height: a dashed "New
   list" shows there on hover (and while something's dragged); in One
   column it's always there, in place of the one at the side. */
.board-stack { align-self: stretch; }
.board-stack__under { flex: 1 0 64px; padding-top: 12px; }
.board-stack__add { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 48px; padding: 0 12px; border: 1.5px dashed var(--line); border-radius: 10px; background: none; color: var(--ink-soft); font: 14px var(--ui); cursor: pointer; opacity: 0; transition: opacity 0.12s; }
.board-stack__under:hover .board-stack__add, .board-stack__add:focus-visible, .board.is-dragging .board-stack__add, .board.is-one-column .board-stack__add { opacity: 1; }
.board-stack__add:hover, .board-stack__add:focus-visible { border-color: var(--ink-faint); color: var(--ink); background: var(--hover); }
.board-stack__under.is-drop .board-stack__add { opacity: 1; border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.board.is-one-column .board-col--new { display: none; }
@media (hover: none) { .board-stack__add { opacity: 1; } }
.board-layout { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.board-layout svg { fill: none; stroke: currentColor; stroke-width: 2; }
.board-layout[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.board-col.is-drop { border-color: var(--accent); }
.board-col--new { flex-direction: row; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; min-height: 96px; padding: 12px; border: 1.5px dashed var(--line); background: none; color: var(--ink-soft); font: 14px var(--ui); cursor: pointer; }
.board-col--new:hover, .board-col--new:focus-visible { border-color: var(--ink-faint); color: var(--ink); background: var(--hover); }
.board-col--new.is-drop { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.board-col__drop-hint { display: none; width: 100%; text-align: center; font-size: 12px; }
.board.is-dragging .board-col--new { border-color: var(--ink-faint); }
.board.is-dragging .board-col__drop-hint { display: block; }
.board-col__head { display: flex; align-items: center; gap: 6px; padding: 8px 6px 6px 10px; }
.board-col__name { flex: 1; min-width: 0; margin: 0; padding: 4px 6px; border: 0; border-radius: 5px; background: none; color: var(--ink); font: 600 14px/1.3 var(--ui); text-align: left; overflow-wrap: anywhere; }
.board-col__name[role="button"]:hover { background: var(--hover); }
/* The whole head is the column's handle: a drag moves it, a click on the
   name renames it. */
.board-col__head[draggable="true"], .board-col__head[draggable="true"] .board-col__name { cursor: grab; -webkit-user-select: none; user-select: none; }
.board-col__head[draggable="true"]:active { cursor: grabbing; }
.board-col.is-dragged { opacity: 0.4; }
.board-col__name.is-unnamed { color: var(--ink-faint); font-weight: 500; }
.board-col__name-edit { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid var(--accent); border-radius: 5px; background: var(--paper, var(--surface)); color: var(--ink); font: 600 14px/1.3 var(--ui); }
.board-col__name-edit:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.board-col__count { color: var(--ink-faint); font-size: 12px; }
.board-more { display: grid; place-items: center; width: 26px; height: 26px; flex: none; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--ink-faint); cursor: pointer; }
.board-more circle { fill: currentColor; }
.board-more:hover, .board-more:focus-visible { color: var(--ink); background: var(--hover); }
.board-col__cards { list-style: none; margin: 0; padding: 2px 8px 4px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 12px; }
.board-col__empty { padding: 10px 6px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.board-col__add { display: flex; align-items: center; gap: 6px; margin: 2px 8px 8px; padding: 7px 8px; border: 0; border-radius: 6px; background: none; color: var(--ink-soft); font: 13px var(--ui); cursor: pointer; text-align: left; }
.board-col__add:hover, .board-col__add:focus-visible { background: var(--hover); color: var(--ink); }
.board-card { position: relative; padding: 10px 30px 10px 12px; border: 1px solid var(--line); border-top: 4px solid var(--card, var(--line)); border-radius: 7px; background: var(--paper, var(--bg)); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06); cursor: grab; }
.board:not(.is-editable) .board-card { cursor: default; }
.board-card:hover { border-color: var(--ink-faint); border-top-color: var(--card, var(--ink-faint)); }
.board-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.board-card.is-dragged { opacity: 0.4; }
.board-card.is-landed { animation: landed-card 1.8s ease-out; }
@keyframes landed-card { 0%, 35% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.board-card.is-editing { cursor: auto; border-color: var(--accent); border-top-color: var(--card, var(--accent)); }
.board-card__text { font: 14px/1.45 var(--ui); white-space: pre-wrap; overflow-wrap: anywhere; }
.board-card__text::first-line { font-weight: 600; }
.board-card__text.is-empty { color: var(--ink-faint); font-style: italic; }
.board-card__edit { display: block; box-sizing: border-box; width: 100%; padding: 0; border: 0; resize: none; overflow: hidden; background: none; color: var(--ink); font: 14px/1.45 var(--ui); }
.board-card__edit:focus { outline: none; }
.board-card__scene { display: inline-block; max-width: 100%; margin-top: 8px; padding: 2px 8px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font: 12px/1.5 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
button.board-card__scene { cursor: pointer; }
button.board-card__scene:hover { text-decoration: underline; }
span.board-card__scene, .board-card__scene.is-gone { background: var(--hover); color: var(--ink-soft); }
.board-card__more { position: absolute; top: 6px; right: 4px; opacity: 0; }
.board-card:hover .board-card__more, .board-card:focus-within .board-card__more, .board-card__more[aria-expanded=true] { opacity: 1; }
.board-card.is-editing .board-card__more { display: none; }
.board-drop { height: 3px; margin: -2px 0; border-radius: 2px; background: var(--accent); list-style: none; }
.board-menu button.is-danger { color: var(--danger); }
@media (hover: none) { .board-card__more { opacity: 1; } }
@media (max-width: 600px) {
  .board__head { padding: 12px 16px 8px; }
  .board__columns { padding: 4px 16px 16px; gap: 10px; scroll-padding-inline: 16px; }
  .board-col, .board-stack { width: min(272px, calc(100vw - 48px)); }
}
.board-card__scene:first-child { margin-top: 0; }
/* "Make it a scene…": where it goes, a scrolling list (and a box to find
   a scene in a long script). */
.board-menu.board-place { width: min(340px, calc(100vw - 16px)); }
.board-place__search { margin: 2px 6px 6px; width: auto; }
.board-place__list { display: flex; flex-direction: column; max-height: min(320px, 50vh); overflow-y: auto; }
.board-place__list button { display: block; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-place__list button[hidden] { display: none; }
.outline-act.is-dragged { opacity: 0.4; }
.board:not(.is-editable) .board__lay-out { display: none; }
/* A drop between columns (or beside the first or last): a line in the gap,
   where a new column will go. */
.board-col:not(.board-col--new) { position: relative; }
.board-stack.is-gap-before::before, .board-stack.is-gap-after::after { content: ""; position: absolute; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: var(--accent); pointer-events: none; }
.board-stack.is-gap-before::before { left: -10px; }
.board-stack.is-gap-after::after { right: -10px; }
/* A list dropped into a stack: a line across where it goes. */
.board-col.is-slot-before::before, .board-col.is-slot-after::after { content: ""; position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--accent); pointer-events: none; }
.board-col.is-slot-before::before { top: -8px; }
.board-col.is-slot-after::after { bottom: -8px; }
/* (Snapping would pull the board back after each step of the scrolling
   a drag near its sides does, boardview.js autoScroll.) */
.board.is-dragging .board__columns, .board.is-moving-column .board__columns { scroll-snap-type: none; }
/* The column a card's "Move to …" item points at, while it's hovered. */
.board-col.is-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Tags on cards (boardview.js): characters as plain chips, threads with a
   "#" and an outline; a scene's speakers are chips too. Chosen in the
   filter: accent. Cards outside the filter fade. */
.board__filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 20px 10px; }
.board__filter:empty { display: none; }
.board__filter .board-filter__button { display: inline-flex; flex: none; align-items: center; gap: 5px; }
.board-filter__clear { border: 0; background: none; padding: 2px 4px; color: var(--accent-text); font: 12px var(--ui); cursor: pointer; }
.board-filter__clear:hover { text-decoration: underline; }
.board-filter__count { color: var(--ink-faint); font-size: 12px; }
.board-filter__none { margin: 0; padding: 8px 10px; max-width: 260px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.board-card__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.board-card__tags[hidden] { display: none; }
.board-card__tags--editing { margin-top: 6px; }
.board-tag { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 1px 7px; border: 1px solid transparent; border-radius: 999px; background: var(--hover); color: var(--ink-soft); font: 600 11px/1.6 var(--ui); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.board-tag { cursor: pointer; }
button.board-tag:hover { color: var(--ink); border-color: var(--line); }
.board-tag--threads { background: none; border-color: var(--line); font-weight: 500; letter-spacing: 0; }
.board-tag.is-on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.board-tag__remove { display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: -3px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; font: 13px/1 var(--ui); cursor: pointer; }
.board-tag__remove:hover { background: var(--line); }
.board-card.is-faded { opacity: 0.3; }
.board-card.is-faded:hover, .board-card.is-faded:focus-within { opacity: 0.7; }
.board-suggest { position: fixed; z-index: 30; min-width: 200px; max-width: 300px; max-height: 260px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.board-suggest[hidden] { display: none; }
.board-suggest__option { padding: 6px 10px; border-radius: 5px; color: var(--ink); font: 13px var(--ui); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-suggest__option[aria-selected=true] { background: var(--accent-soft); color: var(--accent-text); }
/* "Add 3 new scenes" (or "All 9 scenes are on the board") and "Rearrange
   by act…". */
.board__lay-out { display: inline-flex; flex: none; flex-wrap: wrap; align-items: center; gap: 8px; }
.board__lay-out[hidden], .board__lay-out [hidden] { display: none; }
.board__lay-out-status { color: var(--ink-soft); font-size: 13px; }

/* A pop-out window (app.js popOut): one script, only its board or only its
   pages; the top bar keeps the title and status, and undo / redo (the
   board's own on the board). */
.popout .topbar > :not(.title-wrap):not(.topbar__gap):not(#undo):not(#redo) { display: none !important; }
.popout .sidebar, .popout #sidebar-resize, .popout #sidebar-tab, .popout .board__back { display: none !important; }
.popout .title-wrap { margin-left: 8px; }
.popout .notes-side, .popout #notes-tab { display: none !important; }
/* "New window" (app.js popOut): a small button at the bottom right of
   the page area, for whichever is showing; clear of the Notes panel. */
.popout-float { position: absolute; right: calc(var(--desk-bar, 0px) + 16px); bottom: 16px; z-index: 12; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; }
.popout-float svg { color: var(--accent-text); }
.popout-float:hover { background: var(--hover); border-color: var(--ink-faint); }
.popout-float:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notes-open .popout-float { right: calc(260px + 16px); }
.popout .popout-float, .nothing-open .popout-float, .starting .popout-float { display: none !important; }
/* Under 800px, while a line is being written, the type bar sits along the
   bottom (typepicker.js dock): the button goes up above it (2026-10-30,
   the bar covered it). On touch screens there are no windows to pop out
   into, so it isn't there at all. */
@media (max-width: 800px) {
  .editing .popout-float { bottom: calc(16px + 48px + env(safe-area-inset-bottom)); }
}
@media (hover: none) and (pointer: coarse) { .popout-float { display: none; } }
