/* Still My Voice — Failing Daily brand layer
 *
 * Black-first, editorial, newspaper masthead. Black and white do almost all
 * the work; gold is a spice, not a sauce — ONE gold element leads per view.
 * Serif (Lora) carries the masthead and headlines; humanist sans (Source Sans 3)
 * carries body and the gold tagline.
 */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=Source+Sans+3:ital,wght@0,300;0,400;0,600;0,700;1,400&display=swap');

:root {
  /* Raw brand */
  --fd-black: #000000;
  --fd-white: #ffffff;
  --fd-gold: #ca9800;
  --fd-gold-bright: #e5ac00;
  --fd-gold-deep: #a57c00;
  --fd-charcoal: #1a1a1a;
  --fd-graphite: #2c2c2c;
  --fd-ash: #8a8a8a;
  --fd-fog: #d4d4d4;
  --fd-paper: #fafafa;
  --fd-ink: #111111;

  /* Semantic */
  --bg: var(--fd-black);
  --surface: var(--fd-charcoal);
  --border: var(--fd-graphite);
  --text: var(--fd-white);
  --text-2: var(--fd-fog);
  --text-3: var(--fd-ash);
  --accent: var(--fd-gold);

  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --r: 4px;
  --maxw: 1120px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.1em; }
a { color: var(--fd-gold-bright); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--fd-white); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.small { font-size: 0.86rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   The masthead: white serif title → thin white rule → gold tagline.
   The signature rhythm. Do not let anything else compete with it.
   -------------------------------------------------------------------------- */

.fd-masthead {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--fd-white);
  letter-spacing: -0.015em;
  line-height: 1;
  display: block;
}

.fd-rule {
  border: 0;
  border-top: 1px solid var(--fd-white);
  margin: 0.6rem 0 0.55rem;
  opacity: 0.9;
}

.fd-tagline {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--fd-gold);
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding-block: 12px;
}

.brand { text-decoration: none; display: block; }
.brand .fd-masthead { font-size: 1.4rem; }
.brand .fd-rule { margin: 4px 0 3px; }
.brand .fd-tagline { font-size: 0.7rem; }

.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.site-nav a:hover { color: var(--fd-white); }

/* Signed-in indicator — the page must never look the same signed in as out. */
#whoami {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-2);
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.signed-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--fd-gold);
  flex: none;
}
#whoami-email { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 760px) {
  #whoami-email { display: none; }
  #whoami { padding-left: 10px; }
}

/* --------------------------------------------------------------------------
   Buttons — gold leads only where it is THE action
   -------------------------------------------------------------------------- */

.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--r);
  padding: 11px 22px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fd-white);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.2;
}
.btn:hover:not(:disabled) { border-color: var(--fd-white); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--fd-gold);
  border-color: var(--fd-gold);
  color: var(--fd-black);
}
.btn-primary:hover:not(:disabled) {
  background: var(--fd-gold-bright);
  border-color: var(--fd-gold-bright);
  color: var(--fd-black);
}

.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { padding: 84px 0 64px; border-bottom: 1px solid var(--border); }
.hero .kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fd-gold);
  margin-bottom: 18px;
}
.hero h1 { max-width: 15ch; }
.hero .lede {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  color: var(--text-2);
  max-width: 58ch;
  margin-bottom: 30px;
}
.hero em { font-style: italic; color: var(--fd-white); }

/* --------------------------------------------------------------------------
   Sections and cards
   -------------------------------------------------------------------------- */

section.band { padding: 68px 0; border-bottom: 1px solid var(--border); }

.eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
}
.card h3 { margin-bottom: 6px; }
.card p { margin-bottom: 0; color: var(--text-2); font-size: 0.95rem; }

button.card {
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
button.card:hover { border-color: var(--fd-gold); }
button.card[aria-pressed='true'] {
  border-color: var(--fd-gold);
  box-shadow: inset 3px 0 0 var(--fd-gold);
}

/* The rule block — the product's whole argument, so it gets the one gold
   accent on the page it lives on. */
.rule-block {
  border-left: 3px solid var(--fd-gold);
  padding: 4px 0 4px 24px;
}
.rule-block .does { color: var(--fd-white); }
.rule-block .does-not { color: var(--text-3); }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

.app { padding: 40px 0 96px; }

.step-head { margin-bottom: 26px; }
.step-head .eyebrow { color: var(--fd-gold); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 26px;
}

.gate {
  border: 1px solid var(--fd-gold);
  border-radius: var(--r);
  background: rgba(202, 152, 0, 0.06);
  padding: 26px;
}
.gate h3 { color: var(--fd-white); }
.gate ul { margin: 0 0 18px; padding-left: 20px; color: var(--text-2); }
.gate li { margin-bottom: 7px; }

label.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  color: var(--text);
  font-size: 0.97rem;
  margin-bottom: 20px;
}
label.check input { margin-top: 5px; flex: none; width: 17px; height: 17px; accent-color: var(--fd-gold); }

input[type='text'],
textarea,
select {
  width: 100%;
  background: var(--fd-black);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  padding: 12px 14px;
}
input[type='text']:focus,
textarea:focus,
select:focus { outline: 2px solid var(--fd-gold); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 130px; }

/* Transcript */
.transcript { display: flex; flex-direction: column; gap: 20px; margin-bottom: 26px; }

.turn { display: grid; grid-template-columns: 92px 1fr; gap: 18px; align-items: start; }
.turn .who {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-top: 5px;
}
.turn-interviewer .who { color: var(--fd-gold); }
.turn-subject .who { color: var(--text-3); }
.turn-interviewer .what { font-family: var(--serif); font-size: 1.16rem; line-height: 1.45; color: var(--fd-white); }
.turn-subject .what {
  color: var(--text-2);
  border-left: 1px solid var(--border);
  padding-left: 18px;
  white-space: pre-wrap;
}

/* Diff */
.diff {
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.85;
  background: var(--fd-black);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  white-space: pre-wrap;
  margin-bottom: 18px;
}
.diff ins { background: rgba(202, 152, 0, 0.22); color: var(--fd-gold-bright); text-decoration: none; }
.diff del { background: rgba(255, 255, 255, 0.07); color: var(--text-3); }

/* Lanes */
.lane-out {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 24px;
}
.lane-out pre {
  white-space: pre-wrap;
  font-family: var(--sans);
  font-size: 0.97rem;
  line-height: 1.7;
  color: var(--text-2);
  margin: 0;
}

/* Status */
.status { font-size: 0.88rem; color: var(--text-3); min-height: 1.4em; }
.status.err { color: var(--fd-gold-bright); }

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--fd-graphite);
  border-top-color: var(--fd-gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.site-footer {
  padding: 44px 0;
  color: var(--text-3);
  font-size: 0.85rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.site-footer .fd-masthead { font-size: 1.05rem; }
.site-footer .fd-tagline { font-size: 0.64rem; }
.stamp { font-family: var(--mono); font-size: 0.72rem; color: var(--fd-graphite); }

@media (max-width: 640px) {
  .turn { grid-template-columns: 1fr; gap: 8px; }
  .site-nav { gap: 14px; }
  .site-nav a.nav-extra { display: none; }
  .hero { padding: 56px 0 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Interview surface — rebuilt 2026-09-05.
   The old version buried the live question at the bottom of a growing
   transcript, so answering pushed the next question off-screen. The question
   is now pinned and the transcript is a collapsed record.
   ========================================================================== */

.iv-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.iv-head h2 { margin: 0; }
.iv-meta { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1 1 auto; }

/* Saved indicator. "Is my work safe" should never need asking. */
.saved-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.saved-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fd-gold);
  flex: none;
}
.saved-pill.saving .saved-dot { animation: pulse 1s ease-in-out infinite; }
.saved-pill.error { color: var(--fd-gold-bright); border-color: var(--fd-gold); }
@keyframes pulse { 50% { opacity: 0.25; } }

/* Progress */
.progress-wrap { margin-bottom: 26px; }
.progress-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 8px;
}
#progress-label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }
.progress-track {
  height: 3px;
  background: var(--fd-graphite);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--fd-gold);
  transition: width 0.4s ease;
}
.progress-bar.over { background: var(--fd-fog); }

/* The live question. This is the thing the user is answering, so it gets the
   visual weight — serif, large, gold rule. */
.current-q {
  border-left: 3px solid var(--fd-gold);
  padding: 4px 0 4px 24px;
  margin-bottom: 22px;
}
.current-q-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fd-gold); margin-bottom: 10px;
}
.current-q-text {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  line-height: 1.4;
  color: var(--fd-white);
  white-space: pre-wrap;
}

.btn-finish { border-color: var(--fd-gold); color: var(--fd-gold); }
.btn-finish:hover:not(:disabled) { background: var(--fd-gold); color: var(--fd-black); }

/* Transcript is now a record, not the workspace */
.transcript-details {
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.transcript-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-3);
  list-style: none;
}
.transcript-details summary::-webkit-details-marker { display: none; }
.transcript-details summary::before { content: '▸ '; color: var(--fd-gold); }
.transcript-details[open] summary::before { content: '▾ '; }
.transcript-details summary:hover { color: var(--fd-white); }
.transcript-details .transcript { margin-top: 20px; }

/* ==========================================================================
   Outline — readable, checkable, commentable.
   The complaint that produced this: "one long runon", "brutal to read and
   respond in one window".
   ========================================================================== */

.outline { max-width: 78ch; }

.outline h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--fd-white);
  margin: 34px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.outline h3:first-child { margin-top: 0; }
.outline h4 {
  font-family: var(--sans);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fd-gold);
  margin: 24px 0 10px;
}
.outline p { color: var(--text-2); margin: 0 0 14px; }
.outline .label { color: var(--text-3); font-weight: 600; }

/* One item = one row. Checkbox, text, and a note affordance. */
.o-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding: 12px 0 12px 11px;
  border-bottom: 1px solid var(--fd-charcoal);
  border-left: 3px solid transparent;
  align-items: start;
  transition: background 120ms ease, border-left-color 120ms ease;
}
.o-item:last-child { border-bottom: 0; }
.o-item input[type='checkbox'] {
  width: 17px; height: 17px; margin-top: 3px;
  accent-color: var(--fd-gold); cursor: pointer;
}
.o-item .o-text { color: var(--text); line-height: 1.6; }

/* CHECKED MEANS KEEP. It is an affirmative mark, so it lights up — a gold rail
 * and a faint wash. It must NEVER read as struck through, dimmed or crossed out.
 * The first version used `text-decoration: line-through`, borrowed from to-do
 * lists, and it told Bill the exact opposite of the truth: he ticked a quote he
 * wanted and watched it appear to be deleted. Nothing marked "keep" is ever
 * styled as removed. Fixed 2026-09-06 after he caught it. */
.o-item.keep { border-left-color: var(--fd-gold); background: rgba(202, 152, 0, 0.055); }
.o-item.keep .o-text { color: var(--text); }
.o-item .o-note {
  display: block;
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--text-3);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  padding: 7px 10px;
  width: 100%;
  min-height: 0;
  resize: vertical;
  font-family: var(--sans);
}
.o-item .o-note:focus { border-style: solid; }
.o-item .o-note.has-text { border-style: solid; border-color: var(--fd-gold-deep); color: var(--text-2); }

.o-quote {
  border-left: 2px solid var(--border);
  padding: 2px 0 2px 16px;
  margin: 0 0 14px;
  color: var(--text-2);
  font-family: var(--serif);
  font-style: italic;
}
.o-turn {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fd-gold-deep);
  font-style: normal;
  white-space: nowrap;
}

/* ==========================================================================
   My work
   ========================================================================== */

.proj {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 22px;
  margin-bottom: 12px;
}
.proj:hover { border-color: var(--fd-gold); }
.proj h3 { margin: 0 0 4px; font-size: 1.1rem; }
.proj .proj-meta { font-size: 0.82rem; color: var(--text-3); }
.proj .badge {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-3);
}
.proj .badge.open { border-color: var(--fd-gold); color: var(--fd-gold); }
.empty-note {
  border: 1px dashed var(--border);
  border-radius: var(--r);
  padding: 30px;
  text-align: center;
  color: var(--text-3);
}

/* ==========================================================================
   Print — this is the PDF export. No library, no dependency.
   ========================================================================== */

@media print {
  @page { margin: 18mm; }
  body { background: #fff !important; color: #111 !important; font-size: 11pt; }
  .site-header, .site-footer, .hero, .band, .panel, .btn, .btn-row,
  .progress-wrap, .current-q, .transcript-details, #step-projects,
  #step-playbook, #step-gate, #step-auth, .iv-meta, #cleanup-panel { display: none !important; }
  #outline-section, #step-interview, .app, main, .wrap { display: block !important; }
  .outline, .outline * { color: #111 !important; }
  .outline h3 { border-bottom: 1px solid #999; page-break-after: avoid; }
  .outline h4 { color: #8a6a00 !important; page-break-after: avoid; }
  .o-item { border-bottom: 1px solid #ddd; page-break-inside: avoid; }
  .o-item .o-note { border: 1px solid #ccc; }
  .o-item .o-note:placeholder-shown { display: none; }
  .o-quote { border-left: 2px solid #999; }
  .o-turn { color: #8a6a00 !important; }
  a { text-decoration: none; color: #111 !important; }
}

/* The sticky header would otherwise cover the top of whichever step just
   became visible. */
#start { scroll-margin-top: 92px; }

/* ==========================================================================
   Notice — loud feedback.
   "The feedback is very weak on this site." It was: a small grey line at the
   bottom of a panel, easy to miss entirely, which made a failed action look
   like nothing happening at all.
   ========================================================================== */

.notice {
  display: grid;
  grid-template-columns: 26px 1fr 28px;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--fd-gold);
  border-left-width: 4px;
  border-radius: var(--r);
  background: rgba(202, 152, 0, 0.08);
  padding: 16px 18px;
  margin-bottom: 22px;
}
.notice.err   { border-color: var(--fd-gold-bright); background: rgba(229, 172, 0, 0.10); }
.notice.done  { border-color: var(--fd-graphite);    background: var(--surface); }

.notice-title {
  font-weight: 700;
  color: var(--fd-white);
  font-size: 1rem;
  margin-bottom: 3px;
}
.notice-body { color: var(--text-2); font-size: 0.92rem; line-height: 1.55; }
.notice-body .elapsed { font-family: var(--mono); font-size: 0.8rem; color: var(--text-3); }

.notice-icon {
  width: 22px; height: 22px; margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--fd-graphite);
  border-top-color: var(--fd-gold);
  flex: none;
}
.notice.working .notice-icon { animation: spin 0.8s linear infinite; }
.notice.done .notice-icon,
.notice.err  .notice-icon {
  animation: none;
  border: 0;
  display: grid; place-items: center;
  font-size: 20px; line-height: 1;
  color: var(--fd-gold);
}
.notice.done .notice-icon::before { content: '✓'; }
.notice.err  .notice-icon::before { content: '!'; font-weight: 700; }

.notice-x {
  background: none; border: 0; color: var(--text-3);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0;
}
.notice-x:hover { color: var(--fd-white); }
.notice.working .notice-x { visibility: hidden; }

/* A long operation must visibly own the control that started it. */
.btn.busy { opacity: 0.65; cursor: progress; }

@media print { .notice { display: none !important; } }

/* Copyable build stamp. Bug reports are far more useful with the exact build
   and session attached, and asking someone to read a version string off a
   screenshot is asking them to make a typo. */
.stamp-copy {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.stamp-copy:hover { border-color: var(--fd-gold); color: var(--fd-gold); }
.stamp-copy .stamp-hint {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
}
.stamp-copy:hover .stamp-hint { opacity: 1; }
.stamp-copy.copied {
  border-color: var(--fd-gold);
  color: var(--fd-gold);
  background: rgba(202, 152, 0, 0.10);
}
.site-footer .stamp-copy { margin-top: 6px; }

@media print { .stamp-copy { display: none !important; } }


/* ===========================================================================
 * THE WORK SURFACE
 * ---------------------------------------------------------------------------
 * Everything below belongs to #step-home and #step-work. It is appended as one
 * block, and every selector is scoped under one of those two ids or under a
 * class that exists nowhere else, because the last time two layers of this
 * stylesheet shared a class name they cancelled each other's padding.
 *
 * The layout was settled by Bill using it and telling me where it broke. The
 * comments record the WHY, not the what — several of these rules look arbitrary
 * and are load-bearing.
 * ======================================================================== */

:root {
  /* The writing height. Set by the drag handle, remembered in localStorage,
   * and clamped in JS against the space actually available. 300px is where
   * Bill started it, not a guess. */
  --draft-h: 300px;
  --rail-w: 264px;
  --sug-w: 300px;
}

/* --------------------------------------------------------------- home screen */

#home-body .section-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 34px 0 14px;
}
#home-body .section-label:first-child { margin-top: 6px; }

#home-body .loadwarn {
  border-left: 3px solid var(--fd-gold-deep);
  background: var(--surface);
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 15px;
  color: var(--text-2);
}

#home-body .card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* The base .card is a marketing tile. These are controls, so they are declared
 * in full rather than inheriting a look built for something else. */
#home-body .card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  text-align: left;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  color: var(--text);
  font-family: var(--sans);
}
#home-body .card:hover { border-color: var(--fd-ash); background: #202020; }

#home-body .card-kind {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
#home-body .card-title { font-family: var(--serif); font-size: 20px; line-height: 1.25; }
#home-body .card-sub { font-size: 15px; color: var(--text-2); }
#home-body .card-meta { font-size: 13px; color: var(--text-3); margin-top: 2px; }
#home-body .needsgate { color: var(--accent); font-weight: 600; }

#home-body .bar { display: block; height: 3px; background: var(--border); margin-top: 8px; }
#home-body .bar i { display: block; height: 100%; background: var(--accent); }

#home-body .row-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); }
#home-body .row-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  border: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}
#home-body .row-item:hover { background: #202020; }
#home-body .ri-meta { font-size: 13px; color: var(--text-3); white-space: nowrap; }

/* Fields and the classification gate, reused on the new-work form. */
#home-body .field { display: block; margin: 0 0 14px; max-width: 560px; }
#home-body .field > span { display: block; font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
#home-body .field em { font-style: normal; color: var(--fd-ash); }
#home-body .field input,
#home-body .field textarea,
#home-body .field select { width: 100%; }

/* The same gate box appears on the new-work form and on an imported work's
 * overview. One rule, one look, wherever it is asked. */
.wk-ctx .gatebox,
#home-body .gatebox {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 16px 18px;
  max-width: 560px;
  margin: 22px 0;
}
.wk-ctx .gatebox .lab,
#home-body .gatebox .lab {
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 8px;
}
#home-body .row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }

/* ------------------------------------------------------------- work: shell */

/* The site header plus this section's own padding. The work surface is a
 * fixed-height column: everything inside it is laid out against this, so it is
 * stated once here rather than assumed in three places. */
#step-work { --wk-chrome: 128px; scroll-margin-top: 84px; }
#step-home { scroll-margin-top: 84px; }
#start { scroll-margin-top: 76px; }

.wk {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  background: var(--fd-black);
}

.wk-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* A definite height is what makes the draft resizer mean anything: the JS
   * clamps the draft against this box, so if it were auto the clamp would
   * chase its own tail. dvh rather than vh because a phone's URL bar is not
   * a fixed height. */
  height: calc(100dvh - var(--wk-chrome));
  min-height: 520px;
}

/* ------------------------------------------------------------- work: rail */

.wk-rail {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  background: #0d0d0d;
  min-width: 0;
}

.wk-rail .bookrow,
.wk-rail .rrow {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  padding: 12px 14px;
  cursor: pointer;
}
.wk-rail .bookrow { flex-direction: column; gap: 2px; }
.wk-rail .bookrow:hover,
.wk-rail .rrow:hover { background: #171717; }
.wk-rail .bookrow.on,
.wk-rail .rrow.on { background: #1e1e1e; box-shadow: inset 3px 0 0 var(--accent); }

.wk-rail .bt { font-family: var(--serif); font-size: 16px; line-height: 1.25; }
.wk-rail .bs { font-size: 12px; color: var(--text-3); }

.wk-rail .rn {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-3);
  padding-top: 3px;
  flex: 0 0 auto;
}
.wk-rail .rrow > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.wk-rail .rt { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.wk-rail .rw { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.rdot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1px solid var(--fd-ash);
  margin-right: 6px;
  vertical-align: middle;
}
.rdot.started { background: var(--accent); border-color: var(--accent); }

.wk-rail .rgrp {
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 14px 6px;
}
.wk-rail .rail-empty { padding: 0 14px 16px; font-size: 14px; color: var(--text-3); margin: 0; }

/* ---------------------------------------------------------- work: breadcrumb */

.wk-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  /* One line. It wrapped to two on a long book title, and every pixel it took
   * came out of the reference pane below it. The title truncates instead. */
  flex-wrap: nowrap;
  overflow: hidden;
  white-space: nowrap;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  background: #0d0d0d;
}
.wk-crumb .pos { color: var(--text-3); }
.wk-crumb .sep { color: var(--fd-graphite); }
.wk-crumb .here { font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 6ch; }
.wk-crumb .up { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-crumb .pos { flex: 0 0 auto; }
.wk-crumb .stepper { flex: 0 0 auto; }
.wk-crumb .sp { flex: 1 1 auto; }
.wk-crumb .up,
.wk-crumb .railtoggle,
.wk-crumb .stepbtn {
  background: none; border: 1px solid transparent; color: var(--text-2);
  font-family: var(--sans); font-size: 13px; padding: 2px 6px; cursor: pointer;
}
.wk-crumb .up:hover,
.wk-crumb .railtoggle:hover,
.wk-crumb .stepbtn:hover:not(:disabled) { border-color: var(--border); color: var(--text); }
.wk-crumb .stepbtn:disabled { color: var(--fd-graphite); cursor: default; }
.wk-crumb .stepper { display: flex; gap: 4px; }
/* The rail is permanently on screen at desk widths; the toggle is for the
 * narrow layout where it becomes an overlay. */
.wk-crumb .railtoggle { display: none; }

/* -------------------------------------------------------------- work: header */

.wk-head {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.wk-head .wk-id { min-width: 0; flex: 1 1 240px; }
.wk-head h2 { font-size: 21px; margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
/* Two lines maximum. A long title used to grow this header until it ate the
 * reference pane below it — the header is chrome, and chrome does not get to
 * take the working space. */
.wk-head h2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wk-kind {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wk-stats { display: flex; gap: 22px; margin: 0; }
.wk-stats div { display: flex; flex-direction: column-reverse; }
.wk-stats dt { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.wk-stats dd {
  margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.wk-stats dd i { font-style: normal; font-size: 14px; color: var(--text-3); }

/* ---------------------------------------------------------------- work: tabs */

.wk-tabsrow {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  min-height: 40px;
}
.wk-tabs {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  /* overflow-x:auto makes overflow-y compute to auto, which produced a phantom
   * vertical scrollbar in a 40px-tall strip. Stating it kills that. */
  overflow-y: hidden;
  scrollbar-width: none;
}
.wk-tabs::-webkit-scrollbar { display: none; }

.wk-tabs .tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  background: none;
  border: 0;
  color: var(--text-2);
  font-family: var(--sans);
  font-size: 14px;
  padding: 0 16px;
  cursor: pointer;
}
.wk-tabs .tab:hover { color: var(--text); background: #141414; }
/* The active underline is an inset shadow, NOT a negative margin. A -1px
 * margin made the strip 41px tall inside a 40px box, which is where the
 * phantom scrollbar came from. */
.wk-tabs .tab[aria-selected='true'] {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.wk-tabs .tab .ic { font-size: 13px; opacity: 0.75; }
.wk-tabs .tab .cnt {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 6px;
}
.wk-tabs .spacer { flex: 1 1 auto; }
.wk-tabs .srctab { border-left: 1px solid var(--border); }

.wk-tabsrow .chev {
  flex: 0 0 auto;
  background: none;
  border: 0;
  border-left: 1px solid var(--border);
  color: var(--text-3);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 14px;
  cursor: pointer;
}
.wk-tabsrow .chev:hover { color: var(--text); }

/* Tooltips. Every tab carries a real one — an empty data-tip still matches
 * [data-tip], which is how a help cursor appeared over nothing. And no
 * cursor:help on a button: the thing is clickable, so it says so. */
[data-tip] { position: relative; }
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 8px;
  z-index: 40;
  width: max-content;
  max-width: 300px;
  white-space: normal;
  background: var(--fd-white);
  color: var(--fd-black);
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  padding: 8px 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* ------------------------------------------------------- work: the tab body */

.wk-ctx {
  flex: 1 1 auto;
  /* An explicit min-height does two jobs. It lets this flex child shrink below
   * its content and scroll (the default min-height:auto refuses, and pushes
   * the writing surface off the bottom of the screen), AND it is the floor the
   * draft resizer is measured against — see draftCeiling() in works.js. It was
   * briefly BOTH `min-height: 0` and `min-height: 180px`, in that order, so
   * the floor was silently zero and the pane collapsed to a single line. */
  min-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  /* A clipped last line reads as a bug rather than as "there is more below",
   * so the pane always ends on empty space. */
  padding: 16px 20px 40px;
  /* When there is more below, say so. 294px of this pane was hidden behind a
   * scrollbar on the setup screen and nothing on the page suggested it. */
  scrollbar-color: var(--fd-graphite) transparent;
}
.wk-ctx > :first-child { margin-top: 0; }
.wk-ctx h3.first { font-size: 21px; margin: 0 0 8px; }
.wk-ctx .thesis { font-size: 16px; color: var(--text-2); max-width: 68ch; margin: 0 0 16px; }
.wk-ctx .lab {
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); margin: 0 0 6px;
}
.wk-ctx .row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.wk-ctx .raw {
  white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px;
  background: #0d0d0d; border: 1px solid var(--border); padding: 12px;
  overflow-x: auto;
}
.wk-ctx .field { display: block; margin: 0 0 14px; max-width: 600px; }
.wk-ctx .field > span { display: block; font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.wk-ctx .field em { font-style: normal; color: var(--fd-ash); }
.wk-ctx .field input,
.wk-ctx .field textarea,
.wk-ctx .field select { width: 100%; }

/* setup checklist */
.wk-ctx .steps { list-style: none; padding: 0; margin: 0 0 20px; }
.wk-ctx .steps li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.wk-ctx .steps li > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.wk-ctx .sdot {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border); display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; color: var(--text-3);
}
.wk-ctx .steps li.done .sdot { border-color: var(--accent); color: var(--accent); }
.wk-ctx .steps li.now .sdot { background: var(--accent); border-color: var(--accent); color: var(--fd-black); }
.wk-ctx .stitle { font-size: 15px; font-weight: 600; }
.wk-ctx .sdesc { font-size: 13.5px; color: var(--text-3); }

.wk-ctx .progress { height: 3px; background: var(--border); margin: 4px 0 12px; }
.wk-ctx .progress i { display: block; height: 100%; background: var(--accent); }
.wk-ctx .ivmeta { font-size: 12px; color: var(--text-3); margin: 0 0 10px; }
.wk-ctx .ivq { font-family: var(--serif); font-size: 22px; line-height: 1.35; margin: 0 0 8px; max-width: 44ch; }
.wk-ctx .ivsrc { font-size: 13px; color: var(--text-3); margin: 0; }

.wk-ctx .beats { margin: 0 0 10px; padding-left: 20px; }
.wk-ctx .beats li { margin: 4px 0; }
.wk-ctx .notes { width: 100%; max-width: 68ch; }

.wk-ctx .qcard { border: 1px solid var(--border); padding: 12px 14px; margin: 0 0 8px; }
.wk-ctx .qcard p { margin: 0 0 6px; font-size: 15px; }
.wk-ctx .qfoot { display: flex; justify-content: space-between; }
.wk-ctx .qmeta { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }

/* the outline / part list */
.wk-ctx .olrow {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.wk-ctx .olrow .onum {
  font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-3); padding-top: 4px;
}
.wk-ctx .olrow .ot { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wk-ctx .olrow .ot small { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wk-ctx .olrow .oa { display: flex; gap: 5px; }
.wk-ctx .golink {
  background: none; border: 0; padding: 0; text-align: left;
  color: var(--text); font-family: var(--serif); font-size: 17px; cursor: pointer;
  overflow-wrap: anywhere;
}
.wk-ctx .golink:hover { color: var(--accent); }
.wk-ctx .ol-title { width: 100%; }
.wk-ctx .mini {
  background: none; border: 1px solid var(--border); color: var(--text-2);
  font-family: var(--sans); font-size: 12px; padding: 3px 8px; cursor: pointer;
}
.wk-ctx .mini:hover:not(:disabled) { border-color: var(--fd-ash); color: var(--text); }
.wk-ctx .mini:disabled { color: var(--fd-graphite); border-color: #1c1c1c; cursor: default; }

/* sources */
.wk-ctx .syncbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); padding: 14px 16px; margin: 0 0 14px;
}
.wk-ctx .syncbar .t { flex: 1 1 260px; font-size: 15px; display: flex; flex-direction: column; }
.wk-ctx .syncbar .t small { font-size: 13px; color: var(--text-3); }
.wk-ctx .srcrow {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); font-family: var(--sans); padding: 11px 4px; cursor: pointer;
}
.wk-ctx .srcrow:hover { background: #141414; }
.wk-ctx .srcrow .g {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent); color: var(--accent); font-size: 12px; font-weight: 700;
}
.wk-ctx .srcrow .g.d { border-color: var(--fd-ash); color: var(--fd-ash); }
.wk-ctx .srcrow .ti { display: flex; flex-direction: column; min-width: 0; font-size: 15px; }
.wk-ctx .srcrow .ti small { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.wk-ctx .srcrow .go { font-size: 12px; color: var(--text-3); }

/* --------------------------------------------------------------- work: grip */

.wk-grip {
  flex: 0 0 auto;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: #0d0d0d;
  cursor: ns-resize;
  touch-action: none;
}
.wk-grip .griphandle { width: 46px; height: 3px; background: var(--fd-graphite); border-radius: 2px; }
.wk-grip:hover .griphandle,
.wk-grip.drag .griphandle { background: var(--accent); }
.hreadout {
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity 0.15s;
}
.hreadout.on { opacity: 1; }

/* ------------------------------------------------------ work: writing surface */

.wk-drafthead {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #0d0d0d;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.wk-drafthead .saveflag { text-transform: none; letter-spacing: 0; font-size: 12px; }
/* Nothing in this strip is typeable, and it should not invite a click that
 * ends in a text selection. */
.wk-drafthead > span:not(.grow) { user-select: none; }
.wk-drafthead .grow { flex: 1 1 auto; }

.draft {
  flex: 0 0 auto;
  height: var(--draft-h);
  min-height: 110px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sug-w);
  gap: 0;
}
/* Collapsing the reference panel hands the whole remaining column to writing,
 * which is the only reason to collapse it. */
.draft.grow { flex: 1 1 auto; height: auto; }
/* While answering there is no draft to punch up, so the panel is not there and
 * the single column is the answer box. */
.draft.answering { grid-template-columns: minmax(0, 1fr); }

.draft .pane { min-width: 0; min-height: 0; display: flex; padding: 10px 12px 12px; }
/* IT HAS TO LOOK LIKE SOMEWHERE YOU CAN TYPE.
 *
 * This was a borderless black textarea on a black page, under a strip reading
 * "YOUR ANSWER". The strip read as the field and the field read as empty page:
 * Bill clicked the label, selected the words "YOUR ANSWER", and reported that
 * he could not type in the answer box. He was right — nothing on screen said
 * that was the box. It now has an edge, a slightly lifted ground, and a gold
 * focus ring. */
.draft .pane textarea {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #0b0b0b;
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  padding: 14px 18px;
}
.draft .pane textarea::placeholder { color: var(--fd-ash); opacity: 1; }
.draft .pane textarea:hover { border-color: var(--fd-ash); }
.draft .pane textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--fd-black);
}
/* While answering, the box IS the screen's one job — say so louder. */
.draft.answering .pane textarea { border-color: var(--fd-ash); }
.draft.answering .pane textarea:focus { border-color: var(--accent); }
/* A measure the eye can follow, without leaving the rest of the box dead —
 * the textarea still fills the width, the TEXT is what gets the column. */
.draft .pane.narrowmeasure textarea { padding-left: max(18px, calc((100% - 68ch) / 2)); padding-right: max(18px, calc((100% - 68ch) / 2)); }

.draft .sug {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid var(--border);
  background: #0d0d0d;
  padding: 12px 14px 18px;
}
.draft .sughead {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
.draft .sughead .cnt { color: var(--text-3); font-weight: 400; letter-spacing: 0; text-transform: none; }
.draft .sugempty { font-size: 13px; color: var(--text-3); margin: 0; }
.draft .sugblock { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 12px; }
.draft .sugblock:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.draft .sugblock h5 {
  font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-3); margin: 0 0 6px;
}
.draft .sugblock h4 { font-family: var(--sans); font-size: 13.5px; margin: 12px 0 4px; }
.draft .sugblock p { font-size: 13.5px; line-height: 1.55; margin: 0 0 8px; }
.draft .sugblock ul { margin: 0 0 8px; padding-left: 18px; }
.draft .sugblock li { font-size: 13.5px; line-height: 1.5; margin: 3px 0; }
.draft .sugblock blockquote {
  margin: 0 0 8px; padding-left: 10px; border-left: 2px solid var(--accent);
  font-size: 13.5px; color: var(--text-2);
}
.draft .sugblock code { font-family: var(--mono); font-size: 12px; }
.draft .sugerr { font-size: 13px; color: var(--fd-gold-deep); margin: 0; }

/* --------------------------------------------------------------- work: bench */

.bench {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px 16px 11px;
  border-top: 1px solid var(--border);
  background: #0d0d0d;
}
.bench .brow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bench .blab {
  cursor: default;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
}
.bench .spacer { flex: 1 1 auto; }
.bench .pass {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); padding: 3px 9px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
}
.bench .pass:hover { border-color: var(--fd-ash); color: var(--text); }
.bench .pass input { margin: 0; accent-color: var(--fd-gold); }
.bench .pass:has(input:checked) { border-color: var(--accent); color: var(--text); }
/* The bench is the last thing in the column, so its tooltips open upward —
 * below it is off the bottom of the screen. */
.bench [data-tip]:hover::after,
.bench [data-tip]:focus-visible::after { top: auto; bottom: calc(100% + 6px); }

/* ------------------------------------------------------------- narrow screens */

@media (max-width: 900px) {
  #step-work { --wk-chrome: 108px; }
  .wk { grid-template-columns: minmax(0, 1fr); }
  /* The rail becomes an overlay rather than disappearing. A list you cannot
   * reach is worse than a list that takes a tap. */
  .wk-rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, var(--rail-w));
    z-index: 60;
    transform: translateX(-102%);
    transition: transform 0.18s ease;
    border-right: 1px solid var(--fd-graphite);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
    /* Moved off-screen is not gone: an element at -102% is still focusable and
     * still clickable at its edge. visibility takes it out of the tab order. */
    visibility: hidden;
  }
  body.rail-open .wk-rail { transform: none; visibility: visible; }
  .wk-crumb .railtoggle { display: inline-block; }
  .wk-head { padding: 12px 14px 10px; }
  .wk-head h2 { font-size: 20px; }
  .wk-stats { gap: 16px; }
  .wk-stats dd { font-size: 18px; }
  .wk-ctx { padding: 14px; }
  .wk-ctx .ivq { font-size: 19px; }
  /* Suggestions go under the writing rather than beside it — at this width a
   * 300px column would leave the draft too narrow to write in.
   *
   * Both rows are given explicit sizes. With `auto` for the panel and a
   * percentage max-height, the percentage resolves against an indefinite row
   * and is ignored, so a long pass answer took the entire box and the thing
   * you write in collapsed to nothing. */
  .draft {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(140px, 1fr) minmax(0, 0.75fr);
  }
  .draft .sug { border-left: 0; border-top: 1px solid var(--border); }
  .draft:not(.withsug) { grid-template-rows: minmax(140px, 1fr) auto; }
  .draft.withsug { height: calc(var(--draft-h) + 150px); }
  .wk-tabs .tab { padding: 0 11px; font-size: 13px; }
}

@media (max-width: 600px) {
  /* The masthead wraps to three lines on a phone and the header is sticky, so
   * every line it gains is a line it covers of whatever is underneath. Trim it
   * to what a signed-in person on a phone actually needs. */
  .site-header .wrap { min-height: 60px; padding-block: 8px; gap: 10px; }
  .site-nav .nav-extra,
  #whoami-email { display: none; }
  .brand .fd-masthead { font-size: 1.15rem; }
  .brand .fd-tagline { display: none; }
  .app { padding: 18px 0 48px; }

  .wk-head .btn { display: none; }
  .wk-stats { width: 100%; }
  .draft .pane textarea { font-size: 16px; padding: 12px 14px; }
  .draft .pane.narrowmeasure textarea { padding-left: 14px; padding-right: 14px; }
  .draft .pane { padding: 8px; }
  .bench .blab { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wk-rail { transition: none; }
}

/* The gate's point list, wherever the gate appears. */
.gatelist { margin: 10px 0 14px; padding-left: 20px; }
.gatelist li { font-size: 13.5px; line-height: 1.5; color: var(--text-2); margin: 5px 0; }
#step-gate #gate-points { margin: 12px 0 18px; padding-left: 22px; }
#step-gate #gate-points li { margin: 7px 0; }

/* The page tally on a proposal outline. A budget that does not add up should be
 * visible before the sections are created, not after somebody writes into it. */
.wk-ctx .pagetally {
  font-size: 13px; color: var(--text-3); margin: 0 0 14px;
  border-left: 2px solid var(--border); padding-left: 10px;
}
.wk-ctx .pagetally.over { color: var(--fd-gold-bright); border-left-color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------- the lightbulb */

.fb-open {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.fb-open:hover { border-color: var(--accent); color: var(--accent); }

.fb {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 71;
  width: min(380px, calc(100vw - 36px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  padding: 14px 16px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}
.fb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.fb-x {
  background: none; border: 0; color: var(--text-3);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.fb-x:hover { color: var(--text); }
.fb-hint { font-size: 13px; color: var(--text-3); margin: 0 0 10px; }
.fb textarea { width: 100%; resize: vertical; }
.fb-ctx { font-size: 11.5px; color: var(--text-3); margin: 8px 0 10px; line-height: 1.45; }
.fb-ctx em { font-style: normal; color: var(--fd-ash); }
.fb-actions { display: flex; align-items: center; gap: 10px; }
.fb-status { font-size: 12px; color: var(--text-3); }

@media (max-width: 600px) {
  .fb-open-label { display: none; }
  .fb-open { padding: 11px 13px; }
}
