:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #ebe6db;
  --ink: #18202c;
  --muted: #5a6370;
  --line: #d8d1c3;
  --accent: #1f3354;
  --accent-ink: #fffdf8;
  --gold: #b9692b;
  --gold-soft: #f7e3cf;
  --warn-soft: #f6e2dc;
  --warn: #8f3b2a;
  --t1: #1f3354; --t2: #3d5f8f; --t3: #2f6f6a; --t4: #b9692b; --t5: #8f3b2a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1420; --surface: #151d2b; --surface-2: #1d2738; --ink: #e9e4da; --muted: #a3abb8;
    --line: #2c3749; --accent: #9db8e0; --accent-ink: #0e1420; --gold: #f0a35e; --gold-soft: #2e2416;
    --warn-soft: #34201b; --warn: #e59a86;
    --t1: #9db8e0; --t2: #b9cbe6; --t3: #8cc7bf; --t4: #f0a35e; --t5: #e59a86;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1420; --surface: #151d2b; --surface-2: #1d2738; --ink: #e9e4da; --muted: #a3abb8;
    --line: #2c3749; --accent: #9db8e0; --accent-ink: #0e1420; --gold: #f0a35e; --gold-soft: #2e2416;
    --warn-soft: #34201b; --warn: #e59a86;
    --t1: #9db8e0; --t2: #b9cbe6; --t3: #8cc7bf; --t4: #f0a35e; --t5: #e59a86;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.6 var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 680px; margin: 0 auto; padding: 16px 16px 96px; outline: none; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.35rem; margin: 1.8em 0 0.5em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 0.4em; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
.reading p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.7; }
.lead { font-family: var(--serif); font-size: 1.22rem; line-height: 1.6; color: var(--ink); }
.muted { color: var(--muted); }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.small { font-size: 0.9rem; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; min-height: 44px; }
.back { text-decoration: none; font-weight: 600; padding: 10px 0; display: inline-block; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; }
.card.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card.accent .eyebrow { color: var(--accent-ink); opacity: 0.85; }
.card.accent a, .card.accent .muted { color: var(--accent-ink); opacity: 0.9; }
.card.gold { background: var(--gold-soft); border-color: transparent; }
.card.warn { background: var(--warn-soft); border-color: transparent; }
.card h3:first-child, .card h2:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: 600 1rem var(--sans); cursor: pointer; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); }
.card.accent .btn { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: 0.92rem; }
.btn.danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }

/* Progress dots — not a streak */
.dots { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: transparent; }
.dot.done { background: var(--accent); border-color: var(--accent); }
.dot.today { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }

.daylist { list-style: none; margin: 0; padding: 0; }
.daylist a { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 56px; }
.daylist .num { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: 0.9rem; }
.daylist .done .num { background: var(--accent); color: var(--accent-ink); }
.daylist .today .num { outline: 2px solid var(--gold); }
.daylist .t { flex: 1; }
.daylist .t small { display: block; color: var(--muted); }
.phase-h { margin-top: 1.6em; }
.phase-h small { display: block; font-family: var(--sans); font-weight: 400; color: var(--muted); font-size: 0.9rem; }

/* Scripture */
.scripture { border-left: 4px solid var(--gold); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 16px; margin: 14px 0; }
.scripture .ref { font: 700 0.85rem var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.scripture p { font-family: var(--serif); font-size: 1.08rem; line-height: 1.65; margin: 0; }
.scripture sup { color: var(--muted); font: 600 0.7rem var(--sans); margin-right: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: 600 0.85rem var(--sans); cursor: pointer; min-height: 36px; }
.chip[aria-expanded="true"] { background: var(--gold-soft); border-color: var(--gold); }

.g { all: unset; cursor: help; border-bottom: 1.5px dotted var(--gold); }
.g:focus-visible { outline: 2px solid var(--gold); }

/* Video (click-to-load, nothing loads from YouTube until play) */
.video { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 14px 0; }
.video .vplay, .video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.video .vplay { background: #1d2620 center / cover no-repeat; cursor: pointer; position: relative; padding: 0; }
.video .pbtn { position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font-size: 1.6rem; display: grid; place-items: center; padding-left: 6px; }
.video .vplay:hover .pbtn { background: var(--accent); }
.video .vmeta { padding: 14px 16px 16px; }
.video .vmeta strong { display: block; font-family: var(--serif); font-size: 1.05rem; line-height: 1.3; }
.video .vmeta p { margin: 8px 0 6px; }

/* Depth sections */
details.depth { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; }
details.depth > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 56px; }
details.depth > summary::-webkit-details-marker { display: none; }
details.depth > summary::after { content: "+"; font: 400 1.6rem var(--sans); color: var(--muted); }
details.depth[open] > summary::after { content: "–"; }
details.depth > summary strong { font-family: var(--serif); font-size: 1.15rem; display: block; }
details.depth > summary span { color: var(--muted); font-size: 0.9rem; }
details.depth > .inner { padding: 0 18px 18px; }

.case { border-radius: var(--radius); background: var(--surface-2); padding: 16px 18px; margin: 18px 0; }
.case .badge { font: 700 0.72rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.case p { font-family: var(--serif); margin: 6px 0 0; }

.tier { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tier:last-child { border-bottom: 0; }
.tier .lab { font: 700 0.72rem var(--sans); letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1.5px solid currentColor; align-self: start; white-space: nowrap; }
.tier .src { font-size: 0.85rem; color: var(--muted); }
.t1 { color: var(--t1); } .t2 { color: var(--t2); } .t3 { color: var(--t3); } .t4 { color: var(--t4); } .t5 { color: var(--t5); }
.tier .claim { color: var(--ink); }

.carry { background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000)); color: var(--accent-ink); border-radius: 18px; padding: 22px; margin: 22px 0; }
.carry .eyebrow { color: var(--accent-ink); opacity: 0.8; }
.carry blockquote { margin: 10px 0; font: 1.2rem/1.5 var(--serif); }
.carry .line { font-weight: 700; font-size: 1.05rem; }
.carry .btn { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }

ol.qs { padding-left: 1.3em; }
ol.qs li { margin-bottom: 0.6em; font-family: var(--serif); font-size: 1.08rem; }

label { display: block; font-weight: 600; margin: 16px 0 6px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }
textarea, input[type="text"], input[type="date"], select {
  width: 100%; font: 1rem/1.5 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 48px;
}
textarea { min-height: 96px; resize: vertical; }
textarea.big { min-height: 200px; }
.saved { font-size: 0.8rem; color: var(--muted); height: 1.2em; }

.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; cursor: pointer; background: var(--surface); font-weight: 400; }
.choice input { margin-top: 5px; width: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--accent); }
.choice .grp { font: 700 0.72rem var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); display: block; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 10px 0; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.photos button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1rem; cursor: pointer; }

.log-entry { border-top: 1px solid var(--line); padding: 14px 0; }
.log-entry .meta { font-size: 0.85rem; color: var(--muted); }
.log-entry dl { margin: 8px 0; }
.log-entry dt { font-weight: 600; font-size: 0.9rem; margin-top: 6px; }
.log-entry dd { margin: 0; font-family: var(--serif); }

.outcome { display: inline-block; font: 700 0.75rem var(--sans); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(150%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; transition: transform .25s ease; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
#toast.show { transform: translateX(-50%) translateY(0); }

dialog { border: 0; border-radius: 18px; padding: 22px; max-width: min(440px, calc(100% - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h3 { margin-top: 0; }

.foot { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.foot a { color: var(--muted); }
.navrow { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.check { color: var(--accent); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  body { background: #fff; color: #000; }
  .btn, .btnrow, .topbar, .foot, #toast { display: none !important; }
  details.depth { border: 0; }
}

/* Series rhythm (Profound Mystery onward) */
.daylist .planned .row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-height: 56px; opacity: .55; }
.scripts { display: grid; gap: 10px; margin: 12px 0; }
.script { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.script strong { font-family: var(--serif); font-size: 1.05rem; }
.script span { font-size: .95rem; }
.script em { font-style: normal; font-weight: 600; color: var(--muted); }
.love .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.love .size { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.love .size p { margin: 0; }
.love .lab { font: 700 0.72rem var(--sans); letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1.5px solid currentColor; }
.card.feast { background: var(--gold-soft); border-color: transparent; }
.card.feast p { font-family: var(--serif); font-size: 1.08rem; margin: .4em 0 0; }

/* Judgement exercise */
.judge { display: grid; gap: 8px; margin: 12px 0; }
.jitem { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.jitem summary { list-style: none; cursor: pointer; display: flex; gap: 12px; padding: 14px; align-items: flex-start; min-height: 48px; }
.jitem summary::-webkit-details-marker { display: none; }
.jitem .jn { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.jitem[open] .jn { background: var(--accent); color: var(--accent-ink); }
.jans { padding: 0 14px 14px 54px; }
.jans strong { color: var(--accent); }
.jans p { margin: 4px 0 0; font-size: .95rem; }

.corepath { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: .92rem; }
.card.modelcheck { border-left: 4px solid var(--gold); }
.card.modelcheck textarea { margin-top: 8px; min-height: 72px; }

/* Repairers additions */
.ptitle { font-style: italic; font-size: .85em; color: var(--muted); margin: 0 0 .3em; }
.scripture i { font-style: italic; opacity: .92; }
q.sq { font-family: var(--serif); font-style: italic; quotes: "“" "”"; }
.sref { font-size: .78em; color: var(--muted); white-space: nowrap; }
.wordhelps { font-size: .9em; color: var(--muted); margin: -.2em 0 1em; }
.wordhelps .g { font-size: 1em; }

.card.identity { border-left: 4px solid var(--gold); background: var(--surface); }
.card.identity .eyebrow { color: var(--gold); }
a.tel { font-weight: 700; white-space: nowrap; }
.tsteps { display: flex; align-items: center; gap: 6px; margin: .2em 0 1.2em; }
.tdot { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.tdot.on { background: var(--accent); }
.tsteps .small { margin-left: 6px; }
.today-nav { margin-top: 1.4em; }
.today-more { margin-top: 1.2em; }
.chips.pace { align-items: center; margin: -.3em 0 1em; }
.audio { margin: .2em 0 1em; }
.audio audio { width: 100%; }
.audio p { margin: .2em 0; }
figure.diagram { margin: 1.2em 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
figure.diagram figcaption { margin-bottom: .6em; }
.svgwrap svg { width: 100%; height: auto; display: block; }
.svgwrap svg text { font-family: var(--sans); fill: var(--ink); }
.guide-step h3 { margin-top: 0; }
blockquote.say { border-left: 3px solid var(--gold); margin: .6em 0; padding: .2em .8em; font-style: italic; }
@media print { .topbar, .foot, .btn { display: none !important; } details.depth { break-inside: avoid; } details.depth > .inner { display: block !important; } }

/* At a glance */
.card.glance h3 { margin: 14px 0 6px; font-size: 1rem; }
.card.glance ul, .card.glance ol { margin: 0 0 6px; padding-left: 1.2em; }
.glance-path li { margin: 2px 0; }
#toast:not(.show) { visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
