/* Tabula Rasa, the front door (D176 (4)). Colours are tokens from the Babco Labs brand values; light and dark follow the
   device. Ember is only ever a fill under charcoal words, never words on white. Every state has a word and a mark. */
:root {
  --bg: #FFFFFF; --surface: #F4F5F8; --raise: #FFFFFF; --fg: #0D0F14; --muted: #4A505C; --line: #D3D7DF;
  --ember: #FF7A1A; --on-ember: #0D0F14; --focus: #0D0F14; --field: #FFFFFF;
  --radius: 10px; --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0F14; --surface: #161920; --raise: #1C2028; --fg: #F2F3F5; --muted: #A9AFBB; --line: #2C313B;
    --focus: #FFFFFF; --field: #12151B;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 17px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
main { max-width: 780px; margin: 0 auto; padding: 32px var(--gutter) 64px; }
h1 { font-size: 30px; line-height: 1.2; margin: 8px 0 8px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 20px; margin: 0 0 6px; font-weight: 650; }
p { margin: 0 0 12px; }
.lead { color: var(--muted); margin-bottom: 24px; }
.quiet { color: var(--muted); }
.small { font-size: 15px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

label { display: block; font-weight: 600; margin: 0 0 6px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 15px; margin-top: 2px; }
textarea, input[type=text], select {
  width: 100%; font: inherit; color: var(--fg); background: var(--field);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
textarea { min-height: 180px; resize: vertical; }
textarea.short { min-height: 96px; }
textarea:focus, input:focus, select:focus, button:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.field { margin: 0 0 16px; }

button { font: inherit; cursor: pointer; border-radius: var(--radius); padding: 12px 22px; font-weight: 650; }
button.go { background: var(--ember); color: var(--on-ember); border: 2px solid var(--ember); }
button.plain { background: transparent; color: var(--fg); border: 1px solid var(--line); }
button:disabled { cursor: default; opacity: 0.55; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 18px 0 8px; }

details.five { margin: 16px 0 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.five > summary { padding: 14px 16px; cursor: pointer; font-weight: 600; }
details.five > summary .hint { display: inline; margin-left: 6px; }
details.five .body { padding: 4px 16px 8px; }

/* the stages of a run: a mark and a word, never colour alone */
ol.stages { list-style: none; padding: 0; margin: 24px 0 0; border-top: 1px solid var(--line); }
ol.stages:empty { display: none; }
ol.stages > li { display: grid; grid-template-columns: 148px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.state { font-weight: 650; white-space: nowrap; }
.state.done::before { content: "✓ "; }
.state.failed::before { content: "✕ "; }
.state.working::before { content: "… "; }
.state.waiting::before { content: "○ "; }
.what { min-width: 0; overflow-wrap: anywhere; }
.what .detail { color: var(--muted); font-size: 15px; margin-top: 4px; }

.result { margin-top: 24px; padding: 18px; border: 2px solid var(--fg); border-radius: var(--radius); background: var(--raise); }
.result h2::before { content: "✓ "; }
.result.failed h2::before { content: "✕ "; }
.result ul { margin: 8px 0 0; padding-left: 20px; }
.result li { margin: 4px 0; overflow-wrap: anywhere; }

/* pro mode: the twelve gates */
ol.gates { list-style: none; padding: 0; margin: 24px 0 0; }
ol.gates > li { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 12px; background: var(--surface); }
ol.gates > li.now { border: 2px solid var(--fg); background: var(--raise); }
.gate-head { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: baseline; padding: 14px 16px; }
.gate-id { font-weight: 700; }
.gate-q { font-weight: 600; }
.gate-body { padding: 0 16px 16px 82px; }
.example { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.example::before { content: "For example: "; font-weight: 600; }
ul.shown { margin: 0; padding-left: 20px; color: var(--fg); font-size: 15px; }
ul.shown li { margin: 2px 0; overflow-wrap: anywhere; }

.error { border: 2px solid var(--fg); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; background: var(--raise); }
.error::before { content: "✕ Not done: "; font-weight: 700; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  h1 { font-size: 25px; }
  main { padding-top: 20px; }
  ol.stages > li { grid-template-columns: 1fr; gap: 2px; }
  .gate-head { grid-template-columns: 44px 1fr; }
  .gate-head .state { grid-column: 2; }
  .gate-body { padding: 0 16px 16px; }
}

/* open a deck (D179 (7)) */
input[type=url] { width: 100%; font: inherit; color: var(--fg); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
input[type=url]:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.field.narrow { max-width: 420px; margin-top: 12px; }
section.choices { margin-top: 32px; }
section.choices ul { list-style: none; padding: 0; margin: 8px 0 0; border-top: 1px solid var(--line); }
section.choices li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
section.choices .name { min-width: 0; overflow-wrap: anywhere; }
section.choices button { flex: none; padding: 8px 16px; }

/* diagnostics (D182 (6)) */
details.diag { margin: 40px 0 0; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
details.diag > summary { cursor: pointer; }
details.diag ol { margin: 8px 0 0; padding-left: 22px; }
details.diag li { margin: 3px 0; overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
