:root {
  --paper: #f4eee2;
  --paper-2: #ebe2d1;
  --card: #fbf8f1;
  --ink: #1f2733;
  --ink-soft: #4b5563;
  --muted: #7a7466;
  --line: #d9cfbc;
  --amber: #d48f2a;
  --amber-soft: #f6e3c2;
  --amber-ink: #2a1a04;
  --good: #3f7d5c;
  --good-soft: #dcebe0;
  --miss: #a4553f;
  --miss-soft: #f3e1d9;
  --shadow: 0 1px 2px rgba(31, 39, 51, .06), 0 6px 20px rgba(31, 39, 51, .07);
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141a22; --paper-2: #1b232d; --card: #1d2631; --ink: #ece5d6; --ink-soft: #c4bcad;
    --muted: #958d7e; --line: #2f3a47; --amber: #e7a947; --amber-soft: #3a2d17; --amber-ink: #1b1304;
    --good: #7cc29b; --good-soft: #1f3329; --miss: #e48f75; --miss-soft: #3a241e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --paper: #141a22; --paper-2: #1b232d; --card: #1d2631; --ink: #ece5d6; --ink-soft: #c4bcad;
  --muted: #958d7e; --line: #2f3a47; --amber: #e7a947; --amber-soft: #3a2d17; --amber-ink: #1b1304;
  --good: #7cc29b; --good-soft: #1f3329; --miss: #e48f75; --miss-soft: #3a241e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 18px/1.6 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(30px, 6vw, 42px); }
h2 { font-size: clamp(23px, 4.5vw, 30px); }
h3 { font-size: 20px; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.brand { font: 700 22px var(--font-display); text-decoration: none; letter-spacing: .01em; }
.brand span { color: var(--amber); }
.version { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.version select {
  font: 600 14px var(--font-body); color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px;
}

.shell { max-width: 680px; margin: 0 auto; padding: 20px 16px 64px; }
.stack > * + * { margin-top: 18px; }
.muted { color: var(--muted); }
.kicker { font: 700 13px var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }

.art { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 10px; background: var(--paper-2); }
.art.small { max-width: 420px; margin-inline: auto; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 24px; font-weight: 700; text-decoration: none;
  background: var(--ink); color: var(--paper);
}
.btn.amber { background: var(--amber); color: var(--amber-ink); }
.btn.ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* home */
.hero p { margin-top: 8px; color: var(--ink-soft); }
.story-list { display: grid; gap: 16px; }
.story-card {
  display: block; text-decoration: none; background: var(--card); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.story-card .art { border-radius: 0; }
.story-card .body { padding: 14px 18px 18px; }
.story-card .meta { font-size: 14px; color: var(--muted); margin-top: 4px; }
.story-card.soon { display: flex; align-items: center; gap: 14px; padding: 14px 18px; opacity: .75; box-shadow: none; }
.story-card.soon .body { padding: 0; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--paper-2); color: var(--muted); white-space: nowrap; }
.pill.go { background: var(--amber-soft); color: var(--amber); }
.badge-icon { width: 44px; height: 44px; flex: none; color: var(--muted); }

/* story intro */
.read-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.phases { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.phase { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.phase svg { width: 34px; height: 34px; color: var(--amber); }
.phase b { display: block; font-family: var(--font-display); font-size: 19px; }
.phase span { font-size: 14px; color: var(--muted); }

/* progress */
.progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.progress .seg { display: grid; gap: 4px; }
.progress .label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.progress .label svg { width: 15px; height: 15px; }
.progress .seg.on .label { color: var(--amber); }
.progress .bar { height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.progress .fill { height: 100%; background: var(--amber); transition: width .3s; }

/* step */
.question { font-family: var(--font-display); font-weight: 500; font-size: clamp(21px, 4.2vw, 25px); line-height: 1.3; }
.ref { font-size: 15px; font-weight: 600; color: var(--amber); text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.ref svg { width: 18px; height: 18px; flex: none; }
.ref:hover { text-decoration: underline; }
.hint { font-size: 15px; color: var(--muted); }
.options { display: grid; gap: 10px; }
.opt {
  width: 100%; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 13px 16px; display: flex; gap: 12px; align-items: flex-start; transition: border-color .15s, background .15s;
}
.opt:hover:not(:disabled) { border-color: var(--amber); }
.opt .mark {
  flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.opt.square .mark { border-radius: 6px; }
.opt.picked { border-color: var(--amber); background: var(--amber-soft); }
.opt.picked .mark { border-color: var(--amber); background: var(--amber); color: var(--amber-ink); }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.right .mark { border-color: var(--good); background: var(--good); color: var(--card); }
.opt.miss { border-color: var(--line); background: var(--miss-soft); color: var(--ink-soft); }
.opt.miss .mark { border-color: var(--miss); color: var(--miss); }
.opt.locked:disabled { cursor: default; }
.opt.locked:not(.right):not(.miss) { opacity: .5; }
.reply {
  margin: -2px 6px 2px 18px; padding: 10px 14px; border-left: 3px solid var(--line);
  font-size: 16px; color: var(--ink-soft); animation: rise .25s ease-out;
}
.reply.good { border-color: var(--good); color: var(--ink); }
.reply.miss { border-color: var(--miss); }
.reply.amber { border-color: var(--amber); color: var(--ink); }

.ponder {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 18px 20px;
  box-shadow: var(--shadow); position: relative; animation: rise .3s ease-out;
}
.ponder::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; background: var(--amber); }
.ponder .kicker { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.ponder .kicker svg { width: 18px; height: 18px; }
.ponder p + p { margin-top: 10px; }

.card-body p + p { margin-top: 12px; }
.prayer { font-family: var(--font-display); font-size: 21px; line-height: 1.55; font-weight: 500; }
.prayer p + p { margin-top: 14px; }

textarea {
  width: 100%; min-height: 110px; resize: vertical; font: 400 17px/1.5 var(--font-body); color: var(--ink);
  background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
textarea:focus { border-color: var(--amber); outline: none; }
.journal label { display: block; font-weight: 600; margin-bottom: 8px; }
.saved { font-size: 13px; color: var(--muted); height: 18px; }

.nav { display: flex; justify-content: space-between; gap: 10px; padding-top: 8px; }

/* section intro */
.section-intro { text-align: center; padding-top: 12px; }
.section-intro svg { width: 64px; height: 64px; color: var(--amber); }
.section-intro h2 { margin-top: 6px; }
.section-intro .q { font-family: var(--font-display); font-size: 22px; color: var(--ink-soft); margin-top: 4px; }
.section-intro p.lead { margin-top: 14px; color: var(--ink-soft); max-width: 46ch; margin-inline: auto; }

/* finish */
.notes { display: grid; gap: 12px; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.note .p { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.note p.a { white-space: pre-wrap; }
.note ul { margin: 0; padding-left: 20px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 480px) {
  body { font-size: 17px; }
  .phases { grid-template-columns: 1fr; }
  .phase { display: flex; gap: 12px; align-items: center; text-align: left; }
  .progress .label span { display: none; }
}
