/* Scriptwriter — a working instrument, not a document.
   Two saturated colours only, and both are earned by the content: cold blue is
   a positive charge, oxide red a negative one. Amber means expected but absent. */

:root {
  --paper:      #eef0f2;
  --panel:      #f7f8f9;
  --ink:        #16202b;
  --muted:      #5c6b7a;
  --rule:       #c9d1d8;
  --positive:   #2f6f8f;
  --negative:   #a8443a;
  --gap:        #8a6d1f;

  --measure: 62ch;
  --gutter: 4.5rem;

  --ui: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --page: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #141a20;
    --panel:    #1b222a;
    --ink:      #e4e9ed;
    --muted:    #94a3b0;
    --rule:     #2e3942;
    --positive: #6aa9c6;
    --negative: #d2796e;
    --gap:      #c9a44c;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--ui);
}

main { padding: 0 1rem 6rem; }

h1 {
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--positive); outline-offset: 2px; }

/* Masthead ---------------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}

.masthead .home {
  font-weight: 600;
  text-decoration: none;
}

.model-off {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Library ----------------------------------------------------------------- */

.library, .script { max-width: var(--measure); margin: 0 auto; }

.script-list {
  list-style: none;
  margin: 1.5rem 0 2.5rem;
  padding: 0;
}

.script-list li {
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}

.script-list a {
  font-size: 1.0625rem;
  font-weight: 500;
}

.logline {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.pages { font-family: var(--page); }

.empty, .prompt {
  color: var(--muted);
  border-left: 2px solid var(--gap);
  padding-left: 0.75rem;
  margin: 1.5rem 0;
}

/* Forms ------------------------------------------------------------------- */

.new-script {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: end;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.new-script label {
  flex-basis: 100%;
  font-size: 0.8125rem;
  color: var(--muted);
}

input, textarea, select {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
}

/* Scoped to the library form: a bare `input { flex-basis }` sets a height
   inside column-flex containers, which stretched every title field. */
.new-script input { flex: 1 1 16rem; min-width: 0; }
input { min-width: 0; }

button {
  font: inherit;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

button:hover { background: var(--positive); border-color: var(--positive); }

button[disabled] {
  background: transparent;
  color: var(--muted);
  border-color: var(--rule);
  cursor: not-allowed;
}

/* Layer nav --------------------------------------------------------------- */

.layers {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Vision ------------------------------------------------------------------ */

.vision { max-width: var(--measure); margin: 0 auto; }

.standfirst { color: var(--muted); margin: 0 0 1.75rem; }

.field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 1rem; }
.field label { font-size: 0.8125rem; color: var(--muted); }
.field input, .field textarea, .field select { width: 100%; }
.field.narrow { flex: 0 0 8rem; }

.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: start; }
.row .field { flex: 1 1 10rem; }

fieldset.controlling-idea {
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.75rem 1rem 0.25rem;
  margin: 0 0 1rem;
  background: var(--panel);
}

fieldset.controlling-idea legend { font-size: 0.8125rem; color: var(--muted); padding: 0 0.35rem; }

.help { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.875rem; }

.read-back {
  margin: 0.25rem 0 0.75rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--positive);
  color: var(--ink);
}

.saved { margin: 0; color: var(--muted); font-size: 0.8125rem; }

input.pages { font-family: var(--page); }

/* People ------------------------------------------------------------------ */

.people { max-width: 54rem; margin: 0 auto; }

h2 { font-size: 1rem; font-weight: 600; margin: 2.5rem 0 0.75rem; }

.person {
  border-top: 1px solid var(--rule);
  padding: 1rem 0;
}

.person header { display: flex; align-items: baseline; gap: 0.75rem; }
.person header h3 { margin: 0; font-size: 1.0625rem; font-weight: 600; }
.person .role { color: var(--muted); font-size: 0.8125rem; }
.person header button { margin-left: auto; }

button.quiet {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 0.15rem 0.4rem;
  font-size: 0.8125rem;
}
button.quiet:hover { color: var(--negative); background: transparent; border-color: var(--rule); }

.person-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 1rem; margin-top: 0.5rem; }
.person-fields label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8125rem; color: var(--muted); }

.arc { list-style: none; margin: 0.75rem 0 0; padding: 0; }

.arc li {
  display: grid;
  grid-template-columns: 9rem 3.5rem 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.3rem 0 0.3rem 0.75rem;
  border-left: 2px solid var(--positive);
}

.arc li.unanchored { border-left-color: var(--gap); }
.arc li.unanchored .step { color: var(--gap); }
.arc .at { font-family: var(--page); font-size: 0.8125rem; color: var(--muted); }
.arc form { margin: 0; }
.arc select { width: 100%; }

.new-person, .new-value {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0 1rem;
  align-items: end;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.new-person button, .new-value button { margin-bottom: 1rem; }

.value-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.value-list li { display: flex; align-items: baseline; gap: 0.4rem; padding: 0.35rem 0; border-top: 1px solid var(--rule); }
.value-list button { margin-left: auto; }
.pole.positive { color: var(--positive); }
.pole.negative { color: var(--negative); }
.axis { color: var(--muted); }

/* Spine -------------------------------------------------------------------
   The left gutter is a continuous position ruler: every row says where it
   falls as a fraction of the target runtime, and the gaps interrupt it. */

.spine-page { max-width: 64rem; margin: 0 auto; }

.spine { list-style: none; margin: 1.5rem 0 2rem; padding: 0; }

.spine .row {
  display: grid;
  grid-template-columns: var(--gutter) 1fr auto;
  gap: 0 1rem;
  align-items: start;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}

.spine .row .at {
  font-family: var(--page);
  font-size: 0.8125rem;
  color: var(--muted);
  padding-top: 0.15rem;
  text-align: right;
  border-right: 1px solid var(--rule);
  padding-right: 0.75rem;
  align-self: stretch;
}

.spine .row.depth-1 .body { padding-left: 1.25rem; }
.spine .row.depth-2 .body { padding-left: 2.5rem; }

.spine .row.dragging { opacity: 0.45; }

.headline { margin: 0; font-weight: 600; }
.empty-slot { color: var(--muted); font-weight: 500; text-transform: none; }

.expectation {
  margin: 0.25rem 0 0;
  color: var(--muted);
  max-width: 54ch;
}

/* A missing anchor is the one place the page raises its voice. */
.spine .row.missing .at { color: var(--gap); border-right-color: var(--gap); }
.spine .row.missing .body {
  border-left: 2px solid var(--gap);
  padding-left: 0.75rem;
}
.spine .row.missing .headline { color: var(--gap); }

.spine .row.empty .body { border-left: 2px dashed var(--rule); padding-left: 0.75rem; }

.actions { display: flex; gap: 0.5rem; margin: 0.5rem 0 0; }
.actions button { font-size: 0.8125rem; padding: 0.25rem 0.6rem; }

.row-edit { display: flex; flex-direction: column; gap: 0.4rem; }
.row-edit .title { font-weight: 600; }
.row-edit .summary { resize: vertical; }
.row-meta { display: flex; gap: 1rem; align-items: center; }
.pages-field { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; color: var(--muted); }
.pages-field input { width: 5.5rem; }

.turns { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 0; padding: 0; font-size: 0.8125rem; }
.turns li { color: var(--muted); }
.turns li .charge { font-family: var(--page); }
.turns li.turns .charge { color: var(--positive); }
.turns li.flat .charge { color: var(--negative); }

.row-findings { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.875rem; }
.row-findings li { padding-left: 0.6rem; border-left: 2px solid var(--rule); color: var(--muted); margin-top: 0.25rem; }
.row-findings li.sev-high { border-left-color: var(--negative); color: var(--ink); }
.row-findings li.sev-medium { border-left-color: var(--gap); }

.row-tools { display: flex; flex-direction: column; gap: 0.35rem; align-items: end; }
.row-tools select { max-width: 11rem; font-size: 0.8125rem; }

.new-node { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--rule); }
.new-node label { font-size: 0.8125rem; color: var(--muted); }

@media (max-width: 640px) {
  .spine .row { grid-template-columns: 3rem 1fr; }
  .row-tools { grid-column: 1 / -1; flex-direction: row; align-items: center; }
}

/* Chart ------------------------------------------------------------------- */

.chart-frame { margin: 1.5rem 0 0; }
.chart-frame svg { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: var(--panel); }
.chart-frame figcaption { margin-top: 0.4rem; font-size: 0.8125rem; color: var(--muted); }

.chart .axis { stroke: var(--rule); }
.chart .act-boundary { stroke: var(--rule); }
.chart .act-label, .chart .value-label { font-family: var(--ui); font-size: 11px; }
.chart .act-label { fill: var(--muted); }
.chart .expected-empty { stroke: var(--rule); }

/* Scene editor ------------------------------------------------------------ */

.scene-page { max-width: 72rem; margin: 0 auto; }

.scene-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }

.scene-editor { display: flex; flex-direction: column; gap: 0.35rem; }
.scene-editor label { font-size: 0.8125rem; color: var(--muted); }
.scene-editor textarea {
  font-family: var(--page);
  font-size: 0.9375rem;
  line-height: 1.55;
  min-height: 62vh;
  resize: vertical;
}

.preview { border: 1px solid var(--rule); background: var(--panel); padding: 1.25rem 1.5rem; min-height: 62vh; }
.preview-meta { margin: 0 0 1rem; font-size: 0.8125rem; color: var(--muted); }

/* The preview is the page as it will read, so it is set in the page face. */
.preview .el { font-family: var(--page); font-size: 0.9375rem; line-height: 1.55; margin: 0 0 1em; white-space: pre-wrap; }
.preview .el.scene-heading { text-transform: uppercase; font-weight: 600; }
.preview .el.character { margin-left: 8rem; margin-bottom: 0; text-transform: uppercase; }
.preview .el.parenthetical { margin-left: 6rem; margin-bottom: 0; color: var(--muted); }
.preview .el.dialogue { margin-left: 4rem; margin-right: 4rem; }
.preview .el.transition { text-align: right; text-transform: uppercase; }

.write-link { font-size: 0.8125rem; }

.exports { display: flex; gap: 1.25rem; margin: 1.5rem 0 0; font-size: 0.875rem; }

@media (max-width: 860px) {
  .scene-split { grid-template-columns: 1fr; }
  .scene-editor textarea, .preview { min-height: 40vh; }
  .preview .el.character { margin-left: 3rem; }
  .preview .el.parenthetical { margin-left: 2rem; }
  .preview .el.dialogue { margin-left: 1.5rem; margin-right: 1rem; }
}

/* Critic rail ------------------------------------------------------------- */

.spine-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 2rem; align-items: start; }
.spine-main { min-width: 0; }

.critic { position: sticky; top: 1rem; border-left: 1px solid var(--rule); padding-left: 1.25rem; }
.critic-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.critic-head h2 { margin: 0; flex-basis: 100%; }
.critic-head button { font-size: 0.8125rem; padding: 0.25rem 0.6rem; }

.findings { list-style: none; margin: 0; padding: 0; }

.finding {
  border-left: 2px solid var(--rule);
  padding: 0 0 0 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.finding.sev-high { border-left-color: var(--negative); }
.finding.sev-medium { border-left-color: var(--gap); }
.finding .body { margin: 0; }
.finding-meta { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.25rem 0 0; font-size: 0.75rem; color: var(--muted); }

/* Rule findings are arithmetic; model findings are opinion. The writer
   should always be able to tell which is which. */
.critic-head .cost, form.suggested .where { color: var(--muted); font-weight: 400; }
.critic-head .thinking { flex-basis: 100%; margin: 0; font-size: 0.8125rem; color: var(--muted); }
form.suggested { margin: 0 0 1.25rem; padding: 0.85rem 1rem; border: 1px solid var(--positive); border-radius: 0.6rem; background: var(--panel); }
form.suggested h3 { margin: 0 0 0.25rem; font-size: 1rem; }
form.suggested ul { list-style: none; margin: 0.6rem 0; padding: 0; }
form.suggested li { margin: 0 0 0.6rem; }
form.suggested label { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9375rem; line-height: 1.45; }
form.suggested input { margin-top: 0.25rem; flex: none; }

.refused { list-style: none; margin: 0 0 1rem; padding: 0.5rem 0.75rem; border-left: 2px solid var(--gap); font-size: 0.8125rem; color: var(--muted); }

@media (max-width: 1000px) {
  .spine-layout { grid-template-columns: 1fr; }
  .critic { position: static; border-left: none; border-top: 1px solid var(--rule); padding: 1.25rem 0 0; }
}

/* Value turns on a row ----------------------------------------------------- */

.turns { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin: 0.5rem 0 0; }
.turn { display: flex; align-items: center; gap: 0.3rem; font-size: 0.8125rem; color: var(--muted); }
.turn select { font-family: var(--page); padding: 0.1rem 0.2rem; font-size: 0.8125rem; }
.turn.turns .arrow { color: var(--positive); }
.turn.flat .arrow { color: var(--muted); }

.streaming {
  font-family: var(--page);
  font-size: 0.75rem;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow: auto;
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--positive);
  color: var(--muted);
}

.critic-held { margin: 0 0 1rem; padding-left: 0.75rem; border-left: 2px solid var(--gap); font-size: 0.875rem; color: var(--muted); }
.critic-held a { color: var(--ink); }

/* Beats -------------------------------------------------------------------- */

.beat-tag {
  display: inline-block;
  margin: 0 0 0.35rem;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--positive);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--positive);
}
.beat-tag.suggested { border-style: dashed; color: var(--muted); border-color: var(--rule); }

.mark-as label { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.75rem; color: var(--muted); }

.beat-help { margin-top: 0.25rem; font-size: 0.875rem; }
.beat-help summary { cursor: pointer; color: var(--muted); }
.spine .row.missing { padding: 0.45rem 0; }
.spine .row.missing .headline { font-weight: 500; font-size: 0.9375rem; }

/* Checklist ----------------------------------------------------------------- */

.next { margin: 1.25rem 0 1.75rem; padding: 0.75rem 1rem; border-left: 2px solid var(--positive); background: var(--panel); }
.next a { font-weight: 600; }

.checklist { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.checklist li { counter-increment: step; position: relative; padding: 0.85rem 0 0.85rem 2.5rem; border-top: 1px solid var(--rule); }
.checklist li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0.85rem;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--page); font-size: 0.8125rem;
  border: 1px solid var(--rule); color: var(--muted);
}
.checklist li.done::before { content: "\2713"; border-color: var(--positive); color: var(--positive); }
.checklist li a { font-weight: 600; font-size: 1.0625rem; }
.checklist .status { margin: 0.2rem 0 0; color: var(--muted); }

/* A written slot keeps its definition, quieter, above what has been written. */
.expectation.definition { margin: 0 0 0.4rem; font-size: 0.875rem; }
.row-findings:empty { display: none; }

/* ==========================================================================
   Guided view. One thing at a time, in plain words, with room around it.
   Blue is things getting better for the hero; red is things getting worse.
   ========================================================================== */

.guided { max-width: 40rem; margin: 0 auto; }

.crumb { margin: 0 0 1.25rem; font-size: 0.875rem; color: var(--muted); display: flex; gap: 0.75rem; align-items: baseline; }
.crumb a { color: var(--muted); }

.dots { display: flex; gap: 6px; margin: 0 0 2.25rem; }
.dots span, .dots a { flex: 1; height: 5px; border-radius: 3px; background: var(--rule); }
.dots .on { background: var(--positive); }
.dots a.here { outline: 2px solid var(--ink); outline-offset: 2px; }

.question h1 { font-size: 1.9rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.6rem; }
.kicker { margin: 0 0 0.4rem; font-size: 0.8125rem; color: var(--muted); }
.question .help { font-size: 1.0625rem; color: var(--ink); margin: 0 0 0.5rem; max-width: 36rem; }
.example { margin: 0 0 1.5rem; padding-left: 0.85rem; border-left: 2px solid var(--rule); color: var(--muted); font-size: 0.9375rem; }

.answer { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.answer label { font-size: 0.9375rem; color: var(--muted); }
.answer input:where(:not([type="radio"], [type="checkbox"])), .answer textarea, .answer select { width: 100%; font-size: 1.125rem; padding: 0.7rem 0.85rem; border-radius: 6px; line-height: 1.5; }
.answer textarea { resize: vertical; }
.answer input:focus, .answer textarea:focus, .answer select:focus { outline: 2px solid var(--positive); outline-offset: 0; border-color: var(--positive); }

.field-error { margin: 0 0 1rem; color: var(--negative); }

.question-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.question-actions .spacer { flex: 1; }
button.primary { font-size: 1.0625rem; padding: 0.6rem 1.4rem; border-radius: 6px; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 0.6rem 1rem; }
button.ghost:hover { background: var(--panel); border-color: var(--muted); color: var(--ink); }
.quiet-link { font-size: 0.875rem; color: var(--muted); }

.thinking { font-size: 0.875rem; color: var(--muted); }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

.ideas { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.ideas:empty { display: none; }
.ideas-lead { margin: 0; font-size: 0.875rem; color: var(--muted); }
button.idea {
  text-align: left; background: var(--panel); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 6px; padding: 0.7rem 0.9rem; line-height: 1.45;
}
button.idea:hover { border-color: var(--positive); background: var(--panel); }

/* Better / worse */
.fortune { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.25rem 0 0.5rem; }
.fortune-ask { color: var(--muted); }
.fortune-stake { font-size: 0.8125rem; color: var(--muted); flex-basis: 100%; }
button.pick { background: transparent; color: var(--ink); border: 1px solid var(--rule); border-radius: 999px; padding: 0.35rem 1rem; }
button.pick.better:hover, button.pick.better.on { border-color: var(--positive); color: var(--positive); background: transparent; }
button.pick.worse:hover, button.pick.worse.on { border-color: var(--negative); color: var(--negative); background: transparent; }
button.pick.on { font-weight: 600; box-shadow: inset 0 0 0 1px currentColor; }

/* Coach */
.coach { margin-top: 2.5rem; padding: 1rem 1.25rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); }
.coach h2 { margin: 0 0 0.6rem; font-size: 0.9375rem; }
.coach .findings { list-style: none; margin: 0; padding: 0; }
.coach-note { margin: 0 0 0.9rem; padding-left: 0.85rem; border-left: 2px solid var(--positive); }
.coach-note.computed { border-left-color: var(--gap); }
.coach-note p { margin: 0; }
.coach-note .about { font-size: 0.8125rem; color: var(--muted); }
.coach-note button.quiet { padding-left: 0; }
.coach-off { margin: 0.5rem 0 0; font-size: 0.875rem; color: var(--muted); }
button.ask-coach { background: transparent; color: var(--ink); border: 1px solid var(--muted); border-radius: 6px; }
button.ask-coach:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.coach .streaming { font-family: var(--ui); font-size: 0.9375rem; border-left: none; padding: 0; margin: 0 0 0.75rem; }

/* Scenes inside a moment */
.scenes { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.scenes h2 { margin-top: 0; }
.scene-list { list-style: none; margin: 0 0 1rem; padding: 0; counter-reset: scene; }
.scene-list li { counter-increment: scene; display: flex; gap: 0.75rem; align-items: baseline; padding: 0.55rem 0; border-top: 1px solid var(--rule); }
.scene-list li::before { content: counter(scene); font-family: var(--page); font-size: 0.8125rem; color: var(--muted); width: 1.25rem; }
.scene-list a { font-weight: 500; }
.scene-state { margin-left: auto; font-size: 0.8125rem; color: var(--muted); }
.add-scene { display: flex; gap: 0.5rem; }
.add-scene input { flex: 1; }

/* Story map */
.map-page { max-width: 60rem; margin: 0 auto; }
.map-head h1 { font-size: 2rem; letter-spacing: -0.02em; }
.stages { list-style: none; display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1.25rem 0 0; padding: 0; }
.stages li { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.45rem 0.9rem; border: 1px solid var(--rule); border-radius: 8px; min-width: 7rem; color: var(--muted); }
.stages li.current { border-color: var(--ink); color: var(--ink); }
.stages li.done { border-color: var(--positive); color: var(--positive); }
.stage-name { font-weight: 600; font-size: 0.9375rem; }
.stage-progress { font-family: var(--page); font-size: 0.75rem; }
.stages li.done .stage-progress::before { content: "\2713  "; }

.milestone { margin: 1.5rem 0 0; padding: 0.75rem 1rem; border-left: 2px solid var(--positive); background: var(--panel); }

.next-card {
  display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1.5rem; align-items: center;
  margin: 1.5rem 0 0; padding: 1.1rem 1.35rem; border-radius: 10px;
  background: var(--ink); color: var(--paper); text-decoration: none;
}
.next-card:hover { background: var(--positive); }
.next-label { font-size: 0.8125rem; opacity: 0.75; }
.next-prompt { grid-column: 1; font-size: 1.1875rem; font-weight: 600; line-height: 1.35; }
.next-go { grid-column: 2; grid-row: 1 / span 2; padding: 0.5rem 1.1rem; border: 1px solid currentColor; border-radius: 6px; font-weight: 600; }

.map-frame { margin: 1.75rem 0 0; }
.map-frame figcaption { margin-top: 0.4rem; font-size: 0.8125rem; color: var(--muted); }
.journey-map { display: block; width: 100%; height: auto; }
.journey-map .map-mid { stroke: var(--rule); }
.journey-map .map-drop { stroke: var(--rule); stroke-dasharray: 1 4; }
.journey-map .map-part { stroke: var(--rule); stroke-dasharray: 3 5; }
.journey-map .map-part-name { font: 600 12px var(--ui); fill: var(--muted); }
.journey-map .map-line { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.journey-map .map-line.ahead { stroke: var(--rule); stroke-width: 2; stroke-dasharray: 5 6; }
.journey-map .map-dot { fill: var(--paper); stroke: var(--muted); stroke-width: 1.5; }
.journey-map .map-dot.written { fill: var(--ink); stroke: var(--ink); }
.journey-map .map-dot.better { fill: var(--positive); stroke: var(--positive); }
.journey-map .map-dot.worse { fill: var(--negative); stroke: var(--negative); }
.journey-map .map-dot.current { stroke: var(--ink); stroke-width: 3; }
.journey-map .map-name { font: 12px var(--ui); fill: var(--muted); text-anchor: middle; }
.journey-map .map-stop:hover .map-name { fill: var(--ink); }
.journey-map .map-stop:hover .map-dot { stroke: var(--ink); stroke-width: 3; }
@media (prefers-reduced-motion: no-preference) {
  .journey-map .map-line:not(.ahead) { stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 0.9s ease-out forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

.map-columns { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 2rem; align-items: start; margin-top: 1.5rem; }
.map-columns .coach { margin-top: 0; position: sticky; top: 1rem; }
.moments { list-style: none; margin: 0; padding: 0; }
.moments li { border-top: 1px solid var(--rule); }
.moments a { display: flex; gap: 0.9rem; padding: 0.7rem 0.25rem; text-decoration: none; align-items: baseline; }
.moments a:hover { background: var(--panel); }
.moments .n { font-family: var(--page); font-size: 0.8125rem; color: var(--muted); width: 1.5rem; height: 1.5rem; border: 1px solid var(--rule); border-radius: 50%; display: grid; place-items: center; flex: none; }
.moments li.written .n { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.moments li.better .n { background: var(--positive); border-color: var(--positive); color: var(--paper); }
.moments li.worse .n { background: var(--negative); border-color: var(--negative); color: var(--paper); }
.moments .what { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.moments .name { font-weight: 600; }
.moments .said { color: var(--muted); font-size: 0.9375rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.moments .said.todo { font-size: 0.8125rem; }

.map-foot { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.875rem; color: var(--muted); }
.map-foot a { color: var(--muted); }

/* Read-through */
.read { max-width: 38rem; margin: 0 auto; font-size: 1.0625rem; line-height: 1.65; }
.read h1 { font-size: 2rem; }
.read h2 { font-size: 0.8125rem; color: var(--muted); margin: 2.5rem 0 0.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.read h3 { font-size: 1.0625rem; margin: 1.25rem 0 0.25rem; }
.read-moment p { margin: 0; }
.read .todo { color: var(--muted); font-size: 0.9375rem; }
.read .saying { padding-left: 0.85rem; border-left: 2px solid var(--positive); }

@media (max-width: 760px) {
  .map-columns { grid-template-columns: 1fr; }
  .map-columns .coach { position: static; }
  .next-card { grid-template-columns: 1fr; }
  .next-go { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 0.5rem; }
  .question h1 { font-size: 1.5rem; }
}

.howto { margin: 0 0 1.25rem; padding: 0.6rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); max-width: 44rem; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto ol { margin: 0.75rem 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.howto code { font-family: var(--page); font-size: 0.875rem; background: var(--paper); padding: 0.05rem 0.35rem; border-radius: 3px; }
.draft-offer { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 1.25rem; }
.draft-offer .help { margin: 0; }

form.next-card:hover { background: var(--ink); }
button.next-go { background: transparent; color: inherit; font-size: 1rem; }
button.next-go:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* Accounts ------------------------------------------------------------------ */
.masthead .spacer { flex: 1; }
.masthead .who { font-size: 0.8125rem; color: var(--muted); }
.masthead .signout { margin: 0; }
.auth { max-width: 26rem; margin: 3rem auto 0; }
.auth h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.auth-form { margin-top: 1.5rem; }
.auth-form button.primary { width: 100%; margin-top: 0.5rem; }
.auth-switch { margin-top: 1.5rem; color: var(--muted); }
.answer .hint { font-size: 0.8125rem; }

/* Import ----------------------------------------------------------------------- */
.import-offer { margin-top: 1.5rem; color: var(--muted); }
.import-note { margin-top: 1rem; font-size: 0.875rem; color: var(--muted); }
.answer input[type="file"] { font-size: 0.9375rem; padding: 0.5rem; }
.understood { margin: 0 0 1rem; }
.understood div { padding: 0.6rem 0; border-top: 1px solid var(--rule); }
.understood dt { font-size: 0.8125rem; color: var(--muted); }
.understood dd { margin: 0.1rem 0 0; }
a.button { display: inline-block; text-decoration: none; background: var(--ink); color: var(--paper); border-radius: 6px; padding: 0.6rem 1.4rem; font-size: 1.0625rem; }
a.button:hover { background: var(--positive); }
.original { white-space: pre-wrap; font-family: var(--page); font-size: 0.875rem; line-height: 1.55; background: var(--panel); border: 1px solid var(--rule); padding: 1.25rem; border-radius: 6px; }

/* Front page -------------------------------------------------------------------
   The screen is always dark: house lights down, whatever the reader's theme. */
.landing {
  --night: #0d1a2c; --night-2: #16283f; --light: #f6e7bd; --dim: #9fb0c4;
  --up: #86cbe6; --down: #ec9488;
  --script: "Courier Prime", "Courier New", Courier, monospace;
  margin: -2rem -1rem -6rem;
}
.landing h2 { font-size: clamp(1.5rem, 3vw, 2.125rem); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 1rem; max-width: 22ch; }
.landing section { padding: clamp(3rem, 8vw, 6rem) clamp(1.25rem, 6vw, 5rem); }

.landing .screen {
  background: radial-gradient(120% 90% at 85% 0%, var(--night-2), var(--night) 60%);
  color: var(--light);
  padding-top: clamp(2.5rem, 4.5vw, 3.75rem); padding-bottom: clamp(2rem, 4vw, 3rem);
}
.screen-copy { max-width: 46rem; }
.screen h1 {
  font-family: var(--script); font-weight: 700;
  font-size: clamp(2.125rem, 5.4vw, 4.25rem); line-height: 1.04; letter-spacing: -0.045em;
  margin: 0 0 1.25rem; text-wrap: balance;
}
.screen .lede { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); line-height: 1.55; color: #d7dfe8; max-width: 38rem; margin: 0 0 1.75rem; }
.ways-in { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 0; }
.landing a.cta {
  display: inline-block; text-decoration: none; font-weight: 650; font-size: 1.125rem;
  background: var(--light); color: var(--night); padding: 0.8rem 1.6rem; border-radius: 4px;
}
.landing a.cta:hover { background: #fff; }
.landing a.cta:focus-visible, .landing a.cta-quiet:focus-visible { outline: 3px solid var(--up); outline-offset: 3px; }
.landing a.cta-quiet { color: var(--light); text-underline-offset: 0.25em; }
.landing .closed { color: var(--dim); }

.ride { margin: 0.5rem 0 0; }
.ride svg { display: block; width: 100%; height: auto; overflow: visible; }
.ride .ground { stroke: var(--dim); stroke-opacity: 0.35; stroke-width: 1; stroke-dasharray: 3 7; }
.ride .line { fill: none; stroke: var(--light); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.ride .stop circle { fill: var(--night); stroke: var(--light); stroke-width: 3; }
.ride .stop.up circle { stroke: var(--up); fill: var(--up); }
.ride .stop.down circle { stroke: var(--down); fill: var(--down); }
.ride .stop text { fill: var(--light); font: 600 19px var(--ui); text-anchor: middle; }
.ride .stop.first text, .ride .stop.beside text { text-anchor: start; }
.ride .stop.last text { text-anchor: end; }
.ride figcaption { color: var(--dim); font-size: 0.9375rem; max-width: 36rem; margin-top: 1.25rem; }

@media (prefers-reduced-motion: no-preference) {
  .ride .line { animation: ride-draw 2.6s cubic-bezier(.45,.05,.3,1) 0.3s both; }
  .ride .stop { animation: ride-stop 0.5s ease-out both; animation-delay: calc(0.3s + var(--at) * 2.5s); }
}
@keyframes ride-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ride-stop { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 720px) {
  .ride svg { width: 215%; }
  .ride { overflow-x: auto; margin-right: calc(-1 * clamp(1.25rem, 6vw, 5rem)); padding-bottom: 0.5rem; }
  .ride figcaption { position: sticky; left: 0; padding-right: 1.25rem; }
}

.steps { list-style: none; counter-reset: step; margin: 2.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2.5rem 3rem; }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 1rem; }
.steps li::before { content: counter(step); font: 700 2.25rem/1 var(--page); color: var(--positive); }
.steps h3 { font-size: 1.125rem; margin: 0.75rem 0 0.4rem; }
.steps p { margin: 0; color: var(--muted); max-width: 34ch; }

.landing .coach-sample { background: var(--panel); display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 2.5rem 4rem; align-items: center; }
.coach-words p { color: var(--muted); max-width: 44ch; font-size: 1.0625rem; margin: 0; }
.sample { max-width: 30rem; }
.sample-page { margin: 0; background: #fffdf6; color: #1c1c1c; font: 0.875rem/1.5 var(--script); padding: 1.5rem 1.5rem 1.75rem; box-shadow: 0 1px 0 #d8d2bf, 0 18px 40px -22px rgba(13,26,44,.55); overflow-x: auto; }
.sample-note { margin: -0.75rem 0 0 2rem; position: relative; background: var(--night); color: #e8eef5; padding: 1rem 1.25rem; border-left: 4px solid var(--down); font-size: 0.9375rem; line-height: 1.5; }
.sample-note strong { display: block; color: var(--light); margin-bottom: 0.2rem; }

.bring p { max-width: 56ch; color: var(--muted); font-size: 1.0625rem; margin: 0; }
.landing .last-word { background: var(--night); color: var(--light); text-align: left; }
.last-word p { font: 700 clamp(1.5rem, 3.6vw, 2.75rem)/1.1 var(--script); letter-spacing: -0.04em; margin: 0 0 1.75rem; max-width: 20ch; }
.screen-top { display: grid; gap: 1.5rem 3rem; align-items: center; }
.talk { display: block; width: 100%; max-width: 44rem; aspect-ratio: 720 / 380; justify-self: center; }
@media (max-width: 560px) { .talk { aspect-ratio: 460 / 390; } }
@media (min-width: 1000px) { .screen-top { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }

/* Movie settings ---------------------------------------------------------------- */
.settings-block { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.settings-block h2 { font-size: 1.125rem; margin: 0 0 0.25rem; }
.settings-block.danger h2 { color: var(--negative); }
button.delete { background: var(--negative); border-color: var(--negative); color: #fff; border-radius: 6px; padding: 0.6rem 1.2rem; }
button.delete:hover { background: #7f2d25; border-color: #7f2d25; }

/* Confirm-your-email reminder -------------------------------------------------- */
.confirm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin: -2rem 0 2rem; padding: 0.7rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--rule); border-left: 4px solid var(--gap); font-size: 0.9375rem; }
.confirm-bar p { margin: 0; }

/* Logo --------------------------------------------------------------------------- */
.masthead { align-items: center; }
.masthead .home { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); }
.masthead .mark { display: block; border-radius: 7px; }
.masthead .wordmark { font: 700 1.1875rem/1 "Courier Prime", "Courier New", Courier, monospace; letter-spacing: -0.06em; }

/* The shelf: your movies ---------------------------------------------------------- */
.shelf { list-style: none; margin: 1.25rem 0 2rem; padding: 0; border-top: 1px solid var(--rule); }
.shelf li { border-bottom: 1px solid var(--rule); }
a.movie { display: flex; align-items: center; gap: 1.5rem; padding: 1.1rem 0.5rem; margin: 0 -0.5rem; text-decoration: none; color: var(--ink); border-radius: 6px; }
a.movie:hover { background: var(--panel); }
.movie-words { flex: 1; min-width: 0; display: grid; gap: 0.2rem; }
.movie-title { font-size: 1.25rem; font-weight: 650; letter-spacing: -0.015em; }
.movie-about { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.movie-progress { font-size: 0.8125rem; color: var(--muted); margin-top: 0.2rem; }
.movie-next { margin-left: 0.9rem; color: var(--positive); }
.movie-line { flex: none; width: 120px; height: 36px; }
.movie-line polyline { fill: none; stroke: var(--positive); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 520px) { .movie-line { display: none; } .movie-next { display: block; margin: 0.15rem 0 0; } }

/* The script editor ---------------------------------------------------------------
   With scripts on, the plain text box and the separate preview give way to one
   page that is both: you type on it and it is already laid out. */
.scene-split.rich { grid-template-columns: minmax(0, 1fr); }
.scene-page:has(.rich) { max-width: 52rem; }
.scene-split.rich textarea, .scene-split.rich .plain-label, .scene-split.rich .preview .el, .scene-split.rich .preview .empty { display: none; }
.scene-split.rich .preview { border: 0; background: transparent; padding: 0; min-height: 0; }
.scene-split.rich .preview-meta { margin: 0.5rem 0 0; }
.scene-page:has(.rich) .howto { display: none; }

.script-editor { position: relative; }
.kinds { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.5rem 0; background: var(--paper); }
.kinds-label { font-size: 0.8125rem; color: var(--muted); margin-right: 0.35rem; }
.kinds button { background: transparent; color: var(--ink); border: 1px solid var(--rule); border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.8125rem; }
.kinds button:hover { background: var(--panel); border-color: var(--muted); color: var(--ink); }
.kinds button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.script-editor .page {
  background: #fffdf6; color: #1c1c1c; caret-color: #1c1c1c;
  font: 1rem/1.5 "Courier Prime", "Courier New", Courier, monospace;
  padding: 3rem clamp(1rem, 6vw, 4.5rem) 6rem; min-height: 62vh;
  box-shadow: 0 1px 0 #d8d2bf, 0 18px 40px -26px rgba(13,26,44,.5);
  outline: none; white-space: pre-wrap; overflow-wrap: break-word;
}
.script-editor .page:focus-visible { box-shadow: 0 0 0 2px var(--positive), 0 18px 40px -26px rgba(13,26,44,.5); }
.script-editor .line { position: relative; margin-top: 1.5em; min-height: 1.5em; }
.script-editor .line:first-child { margin-top: 0; }
.script-editor .line[data-kind="scene-heading"] { text-transform: uppercase; font-weight: 700; }
.script-editor .line[data-kind="character"] { margin-left: 37%; text-transform: uppercase; }
.script-editor .line[data-kind="parenthetical"] { margin: 0 25% 0 27%; }
.script-editor .line[data-kind="dialogue"] { margin: 0 17% 0 17%; }
.script-editor .line[data-kind="transition"] { text-align: right; text-transform: uppercase; }
/* An empty line says what belongs on it. */
.script-editor .line.blank::before { content: attr(data-hint); position: absolute; left: 0; right: 0; color: #a39f90; pointer-events: none; text-transform: none; font-weight: 400; white-space: nowrap; overflow: hidden; }
.script-editor .line.blank[data-kind="transition"]::before { text-align: right; }

.suggest { position: absolute; z-index: 3; list-style: none; margin: 0; padding: 0.25rem; min-width: 14rem; background: var(--panel); border: 1px solid var(--muted); border-radius: 6px; box-shadow: 0 12px 28px -12px rgba(13,26,44,.5); font: 0.9375rem/1.3 "Courier Prime", "Courier New", Courier, monospace; }
.suggest li { padding: 0.35rem 0.6rem; border-radius: 4px; cursor: pointer; white-space: pre; }
.suggest li.on { background: var(--ink); color: var(--paper); }
.keys { font-size: 0.8125rem; color: var(--muted); margin: 0.75rem 0 0; }
.keys kbd { font: inherit; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.3rem; background: var(--panel); }
@media (max-width: 600px) {
  .script-editor .line[data-kind="character"] { margin-left: 30%; }
  .script-editor .line[data-kind="dialogue"] { margin: 0 6% 0 10%; }
  .script-editor .line[data-kind="parenthetical"] { margin: 0 12% 0 20%; }
}

/* Your script ----------------------------------------------------------------------
   On screen: a sheet of paper under a few controls. In print: only the paper,
   set out to the measurements a screenplay is expected to have. */
.script-view { max-width: 52rem; margin: 0 auto; }
.script-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin: 1.25rem 0; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 1.5rem; }
.byline label { font-size: 0.875rem; color: var(--muted); }
.byline input { flex: 1 1 16rem; min-width: 0; }
.paper {
  --script: "Courier Prime", "Courier New", Courier, monospace;
  background: #fffdf6; color: #1c1c1c; font: 1rem/1.25 var(--script);
  padding: 3.5rem clamp(1rem, 7vw, 5rem) 5rem;
  box-shadow: 0 1px 0 #d8d2bf, 0 18px 40px -26px rgba(13,26,44,.5);
}
.paper a { color: inherit; }
.title-page { min-height: 22rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-bottom: 1px dashed #d8d2bf; margin-bottom: 3rem; padding-bottom: 3rem; }
.tp-title { text-transform: uppercase; font-weight: 700; margin: 0 0 2rem; letter-spacing: 0.02em; }
.tp-by, .tp-name { margin: 0 0 1rem; }
.paper .el { margin: 1.25em 0 0; white-space: pre-wrap; }
.paper .el.scene-heading { text-transform: uppercase; font-weight: 700; margin-top: 2.5em; break-after: avoid; }
.paper .el.character { margin-left: 37%; text-transform: uppercase; break-after: avoid; }
.paper .el.parenthetical { margin: 0 25% 0 27%; break-after: avoid; }
.paper .el.dialogue { margin: 0 17%; }
.paper .el.transition { text-align: right; text-transform: uppercase; }
.script-scene { position: relative; }
.scene-edit { position: absolute; top: 0; right: 0; font: 0.75rem var(--ui); color: #8a8674 !important; opacity: 0; }
.script-scene:hover .scene-edit, .scene-edit:focus { opacity: 1; }
.unwritten { margin: 2.5em 0 0; padding: 0.75rem 1rem; border: 1px dashed #c9c2a8; color: #6f6a58; font: 0.9375rem var(--ui); }
.unwritten-where { color: #9a957f; }

@media print {
  @page { size: letter; margin: 1in 1in 1in 1.5in; }
  html, body { background: #fff !important; }
  .masthead, .script-tools, .confirm-bar, .scene-edit, .unwritten, .site-foot { display: none !important; }
  main { padding: 0 !important; }
  .script-view { max-width: none; margin: 0; }
  .paper { box-shadow: none; padding: 0; background: #fff; color: #000; font: 12pt/1 "Courier Prime", "Courier New", Courier, monospace; line-height: 12pt; }
  .title-page { min-height: 0; height: 8.5in; border: 0; margin: 0; padding: 0; break-after: page; }
  .paper .el { margin-top: 12pt; orphans: 2; widows: 2; }
  .paper .el.scene-heading { margin-top: 24pt; }
  .script-scene:first-of-type .el.scene-heading:first-child { margin-top: 0; }
  .paper .el.character { margin-left: 2.2in; }
  .paper .el.parenthetical { margin: 0 0 0 1.6in; max-width: 2in; }
  .paper .el.dialogue { margin: 0 0 0 1in; max-width: 3.5in; }
}
.example-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: 1.5rem; color: var(--muted); }
.example-offer button.ghost { padding: 0.4rem 0.9rem; font-size: 0.9375rem; }

/* The cast ------------------------------------------------------------------------- */
.person { border-top: 1px solid var(--rule); padding: 1rem 0; }
.person.hero { border: 1px solid var(--rule); border-left: 4px solid var(--positive); background: var(--panel); padding: 1rem 1.25rem; border-radius: 6px; margin: 1.5rem 0 1rem; }
.person.hero h2 { margin: 0 0 0.35rem; font-size: 1.375rem; }
.person.hero p { margin: 0.2rem 0; }
.person-role, .person-label { font-size: 0.8125rem; color: var(--muted); }
.person-role { margin: 0 0 0.2rem !important; }
.person summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; list-style: none; }
.person summary::-webkit-details-marker { display: none; }
.person-name { font-weight: 650; font-size: 1.0625rem; }
.person-tag { font-size: 0.75rem; color: var(--negative); border: 1px solid currentColor; border-radius: 999px; padding: 0 0.5rem; }
.person-about { color: var(--muted); flex-basis: 100%; }
.person-form { margin-top: 1rem; }
.person-form .answer { margin-bottom: 0.75rem; }
.person-remove { margin-top: 0.5rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9375rem; margin: 0.25rem 0 0.75rem; }
label.check input { flex: none; }
.unlisted { border-top: 1px solid var(--rule); padding: 1rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.unlisted h2, .unlisted .help { flex-basis: 100%; margin: 0; }
.unlisted h2, .add-person h2 { font-size: 1.0625rem; }
.add-person { border-top: 1px solid var(--rule); padding-top: 1.25rem; margin-top: 0.5rem; }
.scene-nav { display: flex; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 0; font-size: 0.9375rem; }
.scene-nav a { color: var(--muted); }
.masthead a.who { text-decoration: none; }
.masthead a.who:hover { color: var(--ink); text-decoration: underline; }
.saved-note { border-left: 4px solid var(--positive); background: var(--panel); padding: 0.6rem 1rem; }
@media (max-width: 520px) { .masthead .who { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* Footer and small print ----------------------------------------------------------- */
main { min-height: calc(100vh - 12rem); }
.site-foot { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 1.5rem 1rem; border-top: 1px solid var(--rule); font-size: 0.8125rem; color: var(--muted); }
.site-foot a { color: var(--muted); }
.site-foot span { margin-right: auto; }
.small-print { font-size: 0.8125rem; color: var(--muted); margin-top: 1rem; }
.prose { max-width: 40rem; margin: 0 auto; }
.prose h1 { font-size: 2rem; letter-spacing: -0.02em; }
.prose h2 { font-size: 1.125rem; margin: 2rem 0 0.5rem; }
.prose p, .prose li { line-height: 1.65; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.5rem; }

/* Small-screen and dark-mode refinements -------------------------------------------- */
.movie-next { margin: 0; font-size: 0.8125rem; color: var(--positive); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.who-short { display: none; }
@media (max-width: 560px) {
  .who-email { display: none; }
  .who-short { display: inline; }
  .masthead { flex-wrap: nowrap; }
  .masthead .model-off { display: none; }
}
@media (prefers-color-scheme: dark) { .masthead .mark { box-shadow: 0 0 0 1px var(--rule); } }
@media (max-width: 640px) {
  /* The story line stays readable on a phone: it scrolls sideways rather than shrinking to nothing. */
  .map-frame { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .map-frame .journey-map { width: 640px; max-width: none; }
  .map-frame figcaption { position: sticky; left: 0; }
}
:where(a, button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--positive); outline-offset: 2px; }

/* ---- auto mode: a script written from one idea ---- */
a.button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
a.button.ghost:hover { background: var(--panel); border-color: var(--muted); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--positive); width: 1.05rem; height: 1.05rem; margin: 0; padding: 0; flex: none; }
.question .help:has(+ .answer), .question .help:has(+ .field-error) { margin-bottom: 1.5rem; }
.question .help.import-note { font-size: 0.875rem; color: var(--muted); margin: 1rem 0 0; }
.answer .help { font-size: 0.875rem; color: var(--muted); margin: 0.2rem 0 0; max-width: none; }
.answer { margin-bottom: 1.25rem; }
fieldset.choice { border: 0; padding: 0; margin-inline: 0; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
fieldset.choice legend { padding: 0; margin-bottom: 0.4rem; font-size: 0.9375rem; color: var(--muted); }
/* A choice is a whole row you can press, with the control at its left. */
.answer label.option { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.7rem; align-items: center; padding: 0.65rem 0.85rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--panel); color: var(--ink); font-size: 1.0625rem; cursor: pointer; }
.answer label.option .hint { grid-column: 2; margin-left: 0; color: var(--muted); font-size: 0.875rem; }
.answer label.option:has(input[type="radio"]:checked) { border-color: var(--positive); box-shadow: inset 0 0 0 1px var(--positive); }
.answer label.option:has(input:focus-visible) { outline: 2px solid var(--positive); outline-offset: 2px; }
.autorun h1 { margin-bottom: 0.25rem; }
.auto-doing { font-size: 1.125rem; margin: 0.5rem 0 0.75rem; display: flex; align-items: center; gap: 0.6rem; }
.auto-pulse { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--positive); flex: none; animation: auto-pulse 1.4s ease-in-out infinite; }
@keyframes auto-pulse { 50% { opacity: 0.25; transform: scale(0.7); } }
@media (prefers-reduced-motion: reduce) { .auto-pulse { animation: none; } }
.auto-bar { height: 0.5rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.auto-bar span { display: block; height: 100%; background: var(--positive); transition: width 0.6s ease; }
.autorun .question-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin: 1.25rem 0 0.5rem; }
.auto-story { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); max-width: 42rem; }
.auto-premise { font-size: 1.1875rem; line-height: 1.5; margin: 0 0 0.5rem; }
.auto-hero { color: var(--muted); margin: 0 0 1.5rem; }
.auto-parts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.auto-parts h2 { font-size: 1rem; margin: 0 0 0.25rem; display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.auto-parts h2 .hint { font-weight: 400; font-size: 0.8125rem; color: var(--muted); }
.auto-parts p { margin: 0; line-height: 1.55; }
.auto-scenes { margin: 0.4rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.9375rem; }
.auto-review { margin-top: 1.5rem; padding: 1.1rem 1.25rem 1.25rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); }
.auto-review .answer { margin-bottom: 0; }
.auto-review .answer label { color: var(--ink); font-weight: 600; font-size: 1rem; }
.auto-review textarea { background: var(--paper); }
.autorun .auto-review .question-actions { margin: 1rem 0 0; }
.autorun .stages { margin-top: 1rem; }
.auto-review textarea { width: 100%; }
.auto-scenes strong { color: var(--ink); font-weight: 600; }
.answer label .hint { margin-left: 0.35rem; }

/* ---- polish pass ---- */
.add-person h2 { margin-top: 0; }
.unlisted { padding-bottom: 1.25rem; }
.new-script { padding-top: 1.75rem; }
.new-script label { font-size: 0.9375rem; }
.new-script input { font-size: 1.0625rem; padding: 0.6rem 0.8rem; }
.new-script button { font-size: 1.0625rem; padding: 0.6rem 1.4rem; }
/* Other ways to begin a movie: three doors, side by side. */
.ways-head { font-size: 0.9375rem; font-weight: 400; color: var(--muted); margin: 2rem 0 0.6rem; }
.ways { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: 0.75rem; }
.ways li, .ways form { display: flex; margin: 0; }
.way { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; text-align: left; text-decoration: none; font: inherit; line-height: 1.4; cursor: pointer; padding: 0.85rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); color: var(--ink); }
.way:hover { border-color: var(--positive); background: var(--panel); color: var(--ink); }
.way-name { font-weight: 650; }
.way-what { font-size: 0.875rem; color: var(--muted); }
.shelf { margin-bottom: 0; }
.shelf + .new-script { border-top: 0; }
.ways form { flex: 1; }
.byline input { flex: 1 1 8rem; }
:root { color-scheme: light dark; }

/* ---- credits ---- */
.masthead .credit-chip {
  font-size: 0.8125rem; font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap;
  color: var(--ink); border: 1px solid var(--rule); border-radius: 999px; padding: 0.15rem 0.6rem;
}
.masthead .credit-chip:hover { border-color: var(--positive); color: var(--positive); }
.credit-balance { font-size: 1.125rem; margin: 0.25rem 0 0.5rem; }
.credit-balance strong { font-size: 2rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.settings-block.credits h3 { font-size: 0.9375rem; margin: 1.5rem 0 0.25rem; }
.credit-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.credit-table td { padding: 0.4rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.credit-table td + td { padding-left: 1rem; }
.credit-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.credit-table .when, .credit-table .left { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }
.credit-table .added { color: var(--positive); }
.refusal {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 20;
  width: min(34rem, calc(100vw - 2rem)); margin: 0; padding: 0.75rem 1rem;
  display: flex; gap: 1rem; align-items: baseline; justify-content: space-between;
  background: var(--panel); color: var(--ink); border: 1px solid var(--negative); border-radius: 6px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.18); font-size: 0.9375rem;
}
.refusal button { flex: none; }
@media (max-width: 520px) { .credit-table .left { display: none; } }
.credit-table + .help { margin-top: 0.6rem; }

/* Passkeys ---------------------------------------------------------------- */
.passkey-way { margin-top: 1.25rem; }
.passkey-way button { width: 100%; }
.passkey-or { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.875rem; margin: 0 0 1.25rem; }
.passkey-or::before, .passkey-or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.passkey-note { margin: 0.75rem 0 0; }
.passkey-list { list-style: none; margin: 1rem 0 1.25rem; padding: 0; }
.passkey-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.passkey-list form { margin: 0; }
.passkey-name .hint { display: inline-block; margin-left: 0.4rem; }
.passkey-name .hint { color: var(--muted); font-size: 0.8125rem; }

/* Buying credits ------------------------------------------------------------ */
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.75rem; margin: 0.75rem 0; }
button.pack { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; text-align: left; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 0.8rem 1rem; }
button.pack:hover { border-color: var(--positive); background: var(--panel); color: var(--ink); }
button.pack span { color: var(--muted); font-size: 0.9375rem; }

/* A scene's notes, shown as the writer wrote them, line breaks and all. */
.scene-notes { margin: 0 0 1rem; padding: 0.75rem 1rem; border-left: 3px solid var(--line, #ccc); }
.scene-notes h2 { font-size: 0.95rem; margin: 0 0 0.35rem; }
.scene-notes-text { white-space: pre-wrap; margin: 0; }
.scene-kind { margin: 0 0 1rem; }

/* Fountain's centred text and sung lines. */
.preview .el.centered, .paper .el.centered { text-align: center; }
.preview .el.lyric, .paper .el.lyric { font-style: italic; }

/* The bar at the top of a movie's pages: back to the movie, the main things
   to do as buttons, and the rest in a menu. */
.movie-bar { display: flex; align-items: center; gap: 0.25rem; margin: 0 0 1rem; min-height: 2.5rem; }
.movie-bar .spacer { flex: 1; }
/* On the movie's own page the bar sits level with its title. */
.movie-bar.home { float: right; margin: 0.35rem 0 0.5rem 1rem; }
.movie-bar svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.movie-back { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--muted); text-decoration: none; font-size: 0.9375rem; min-width: 0; }
.movie-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movie-back:hover { color: var(--ink); }
.bar-btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.4rem 0.7rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--panel); color: var(--ink); text-decoration: none; font-size: 0.9375rem; line-height: 1; cursor: pointer; }
.bar-btn:hover { border-color: var(--positive); color: var(--positive); }
.bar-btn:focus-visible, .menu-list a:focus-visible { outline: 2px solid var(--positive); outline-offset: 2px; }
.movie-bar { flex-wrap: wrap; justify-content: flex-end; }
.view-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; margin-right: 0.35rem; font-size: 0.875rem; }
.view-switch a { padding: 0.4rem 0.7rem; color: var(--muted); text-decoration: none; line-height: 1; }
.view-switch a[aria-current] { background: var(--ink); color: var(--paper); }
.view-switch a:not([aria-current]):hover { color: var(--ink); }
.view-switch a:focus-visible { outline: 2px solid var(--positive); outline-offset: -2px; }
.movie-menu { position: relative; }
.movie-menu > summary { list-style: none; padding: 0.4rem 0.55rem; }
.movie-menu > summary::-webkit-details-marker { display: none; }
.movie-menu[open] > summary { border-color: var(--positive); color: var(--positive); }
.menu-list { position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 20; min-width: 15rem; margin: 0; padding: 0.35rem; list-style: none; background: var(--panel); border: 1px solid var(--rule); border-radius: 0.6rem; box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); }
.menu-list a { display: block; padding: 0.55rem 0.75rem; border-radius: 0.4rem; color: var(--ink); text-decoration: none; }
.menu-list a:hover { background: var(--paper); }
@media (max-width: 560px) {
  .bar-btn { padding: 0.45rem 0.55rem; }
  .bar-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* The outline and the treatment: two tellings of the same story. */
.read .telling { color: var(--muted); font-size: 0.9375rem; margin: -0.25rem 0 1rem; }

/* Download and Print, on the pages that are documents. */
.doc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1.25rem 0; }
.doc-actions svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.doc-actions button.bar-btn { font: inherit; font-size: 0.9375rem; line-height: 1; }
.doc-menu > summary { padding: 0.4rem 0.7rem; }
.doc-menu .menu-list { left: 0; right: auto; }
.menu-list .ext { color: var(--muted); font-size: 0.8125rem; margin-left: 0.35rem; }
.untold { border-left: 4px solid var(--gap); background: var(--panel); padding: 0.75rem 1rem; margin: 1rem 0; }
.untold p { margin: 0 0 0.6rem; }

/* The treatment: prose on the same sheet of paper as the script. */
.tp-logline { max-width: 30rem; margin: 1.5rem auto 0; }
.paper .tr-act { font: inherit; font-weight: 700; text-transform: uppercase; margin: 2.5em 0 0; break-after: avoid; }
.paper .tr-p { margin: 1.25em 0 0; white-space: pre-wrap; }
/* The edit link sits in the gap above its paragraph, clear of the words. */
.paper.prose .scene-edit { top: -1.1rem; }
@media print {
  @page prose { size: letter; margin: 1in; }
  .paper.prose { page: prose; }
  .paper .tr-act { margin-top: 24pt; }
  .paper .tr-p { margin-top: 12pt; orphans: 2; widows: 2; }
  .movie-bar, .doc-actions, .read .telling { display: none !important; }
}
.scene-tag { font-family: var(--ui); font-weight: 400; font-size: 0.8125rem; color: var(--gap); border: 1px solid currentColor; border-radius: 999px; padding: 0.05rem 0.5rem; margin-left: 0.35rem; white-space: nowrap; }

/* Talking a note over with the coach. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.coach-note .who { font-size: 0.75rem; font-weight: 600; color: var(--muted); margin: 0 0.35rem 0 0; }
.coach-note p.who { margin: 0 0 0.15rem; }
.coach-note .said { margin: 0.4rem 0 0 0.75rem; padding-left: 0.6rem; border-left: 2px solid var(--rule); font-size: 0.9375rem; }
.coach-note .said.coach-says { border-left-color: var(--positive); }
.note-reply, .coach-ask { display: grid; gap: 0.35rem; margin: 0.6rem 0 0.4rem; }
.note-reply textarea, .coach-ask textarea { width: 100%; font: inherit; font-size: 0.9375rem; padding: 0.4rem 0.5rem; border: 1px solid var(--rule); border-radius: 0.4rem; background: var(--paper); color: var(--ink); resize: vertical; }
.note-reply button, .coach-ask button { justify-self: start; }
.coach-ask { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--rule); }
.coach-ask label { font-size: 0.875rem; font-weight: 600; }
.closed-notes { margin-top: 1rem; font-size: 0.9375rem; }
.closed-notes summary { cursor: pointer; color: var(--muted); }
.closed-notes .coach-note { opacity: 0.85; }
.closed-notes .reason { font-size: 0.75rem; color: var(--muted); margin: 0.35rem 0 0; }

/* People: a picture, or initials on the person's own colour. */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--muted); color: #fff; font-family: var(--ui); font-weight: 650; line-height: 1; vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.s28 { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar.s40 { width: 40px; height: 40px; font-size: 0.9375rem; }
.avatar.s72 { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar.blank { background: var(--panel); border: 1px dashed var(--rule); }
.masthead a.who { display: inline-flex; align-items: center; gap: 0.45rem; }
.picture-field[hidden] { display: none; }
.picture-row { display: flex; align-items: center; gap: 1rem; }
.picture-row input[type="file"] { width: auto !important; min-width: 0; flex: 1; font-size: 0.9375rem !important; padding: 0.4rem !important; }
.settings-block.profile button + button { margin-left: 0.5rem; }

/* Sharing ------------------------------------------------------------------ */
.shared-tag { font-size: 0.8125rem; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 0.2rem 0.6rem; margin-left: 0.5rem; white-space: nowrap; }
.shelf.shared .movie-progress { display: inline-flex; align-items: center; gap: 0.4rem; }
/* Someone who may only read a movie is not shown controls that would be
   refused. The server refuses them regardless. */
.view-only main :is(button[type="submit"], form.new-node, form.add-person, .scene-edit):not(.movie-bar *, .doc-actions *, [data-anyone] *) { display: none !important; }
.view-only main :is(input, textarea, select):disabled { opacity: 0.85; cursor: default; }
.share-said { list-style: none; margin: 1rem 0; }
.share-said li + li { margin-top: 0.35rem; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.share-people { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.share-people li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.6rem 0; border-top: 1px solid var(--rule); }
.share-who { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; }
.share-name { font-weight: 600; }
.share-email, .share-role { font-weight: 400; font-size: 0.875rem; color: var(--muted); }
.share-change { display: inline-flex; align-items: center; gap: 0.4rem; }
.scene-held { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; border-left: 4px solid var(--gap); background: var(--panel); padding: 0.6rem 1rem; margin: 0.75rem 0; }
.scene-stale { margin: 0.75rem 0; }
.scene-stale[hidden], .scene-held [hidden] { display: none; }
.kinds[hidden] { display: none; }

/* Writing a scene together ------------------------------------------------- */
.live-people { display: flex; align-items: center; gap: 0.35rem; margin: 0.25rem 0 0.5rem; font-size: 0.8125rem; color: var(--muted); }
.live-people[hidden], .live-status[hidden], .live-lost[hidden] { display: none; }
.live-people .avatar { box-shadow: 0 0 0 2px var(--paper); }
.live-status { font-size: 0.875rem; color: var(--gap); margin: 0.25rem 0; }
.live-lost { border-left: 4px solid var(--negative); background: var(--panel); padding: 0.75rem 1rem; margin: 0.75rem 0; }
.live-lost p { margin: 0 0 0.5rem; }
.live-lost pre { white-space: pre-wrap; font: 0.9375rem/1.5 var(--script, "Courier Prime", "Courier New", monospace); background: var(--paper); padding: 0.6rem 0.75rem; border-radius: 6px; margin: 0 0 0.5rem; max-height: 14rem; overflow: auto; user-select: all; }
.script-editor .line { white-space: pre-wrap; }
.live-carets { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.live-caret { position: absolute; width: 2px; margin-left: -1px; }
.live-caret span { position: absolute; left: -1px; bottom: 100%; padding: 0 0.3rem; font: 600 0.6875rem/1.4 var(--ui); color: #fff; white-space: nowrap; border-radius: 3px 3px 3px 0; }
.live-tint { position: absolute; opacity: 0.22; }
@media print { .live-people, .live-status, .live-lost, .live-carets { display: none !important; } }

/* The Advanced view's own menu: three steps from the top down, with the one
   you are on marked. */
.work-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 1rem 0 1.5rem; }
.work-tabs a { display: grid; grid-template-columns: auto 1fr; column-gap: 0.6rem; align-items: baseline; padding: 0.65rem 0.85rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); color: var(--ink); text-decoration: none; }
.work-tabs a:hover { border-color: var(--positive); }
.work-tabs a:focus-visible { outline: 2px solid var(--positive); outline-offset: 2px; }
.adv-step { grid-row: 1 / span 2; align-self: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid var(--rule); display: inline-flex; align-items: center; justify-content: center; font-size: 0.8125rem; color: var(--muted); }
.adv-name { font-weight: 650; }
.adv-what { grid-column: 2; font-size: 0.8125rem; color: var(--muted); }
.work-tabs a[aria-current] { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--positive); }
.work-tabs a[aria-current] .adv-step { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@media (max-width: 640px) { .work-tabs { grid-template-columns: 1fr; } .adv-what { display: none; } }

/* The spine: acts stand out, sequences sit inside them, scenes inside those. */
.spine .row { padding: 0.9rem 0; }
.spine .row.is-act { margin-top: 1.25rem; padding: 1rem 0.75rem 1rem 0; background: var(--panel); border-top: 2px solid var(--ink); border-radius: 0 0 8px 8px; }
.spine .row.is-act:first-child { margin-top: 0; }
.spine .row.depth-1 .body { padding-left: 1.25rem; border-left: 2px solid var(--rule); }
.spine .row.depth-2 .body { margin-left: 1.25rem; padding-left: 1.25rem; border-left: 2px solid var(--rule); }
.layer-tag { display: inline-block; font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0.5rem 0.35rem 0; }
.is-act .layer-tag { color: var(--ink); font-weight: 700; }
.spine .row .beat-tag { margin-bottom: 0.35rem; }
.row-edit .title { font-size: 1.0625rem; }
.is-act .row-edit .title { font-size: 1.1875rem; }
.row-edit .summary { field-sizing: content; min-height: 2.6rem; max-height: 14rem; }
.actions { flex-wrap: wrap; }
.actions button, .row-tools button, .row-tools a { white-space: nowrap; }
.turn label { display: inline-flex; align-items: center; gap: 0.3rem; }
.turn select { max-width: 13rem; }
.turn-flat { font-style: italic; }
.row-tools { min-width: 9.5rem; }
.row-tools .mark-as label { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.75rem; color: var(--muted); }
.spine .row { grid-template-columns: var(--gutter) minmax(0, 1fr) auto; }
.turn { flex-wrap: wrap; row-gap: 0.25rem; }
.turn-flat { white-space: nowrap; }
.turn select { max-width: 100%; }

/* The three Advanced pages are one width, so the title and the menu sit in
   the same place on each; what is under them keeps its own reading width. */
.vision, .people, .spine-page { max-width: 64rem; margin: 0 auto; }
.vision > .standfirst, .vision > .vision-form { max-width: var(--measure); }
.people > .standfirst, .people > #people-body { max-width: 54rem; }

/* A button whose request is on its way says so, and cannot be pressed twice.
   One that asks the AI, which takes a while, says what it is doing. */
button.htmx-request { cursor: progress; opacity: 0.75; }
button.htmx-request::after { content: " …"; }
button[data-working].htmx-request { opacity: 1; border-color: var(--positive); color: var(--positive); font-size: 0; }
button[data-working].htmx-request::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.4rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -0.05rem; animation: working-spin 0.8s linear infinite; }
button[data-working].htmx-request::after { content: attr(data-working); font-size: 0.8125rem; }
@keyframes working-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button[data-working].htmx-request::before { animation: none; border-right-color: currentColor; opacity: 0.5; } }

/* The bar of a movie: its name, the view, Overview, the three ways to read
   it as one block, who is on it, and the rest in a menu. */
.movie-bar.home { float: none; margin: 0 0 1rem; }
.movie-bar .bar-btn[aria-current], .read-switch a[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.read-switch { display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; background: var(--panel); font-size: 0.9375rem; }
.read-switch .read-label { padding: 0.4rem 0.5rem 0.4rem 0.8rem; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); line-height: 1; }
.read-switch a { padding: 0.45rem 0.7rem; color: var(--ink); text-decoration: none; line-height: 1; border-left: 1px solid var(--rule); }
.read-switch a:hover { color: var(--positive); }
.read-switch a[aria-current]:hover { color: var(--paper); }
.read-switch a:focus-visible { outline: 2px solid var(--positive); outline-offset: -2px; }
.bar-people { display: inline-flex; align-items: center; padding-left: 8px; margin: 0 0.15rem; text-decoration: none; }
.bar-people .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--paper); }
.bar-people .avatar.more { background: var(--panel); color: var(--ink); border: 1px solid var(--rule); font-size: 0.6875rem; font-weight: 600; }
.bar-people:hover .avatar { box-shadow: 0 0 0 2px var(--positive); }
.work-tabs { margin-top: 0; }
@media print { .work-tabs { display: none !important; } }
@media (max-width: 560px) { .read-switch .read-label { display: none; } .read-switch a { padding: 0.45rem 0.55rem; } }
@media (max-width: 640px) {
  /* On a phone the three parts sit side by side, by name alone. */
  .work-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem; }
  .work-tabs a { display: block; padding: 0.5rem 0.4rem; text-align: center; font-size: 0.875rem; line-height: 1.25; }
  .work-tabs .adv-step { display: none; }
}
.read-switch .read-label { display: inline-flex; align-items: center; padding: 0.3rem 0.45rem 0.3rem 0.7rem; }
.coach-ask button { justify-self: end; }

/* Simple or Advanced only changes the overview, so the switch sits with the
   overview's three tabs. */
.work-tabs { grid-template-columns: auto repeat(3, minmax(0, 1fr)); align-items: stretch; }
.work-tabs .view-switch { align-self: center; margin: 0 0.4rem 0 0; }
.work-tabs a.work-tab { display: grid; }
.work-tabs .view-switch a { display: inline-block; padding: 0.4rem 0.7rem; border: 0; border-radius: 0; background: none; box-shadow: none; }
.work-tabs .view-switch a[aria-current] { background: var(--ink); color: var(--paper); box-shadow: none; }
@media (max-width: 640px) {
  .work-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-tabs .view-switch { grid-column: 1 / -1; justify-self: start; margin: 0 0 0.15rem; }
  .work-tabs a.work-tab { display: block; }
}

/* The row of the spine you were sent to is brought clear of the top and
   marked for a moment. */
.spine .row { scroll-margin-top: 1rem; }
.spine .row:target { outline: 2px solid var(--positive); outline-offset: 4px; border-radius: 6px; }

/* Outline, Treatment and Script open the same way: the page's name, a line
   saying what it is and how far along, then Download and Print. */
.script-tools h1 { font-size: 2rem; margin: 0 0 0.35rem; }
.script-tools > .help { margin: 0; max-width: 44rem; }
.script-tools .doc-actions { margin: 1rem 0 1.25rem; }
.script-tools .untold, .script-tools .byline { margin: 0 0 1.5rem; }
.script-view > .read { margin-top: 0.5rem; }
.read .doc-title { font-size: 2rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; margin: 1rem 0 0.75rem; }

/* How a part leaves things: three arrows. Grey until pointed at or chosen;
   then red for worse, blue for no change, green for better. */
.turn { gap: 0.5rem; }
.turn .quiet-label { font-size: 0.75rem; }
.moves { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; background: var(--panel); }
.moves .mv { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 1.6rem; padding: 0; border: 0; border-radius: 0; background: none; color: #9aa0a6; cursor: pointer; }
.moves .mv + .mv { border-left: 1px solid var(--rule); }
.moves .mv svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.moves .mv::after { content: none !important; }
.moves .mv.down:hover, .moves .mv.down[aria-pressed="true"] { background: #f6c9c5; color: #8f2a22; }
.moves .mv.level:hover, .moves .mv.level[aria-pressed="true"] { background: #c9dcf6; color: #244a86; }
.moves .mv.up:hover, .moves .mv.up[aria-pressed="true"] { background: #c7ecd0; color: #1f6b35; }
.moves .mv:focus-visible { outline: 2px solid var(--positive); outline-offset: -2px; }
.moves .mv:disabled { cursor: default; opacity: 0.7; }
.moves .mv:disabled:hover:not([aria-pressed="true"]) { background: none; color: #9aa0a6; }

/* A scene that is planned but has no script yet says so with a tag. (The box
   round the Reshape suggestions is that form's alone.) */
.beat-tag.planned { border-style: dashed; color: var(--gap); border-color: currentColor; }

/* Folding the spine: an act or a sequence down to one line. */
.fold-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; margin: 1rem 0 0; font-size: 0.875rem; color: var(--muted); }
.fold-bar[hidden] { display: none; }
.fold-bar button { font-size: 0.875rem; }
.fold { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; padding: 0; margin: 0 0.3rem 0.3rem -0.3rem; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; vertical-align: middle; }
.fold:hover { border-color: var(--rule); color: var(--ink); }
.fold svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.12s; }
.fold[aria-expanded="false"] svg { transform: rotate(-90deg); }
.fold::after { content: none !important; }
.fold-summary { display: none; font-size: 0.8125rem; color: var(--muted); margin-left: 0.25rem; }
.spine .row.folded .fold-summary { display: inline; }
.spine .row.folded-away { display: none; }
.spine .row.folded .expectation, .spine .row.folded .row-edit .summary, .spine .row.folded .row-tools,
.spine .row.folded .row-findings, .spine .row.folded .actions, .spine .row.folded .beat-help { display: none; }
.spine .row.folded { padding-top: 0.55rem; padding-bottom: 0.55rem; }
.spine .row.folded .row-edit .title { font-size: 1rem; padding-top: 0.3rem; padding-bottom: 0.3rem; }
.spine .row.folded .row-edit, .spine .row.folded .turns { display: inline-flex; vertical-align: middle; margin: 0.25rem 1rem 0 0; }
.spine .row.folded .row-edit { flex-direction: row; align-items: center; gap: 0.75rem; }
