:root {
  --ground: #e6e9ed; --paper: #fff; --ink: #14161a; --muted: #565d68; --line: #d3d8df;
  --deck: #14161a; --deck-2: #22262e; --deck-3: #323844; --deck-text: #f4f5f7; --deck-muted: #aab2bf;
  --clear: #7cc7ff; --firm: #ffb454; --warm: #ff9fae; --sharp: #cdb0ff; --proof: #7be0a6;
  --ins-bg: #c9f3da; --ins-ink: #0a3a20; --del-ink: #a3262a; --flag: #ffe3a0;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --serif: ui-serif, "New York", Charter, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.45 var(--sans);
  display: grid; grid-template-rows: 56px minmax(0, 1fr) auto; height: 100dvh; overflow: hidden;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #1769d1; outline-offset: 2px; }
.deck :focus-visible { outline-color: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.btn { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 7px 12px; font-weight: 600; min-height: 34px; transition: transform 140ms var(--ease), background-color 140ms ease; }
.btn:active { transform: scale(.97); }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }

.bar { display: flex; align-items: center; gap: 14px; padding-inline: 16px; background: var(--paper); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { font: 800 20px/1 var(--round); letter-spacing: -.02em; }
.thread-pick select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--paper); font-weight: 600; max-width: 180px; min-height: 34px; }
.bar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.engine { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px; min-height: 34px; min-width: 24px; white-space: nowrap; }
.engine::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c2382f; }
.engine[data-ready="true"]::before { background: #1f9d58; }
.engine[data-ready="checking"]::before { background: #d9a21b; }

.bench { display: grid; grid-template-columns: 300px minmax(0, 1fr) 376px; min-height: 0; }
.col { min-height: 0; overflow-y: auto; }

.record { padding: 16px; border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.incoming { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; margin-top: 8px; }
.bubble { background: var(--paper); border-radius: 14px 14px 14px 4px; padding: 7px 11px; max-width: 100%; overflow-wrap: anywhere; }
.note-small { font-size: 12px; color: var(--muted); }
.facts, .rules { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fact { background: var(--paper); border-radius: 8px; padding: 9px 10px; position: relative; }
.fact-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.status { font-size: 11px; font-weight: 700; border: 0; border-radius: 99px; padding: 2px 8px; min-height: 24px; }
.status[data-s="proven"] { background: #c9f3da; color: #0a3a20; }
.status[data-s="witness"] { background: #d6e9ff; color: #103a68; }
.status[data-s="yours"] { background: #ebe7f7; color: #372a63; }
.status[data-s="disputed"] { background: var(--flag); color: #573c00; }
.fact-x { border: 0; background: none; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; }
.fact .was { font-size: 12px; color: var(--del-ink); text-decoration: line-through; }
.fact-form { display: flex; gap: 6px; margin-top: 8px; }
.fact-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--paper); }
.rule { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.rule input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--ink); }
.rule small { display: block; color: var(--muted); font-size: 12px; }
.turns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.turn-chip { background: var(--paper); border-radius: 6px; padding: 2px 7px; font-size: 12px; font-weight: 600; }

.desk { display: flex; flex-direction: column; gap: 12px; padding: 16px 24px 0; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.take-title { font: 700 18px/1.2 var(--round); }
.take-say { color: var(--muted); margin-top: 3px; font-size: 13px; max-width: 62ch; overflow-wrap: anywhere; }
.take-tools { display: flex; align-items: center; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.seg { display: inline-flex; background: #d7dce2; border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-weight: 600; font-size: 13px; min-height: 30px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.compare { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.compare select { border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 3px 5px; max-width: 220px; min-height: 26px; }
.stat-add { color: #12713d; font-weight: 700; }
.stat-del { color: var(--del-ink); font-weight: 700; }

.sheet { background: var(--paper); border-radius: 12px; padding: 28px 32px; font: 19px/1.62 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; flex: 1 0 auto; transition: opacity 180ms ease, filter 180ms ease; box-shadow: 0 1px 0 var(--line); }
.sheet.busy { opacity: .72; }
.sheet textarea { display: block; width: 100%; min-height: 340px; border: 0; padding: 0; outline: 0; resize: none; font: inherit; background: none; }
.ins { background: var(--ins-bg); color: var(--ins-ink); border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; padding-inline: 1px; }
.del { color: var(--del-ink); user-select: none; -webkit-user-select: none; background: linear-gradient(currentColor, currentColor) 0 58% / 100% 1.5px no-repeat; box-decoration-break: clone; -webkit-box-decoration-break: clone; opacity: .8; }
mark.flag { background: var(--flag); color: inherit; border-radius: 3px; padding-inline: 1px; }
/* A tracked change you can act on, and wording the writer locked. Both stay quiet: no new fill colours. */
.hunk { cursor: pointer; border-radius: 3px; -webkit-tap-highlight-color: transparent; }
.hunk[aria-expanded="true"] { outline: 1.5px solid var(--muted); outline-offset: 2px; }
.hunk:focus-visible { outline: 2px solid #1769d1; outline-offset: 2px; }
.hunk-sr { user-select: none; -webkit-user-select: none; }
.locked { text-decoration: underline dotted var(--muted); text-decoration-thickness: 1.5px; text-underline-offset: .28em; text-decoration-skip-ink: none; }
.lock-text { font: 15px/1.45 var(--serif); overflow-wrap: anywhere; }
.lock-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.run .ins { animation: arrive 260ms var(--ease) backwards; animation-delay: var(--d, 0ms); }
.run .del { animation: strike 220ms var(--ease) backwards; animation-delay: var(--d, 0ms); }
@keyframes arrive { from { opacity: 0; filter: blur(3px); background-color: transparent; } }
@keyframes strike { from { background-size: 0% 1.5px; opacity: 1; } }

.notice { display: flex; align-items: flex-start; gap: 10px; background: #fff6df; border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 6px; }
.notice.good { background: #e4f8ec; }
.notice .grow { flex: 1; min-width: 0; }
.notice q { font-weight: 700; quotes: "\201C" "\201D"; }
.composer { display: flex; gap: 8px; position: sticky; bottom: 0; padding-block: 8px 12px; background: var(--ground); }
.composer input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; background: var(--paper); min-height: 44px; font-size: 16px; }
.composer .btn { min-height: 44px; padding-inline: 18px; }

.deck { background: var(--deck); color: var(--deck-text); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.deck .eyebrow, .deck .note-small { color: var(--deck-muted); }
.foe { background: var(--deck-2); border-radius: 12px; padding: 12px 14px; }
.foe-name { font: 800 20px/1.15 var(--round); margin-top: 2px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.chip { border: 1px solid var(--deck-3); background: none; color: var(--deck-muted); border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 600; min-height: 26px; transition: transform 140ms var(--ease); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--deck-text); border-color: var(--deck-text); color: var(--ink); }
.chip[data-type][aria-pressed="true"] { background: var(--tc); border-color: var(--tc); }
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.move { --tc: var(--clear); text-align: start; background: var(--deck-2); border: 0; border-bottom: 3px solid var(--tc); border-radius: 10px; color: var(--deck-text); padding: 10px 11px 9px; min-height: 104px; display: flex; flex-direction: column; gap: 4px; transition: transform 160ms var(--ease), background-color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .move:not([aria-disabled="true"]):hover { background: var(--deck-3); transform: translateY(-2px); } }
.move:not([aria-disabled="true"]):active { transform: scale(.97); }
.move[aria-disabled="true"] { cursor: not-allowed; }
.move.firing { background: var(--tc); color: var(--ink); }
.move.firing * { color: var(--ink) !important; }
.move-name { font: 800 15px/1.2 var(--round); }
.move-effect { font-size: 12.5px; line-height: 1.3; color: var(--deck-muted); flex: 1; }
.move-foot { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; }
.move-type { color: var(--tc); }
.match[data-l="Lands"] { color: var(--proof); }
.match[data-l="Even"] { color: var(--deck-muted); }
.match[data-l="Backfires"] { color: #ff8f85; }
[data-type="clear"] { --tc: var(--clear); } [data-type="firm"] { --tc: var(--firm); } [data-type="warm"] { --tc: var(--warm); } [data-type="sharp"] { --tc: var(--sharp); } [data-type="proof"] { --tc: var(--proof); }
.dials { display: grid; gap: 8px; }
.dial { display: grid; grid-template-columns: 58px 1fr 58px; align-items: center; gap: 8px; font-size: 12px; color: var(--deck-muted); }
.dial span:last-child { text-align: end; }
.dial input { width: 100%; accent-color: var(--proof); min-height: 24px; }
.deck .btn { background: var(--deck-2); border-color: var(--deck-3); color: var(--deck-text); }
.deck .btn.primary { background: var(--deck-text); color: var(--ink); border-color: var(--deck-text); }
.connect { background: #3a2a14; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.connect code { display: block; margin-top: 5px; font: 12px/1.4 ui-monospace, Menlo, monospace; color: var(--firm); overflow-wrap: anywhere; }
.reading { display: grid; gap: 8px; font-size: 13px; }
.reading b { display: block; font-size: 11px; color: var(--deck-muted); text-transform: uppercase; letter-spacing: .06em; }

.timeline { background: var(--paper); border-top: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 124px; }
.timeline-head { display: flex; align-items: center; gap: 14px; padding: 7px 16px 0; font-size: 13px; color: var(--muted); }
.timeline-head .btn { margin-inline-start: auto; min-height: 28px; padding: 3px 10px; }
.tree-scroll { overflow: auto; flex: 1; padding: 4px 16px 8px; max-height: calc(4 * 34px + 12px); } /* grows to four lanes, then scrolls */
.tree { position: relative; }
.tree svg { position: absolute; inset: 0; pointer-events: none; }
.tree path { fill: none; stroke: var(--line); stroke-width: 2; }
.tree path.on { stroke: var(--ink); }
.node { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--paper); background: #dfe3e8; font: 700 11px/1 var(--round); padding: 0; color: var(--ink); transition: transform 140ms var(--ease); }
.node:active { transform: scale(.94); }
.node[data-kind="Correction"] { background: var(--flag); }
.node[data-kind="Sharpen"] { background: var(--sharp); }
.node[data-kind="Soften"] { background: var(--warm); }
.node[data-kind="Add"] { background: var(--clear); }
.node[data-kind="Restructure"], .node[data-kind="Starter"] { background: var(--proof); }
.node[aria-current="true"] { background: var(--ink); color: #fff; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

.popover { position: fixed; z-index: 20; display: flex; gap: 2px; padding: 4px; background: var(--ink); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); transform-origin: bottom center; animation: pop 140ms var(--ease); }
.popover[hidden], .toast[hidden] { display: none; }
.popover button { background: none; border: 0; color: #fff; border-radius: 7px; padding: 6px 10px; font-weight: 600; font-size: 13px; min-height: 32px; }
@media (hover: hover) and (pointer: fine) { .popover button:hover { background: var(--deck-3); } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(3px); } }
.toast { position: fixed; z-index: 30; inset-block-end: calc(var(--below, 124px) + 16px); inset-inline-start: 50%; translate: -50% 0; background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 9px; font-weight: 600; max-width: min(460px, calc(100vw - 32px)); }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); color: var(--ink); }
dialog::backdrop { background: rgb(20 22 26 / .55); }
#new-body { padding: 22px; display: grid; gap: 12px; }
#new-body h2 { font: 800 22px/1.2 var(--round); }
.field { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.field input, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-weight: 400; font-size: 16px; width: 100%; }
.field textarea { min-height: 96px; resize: vertical; }
.pattern-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pattern-row .chip { color: var(--ink); border-color: var(--line); }
.pattern-row .chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.starter { text-align: start; background: var(--deck); color: var(--deck-text); border: 0; border-bottom: 4px solid var(--tc); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; transition: transform 160ms var(--ease); }
.starter:active { transform: scale(.98); }
.starter h3 { font: 800 17px/1.2 var(--round); }
.starter p { font-size: 13px; }
.starter .why { color: var(--deck-muted); font-size: 12px; }

.tabs { display: none; }
.take-list { display: none; list-style: none; margin: 0; padding: 0 16px 16px; overflow-y: auto; }
.take-list button { display: grid; gap: 2px; width: 100%; text-align: start; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 8px; font-size: 14px; }
.take-list button[aria-current="true"] { background: var(--ground); border-radius: 8px; }
.take-list span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

@media (max-width: 1080px) {
  body { grid-template-rows: 56px minmax(0, 1fr) 56px; }
  .bench { display: block; min-height: 0; overflow: hidden; }
  .col, .timeline { display: none; }
  body[data-tab="record"] .record, body[data-tab="moves"] .deck { display: flex; height: 100%; }
  body[data-tab="draft"] .desk { display: flex; height: 100%; }
  .record { border: 0; }
  /* The bench stays in the page (empty, no height) so there is always a main landmark. */
  body[data-tab="history"] .bench { height: 0; }
  body[data-tab="history"] { grid-template-rows: 56px 0 minmax(0, 1fr) 56px; }
  body[data-tab="history"] .timeline { display: flex; min-height: 0; }
  .tree-scroll { flex: none; }
  .take-list { display: block; flex: 1; min-height: 0; }
  .desk { padding: 12px 16px 0; }
  .sheet { padding: 18px; font-size: 17px; }
  .sheet-head { flex-direction: column; gap: 8px; }
  .take-tools { justify-content: flex-start; }
  .starters { grid-template-columns: 1fr; }
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border-top: 1px solid var(--line); }
  .tabs button { border: 0; background: none; font-weight: 700; color: var(--muted); }
  body[data-tab="record"] [data-go="record"], body[data-tab="draft"] [data-go="draft"], body[data-tab="moves"] [data-go="moves"], body[data-tab="history"] [data-go="history"] { color: var(--ink); box-shadow: inset 0 3px 0 var(--ink); }
  .toast { inset-block-end: 72px; }
  .engine span { display: none; }
  .brand { font-size: 18px; }
  .thread-pick select { max-width: 120px; }
}

/* Conversation card, rule scopes and the example lesson */
.btn-small { min-height: 28px; padding: 3px 10px; font-size: 13px; }
.btn-danger { color: var(--del-ink); }
.btn-icon { min-width: 34px; padding-inline: 0; font-size: 18px; line-height: 1; }
.badge { display: inline-block; flex: none; background: var(--paper); border: 1px solid var(--line); color: var(--ink); border-radius: 99px; padding: 0 8px; font-size: 11px; font-weight: 700; line-height: 18px; }
.thread-card { display: grid; gap: 8px; }
.thread-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.thread-name { font: 800 17px/1.2 var(--round); overflow-wrap: anywhere; min-width: 0; }
.thread-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.thread-card.confirm { background: #fff6df; border-radius: 8px; padding: 9px 10px; font-size: 13px; }
.rules-sub { font-size: 12px; font-weight: 700; margin: 10px 0 0; }
.rules-sub + .note-small { margin-top: 4px; }
.rule-row { display: flex; align-items: flex-start; gap: 8px; }
.rule-row .rule { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rule-scope { display: inline-block; margin-inline-start: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.notice.ask { flex-wrap: wrap; }
.notice.ask .grow { min-width: 12em; }
.lesson { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); max-width: 72ch; border-radius: 4px; }
.lesson[hidden] { display: none; }
.lesson .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* First run and the example gallery */
.empty { display: none; }
body[data-empty] { grid-template-rows: 56px minmax(0, 1fr); }
body[data-empty] .bench, html[data-boot="first-run"] body:not([data-mode]) .bench { display: block; overflow-y: auto; }
body[data-empty] .bench > .col, body[data-empty] .timeline, body[data-empty] .tabs,
html[data-boot="first-run"] body:not([data-mode]) .bench > .col, html[data-boot="first-run"] body:not([data-mode]) .timeline, html[data-boot="first-run"] body:not([data-mode]) .tabs { display: none; }
body[data-empty] .empty, html[data-boot="first-run"] body:not([data-mode]) .empty { display: grid; gap: 28px; max-width: 1080px; margin-inline: auto; padding: 32px 24px 40px; }
.welcome { display: grid; gap: 10px; max-width: 62ch; }
.welcome h2 { font: 800 28px/1.15 var(--round); letter-spacing: -.02em; border-radius: 4px; }
.welcome p { color: var(--muted); font-size: 15px; }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.welcome-actions .btn { min-height: 44px; padding-inline: 18px; }
.gallery { display: grid; gap: 12px; }
.gallery-head { display: grid; gap: 2px; }
.gallery-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gallery-top h2 { margin-inline-end: auto; font: 800 22px/1.2 var(--round); }
#examples-dialog { width: min(1040px, calc(100vw - 24px)); background: var(--ground); }
#examples-body { padding: 22px; display: grid; gap: 12px; }
.ex-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-filter .chip { color: var(--ink); border-color: var(--line); background: var(--paper); min-height: 32px; padding-inline: 12px; font-size: 13px; }
.ex-filter .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-n { margin-inline-start: 6px; opacity: .65; font-variant-numeric: tabular-nums; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.ex-card { background: var(--paper); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 0 var(--line); min-width: 0; }
.ex-card h3 { font: 700 17px/1.25 var(--round); overflow-wrap: anywhere; }
.ex-blurb { font-size: 13.5px; color: var(--muted); flex: 1; overflow-wrap: anywhere; }
.ex-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.ex-to { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.ex-tags { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
.tag { background: var(--ground); border-radius: 6px; padding: 2px 7px; font-weight: 600; color: var(--ink); }
.ex-count { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.ex-actions { display: flex; gap: 6px; margin-top: 6px; }
.ex-actions .btn { flex: 1; }

@media (max-width: 1080px) {
  body[data-empty] .empty, html[data-boot="first-run"] body:not([data-mode]) .empty { padding: 20px 16px 32px; gap: 22px; }
  .welcome h2 { font-size: 24px; }
  #examples-body { padding: 16px; }
}
@media (max-width: 560px) {
  .wide-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bar { gap: 10px; }
  .bar-end { gap: 8px; }
  .thread-pick { min-width: 0; }
  .thread-pick select { width: 100%; }
}

/* After sending: the round panel, the conversation in the record, sent markers and round marks on the timeline */
.loop { background: var(--paper); border-radius: 12px; padding: 12px 14px; display: grid; gap: 12px; font-size: 13px; box-shadow: 0 1px 0 var(--line); min-width: 0; }
.loop[hidden] { display: none; }
.loop .grow { flex: 1; min-width: 0; }
.loop-head { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.loop-head p { color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.loop-head .eyebrow { border-radius: 4px; }
.loop-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.loop-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.loop-pair p, .loop-debrief p { overflow-wrap: anywhere; }
.loop .incoming { margin-top: 0; }
.loop .bubble, .round-msg .bubble { background: var(--ground); }
.loop-form { display: grid; gap: 8px; }
.loop-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.loop-inline { grid-auto-flow: column; align-items: center; gap: 8px; }
.loop-inline select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--paper); min-height: 34px; font-weight: 400; }
.loop-verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.loop-debrief { display: grid; gap: 4px; }
.loop-debrief .fact { background: var(--ground); display: grid; gap: 4px; }
.proposal-title { font-weight: 700; }
.loop-next { border-top: 1px solid var(--line); padding-top: 10px; justify-content: flex-end; }
.silence { font-size: 13px; color: var(--muted); font-style: italic; }
.round-msg { background: var(--ground); border-radius: 10px; padding: 10px; }
.convo { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.convo .incoming { margin-top: 0; }
.incoming.mine { align-items: flex-end; }
.bubble.mine { background: var(--ink); color: #fff; border-radius: 14px; border-end-end-radius: 4px; white-space: pre-wrap; }
.convo-meta { text-align: end; margin-top: 4px; }
.convo-now { margin-top: 2px; font-weight: 700; }
.score { margin-top: 10px; font-variant-numeric: tabular-nums; }
.node[data-sent]::after { content: "✓"; position: absolute; inset-block-start: -5px; inset-inline-end: -6px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); color: #fff; border: 2px solid var(--paper); font: 700 8px/10px var(--sans); text-align: center; }
.tree path.round-link { stroke-dasharray: 3 4; }
.tree path.round-link.on { stroke: var(--ink); }
.round-mark { position: absolute; width: 28px; height: 18px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); font: 700 10px/16px var(--round); text-align: center; pointer-events: none; }
.take-list .sent-tag { margin-inline-start: 6px; font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
.take-list .take-round { padding: 12px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

/* Waiting on Claude: where the result will land, how long it has been, Cancel. The counter is the sign of life, not motion. */
.pending[hidden] { display: none; }
.progress { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 8px; padding: 7px 8px 7px 12px; font-size: 13px; box-shadow: 0 1px 0 var(--line); min-width: 0; }
.progress .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.progress-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #1f9d58; animation: waiting 1.6s ease-in-out infinite; }
.progress-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3.5ch; text-align: end; }
.progress.failed { background: #fff6df; flex-wrap: wrap; }
.progress.failed .grow { min-width: 12em; }
.loop .progress, #new-body .progress { background: var(--ground); box-shadow: none; }
#new-body .progress.failed { background: #fff6df; }
.deck .progress { background: var(--deck-2); box-shadow: none; }
.deck .progress-time { color: var(--deck-muted); }
.deck .progress-dot { background: var(--proof); }
.deck .progress.failed { background: #3a2a14; }
@keyframes waiting { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .progress-dot { animation: none; } }
body[data-calling] [data-claude][aria-disabled="true"], body[data-calling] .move[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
body[data-calling] .popover button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Take tools: "I sent this" sits under them, so the compare row keeps its line. Message length stays quiet. */
.take-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.length { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.sms { white-space: nowrap; }

/* The sent panel folds to one line */
.loop.folded { padding-block: 6px; }
.loop-toggle { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; border: 0; background: none; padding: 2px 0; min-height: 28px; text-align: start; color: inherit; border-radius: 4px; max-width: 100%; }
.loop-toggle::before { content: ""; align-self: center; width: 6px; height: 6px; border-inline-end: 1.5px solid var(--muted); border-block-end: 1.5px solid var(--muted); transform: rotate(-45deg); margin-inline: 2px 4px; transition: transform 140ms var(--ease); }
.loop-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
.loop-summary { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

/* Keyboard: the composer hint (desktop only) and the shortcut sheet */
.composer { flex-wrap: wrap; row-gap: 4px; }
.composer-hint { display: none; flex-basis: 100%; gap: 12px; align-items: center; justify-content: flex-end; font-size: 12px; color: var(--muted); }
@media (min-width: 1081px) and (hover: hover) and (pointer: fine) { .composer-hint { display: flex; } }
kbd { font: 600 11px/1 var(--sans); border: 1px solid var(--line); border-block-end-width: 2px; border-radius: 4px; padding: 2px 5px; background: var(--paper); color: var(--ink); white-space: nowrap; }
.link-btn { border: 0; background: none; padding: 2px 0; min-height: 24px; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; border-radius: 4px; }
#keys-dialog { width: min(560px, calc(100vw - 24px)); }
#keys-body { padding: 22px; display: grid; gap: 12px; }
#keys-body h2 { font: 800 22px/1.2 var(--round); }
.keys { margin: 0; display: grid; gap: 2px; }
.keys-row { display: grid; grid-template-columns: 9em 1fr; gap: 12px; align-items: baseline; padding: 5px 0; border-block-end: 1px solid var(--ground); }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; font-size: 13px; }

/* Export choices, and the blocking message when saved work could not be loaded */
.export-choices { padding-inline-start: 2px; }
.thread-card .notice { margin: 0; }
body[data-blocked] .bar-end .btn { visibility: hidden; }

@media (max-width: 1080px) {
  .take-side { align-items: flex-start; }
  .keys-row { grid-template-columns: 7.5em 1fr; }
}

/* The public static copy (no server, no AI). Nothing here applies to the local app: every rule is scoped to
   body[data-mode="static"], or to the retake-mode meta tag before the app has started. */
/* Before app.js runs. boot.js has set html[data-boot]: on a first visit the welcome from index.html paints at
   once, laid out exactly as the app's empty state; with saved work only the top bar shows until the workbench
   renders. Either way the first paint is never the wrong screen. */
html[data-boot="returning"] body:not([data-mode]) :is(.bench, .timeline, .tabs, .thread-pick, .bar-end),
html[data-boot="first-run"] body:not([data-mode]) :is(.thread-pick, .engine) { visibility: hidden; }
html[data-boot="first-run"] body:not([data-mode]) { grid-template-rows: 56px minmax(0, 1fr) auto; }
/* The landing scrolls once the gallery is in: keep room for a scrollbar from the first paint, so the centred
   welcome never moves sideways when one appears. */
html[data-boot="first-run"] body:not([data-mode]) .bench, body[data-mode="static"][data-empty] .bench { scrollbar-gutter: stable; }
/* Hold the status label's width ("Demo: no AI", or "No AI" on narrow screens) until app.js writes it, so the
   buttons beside it never move. Hidden either way; this only takes the space. */
html[data-boot="first-run"] body:not([data-mode]) .engine::before { display: none; }
html[data-boot="first-run"] body:not([data-mode]) .engine::after { content: "Demo: no AI"; }
@media (max-width: 1080px) { html[data-boot="first-run"] body:not([data-mode]) .engine::after { content: "No AI"; } }
/* The welcome's static-only lines exist in the HTML for the public copy; the local app never shows them. */
.welcome [hidden] { display: none; }
.site-foot { display: none; }
html[data-boot="first-run"] body:not([data-mode]) .site-foot, body[data-mode="static"] .site-foot { display: block; }
body[data-mode="static"] .bar-end { position: relative; }
.engine[data-ready="static"] { text-decoration: underline dotted; text-underline-offset: 4px; }
.engine[data-ready="static"]::before { display: none; }
.engine .mode-short { display: none; }
.mode-note { position: absolute; z-index: 25; inset-block-start: calc(100% + 8px); inset-inline-end: 0; width: min(320px, calc(100vw - 32px)); background: var(--ink); color: #fff; padding: 10px 12px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
.mode-note[hidden] { display: none; }
.engine:focus-visible + .mode-note[hidden] { display: block; }
.demo-line { font-weight: 600; }
.welcome p.demo-line { color: var(--ink); }
.welcome .notice { margin: 0; }
.deck-how { margin-top: 8px; }
.move[aria-pressed="true"] { background: var(--deck-3); box-shadow: inset 0 0 0 2px var(--tc); }
.move-how { --tc: var(--clear); background: var(--deck-2); border-radius: 10px; border-inline-start: 3px solid var(--tc); padding: 10px 12px; display: grid; gap: 6px; font-size: 13px; }
.move-how-name { font: 800 15px/1.2 var(--round); }
.pending-edit q { quotes: "\201C" "\201D"; }
.site-foot { font-size: 12px; color: var(--muted); padding: 6px 16px; background: var(--ground); border-top: 1px solid var(--line); }
.site-foot a { color: var(--ink); font-weight: 600; display: inline-block; padding-block: 3px; text-underline-offset: 2px; }
body[data-mode="static"] { grid-template-rows: 56px minmax(0, 1fr) auto auto; }
body[data-mode="static"][data-empty] { grid-template-rows: 56px minmax(0, 1fr) auto; }
@media (max-width: 1080px) {
  .engine[data-ready="static"] .mode-short { display: inline; }
  body[data-mode="static"] { grid-template-rows: 56px minmax(0, 1fr) 56px; }
  body[data-mode="static"][data-empty] { grid-template-rows: 56px minmax(0, 1fr) auto; }
  body[data-mode="static"][data-tab="history"] { grid-template-rows: 56px 0 minmax(0, 1fr) 56px; }
  /* On a phone the workbench needs every row: the credit shows on the first screen only. */
  body[data-mode="static"]:not([data-empty]) .site-foot { display: none; }
}
