/* The three measurements the desktop layout is built out of, named once here
   rather than repeated as literals in the eight rules that need them.
   `tokens.css` is the palette and the families and deliberately nothing else,
   so these live with the layout that uses them.

   `--composer` is the composer's measured height, written by the script. It
   is only wanted where the composer is out of the flow — a phone, where it is
   fixed — and as the margin a scroll leaves under a turn so its last line
   does not land behind the sticky block. 11rem is what holds until the script
   has measured. */
:root {
  --header: 2.75rem;
  --measure: 672px;
  --panel: 22rem;
  /* Where the desktop layout stops and the phone's begins. A media query
     cannot read a custom property in its own condition, so the number is
     written twice in this file and nowhere else on the page: here, and in the
     one `@media (max-width: …)` at the foot. `panel.js` reads this property
     and builds its `matchMedia` from it rather than repeating the number a
     third time in another language, and `test_the_breakpoint_is_one_number…`
     holds the two here to each other.

     This is not tidiness. The two were 60rem and 54rem for one commit, and
     between 864px and 960px the stylesheet had already collapsed the grid and
     hidden the panel while the script still believed it was on a wide screen —
     so the tabs stayed mounted inside the hidden panel and the sheet, the
     memory and the notes were unreachable, silently, at the width a laptop
     window lands in. */
  --phone-max: 60rem;
}

* { box-sizing: border-box; }
/* The `[hidden]` a browser brings is in its user agent stylesheet, and any
   author `display` beats a UA one whatever its specificity — so `main`
   being a grid and `#plate` a block meant `el.hidden = true` on either did
   nothing at all. The start screen was then drawn over a play surface still
   in the document: tall behind the overlay, every control in it still
   reachable by Tab, and a stale story and sheet still read aloud.
   `!important` because as an author rule this is only (0,1,0), and `#plate`
   is (1,0,0). */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 1.0625rem/1.72 var(--serif);
  -webkit-font-smoothing: antialiased;
}
/* The engine's hand, for the rare place that reaches for it directly rather
   than through one of the selectors below that already declare it. */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
/* Announced, never drawn: the indicator appears without a word otherwise. */
.offscreen {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

header {
  position: sticky; top: 0; z-index: 5; height: var(--header);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem; background: var(--ground);
  border-bottom: 1px solid var(--edge);
  font-family: var(--sans); font-size: .8125rem; line-height: 1;
}
/* The one place ember is still the wordmark's, not deleted: it is the
   player's mark on the page, not a name or a readout. */
header .mark {
  color: var(--ember); font-family: var(--sans); font-size: .8125rem;
  font-weight: 700; line-height: 1; letter-spacing: .22em; text-transform: uppercase;
  white-space: nowrap;
}
/* A link home, and the whole height of the header is the thing to tap. */
header a.mark {
  align-self: stretch; display: flex; align-items: center;
  min-height: 44px; text-decoration: none;
}
header a.mark:hover { color: var(--ember); text-decoration: underline; text-underline-offset: .35em; }
a:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; border-radius: 2px; }
/* Which run this is: a title, so it is told the story's way, and it gives up
   its width before anything else in the row does. */
header .where {
  color: var(--ink); font-weight: 500; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The one piece of chrome in the engine's register, because it is the
   engine's number rather than a label for one. It had no element of its own
   while the title and the ordinal were one text node, which is why it has
   worn the chrome's family until now. */
header .turnno {
  color: var(--system); font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap;
}
header nav {
  margin-left: auto; display: flex; gap: 1.1rem; align-items: center;
  font: .8125rem/1 var(--sans);
}
header a, header .link { color: var(--dim); text-decoration: none; }
header a:hover, header .link:hover { color: var(--ink); }
header .link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
}

/* The panel grew from 19rem: at 19rem the memory cards scrolled sideways
   inside it in the live build, which put a fact half off the edge of the one
   panel that exists to hold facts. */
main { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel); align-items: start; }
/* The grid's floor is its content, and a long word in a turn would otherwise
   widen this cell rather than wrap inside it. */
#column { min-width: 0; }

/* The story is a three-track grid per turn: the reading measure in the middle
   and a gutter either side. 42rem is about 62 characters of the serif, a
   column to read a novel in. Track 1 is where a speaker's face hangs, beside
   the speech rather than in it (`.speaker`, hung out of the paragraph's flow
   so it lands beside words already in place); everything a turn is made of
   sits in track 2. No bottom padding for a fixed bar any more — the composer
   is below this in the same flow and takes its own room. */
#story { padding: 2.25rem 1.5rem 1.5rem; }
.turn {
  display: grid; align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr);
  margin: 0 0 2.1rem; scroll-margin-top: calc(var(--header) + 1rem);
}
.turn > * { grid-column: 2; min-width: 0; }
/* The speaker, in track 1: right-aligned against the column with 1.35rem
   between, .3rem down so the face sits level with the first line. */
.utterance { display: block; position: relative; margin: .45em 0; padding-left: 1.15rem; }
.utterance.has-speaker { min-height: 7rem; }
.prose p.speech > .utterance { margin: 0; padding-left: 0; }
.speaker {
  position: absolute; top: .3rem; right: calc(100% + 1.35rem); width: max-content;
  display: grid; justify-items: end; gap: .3rem; text-align: right;
  animation: fadein .3s ease-out 1;
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.speaker-person { display: grid; justify-items: end; gap: .3rem; }
.speaker .sface {
  display: grid; place-items: center; width: 5rem; flex-shrink: 0; aspect-ratio: 1; border-radius: 4px;
  overflow: hidden; border: 1px solid var(--edge-strong); background: var(--raised);
}
.speaker img.simg { width: 100%; height: 100%; object-fit: cover; display: block; }
.speaker span.simg {
  font: .625rem/1.3 var(--sans); color: var(--dim); text-align: center; padding: .3rem;
}
.speaker .sname {
  font: 600 .6rem/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--dim); max-width: 6.5rem;
}
.catalogue-face {
  display: block; width: 100%; height: 100%; min-height: 100%; padding: 0 !important;
  background-image: url("./npc-portraits-v1.png?size=card"); background-size: 400% 200%;
  background-repeat: no-repeat;
}
/* A desktop sidebar can leave too little gutter for a readable name. Move
   the same portrait above its paragraph before it would be clipped. */
@media (max-width: 80rem) {
  .speaker {
    position: static; display: flex; align-items: center; gap: .65rem;
    margin: 0 0 .55rem; text-align: left; flex-wrap: wrap; width: 100%;
  }
  .speaker-person { display: flex; align-items: center; gap: .5rem; }
  .speaker .sname { max-width: none; }
  .utterance.has-speaker { min-height: 0; }
}
/* Turn boxes are `tabIndex = -1` — never in the tab order — so the only
   scripted reason one is ever focused is `#newturn`'s handler handing the
   keyboard to it on purpose, precisely so a keyboard user is not dropped to
   the top of a long document. `outline: none` hid that ring outright;
   `:focus-visible` keeps a ring for the hand-off — focus landing somewhere
   that was not itself the target of the click that caused it — without
   bringing back the blanket `outline: none` this replaces. */
.turn:focus-visible { outline: 2px solid var(--edge); outline-offset: 4px; }
/* Scrolling to a turn's end lands it above the composer, not behind it. */
.turn, .sys { scroll-margin-bottom: calc(var(--composer, 11rem) + .75rem); }
/* The player's own voice, read back to them: a human said this, so it is
   the player's family — sans, italic — never the System's mono. That mix-up
   is the one this page most needed to stop making. */
.said {
  color: var(--ember); font-family: var(--sans); font-style: italic; font-weight: 400;
  font-size: .9375rem; line-height: 1.55; margin: 0 0 .85rem;
  padding-left: 1.1rem; position: relative;
}
/* The marker is drawn, not typed, so the line itself is only what was said. */
.said::before {
  content: "›"; position: absolute; left: 0; top: 0;
  font-style: normal; color: var(--ember-dim);
}
.said.carried { color: var(--dim); font-family: var(--sans); }
.said.carried::before { content: none; }
/* The narrator's own paragraphs, split on its own blank lines. */
.prose { margin: 0; }
.prose p { margin: 0 0 .95em; white-space: pre-line; text-wrap: pretty; }
/* Speech, layered under the narration by indent and leading alone: the same
   serif and the same ink, because it is still the narrator's text, with the
   narrator's own quotation marks. Who is speaking is not decided here. */
.prose p.speech { margin: .35em 0 .95em; padding-left: 1.15rem; max-width: 38rem; }
.prose p:last-child { margin-bottom: 0; }
/* Standing prose during a retry is still story, only quieter — the warm
   secondary ink the memory panel's facts use, not the chrome's cool dim. */
.prose.draft { color: var(--ink-dim); }
/* Only the player's action can be rewritten. Narration is plain reading. */
.said:not(.carried) { cursor: text; border-radius: 3px; }
.said:not(.carried):hover { background: #0F141D; }
/* At the end of the last paragraph written, or alone before the first word. */
.cursor:empty::after, .cursor > p:last-child::after {
  content: "▍"; color: var(--ember); animation: blink 1.1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0 } }

/* --- the System, in the story -----------------------------------------------

   What the engine did on the turn, between the player's line and the prose,
   which is where in the reading it happened. Everything in here is the
   engine's own, so it is the System's register throughout and nothing else on
   the page is allowed to look like it. It reads as a card without looking like
   a chat bubble: two pixels of rule on the left, a tint behind, and a radius
   on the right side only. */
.sys {
  margin: 0 0 1rem; padding: .55rem .9rem .6rem;
  border-left: 2px solid var(--system-rule); border-radius: 0 6px 6px 0;
  background: var(--system-tint); color: var(--system);
  font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero;
  font-size: .8125rem; line-height: 1.55;
}
/* Turn 0's own lines, under the opening prose: the scenario's data, not a
   bracket matched out of what a narrator wrote. */
.sys.opening { margin: 1.25rem 0 0; }
.sys.opening p { margin: 0; }
.sys.opening p + p { margin-top: .15rem; }
/* Not the sheet's `new` tag, which is the same class name and ember. This one
   names the speaker, so it resets what that rule brings. */
.sys .tag {
  display: block; margin: 0 0 .2rem; padding: 0; border: 0;
  color: var(--system-dim); font-size: .6875rem;
  letter-spacing: .12em; text-transform: uppercase;
}

.sys-head { display: flex; gap: .6rem; align-items: baseline; }
.sys-head b { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.sys-head .stat { color: var(--system-dim); }
/* `need 14`, right-aligned and above the tiles: the difficulty was decided
   before the die was thrown, and is read before the die for the same reason. */
.sys-head .need { margin-left: auto; color: var(--system-dim); }
.sys-head .need b { color: var(--system); letter-spacing: 0; text-transform: none; }
/* While the referee reads. */
.sys.pending .sys-head b { color: var(--system-dim); }

/* Why the referee improvised, and what the engine declined: a word that opens
   onto sentences, quiet enough that neither is the thing the block is for. */
.sys .why, .sys .declined { color: var(--system-dim); font-size: .72rem; }
.sys .why summary, .sys .declined summary { cursor: pointer; }
.sys .why summary { list-style: none; }
.sys .why summary::-webkit-details-marker { display: none; }
.sys .why summary::after { content: " ?"; }
.sys .why[open] summary::after { content: ""; }
.sys .why p, .sys .declined p { margin: .25rem 0 0; }
.sys .declined { margin-top: .4rem; }

/* The tiles. `charisma 15+0 = 15 vs 14` failed because every number in it was
   the same size and none of them was labelled. */
.dice { display: flex; align-items: center; gap: .55rem; margin-top: .5rem; }
.d { display: grid; justify-items: center; gap: .15rem; }
.d .n {
  display: grid; place-items: center; min-width: 2.35rem; height: 2.35rem;
  padding: 0 .4rem; border: 1px solid var(--system-rule); border-radius: 6px;
  background: var(--ground); color: var(--ink); font-size: 1.2rem; font-weight: 600;
}
.d label {
  font-size: .6rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--system-dim);
}
/* The die is the largest thing in the block: it is the one moment of chance,
   and the whole of the HUD this design allows itself. */
.d.die .n { min-width: 2.6rem; height: 2.6rem; border: 1.5px solid var(--system); font-size: 1.35rem; }
/* Gold is spent twice a campaign: a natural 20, and a level. */
.d.die.nat20 .n { color: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 3px #E9C76F22; }
.d.die.nat1 .n { color: var(--bad); border-color: var(--bad); }
/* Dashed: the modifier is the sheet's contribution, not chance. */
.d.mod .n { border-style: dashed; color: var(--system); }
.d.mod .n, .d.tot .n { font-size: 1rem; font-weight: 500; }
.op { color: var(--system-dim); font-size: 1rem; padding-bottom: .9rem; }
/* Held back until the die has landed, so the sum is never on screen before
   the number it is a sum of. */
.sys .held { visibility: hidden; }

.verdict {
  margin-left: auto; align-self: flex-start; padding: .3rem .6rem; border-radius: 4px;
  font-weight: 700; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
}
.ok .verdict { color: var(--good); background: #86BD9214; }
.miss .verdict { color: var(--bad); background: #D7767D14; }
.crit .verdict { color: var(--gold); background: #E9C76F16; }
/* A failed roll shifts the block's own left rule, so the eye reads the verdict
   from the margin before it reads a word. */
.sys.miss { border-left-color: #5A3A44; }
.sys.miss .d.die .n { border-color: #8A5C63; }

/* What moved: resulting numbers, never a delta. `22 → 18` is a thing to read;
   `-6` is a sum, and sums are what the narrator cannot do. */
.changes {
  list-style: none; margin: .55rem 0 0; padding: .5rem 0 0;
  border-top: 1px dashed var(--system-rule);
}
.changes li { display: flex; gap: .6rem; align-items: baseline; }
/* Somebody else's name, in front of their own number. The hero's is never
   written: their numbers are their sheet. */
.changes .who { color: var(--system-dim); }
.changes .k { color: var(--ink-dim); }
.changes .v { margin-left: auto; color: var(--ink); }
.changes .v s { color: var(--system-dim); text-decoration: none; }
.changes .v s::after { content: " → "; }
.changes .v.up { color: var(--good); }
.changes .v.down { color: var(--bad); }
.changes .v.gain { color: var(--gold); }
.changes .v.new::before {
  content: "new "; color: var(--system-dim); font-size: .6875rem;
  letter-spacing: .1em; text-transform: uppercase;
}
.changes .downed .k { color: var(--bad); }

/* The motion budget, in full. The die settling, the verdict stamping, and a
   row that moved arriving — spent where a number changes and nowhere else. */
.d.die.landing .n { animation: land .45s ease-out 1; }
@keyframes land {
  from { color: var(--system-dim); transform: translateY(-2px) }
  to { color: var(--ink); transform: none }
}
.verdict.stamp { animation: stamp .28s ease-out 1; }
@keyframes stamp { from { opacity: 0; transform: scale(1.18) } to { opacity: 1; transform: none } }
.changes li.arrive { animation: rise .35s ease-out 1; }
@keyframes rise { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto }
  .speaker, .cursor:empty::after, .cursor > p:last-child::after, .d.die.landing .n, .verdict.stamp, .changes li.arrive,
  #work-status .status.live::before { animation: none }
}

/* The machine reporting on itself: not the engine's readout and not the
   narrator's words, so it sits under the prose rather than in the block. */
.mishap {
  margin-top: .7rem; color: var(--bad); font-family: var(--mono);
  font-size: .8125rem; line-height: 1.55;
}

.editor { margin: .4rem 0 .2rem; }
.editor .row { margin-top: .4rem; }
/* Rewriting a said-line or a paragraph is still the player's words — the
   box they are edited in is the player's family, the same one the said-line
   and the notes are, never the System's. */
textarea {
  width: 100%; background: var(--raised); color: var(--ink);
  border: 1px solid var(--edge); border-radius: 3px; padding: .55rem .7rem;
  font-family: var(--sans); font-size: .84rem;
  line-height: 1.6; min-height: 7rem; resize: vertical;
}
textarea:focus { outline: 2px solid var(--ember); outline-offset: 1px; }

/* --- the composer -----------------------------------------------------------

   What this replaces was a fixed bar with a gradient over its top 2.5rem, and
   the one note from playing the live build was "the dock covers the newest
   paragraph". That was not a bug: the gradient painted translucent ground over
   the last lines by design, and half of "carving three fresh, shallow lines
   into your skin" could be read through it.

   The composer is in the column's flow instead, stuck to the bottom of the
   window while there is story below it and opaque all the way through. An
   opaque block in flow cannot cover anything: the prose scrolls past it.

   No z-index. Sticky is positioned, so it already paints over the story's own
   in-flow content, and a stacking number here would also put it over the
   gallery overlay, which is fixed above the whole play surface. */
#composer {
  position: sticky; bottom: 0;
  background: var(--ground); border-top: 1px solid var(--edge);
}
#composer > .in {
  max-width: var(--measure); margin: 0 auto; padding: .85rem 1.5rem .9rem;
  position: relative;
}
.row { display: flex; gap: .5rem; align-items: stretch; }
input, button, select, #action {
  font: inherit; border: 1px solid var(--edge); border-radius: 3px;
  background: var(--raised); color: var(--ink); padding: .65rem .85rem;
}
/* What is typed in any field on this page — the composer, a corrected fact,
   the hero's own name — is the player's words, never the engine's. */
/* `min-width: 0` is the companion `flex: 1` always wanted: a flex item's floor
   is its content, so a select holding "character" and an input holding a
   placeholder pushed the "someone to remember" row past the panel's width and
   cut the `add` button off its right edge. */
input, select {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: .88rem;
}
input::placeholder, #action::placeholder { color: var(--dim); }
input:focus, select:focus, button:focus-visible, #action:focus {
  outline: 2px solid var(--ember); outline-offset: 1px;
}
/* One row that grows to nine, in the same family and at the same size as the
   said-line it becomes: what you type is visibly what you said. A textarea
   rather than an input because an action long enough to scroll should wrap
   where it can be read back rather than slide sideways out of the box. */
#action {
  flex: 1; min-width: 0; resize: none; overflow-y: auto;
  border-color: var(--edge-strong); border-radius: 6px; padding: .7rem .85rem;
  font-family: var(--sans); font-size: 1rem; line-height: 1.45;
  min-height: 2.9rem; max-height: 9rem;
}
#action:disabled { color: var(--ink-dim); }
/* The one act on the page that spends a turn, so it is outlined in the
   player's own colour rather than filled like the quiet verbs under it. */
#go {
  padding: 0 1.1rem; background: none; border-color: var(--ember-dim);
  border-radius: 6px; font-size: .8125rem; font-weight: 600; line-height: 1;
  letter-spacing: .1em; text-transform: uppercase;
}
#go:hover:not(:disabled) { background: #1C1711; border-color: var(--ember); }
#go:disabled { border-color: var(--edge); }
/* Every button on the page is chrome, so every button is the player's
   family — never inherited from whatever serif or mono context it happens
   to sit inside, which is how `begin`, `back`, `add` and `save` each ended
   up wearing whichever family their container set rather than their own. */
button { cursor: pointer; color: var(--ember); font-family: var(--sans); white-space: nowrap; }
button:hover:not(:disabled) { background: #1C2533; }
button:disabled { color: var(--dim); cursor: default; }
#newturn {
  position: absolute; top: -2.3rem; left: 50%; transform: translateX(-50%);
  font-size: .76rem;
  padding: .3rem .8rem; border-color: var(--ember); box-shadow: 0 2px 14px #000A;
}
.verbs {
  margin-top: .45rem; display: flex; gap: .2rem; align-items: center;
  font-family: var(--sans);
}
.verbs button {
  font-size: .75rem; line-height: 1.4; padding: .25rem .5rem; color: var(--dim);
  background: none; border: 0; border-radius: 4px;
}
.verbs button:hover:not(:disabled) { color: var(--ink); background: var(--raised); }
.verbs button:disabled { color: var(--edge-strong); }
/* Work gets its own readable line; it must not be squeezed beside four
   buttons on a phone. The elapsed time is visual, never a live announcement. */
#work-status {
  display: flex; align-items: baseline; gap: .6rem; margin-top: .3rem;
  padding: .3rem 0; line-height: 1.5;
}
#work-status .status {
  flex: 1; min-width: 0; font-size: .78rem; font-family: var(--sans);
  font-variant-numeric: tabular-nums slashed-zero;
  color: var(--ink-dim);
}
#work-time { color: var(--dim); font: .72rem var(--mono); white-space: nowrap; }
#work-status .status.live { color: var(--system); }
#work-status .status.live::before {
  content: ""; display: inline-block; width: .4rem; height: .4rem;
  border-radius: 50%; background: var(--system);
  margin-right: .45rem; vertical-align: 1px;
  animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .25 } }

#action-queue {
  border-bottom: 1px solid var(--edge); padding-bottom: .6rem; margin-bottom: .65rem;
  font: .78rem/1.45 var(--sans);
}
.queue-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
#queue-note { flex: 1; color: var(--ink-dim); }
#queued-actions { margin: .35rem 0 0; padding: 0; max-height: 6.5rem; overflow-y: auto; }
#queued-actions li { display: flex; align-items: baseline; gap: .5rem; margin-top: .2rem; }
#queued-actions li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
#action-queue button { padding: .35rem .5rem; font-size: .72rem; background: none; }

.tabs {
  flex: 0 0 auto; display: flex; gap: .15rem;
  padding: .55rem .75rem 0; border-bottom: 1px solid var(--edge);
}
.tabs button {
  font-family: var(--sans); font-weight: 600; font-size: .6875rem; line-height: 1;
  padding: .45rem .55rem .55rem; color: var(--dim); background: none;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px;
  letter-spacing: .12em; text-transform: uppercase; position: relative;
}
.tabs button:hover:not(:disabled) { background: none; color: var(--ink); }
/* The bookkeeper wrote something down this turn. Its words are inside it,
   visually hidden, so the tab reads "memory, new" and not a colour alone. */
.tabs .dot {
  position: absolute; top: .45rem; right: .1rem;
  width: .35rem; height: .35rem; border-radius: 50%; background: var(--ember);
}
/* Ink says which tab is open. Ember stays as the underline's accent — the
   mockup keeps that much — but it is no longer the label's own colour,
   which is the tab-state mix-up ember had no business being in. */
.tabs button.on { color: var(--ink); border-color: var(--ember); }

/* The panel is a header and a scroller, not one scrolling column: who you
   are stays on screen while the sheet, the memory and the notes move under
   it. `overflow: hidden` on the column is what gives `#panes` something to
   scroll inside; `min-height: 0` is what lets it, since a flex item's floor
   is its content and a long transcript of facts would otherwise push the
   whole panel taller than the screen instead of scrolling. */
aside {
  border-left: 1px solid var(--edge); background: var(--paper);
  font-size: .8rem; position: sticky; top: var(--header);
  height: calc(100vh - var(--header));
  display: flex; flex-direction: column; overflow: hidden;
}
#panelhead { flex: 0 0 auto; padding: 1.1rem 1.15rem .9rem; border-bottom: 1px solid var(--edge); }
#panes {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: .9rem 1.15rem 1.5rem; scrollbar-width: thin;
}
/* Every section label in the panel is chrome — the player's family, at a
   whisper — never the System's, even sitting directly above a table of the
   engine's own numbers. */
aside h2 {
  font-family: var(--sans); font-weight: 600; font-size: .6875rem; line-height: 1;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); margin: 1.15rem 0 .45rem;
}
aside h2:first-child { margin-top: 0 }
/* Who you are: your own name, told the story's way like anybody else's —
   not the engine's mono, and not ember, which is the player's words and not
   a label for the player. */
#who {
  font-family: var(--serif); font-weight: 500; font-size: 1.05rem; line-height: 1.2;
  color: var(--ink); margin: .1rem 0 .15rem;
}
/* The level, in the engine's register: the label dim, the figure its own. */
#level {
  font-family: var(--mono); font-size: .72rem; line-height: 1.4; letter-spacing: .04em;
  font-variant-numeric: tabular-nums slashed-zero;
  color: var(--system-dim); margin-bottom: .55rem;
}
#level b { color: var(--system); font-weight: 500; }
#level.moved b { color: var(--ember); }
/* The meters are a readout — hit points, experience — in the System's
   family and its numerals, until a value moves this turn and turns ember:
   the one place a number is allowed to say "yours". */
.meter {
  margin-bottom: .45rem; font-family: var(--mono); font-size: .72rem; line-height: 1.4;
  font-variant-numeric: tabular-nums slashed-zero;
}
.meter .label { display: flex; justify-content: space-between; align-items: baseline; }
.meter .label > span:first-child {
  color: var(--system-dim); letter-spacing: .1em; text-transform: uppercase; font-size: .64rem;
}
.meter .label > span:last-child { color: var(--ink) }
.rail { height: 4px; background: var(--edge); border-radius: 2px; overflow: hidden; margin-top: .3rem }
.rail span {
  display: block; height: 100%; background: var(--good); border-radius: 2px;
  transition: width .6s cubic-bezier(.2, .7, .2, 1);
}
.rail.xp span { background: var(--system) }
.rail.hurt span { background: var(--bad) }
/* Attributes and the bag are the engine's own tables, read in its family. */
/* A row is a key in the warm secondary ink and the engine's value in ink,
   right-aligned; the cells carry the row's padding so the grid needs no gap. */
dl {
  display: grid; grid-template-columns: 1fr auto; gap: 0 .6rem; margin: 0;
  font-family: var(--mono); font-size: .78rem; line-height: 1.5;
  font-variant-numeric: tabular-nums slashed-zero;
}
dt, dd { padding: .17rem 0; }
dt { color: var(--ink-dim) }
dd { margin: 0; text-align: right; color: var(--ink); white-space: nowrap; }
/* What moved this turn: a mark, and the value it moved from. */
dt.moved::before, dt.gone::before {
  content: "▸ "; color: var(--ember);
}
.meter.moved .label > span:first-child { color: var(--ember-dim) }
.meter.moved .label > span:last-child, dd.moved { color: var(--ember) }
.meter .was, #level .was, dd .was { color: var(--system-dim) }
dt.moved { color: var(--ink) }
dt.gone, dd.gone { color: var(--dim); text-decoration: line-through }
.was { color: var(--dim) }
.tag {
  border: 1px solid var(--ember); border-radius: 2px; color: var(--ember);
  padding: 0 .3rem; margin-right: .4rem; font-size: .66rem;
}
.none { color: var(--dim) }
/* The five ability scores get a third column the bag never needs: what the
   score is worth on a die. `agility 12 +1` — dim and unremarkable at +0,
   because +0 is the score a check would not have bothered mentioning. */
#stats { grid-template-columns: 1fr auto 2.6rem; column-gap: 0; }
#stats .mod { text-align: right; color: var(--system-dim); }
#stats .mod b { color: var(--system); font-weight: 500; }
/* Everything else the scenario declared. A meter for a resource with its own
   ceiling — `mp 4/4` — and the same dl the bag uses for one that has none. */
.resources { margin-bottom: .2rem; }
.rail.mp span { background: #8E86D9; }
.rail.resource span { background: var(--system-dim); }
/* Everyone in the scene but the hero: a thumb the size a list can afford,
   the name, and nothing invented beside it — `/state` carries no facts, so
   there is no role to put here yet. */
.present {
  list-style: none; margin: 0; padding: 0;
  font-family: var(--sans); font-size: .8125rem; line-height: 1.4; font-variant-numeric: normal;
}
.present li { display: flex; align-items: center; gap: .55rem; padding: .2rem 0; }
.present .thumb {
  width: 1.6rem; aspect-ratio: 4 / 5; flex: 0 0 1.6rem; display: block; object-fit: cover;
  border: 1px solid var(--edge-strong); border-radius: 3px; background: var(--raised);
}
.present .who { color: var(--ink); flex: 0 0 auto; white-space: nowrap; }
/* The role is the server's, off the person's own `occupation` fact. It gives
   up its width before the name does; the whole of it is in the title. */
.present .sub {
  margin-left: auto; min-width: 0; font-family: var(--mono); font-size: .72rem; line-height: 1;
  color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#plate { width: 100%; border: 1px solid var(--edge); border-radius: 3px; display: block }
/* The scene plate's own plate. It is the one picture on this page that used
   to be shown unconditionally, so a render service that was busy — which is
   a considered 503 now rather than a 500, but still not a picture — drew the
   browser's broken-image glyph in the panel. The ratio is the one
   `ImageRequest` asks a plate for, so the panel does not jump when the
   picture lands. */
#noplate {
  width: 100%; aspect-ratio: 768 / 448; background: var(--raised);
  border: 1px solid var(--edge); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: var(--dim); font-family: var(--sans); font-size: .7rem; text-align: center; padding: .4rem;
}
/* The plate's own turn, in its corner, so a plate a reload could not afford
   to re-render says which turn it is actually a picture of. `sheet.js` wraps
   `#plate` and `#noplate` in this at startup — neither element moves, only
   gains a positioned parent — because the markup itself carries no wrapper
   for a corner mark to sit on. */
.platewrap { position: relative; }
.platecap {
  position: absolute; left: .5rem; bottom: .4rem;
  font: .62rem var(--mono); letter-spacing: .08em; text-transform: uppercase;
  color: #fff; opacity: .75; text-shadow: 0 1px 2px rgba(0, 0, 0, .85);
  pointer-events: none;
}
.note { color: var(--dim); font-family: var(--sans); font-size: .72rem; margin-top: .5rem; line-height: 1.5 }
.problem { color: var(--bad); font-family: var(--sans); font-size: .74rem; margin: .35rem 0 0; line-height: 1.5 }

/* who you are: the face, the name and the two bars, above the tabs */
#identity { display: flex; gap: .85rem; align-items: flex-start }
#identity .face { flex: 0 0 4.75rem }
#identity .named { flex: 1 1 auto; min-width: 0 }
.face img, .face .waiting {
  width: 4.75rem; aspect-ratio: 4 / 5; display: block; object-fit: cover;
  border: 1px solid var(--edge-strong); border-radius: 6px; background: var(--raised);
}
/* A face nobody has drawn is a plate that says so. An `<img>` whose src 404s
   draws the browser's own broken glyph, which reads as a fault rather than
   as a picture that has not been asked for. */
.face .waiting {
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--dim); font-family: var(--sans); font-size: .6rem; line-height: 1.35; padding: .3rem;
}

/* --- the phone's status bar, and the sheet it raises -------------------------

   A wide screen has the panel beside the story and needs neither of these, so
   both are off here and switched on in the one media block at the foot. They
   are declared here rather than there because the thing a rule turns *off* is
   as much a layout decision as the thing it turns on, and a `display: none`
   that lives only inside a media query reads as an oversight. */
#bar { display: none }
#scrim { display: none }
#close {
  display: none; position: absolute; right: .9rem; top: .9rem; z-index: 1;
  width: 2rem; height: 2rem; place-items: center; padding: 0;
  background: var(--raised); border: 1px solid var(--edge-strong); border-radius: 50%;
  color: var(--dim);
}
/* The header's own control for the same sheet. A phone has no room beside the
   mark, the title and the counter for three words of chrome. */
#menu {
  display: none; margin-left: auto; padding: 0; width: 2.25rem; height: 2.25rem;
  place-items: center; background: none; border: 0; border-radius: 6px; color: var(--dim);
}
#menu:hover { color: var(--ink); background: none }

/* memory */
/* A card: the face in its own column, everything else beside it. */
.entity {
  display: grid; grid-template-columns: 3.1rem 1fr; gap: .7rem;
  padding: .7rem 0; border-top: 1px solid var(--edge);
}
aside h2 + .entity { padding-top: 0; border-top: 0; }
.ebody { min-width: 0; }
.eface {
  display: grid; place-items: center; width: 3.1rem; aspect-ratio: 4 / 5;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--edge-strong);
  background: var(--raised);
}
.eface img.thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.eface span.thumb {
  font: .625rem/1.3 var(--sans); color: var(--dim); text-align: center; padding: .3rem;
}
/* Drawing: the frame holds its size and names the wait, in the engine's hand. */
.eface.drawing span.thumb { font: .56rem/1.4 var(--mono); color: var(--system-dim); padding: .2rem; }
/* An entity's name is told the way the hero's own is: the story's serif,
   warm ink. Ember is the player's, never a name's. */
.entity .name {
  color: var(--ink); font-family: var(--serif); font-weight: 500;
  font-size: .95rem; line-height: 1.25;
}
.entity .name .also { font: .72rem/1.4 var(--sans); color: var(--dim); }
.entity .facts {
  margin: .35rem 0 0; display: grid; grid-template-columns: max-content 1fr; gap: .12rem .6rem;
  font: .78rem/1.45 var(--sans); font-variant-numeric: normal;
}
.entity .facts dt, .entity .facts dd { padding: 0; }
.entity .facts dt { color: var(--dim); }
.entity .facts dd { margin: 0; color: var(--ink-dim); text-align: left; white-space: normal; min-width: 0; }
/* A fact's value is a sentence that happens to be clickable, not a label on a
   control — so it wraps, where every other button on the page does not. This
   is what actually made the memory cards scroll sideways inside the panel:
   `button { white-space: nowrap }` held one 593px line for "Wren, a woman in
   her late twenties, dark coiled hair…" and the panel could not be made wide
   enough for it at any width. */
.facts .value {
  background: none; border: 0; border-bottom: 1px dotted transparent; border-radius: 0;
  color: var(--ink-dim); padding: 0; font: inherit; text-align: left; cursor: text;
  width: 100%; min-width: 0; white-space: normal;
}
.facts .value:hover { background: none; border-bottom-color: var(--edge-strong); }
.facts .look .value { font-style: italic; }
.facts .look .source { font-style: normal; font-size: .68rem; color: var(--dim); margin-left: .35rem; }
.facts input { width: 100%; font-size: .78rem; padding: .15rem .3rem; }
.fact.new { font-family: var(--sans); display: flex; gap: .4rem; margin-top: .4rem; }
.fact.new input { flex: 1; min-width: 0; font-size: .78rem; padding: .15rem .3rem; }
.fact.new button { padding: .15rem .5rem; }
/* A relationship is the engine's own graph of who stands where, so it is
   read in the System's register under the facts. */
.edge { color: var(--system-dim); font-family: var(--mono); font-size: .72rem; line-height: 1.5; }
.entity .facts dd.edge { color: var(--system-dim); }
.acts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; align-items: center; }
.acts button {
  background: none; border: 1px solid var(--edge-strong); border-radius: 4px;
  color: var(--dim); font: .68rem/1 var(--sans); padding: .28rem .5rem;
}
.acts button:hover:not(:disabled) { color: var(--ink); background: none; }
.acts .hint { color: var(--dim); font: .68rem/1.4 var(--sans); }
/* Everybody the world has heard of and knows nothing about, in one line. */
.also-known { margin: .6rem 0 0; font: .75rem/1.5 var(--sans); color: var(--dim); }
.also-known b { color: var(--ink-dim); font-weight: 500; }
/* A picture that missed has to be able to say so: AI Dungeon's failure was
   one its players could not see. */
.drifted { color: var(--bad); font-family: var(--sans); font-size: .68rem; line-height: 1.4; }
#pane-notes textarea { min-height: 6rem; margin-bottom: .4rem; }

/* Which model plays each lane: a small dialog under the header's `Models`,
   modal, so the keyboard stays in it and Escape closes it. */
#modelmenu {
  position: fixed; inset: calc(var(--header) + .45rem) 1rem auto auto; margin: 0;
  width: calc(100vw - 2rem); max-width: 38rem; padding: 0;
  background: var(--paper); color: var(--ink); border: 1px solid var(--edge-strong);
  border-radius: 12px; box-shadow: 0 20px 60px #000A; font-family: var(--sans);
}
#modelmenu::backdrop { background: #0009; }
.mm-head {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--edge);
}
#models-title {
  font: 600 .75rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
.mm-close {
  margin-left: auto; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--edge-strong); border-radius: 50%; background: none; color: var(--dim);
}
.mm-close:hover:not(:disabled) { background: none; color: var(--ink); }
#lanes { padding: 1.25rem; display: grid; gap: 1.1rem; }
.lane { display: grid; grid-template-columns: 7rem 1fr; gap: .9rem; align-items: center; }
.lane-words { display: grid; gap: .15rem; }
.lane label {
  font: 600 .6875rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--system-dim);
}
.lane-words span { font: .72rem/1.4 var(--sans); color: var(--dim); }
/* A model's name is the engine's own identifier, so it is in the engine's hand. */
#modelmenu .lane select {
  width: 100%; background: var(--raised); border: 1px solid var(--edge-strong); border-radius: 6px;
  color: var(--ink); padding: .5rem .6rem; font: .8125rem/1.3 var(--mono);
}
.mm-foot { padding: 0 1.25rem 1.25rem; display: grid; gap: .9rem; }
.mm-foot .problem:empty { display: none; }
.mm-note { margin: 0; font: .78rem/1.55 var(--sans); color: var(--dim); }
.mm-acts { display: flex; gap: .7rem; align-items: center; }

/* The gallery: the eyeball check no similarity score replaces. An overlay
   rather than a fifth tab, because it is about the whole run and wants the
   width. Grouped by who is in the picture, oldest first. */
#gallery {
  position: fixed; inset: var(--header) 0 0; z-index: 6; overflow-y: auto;
  background: var(--ground);
}
.gal-bar {
  position: sticky; top: 0; z-index: 1; height: 44px; display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; background: var(--ground); border-bottom: 1px solid var(--edge);
}
#gallery-title {
  font: 600 .75rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
#gallery-run {
  font: .8125rem/1 var(--sans); color: var(--ink-dim);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#gallery-run .mono { color: var(--system); }
.gal-bar .back { flex: 0 0 auto; }
.gal-body { padding: 2rem 2.5rem; }
#gallery-shots { display: grid; gap: 2rem; max-width: 64rem; }
.gal-group { display: grid; gap: .7rem; }
.gal-head { display: grid; gap: .15rem; }
/* Whose pictures these are, told the way any entity's name is, and the look
   they were drawn from under it. */
#gallery h3 { margin: 0; font: 500 1.1rem/1.2 var(--serif); color: var(--ink); }
.gal-look { margin: 0; font: italic 400 .8125rem/1.5 var(--sans); color: var(--dim); max-width: 40rem; }
.shots { display: flex; flex-wrap: wrap; gap: .85rem; align-items: start; }
.shot { display: grid; gap: .35rem; }
.shotlink {
  width: 9rem; aspect-ratio: 4 / 5; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--edge-strong); background: var(--raised);
}
.shotlink.empty { display: block; border-style: dashed; }
.shot .plate { width: 100%; height: 100%; display: block; object-fit: cover; }
.shot .reference {
  position: absolute; left: .4rem; top: .4rem;
  font: .58rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--system); background: #0E1622E6; border: 1px solid var(--system-rule);
  border-radius: 3px; padding: .15rem .35rem;
}
/* The turn a render was made at and what it scored is the engine's own
   bookkeeping about the picture, so it is in the System's family. */
.shot .caption { font: .65rem/1.3 var(--mono); color: var(--dim); width: 9rem; }
.shot .caption.drifted { color: var(--bad); }
.gal-acts { display: grid; gap: .4rem; align-content: start; padding-top: .2rem; margin: 0; }
.gal-acts button { justify-self: start; }

/* The front door: the landing page and creation. One column on a phone, the
   same 44rem measure the gallery uses on anything wider. */
#start {
  position: fixed; inset: var(--header) 0 0; z-index: 4; overflow-y: auto;
  background: var(--ground); font-family: var(--sans);
}
#start > div { max-width: 56rem; margin: 0 auto; padding: 2.5rem 2rem; }
#start h2, #creation legend {
  font-family: var(--sans); font-weight: 600; font-size: .6875rem; line-height: 1;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); margin: 0 0 .45rem; padding: 0;
}
#start .group { margin-top: 2rem; }
#start #continue { margin-top: 2.2rem; }
/* The thesis is the story's sentence, so it is set the story's way. */
.masthead .thesis {
  font: 500 1.55rem/1.4 var(--serif); color: var(--ink);
  margin: 0; max-width: 32rem; text-wrap: pretty;
}
/* Where the numbers come from, said once, here. */
.masthead .pitch {
  font: 1rem/1.65 var(--serif); color: var(--ink-dim); margin: .8rem 0 0; max-width: 36rem;
}

/* Begin something: one scenario to a row. */
.cards { display: grid; gap: .85rem; }
.card {
  display: grid; gap: .55rem; justify-items: start;
  text-align: left; width: 100%; min-height: 44px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--edge); border-radius: 10px; padding: 1.15rem 1.25rem;
  white-space: normal;
}
.card:hover:not(:disabled) { border-color: var(--edge-strong); background: var(--paper); }
/* A card's title is a name, told the story's way — not the engine's mono,
   and not ember, which belongs to the player alone. */
.card .title { color: var(--ink); font: 500 1.3rem/1.25 var(--serif); }
.card .under { color: var(--ink-dim); font: 1rem/1.6 var(--serif); max-width: 34rem; }
.card .tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .2rem; }
.card .tags .tag {
  margin: 0; font: .62rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--system-dim); border: 1px solid var(--system-rule); border-radius: 3px;
  padding: .2rem .4rem;
}

/* Continue: one wide card, the whole of it the link. */
.resume {
  display: flex; gap: 1.25rem; align-items: stretch;
  padding: 1.25rem; min-height: 44px; border-radius: 10px;
  background: var(--paper); border: 1px solid var(--edge-strong);
  color: var(--ink); text-decoration: none;
}
.resume:hover { border-color: var(--ember-dim); }
.resume .cframe {
  display: grid; place-items: center; flex: 0 0 4.75rem; width: 4.75rem; aspect-ratio: 4 / 5;
  align-self: center; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--edge-strong); background: var(--raised);
}
.resume img.cface { width: 100%; height: 100%; object-fit: cover; display: block; }
.resume span.cface { font: .625rem/1.3 var(--sans); color: var(--dim); text-align: center; padding: .3rem; }
.resume .words { flex: 1; min-width: 0; display: grid; align-content: center; gap: .5rem; }
.resume .top { display: flex; align-items: baseline; gap: .8rem; min-width: 0; }
.resume .title { font: 500 1.35rem/1.2 var(--serif); color: var(--ink); }
.resume .hero { font: .8125rem/1.3 var(--sans); color: var(--dim); }
/* Where they stand: the engine's figures, in its register. */
.resume .standing {
  font: .8125rem/1.4 var(--mono); font-variant-numeric: tabular-nums slashed-zero;
  color: var(--system); text-transform: uppercase;
}
/* The last thing they said, in the player's own register, on one line. */
.resume .said {
  font: italic 400 .9375rem/1.55 var(--sans); color: var(--ember);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.resume .when { font: .72rem/1 var(--sans); color: var(--dim); }
.resume .go {
  align-self: center; flex: 0 0 auto; font: 600 .6875rem/1 var(--sans);
  letter-spacing: .12em; text-transform: uppercase; color: var(--ember);
  border: 1px solid var(--ember-dim); border-radius: 6px; padding: .7rem 1.1rem;
}

/* Every other run: a compact list, one link per row, the unplayed last. */
.runlist { list-style: none; margin: .2rem 0 0; padding: 0; }
.runlist li { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.runlist li > a { flex: 1; min-width: 0; flex-wrap: wrap; }
.delete-button {
  min-height: 44px; padding: .5rem .75rem; color: var(--bad);
  background: transparent; border: 1px solid var(--edge-strong); border-radius: 6px;
  font: .75rem/1.3 var(--sans); cursor: pointer; flex-shrink: 0;
}
.delete-button:hover { background: var(--paper); border-color: var(--bad); }
#resume-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; margin-top: .5rem; }
#art-progress { margin: .35rem 0 0; font: .75rem/1.4 var(--sans); color: var(--dim); }
#art-progress:empty { display: none; }
#delete-run {
  flex: 1 0 100%; min-width: 0; padding: 1.25rem; margin: .5rem 0;
  overflow-wrap: anywhere;
  color: var(--ink); background: var(--paper); border: 1px solid var(--edge-strong);
  border-radius: 10px; font: 1rem/1.6 var(--sans);
}
#delete-run h2 { margin-top: 0; font: 1.4rem/1.3 var(--serif); }
.delete-actions { display: flex; justify-content: flex-end; gap: .75rem; }
.delete-actions button { min-height: 44px; padding: .6rem .9rem; }
.runlist a {
  display: flex; align-items: baseline; gap: .9rem; min-height: 44px;
  padding: .55rem .25rem; border-top: 1px solid var(--edge);
  color: var(--ink); text-decoration: none;
}
.runlist a:hover { background: var(--paper); }
.runlist .title { font: 500 .95rem/1.3 var(--serif); color: var(--ink); min-width: 13rem; }
.runlist .unplayed .title { color: var(--dim); }
.runlist .hero { font: .8125rem/1.3 var(--sans); color: var(--dim); flex: 1; min-width: 0; }
.runlist .at {
  font: .72rem/1.4 var(--mono); font-variant-numeric: tabular-nums slashed-zero;
  color: var(--system); white-space: nowrap;
}
.runlist .at.unplayed {
  font: .62rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
  border: 1px solid var(--edge); border-radius: 3px; padding: .1rem .35rem;
}
.runlist .when {
  font: .72rem/1 var(--mono); color: var(--dim); width: 6rem; flex: 0 0 auto; text-align: right;
}

/* Creation, in the catalogue's place. */
#creation h1:focus { outline: none; }
.creation-head { display: flex; align-items: baseline; gap: 1rem; }
#creation h1 { font: 500 1.7rem/1.25 var(--serif); color: var(--ink); margin: 0; }
#creation .lede { font: 1rem/1.65 var(--serif); color: var(--ink-dim); margin: .7rem 0 0; max-width: 38rem; }
#creation .heroname { margin-top: 1.8rem; max-width: 22rem; }
#creation .heroname label {
  display: block; margin-bottom: .4rem; font: 600 .6875rem/1 var(--sans);
  letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}
#heroname {
  width: 100%; min-height: 44px; background: var(--raised); border: 1px solid var(--edge-strong);
  border-radius: 6px; color: var(--ink); padding: .7rem .85rem; font: 1rem/1.45 var(--sans);
}
#heroname[aria-invalid="true"] { border-color: var(--bad); }
/* "← All scenarios": chrome at a whisper, but the whole 44px of it tappable. */
.back {
  margin-left: auto; background: none; border: 0; padding: 0 .25rem; min-height: 44px;
  font: 600 .6875rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim);
}
.back:hover:not(:disabled) { background: none; color: var(--ink); }
.back.quiet {
  margin-left: 0; min-width: 44px; padding: 0 .5rem;
  font: .8125rem/1.4 var(--sans); letter-spacing: 0; text-transform: none;
}
#creation fieldset { border: 0; padding: 0; margin: 1.8rem 0 0; min-width: 0; }
#creation .why { margin: 0 0 .9rem; font: .875rem/1.55 var(--sans); color: var(--dim); max-width: 36rem; }
.cards.options { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
/* A choice card is a label around a radio: the radio is what a keyboard and a
   screen reader choose with, and the card is what shows which is chosen. */
.card.option { gap: .5rem; padding: 1rem 1.1rem; cursor: pointer; justify-items: stretch; }
.card.option .ohead { display: flex; align-items: baseline; gap: .6rem; }
.card.option input {
  accent-color: var(--ember); margin: 0; width: 1rem; height: 1rem; flex: 0 0 auto; padding: 0;
}
.card.option .title { font: 500 1.05rem/1.2 var(--serif); }
.card.option .under { font: .9375rem/1.55 var(--serif); }
.card.option:has(input:checked) { border-color: var(--ember-dim); }
.card.option:has(input:focus-visible) { outline: 2px solid var(--ember); outline-offset: 2px; }
/* What the engine will add, in its own hand, under a dashed rule. */
.card.option .grants {
  display: flex; gap: .9rem; flex-wrap: wrap; margin-top: .15rem; padding-top: .5rem;
  border-top: 1px dashed var(--system-rule);
  font: .78rem/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--system);
}
.card.option .kit { font: .78rem/1.5 var(--mono); color: var(--system-dim); }
/* The one act on this screen, drawn as the composer's `act` is: outlined in
   the player's colour rather than filled. */
.begin-row { display: flex; align-items: center; gap: 1rem; margin-top: 1.6rem; }
.primary {
  display: inline-grid; place-items: center; min-height: 2.9rem; padding: 0 1.1rem;
  background: none; border: 1px solid var(--ember-dim); border-radius: 6px; color: var(--ember);
  font: 600 .8125rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
}
.primary:hover:not(:disabled) { background: #1C1711; border-color: var(--ember); }
.primary:disabled { color: var(--ink-dim); border-color: var(--edge-strong); cursor: progress; }
#begin-note { color: var(--ink-dim); font-size: .8rem; margin: .6rem 0 0; }
#begin-note:empty { display: none; }

/* --- the full-size view ------------------------------------------------------

   Every picture is a link to its own file, with this cue in its corner. A
   link with no `href` yet — a face that has not arrived — is not a link, and
   shows no cue. On a thumb too small to carry one (the scene list, a memory
   card) the cue would cover the face it points at, so it is left off there
   and the link's label says what opens. Declared before the phone's block,
   which overrides it. */
a.openable { position: relative; text-decoration: none; }
a.platewrap, #facelink, .shotlink, .present .thumblink { display: block; position: relative; }
.present .thumblink { flex: 0 0 1.6rem; }
.cue {
  position: absolute; right: .4rem; bottom: .4rem; display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem; border-radius: 4px;
  background: #0B0E14CC; border: 1px solid var(--edge-strong); color: var(--ink);
  pointer-events: none;
}
a.openable:not([href]) .cue, .eface .cue, .present .cue { display: none; }

/* The ground at 94%, not black: the page is still there behind it. */
#lightbox {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: #0B0E14F0; color: var(--ink);
  font-family: var(--sans);
}
#lightbox[open] { display: flex; flex-direction: column; }
#lightbox::backdrop { background: transparent; }
.lb-head { flex: 0 0 auto; display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.5rem; }
#lb-title {
  font: 600 .75rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
}
#lb-count { font: .72rem/1 var(--mono); color: var(--system-dim); font-variant-numeric: tabular-nums; }
.lb-round {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border-radius: 50%; border: 1px solid var(--edge-strong); background: var(--raised); color: var(--ink);
}
.lb-round:hover:not(:disabled) { background: var(--raised); border-color: var(--dim); }
#lb-close { margin-left: auto; }
.lb-stage {
  flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 1.5rem; padding: 0 1.5rem;
}
.lb-step { flex: 0 0 auto; align-self: center; width: 2.75rem; height: 2.75rem; }
.lb-frame { flex: 1; min-width: 0; position: relative; }
/* Never past twice the picture's own size, and centred in whatever room is
   left. `--nw` and `--nh` are the picture's own pixels, set once it has
   arrived; `contain` keeps its shape inside the capped box. */
#lb-image {
  position: absolute; inset: 0; margin: auto; display: block;
  width: min(calc(var(--nw, 320px) * 2), 100%); height: min(calc(var(--nh, 400px) * 2), 100%);
  object-fit: contain;
}
.lb-foot {
  flex: 0 0 auto; display: flex; gap: 1.6rem; align-items: flex-start; flex-wrap: wrap;
  padding: 1.2rem 1.5rem 1.1rem; border-top: 1px solid var(--edge); background: var(--ground);
}
.lb-words { display: grid; gap: .3rem; min-width: 0; flex: 1; }
#lb-name { display: none; font: 500 1.05rem/1.2 var(--serif); color: var(--ink); }
#lb-meta {
  font: .75rem/1.4 var(--mono); color: var(--system-dim); font-variant-numeric: tabular-nums;
}
#lb-meta b { color: var(--system); font-weight: 500; }
#lb-look { margin: 0; max-width: 44rem; font: italic 400 .875rem/1.6 var(--sans); color: var(--ink-dim); }
#lb-look span {
  font-style: normal; font-family: var(--mono); font-size: .7rem; color: var(--dim); margin-left: .5rem;
}
.lb-acts { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.lb-acts button, .lb-acts a {
  display: inline-grid; place-items: center; background: none; border: 1px solid var(--edge-strong);
  border-radius: 4px; color: var(--dim); font: .68rem/1 var(--sans); padding: .28rem .5rem;
  text-decoration: none;
}
.lb-acts button:hover:not(:disabled), .lb-acts a:hover { background: none; color: var(--ink); }
#lb-wait { font: .68rem/1 var(--sans); color: var(--dim); }

/* --- the phone ----------------------------------------------------------------

   The story is the whole screen. Below the breakpoint the sheet used to sit
   under the entire transcript, and then became a tab bar over the composer —
   which is the decision this block overturns. A tab makes the numbers a
   *destination you leave the story for*, and that is precisely what the
   permanent panel on a wide screen exists to prevent; a phone that answers it
   with tabs has reinvented the problem in less room.

   So: the four numbers that must never leave the screen ride in a status bar
   over the composer, and the same `aside` a wide screen keeps beside the story
   rises from the bottom as a sheet when the bar is tapped. One panel to build,
   one to keep correct — the head, the tabs and the three panes are the same
   elements under both layouts and neither is a copy of the other.

   The breakpoint is 60rem, where the direction puts it: the desktop layout is
   a 42rem measure beside a 22rem panel and wants every one of those rems. It
   was 54rem while the panel was 19rem. The number is `--phone-max` above and
   is written twice in this file only because a media query cannot read a
   custom property in its own condition; `panel.js` reads the property. */
@media (max-width: 60rem) {
  /* One override, two elements. `#story` and `#composer > .in` both take their
     width from `--measure` in the rules above, so the measure a phone has is
     simply all of it — rather than two `max-width: none` overrides that have
     to be found again the next time a third thing is centred on the measure. */
  :root { --measure: 100%; }

  main { display: block; }
  header { padding: 0 1rem; gap: .75rem; }
  header .mark { font-size: .75rem; letter-spacing: .2em; }
  header .where { flex: 1; }
  header .turnno { font-size: .7rem; }
  #menu { display: grid; }
  #story { padding: 1.5rem 1.15rem 0; }
  /* No gutter on a phone: a speaker's face goes on a line above the speech. */
  .turn { display: block; }
  .prose p.speech { padding-left: .8rem; max-width: 100%; }
  /* No gutter: the speaker goes on a line of its own above the speech, at the
     paragraph's own left edge rather than its indent. */
  .speaker {
    position: static; display: flex; align-items: center; gap: .5rem;
    margin: 0 0 .55rem; text-align: left; flex-wrap: wrap; width: 100%;
  }
  .speaker-person { display: flex; align-items: center; gap: .5rem; }
  .speaker .sface { width: 4rem; }
  .utterance.has-speaker { min-height: 0; }
  .speaker span.simg { padding: 0; font-size: 0; }
  .speaker .sname { font: 600 .6rem/1 var(--sans); letter-spacing: .12em; max-width: none; }
  /* The clearance for a composer that is out of the flow belongs to the column
     rather than to the story: `#story`'s own bottom padding is the gap under
     the last paragraph, and the room the fixed block needs is the column's.
     One measurement covers it, because the status bar is inside the composer. */
  #column { padding-bottom: var(--composer, 11rem); }
  .turn { margin-bottom: 1.8rem; }
  .sys { font-size: .78rem; }

  /* The same panel, raised rather than revealed. Fixed to the bottom, not
     quite the height of the screen so the story is visibly still behind it,
     and translated out of the way rather than hidden — `visibility` is what
     keeps a panel that is off the bottom of the screen out of the tab order
     while the transform is still what moves it. */
  aside {
    position: fixed; inset: auto 0 0 0; top: auto; z-index: 30;
    height: min(86vh, 100vh - var(--header));
    border-left: 0; border-top: 1px solid var(--edge-strong);
    border-radius: 14px 14px 0 0; box-shadow: 0 -12px 40px #0009;
    transform: translateY(100%); visibility: hidden;
    transition: transform .24s cubic-bezier(.2, .7, .2, 1), visibility .24s;
  }
  /* Visible at once on the way up, so the keyboard can be handed into it in
     the same breath; hidden only once it has gone down. */
  body.sheet-open aside {
    transform: none; visibility: visible;
    transition: transform .24s cubic-bezier(.2, .7, .2, 1), visibility 0s;
  }
  /* The grab handle: what says this is a thing that came up and can go down. */
  aside::before {
    content: ""; display: block; flex: 0 0 auto;
    width: 2.5rem; height: 4px; border-radius: 2px; background: var(--edge-strong);
    margin: .55rem auto 0;
  }
  #panelhead { padding-top: .6rem; }
  #close { display: inline-grid; top: 1.1rem; z-index: 2; }
  #panes { padding-bottom: .75rem; }
  /* The three player links do not fit in the header beside the mark, the
     title and the counter, and a phone that cannot reach `runs` cannot change
     run. `panel.js` moves the element itself down here, so there is one of
     each control rather than a second set to keep in step. */
  #panel > nav {
    flex: 0 0 auto; display: flex; gap: 1.1rem; align-items: center; margin: 0;
    padding: .8rem 1.15rem calc(.8rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--edge);
    font-family: var(--sans); font-size: .8125rem;
  }
  #panel > nav a, #panel > nav .link {
    color: var(--dim); text-decoration: none;
    background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  }
  #panel > nav a:hover, #panel > nav .link:hover { color: var(--ink); background: none; }

  #scrim {
    display: block; position: fixed; inset: 0; z-index: 25; background: #0009;
    opacity: 0; pointer-events: none; transition: opacity .24s;
  }
  body.sheet-open #scrim { opacity: 1; pointer-events: auto; }

  /* The status bar. Full width, in the panel's own paper so it reads as the
     panel's edge showing rather than as another row of the composer, and a
     button throughout because the whole of it is the tap target. */
  #bar {
    display: flex; align-items: center; gap: .6rem;
    width: calc(100% + 2.3rem); margin: 0 -1.15rem .6rem;
    min-height: 3.1rem; padding: .45rem 1.15rem;
    background: var(--paper); border: 0; border-top: 1px solid var(--edge);
    border-radius: 0; color: var(--ink); text-align: left;
    font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero;
  }
  #bar:hover:not(:disabled) { background: var(--paper); }
  #bar img, #bar .blank {
    width: 1.9rem; height: 2.35rem; flex: 0 0 auto; display: block; object-fit: cover;
    border: 1px solid var(--edge-strong); border-radius: 4px; background: var(--raised);
  }
  #bar .bwho { display: grid; gap: .2rem; flex: 1; min-width: 0; }
  /* Her own name, told the story's way here as everywhere else she is named. */
  #bar .bname {
    font-family: var(--serif); font-size: .8125rem; line-height: 1.1; font-weight: 500;
    color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #bar .bname.none { color: var(--dim); }
  #bar .bhp {
    display: flex; align-items: center; gap: .45rem;
    font-size: .68rem; line-height: 1; color: var(--system-dim);
  }
  /* The rail gives up its width first and the value never does: the value is
     the thing this bar exists to keep on the screen. The fill and the hurt
     colour are the panel meter's own rules — the same rail, smaller. */
  #bar .bhp .rail {
    flex: 1 1 2rem; min-width: 2rem; max-width: 9rem; height: 4px; margin: 0;
  }
  #bar .bhp .v { flex: 0 0 auto; color: var(--ink); white-space: nowrap; }
  #bar .bhp .v.moved { color: var(--ember); }
  #bar .blv { flex: 0 0 auto; font-size: .68rem; line-height: 1; color: var(--system-dim); letter-spacing: .06em; white-space: nowrap; }
  #bar .blv b { color: var(--system); font-weight: 500; }
  #bar .blv.moved b { color: var(--ember); }
  #bar .chev { flex: 0 0 auto; color: var(--dim); font-family: var(--sans); font-size: .9rem; line-height: 1; }

  /* Fixed rather than sticky: there is no second column for it to be sticky
     inside, and the story clears it by the height measured off this element. */
  #composer {
    position: fixed; left: 0; right: 0; bottom: 0; border-top: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #composer > .in { padding: 0 1.15rem .7rem; }
  #action { min-height: 2.75rem; }

  /* The front door on a phone: the thesis alone, then the same three groups
     with only what a thumb needs — who, where they stand, and the turn. */
  #start > div { padding: 1.4rem 1.15rem; }
  .masthead .thesis { font: 500 1.25rem/1.35 var(--serif); }
  .masthead .pitch { display: none; }
  #start .group, #start #continue { margin-top: 1.4rem; }
  .resume { gap: .9rem; padding: .9rem; }
  .resume .cframe { flex-basis: 3.1rem; width: 3.1rem; }
  .resume .words { gap: .3rem; }
  .resume .top { display: grid; gap: .3rem; }
  .resume .title { font-size: 1rem; }
  .resume .hero { font: .78rem/1.3 var(--sans); }
  .resume .standing { font-size: .72rem; }
  .resume .said, .resume .when, .resume .go { display: none; }
  #catalogue { gap: .6rem; }
  #catalogue .card { gap: .4rem; padding: .9rem 1rem; }
  #catalogue .card .title { font-size: 1.05rem; }
  #catalogue .card .under { font: .9375rem/1.55 var(--serif); }
  #catalogue .card .tags { display: none; }
  .runlist a { gap: .6rem; padding: .5rem .1rem; }
  .runlist .title {
    font-size: .875rem; flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .runlist .hero, .runlist .when { display: none; }
  #creation h1 { font-size: 1.4rem; }
  .gal-bar { padding: 0 1.15rem; }
  .gal-body { padding: 1.4rem 1.15rem; }

  /* The full-size view on a phone: the ground, solid, and the words in the
     panel's paper under the picture. */
  #lightbox { background: var(--ground); }
  .lb-head { gap: .7rem; padding: 1rem 1.15rem; }
  #lb-title { font-size: .7rem; }
  #lb-count { font-size: .68rem; }
  .lb-stage { gap: .5rem; padding: 0 1.15rem; }
  .lb-foot {
    display: grid; gap: .6rem; background: var(--paper);
    padding: 1.1rem 1.15rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  }
  #lb-name { display: block; }
  #lb-meta { font-size: .7rem; }
  #lb-look { font-size: .8125rem; }
  #lb-look span { font-size: .68rem; margin-left: .4rem; }
  .lb-acts { gap: .5rem; }
}

/* The card a name opens. The face is the point of it, so the face is the
   biggest thing in it; under a hairline, two facts and the look it was drawn
   from. The rest of the dossier stays in the panel. */
#namecard {
  position: fixed; z-index: 20; width: 20rem; max-width: calc(100vw - 1rem);
  background: var(--raised); border: 1px solid var(--edge-strong); border-radius: 9px;
  padding: .8rem .85rem .85rem; box-shadow: 0 14px 38px #000B;
  font-family: var(--sans); color: var(--ink);
}
.nc-top { display: flex; gap: .85rem; align-items: flex-start; }
.nc-face {
  position: relative; display: block; flex: 0 0 8.5rem; width: 8.5rem; aspect-ratio: 4 / 5;
  border-radius: 6px; overflow: hidden; border: 1px solid var(--edge-strong);
  background: var(--raised); text-decoration: none;
}
.nc-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nc-face.held { border-style: dashed; }
.nc-face.drawing span.nc-img { font: .68rem/1.5 var(--mono); color: var(--system-dim); padding: .5rem; }
.nc-face.held span.nc-img { font: .68rem/1.45 var(--sans); padding: .6rem; }
.nc-foot .nc-describe {
  margin-left: 0; border: 1px solid var(--edge-strong); border-radius: 4px; padding: .28rem .5rem;
  font: .68rem/1 var(--sans); letter-spacing: 0; text-transform: none; color: var(--dim);
}
.nc-face span.nc-img {
  display: grid; place-items: center; height: 100%; padding: .3rem; text-align: center;
  font: .625rem/1.3 var(--sans); color: var(--dim);
}
.nc-words { flex: 1; min-width: 0; display: grid; gap: .25rem; align-content: start; }
.nc-name { font: 500 1rem/1.25 var(--serif); color: var(--ink); }
.nc-kind {
  font: .6rem/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--system-dim);
}
.nc-primary { margin-top: .2rem; font: .78rem/1.5 var(--sans); color: var(--ink-dim); }
#namecard .nc-facts {
  margin: .7rem 0 0; padding-top: .6rem; border-top: 1px solid var(--edge);
  display: grid; grid-template-columns: max-content 1fr; gap: .12rem .6rem;
  font: .75rem/1.5 var(--sans); font-variant-numeric: normal;
}
#namecard .nc-facts dt { color: var(--dim); margin: 0; padding: 0; }
#namecard .nc-facts dd {
  color: var(--ink-dim); margin: 0; padding: 0; text-align: left; white-space: normal;
}
.nc-look { margin: .45rem 0 0; font: italic 400 .75rem/1.55 var(--sans); color: var(--dim); }
.nc-look span {
  font-style: normal; font-family: var(--mono); font-size: .66rem;
  color: var(--dim); margin-left: .4rem;
}
.nc-foot { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; }
.nc-foot button {
  margin-left: auto; background: none; border: 0; padding: 0;
  font: 600 .6rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ember);
}
.nc-foot button:hover:not(:disabled) { background: none; text-decoration: underline; }

/* A name the story bible knows. Colour at rest and never an underline at rest:
   with every mention tinted, a paragraph with four names would be a field of links. */
a[data-ent] {
  color: var(--name);
  text-decoration: none;
}
a[data-ent]:hover,
a[data-ent]:focus-visible {
  text-decoration: underline dotted;
  text-decoration-color: var(--name-dim);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
