/* Elias brand, taken from the original elias.twin.store theme: warm paper,
   ink text, indigo actions, burnt-orange emphasis, Source Serif headings,
   Inter body, IBM Plex Mono kickers. The orange bracketed blank is the one
   visual motif: Elias leaves a blank rather than guessing. */
:root {
  --paper: #f6f3ec;
  --surface: #ffffff;
  --surface-alt: #efeae0;
  --ink: #14181d;
  --ink-soft: #4c545c;
  --ink-faint: #6b737b;
  --line: #dcd5c7;
  --line-strong: #c4baa8;
  --accent: #2c296f;
  --accent-dark: #201d55;
  --accent-ink: #ffffff;
  --accent-tint: #e8e7f2;
  --emphasis: #b95f1e;
  --emphasis-tint: #f7ead9;
  --blank: #8a4b12;
  --blank-tint: #f7ead9;
  --ok: #2f6b4f;
  --bad: #a3282d;
  --shadow: 0 1px 2px rgba(20, 24, 29, 0.06), 0 10px 28px rgba(20, 24, 29, 0.07);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 10px;
  --r-lg: 16px;
  color-scheme: light;
}
/* The original site was light only; this is the same palette at night. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15130f; --surface: #1f1c17; --surface-alt: #1a1814;
    --ink: #f1ede4; --ink-soft: #c9c2b4; --ink-faint: #a0998c;
    --line: #36312a; --line-strong: #4a4339;
    --accent: #aeaaf0; --accent-dark: #c4c1f5; --accent-ink: #15132e; --accent-tint: #2a2850;
    --emphasis: #e39a5c; --emphasis-tint: #3a2a1a;
    --blank: #f0b27a; --blank-tint: #3a2a1a; --ok: #7fc8a3; --bad: #f08a8e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #15130f; --surface: #1f1c17; --surface-alt: #1a1814;
    --ink: #f1ede4; --ink-soft: #c9c2b4; --ink-faint: #a0998c;
    --line: #36312a; --line-strong: #4a4339;
    --accent: #aeaaf0; --accent-dark: #c4c1f5; --accent-ink: #15132e; --accent-tint: #2a2850;
    --emphasis: #e39a5c; --emphasis-tint: #3a2a1a;
    --blank: #f0b27a; --blank-tint: #3a2a1a; --ok: #7fc8a3; --bad: #f08a8e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}
/* The switch in the header */
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: -6px 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; }
.theme-btn:hover { border-color: var(--ink); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
main { flex: 1; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap {
  width: 100%; max-width: 720px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.screen { display: grid; gap: 20px; padding-block: 24px 32px; }
.stack { display: grid; gap: 16px; }
.h1 { font-size: clamp(34px, 9vw, 48px); }
.h1 em { font-style: italic; font-weight: 400; color: var(--accent); }
.h2 { font-size: 28px; }
.lede { font-size: 18px; color: var(--ink-soft); }
.hint, .fine { font-size: 14px; color: var(--ink-faint); }
.error { color: var(--bad); font-size: 15px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 10px; min-height: 64px; padding-block: 8px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.mark { flex: 0 0 auto; display: block; width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--surface-alt); }
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-name { font: 600 22px/1.1 var(--serif); letter-spacing: -0.01em; }
.brand-tagline { font: 500 11px/1.3 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.brand-note { font: 600 12px/1.3 var(--sans); letter-spacing: 0.02em; color: var(--emphasis); white-space: nowrap; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--emphasis); }
.principle { padding-left: 16px; border-left: 3px solid var(--emphasis); font: 400 20px/1.3 var(--serif); color: var(--ink); max-width: 30ch; }
.top-inner { position: relative; }
.top-actions { position: absolute; top: 12px; right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; gap: 14px; }
.top-actions .link-btn { padding: 4px 0; font-size: 14px; }

/* controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font: 500 16px/1.2 var(--sans); cursor: pointer; border: 1px solid transparent;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.btn-wide { width: 100%; }
.link-btn { background: none; border: 0; padding: 6px 0; font: 500 15px var(--sans); color: var(--accent); cursor: pointer; }
.label { font-weight: 600; font-size: 15px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.input {
  width: 100%; font: 400 17px/1.5 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 12px 14px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.textarea { resize: vertical; min-height: 96px; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  font-size: 15px; cursor: pointer;
}
.chip input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.more { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.more summary { cursor: pointer; padding: 14px 16px; font-weight: 600; font-size: 15px; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "+"; float: right; color: var(--accent); font-weight: 400; font-size: 20px; line-height: 1; }
.more[open] summary::after { content: "−"; }
.optional { font-weight: 400; color: var(--ink-faint); margin-left: 6px; }
.more-body { padding: 0 16px 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }

/* working */
.working { display: grid; justify-items: center; gap: 12px; text-align: center; padding-block: 72px; }
.pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .35; } }
.working-step { font-family: var(--serif); font-size: 22px; }

/* result */
.tag { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.tag-live { color: var(--emphasis); }
.reply { padding: 0; overflow: hidden; }
.reply-head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.subject { padding: 14px 18px 0; font-size: 15px; color: var(--ink-soft); }
.subject b { color: var(--ink); font-weight: 600; }
.draft { padding: 14px 18px 18px; font-family: var(--serif); font-size: 18px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.draft-edit { margin: 14px 18px 18px; width: calc(100% - 36px); min-height: 220px; font-family: var(--serif); font-size: 17px; }
.blank {
  font-family: var(--mono); font-size: .82em; color: var(--blank);
  background: var(--blank-tint); border: 1px dashed var(--emphasis);
  border-radius: 6px; padding: 1px 6px;
}
.reply-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; background: var(--surface-alt); border-top: 1px solid var(--line); }
.reply-actions { display: flex; gap: 8px; margin-left: auto; }
.blank-count { font-size: 14px; color: var(--blank); font-weight: 500; }
.blank-count.done { color: var(--ok); }

#result-body { display: grid; gap: 28px; }
.summary { display: grid; gap: 14px; }
.summary h2 { font-size: 22px; }
.row { display: grid; gap: 4px; }
.row-label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.pill { display: inline-block; justify-self: start; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 3px 10px; }
.list { display: grid; gap: 6px; }
.list li { position: relative; padding-left: 18px; }
.list li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.list.warn li::before { background: var(--emphasis); }

.fold { border-top: 1px solid var(--line); }
.fold summary { cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 16px; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; float: right; color: var(--accent); font-weight: 400; font-size: 20px; line-height: 1; }
.fold[open] summary::after { content: "−"; }
.fold-body { display: grid; gap: 12px; padding-bottom: 16px; font-size: 15px; }
.ledger li { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding-block: 8px; border-bottom: 1px solid var(--line); }
.ledger li:last-child { border-bottom: 0; }
.src { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding-top: 3px; }
.src-stated { color: var(--ok); }
.src-supplied { color: var(--accent); }
.src-blank { color: var(--blank); }
.ev { color: var(--ink-faint); font-size: 14px; }
.scores { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-variant-numeric: tabular-nums; }
.gate-ok { color: var(--ok); }
.gate-bad { color: var(--bad); font-weight: 600; }

.question-card { display: grid; gap: 14px; }
.question-card p.q { font-family: var(--serif); font-size: 21px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* H.U.M.A.N. letter badges, as on the original framework cards */
.human-list { display: grid; gap: 12px; }
.human-list li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--accent-tint); color: var(--accent); font: 400 17px/1 var(--serif); }
.badge.off { background: transparent; color: var(--ink-faint); }

/* history */
.history-list { display: grid; gap: 10px; }
.history-item { width: 100%; text-align: left; display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.history-item .when { font-size: 13px; color: var(--ink-faint); }
.history-item .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* install hint */
.install {
  position: sticky; bottom: max(12px, env(safe-area-inset-bottom, 0px)); margin-block: 8px 16px;
  display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 15px;
}
.install-actions { display: flex; align-items: center; gap: 16px; }

.foot { padding-block: 20px 28px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-faint); }

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