:root {
  --bg: #FFFDF6; --surface: #FFFFFF; --ink: #2C3E50; --muted: #5A6B7A; --line: rgba(128,0,32,.16); --tint: #FBF1D6;
  --accent-ink: #800020; --flame: #D4AC0D; --done: #2B6A50; --done-bg: #DFF0E7;
  --hero-bg: #800020; --hero-fg: #FFFDF6; --hero-muted: #F0D9A0; --btn-bg: #800020; --btn-fg: #FFFFFF;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --read: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1A1215; --surface: #261B20; --ink: #F0EAE1; --muted: #C9BFB3; --line: rgba(243,156,18,.2); --tint: #2F2228;
    --accent-ink: #F5B041; --done: #6FCB9F; --done-bg: #17382D; --hero-bg: #261B20; --hero-fg: #FFFDF6; --hero-muted: #D9C7A0;
    --btn-bg: #F39C12; --btn-fg: #1A1215; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: max(32px, env(safe-area-inset-bottom, 0px)); }
.wrap { max-width: 640px; margin: 0 auto; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--flame); outline-offset: 2px; }

.top { background: var(--hero-bg); color: var(--hero-fg); margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding: max(20px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px)); }
.top .wrap { display: grid; gap: 4px; }
.eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--hero-muted); font-weight: 600; }
.top h1 { font-size: 26px; }
.sub { color: var(--hero-muted); font-size: 14px; }

.bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-block: 14px; }
.bar button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 8px; font-weight: 600; }
.bar button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; display: grid; gap: 18px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.meta b { color: var(--ink); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--tint); color: var(--ink); }
.pill.today { background: var(--flame); color: #1B1500; }
.pill.done { background: var(--done-bg); color: var(--done); }
.card h2 { font-size: 24px; }
.label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--accent-ink); margin-bottom: 6px; }
.hook { background: var(--tint); border-radius: 10px; padding: 14px; font-family: var(--serif); font-size: 20px; line-height: 1.35; display: grid; gap: 12px; }
.hook p + p { padding-top: 12px; border-top: 1px solid var(--line); }
ul.items, ol.items { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.reading { background: var(--tint); border-radius: 10px; padding: 14px; font-family: var(--serif); font-size: var(--read); line-height: 1.6; display: grid; gap: 12px; }
.reading p { overflow-wrap: anywhere; white-space: pre-line; }
.reading h3 { font-family: var(--sans); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.reading .missing { font-family: var(--sans); font-size: 15px; color: var(--muted); }
.sizes { display: flex; gap: 8px; margin-bottom: 8px; }
.sizes button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 12px; font-weight: 600; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 13px 14px; font-weight: 600; text-align: center; width: 100%; }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn.primary.is-done { background: var(--done-bg); color: var(--done); border-color: var(--done); }
.actions { display: grid; gap: 10px; }
.nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.nav .btn[disabled] { opacity: .4; }
.note { font-size: 13px; color: var(--muted); }

.list { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; width: 100%; }
.row.is-today { border-color: var(--flame); box-shadow: 0 0 0 1px var(--flame); }
.dt { font-weight: 700; font-size: 13px; min-width: 64px; }
.rt { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.rt small { display: block; color: var(--muted); font-size: 12px; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: transparent; font-weight: 700; }
.tick.on { background: var(--done); border-color: var(--done); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .card { animation: fade .2s ease-out; } @keyframes fade { from { opacity: .4; } to { opacity: 1; } } }

details.dam { background: var(--tint); border-radius: 10px; }
details.dam summary { cursor: pointer; padding: 14px; font-family: var(--serif); font-size: 18px; font-weight: 700; list-style: none; }
details.dam summary::-webkit-details-marker { display: none; }
details.dam summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details.dam summary::after { content: "Tap to open"; flex: none; font-family: var(--sans); font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: var(--btn-bg); color: var(--btn-fg); }
details.dam[open] summary::after { content: "Tap to close"; }
.tapnote { font-size: 14px; font-weight: 600; color: var(--accent-ink); margin-bottom: 6px; }
.reading p.verse { font-style: italic; }
.reading .gap { text-align: center; color: var(--muted); letter-spacing: .3em; }
.vcard { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.vcard:last-child { border-bottom: 0; padding-bottom: 0; }
.trl-label { font-family: var(--sans); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--accent-ink); }
.pill.main { background: var(--btn-bg); color: var(--btn-fg); }
.dam-body { padding: 0 14px 16px; display: grid; gap: 18px; }
.dam-body .reading { background: var(--surface); }

.input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; background: var(--surface); color: var(--ink); }
.btn.opt { text-align: left; }
.btn.opt.sel { border-color: var(--flame); box-shadow: 0 0 0 2px var(--flame); background: var(--tint); }
.btn[disabled] { opacity: .45; }
.bignum { font-family: var(--serif); font-size: 44px; font-weight: 700; color: var(--accent-ink); line-height: 1.1; }
a.btn { text-decoration: none; color: inherit; }
a.btn.primary { color: var(--btn-fg); }

/* group features */
.bar button[hidden] { display: none; }
.bar #b-admin { grid-column: 1 / -1; }
.joinbar { background: var(--tint); border-radius: 12px; padding: 14px; display: grid; gap: 10px; margin-bottom: 12px; }
textarea.input { resize: vertical; line-height: 1.45; }
.fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 20; border: 0; border-radius: 99px; padding: 14px 20px; font-weight: 700; background: var(--btn-bg); color: var(--btn-fg); box-shadow: 0 4px 14px rgba(0,0,0,.28); }
.fab[hidden] { display: none; }
.fab.has::after { content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 8px; border-radius: 50%; background: var(--flame); vertical-align: middle; }
body { padding-bottom: max(88px, env(safe-area-inset-bottom, 0px)); }
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); color: var(--ink); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px max(22px, env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.answer { background: var(--tint); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.answer:empty { display: none; }
.qbox { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; margin-top: 8px; }
.prow { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.note.pre { white-space: pre-line; }

/* join banner, notes button, leader tools */
.bar #b-admin:not([hidden]) { grid-column: 1 / -1; }
.banner { background: var(--tint); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; display: grid; gap: 10px; }
.banner-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.who { margin-bottom: 8px; }
.field { display: grid; gap: 6px; }
textarea.input { resize: vertical; line-height: 1.5; min-height: 80px; }
.btn.small { width: auto; padding: 8px 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; }
.fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 20; border: 0; border-radius: 99px; padding: 13px 18px; font-weight: 700; background: var(--btn-bg); color: var(--btn-fg); box-shadow: 0 4px 14px rgba(0,0,0,.28); }
.fab[hidden] { display: none; }
.fab.has::after { content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 8px; border-radius: 50%; background: var(--flame); }
body { padding-bottom: max(88px, env(safe-area-inset-bottom, 0px)); }
.sheet-open { overflow: hidden; }
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); color: var(--ink); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px 16px max(20px, env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-x { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 40px; height: 40px; font-size: 24px; line-height: 1; }
.answer { background: var(--tint); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.qa { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; margin-top: 8px; }
.qa.answered { border-color: var(--done); }
.qa-who { font-weight: 700; font-size: 14px; }
.qa-q { font-family: var(--serif); font-size: 18px; }
.person { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.note.pre { white-space: pre-line; }

/* Keep the notes button clear of any host overlay (e.g. the Netlify badge) at the bottom-right */
.fab { bottom: max(76px, calc(env(safe-area-inset-bottom, 0px) + 68px)); }
