/* Reading fonts, self-hosted (SIL OFL, latin subset from @fontsource 5.3.0) so they work offline. */
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap; src: url(vendor/fonts/literata-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap; src: url(vendor/fonts/literata-latin-400-italic.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap; src: url(vendor/fonts/literata-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: italic; font-weight: 400; font-display: swap; src: url(vendor/fonts/atkinson-hyperlegible-latin-400-italic.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* Themes. "Auto" (no data-theme) follows the system: Parchment by day, Night by dark. */
:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Reader text; overridden from Settings › Reading text. */
  --read-font: var(--serif);
  --read-size: 20px;
  --read-leading: 1.7;
  --read-align: left;
  --read-hyphens: manual;
}
:root, :root[data-theme="parchment"] {
  --bg: #f7f3ec; --surface: #fffdf9; --ink: #2a2622; --muted: #7a7166; --line: #e6dfd3;
  --accent: #8a5a2b; --accent-soft: #f1e6d8; --done: #4f7a52; --late: #b4552d; --highlight: #fbecc4;
  color-scheme: light;
}
:root[data-theme="sage"] {
  --bg: #eff3ec; --surface: #fafcf8; --ink: #232d26; --muted: #66756a; --line: #dbe3d7;
  --accent: #4a7356; --accent-soft: #e0eadf; --done: #3d7a55; --late: #b0583a; --highlight: #f2ebc0;
  color-scheme: light;
}
:root[data-theme="ocean"] {
  --bg: #edf2f7; --surface: #fafcfe; --ink: #1e2a35; --muted: #61748a; --line: #d6e0ea;
  --accent: #2f6690; --accent-soft: #dbe7f2; --done: #3d7a55; --late: #b5502f; --highlight: #fbefc2;
  color-scheme: light;
}
:root[data-theme="night"] {
  --bg: #1b1916; --surface: #24211d; --ink: #ece6dc; --muted: #a09685; --line: #38332c;
  --accent: #d9a46c; --accent-soft: #3a2e22; --done: #8fbf8f; --late: #e08a62; --highlight: #4a3c1f;
  color-scheme: dark;
}
:root[data-theme="midnight"] {
  --bg: #0f1620; --surface: #17202c; --ink: #e3e9f0; --muted: #8b9aad; --line: #263243;
  --accent: #7fb3e0; --accent-soft: #1c2d40; --done: #86c49a; --late: #e89272; --highlight: #2c3a4f;
  color-scheme: dark;
}
:root[data-theme="black"] {
  --bg: #000000; --surface: #111111; --ink: #e8e6e3; --muted: #8a8782; --line: #262626;
  --accent: #d9a46c; --accent-soft: #2a2016; --done: #8fbf8f; --late: #e08a62; --highlight: #3d3418;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1b1916; --surface: #24211d; --ink: #ece6dc; --muted: #a09685; --line: #38332c;
    --accent: #d9a46c; --accent-soft: #3a2e22; --done: #8fbf8f; --late: #e08a62; --highlight: #4a3c1f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
.scripture .copyright { font-family: var(--sans); font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 32px; }
.scripture .copyright a, .fine a { color: var(--accent); }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; accent-color: var(--accent); touch-action: manipulation; } /* no double-tap zoom; pinch zoom still works */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
main, .top { max-width: 640px; margin: 0 auto; padding: 0 16px; }
h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
button { font: inherit; color: inherit; }

.top { display: flex; align-items: flex-end; justify-content: space-between; padding-top: 20px; padding-bottom: 12px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }

.icon-btn { background: none; border: 0; padding: 8px; border-radius: 10px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; font-size: 14px; }

.btn { border-radius: 999px; padding: 10px 18px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 15px; }
.btn.primary { background: var(--accent); color: var(--surface); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.done { background: transparent; border-color: var(--done); color: var(--done); }

.progress { margin: 4px 0 20px; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); width: 0; transition: width .4s; }
.progress p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 28px; }
.today .ref { font-family: var(--serif); font-size: 34px; line-height: 1.15; margin: 6px 0 18px; }
.today .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.meeting { position: relative; }
.meeting-close { position: absolute; top: 10px; right: 10px; }
.today .note { color: var(--muted); margin: 0 0 16px; font-size: 15px; }

section > h2, .section-head { margin-bottom: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
#behind { margin-bottom: 28px; }
#week { margin-bottom: 28px; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.account-btn { position: relative; }
.account-btn.signed-in { color: var(--accent); }
.account-dot { display: none; position: absolute; right: 6px; bottom: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--done); border: 2px solid var(--bg); }
.account-btn.signed-in .account-dot { display: block; }
/* Signed out: a labeled pill so it's clear you're not syncing. */
.account-label { display: none; }
.account-btn:not(.signed-in) { flex-direction: row; display: flex; align-items: center; gap: 4px; padding: 5px 12px 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); }
.account-btn:not(.signed-in) svg { width: 18px; height: 18px; }
.account-btn:not(.signed-in) .account-label { display: inline; font-size: 14px; font-weight: 600; }
.set-link { width: 100%; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.set-link svg { color: var(--muted); flex: none; }
a.set-link { text-decoration: none; }
.account-body { flex: 1; overflow-y: auto; padding: 20px 16px 40px; max-width: 560px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.account-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.account-hero h3 { margin: 4px 0 0; font: 600 22px/1.2 var(--serif); }
.account-hero p { margin: 0; color: var(--muted); font-size: 15px; max-width: 420px; }
.account-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.account-body input[type=email], .account-body input[type=url] { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-width: 0; flex: 1; }
.account-body small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.review-btn { width: 100%; margin-top: 10px; }
.review-btn:disabled { opacity: .55; cursor: default; }
#marks-entry { margin-bottom: 20px; }
/* Summary and verses to discuss side by side; either one alone fills the row. */
.btn-row { display: flex; flex-wrap: wrap; column-gap: 10px; }
.btn-row > * { flex: 1 1 auto; }
.btn-row > .review-btn { width: auto; }
.btn-row > section:not(:has(.review-btn:not([hidden]))) { display: none; }
.verse.marked { background: linear-gradient(transparent 55%, var(--highlight) 55%); }
.verse.marked.speaking { background: var(--highlight); }
.mark-bar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--accent-soft); font-size: 14px; }
.mark-bar span { flex: 1; color: var(--ink); }
.mark-bar .link-btn { font-weight: 600; }
.note-dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: calc(100% - 32px); max-width: 480px; background: var(--surface); color: var(--ink); }
.note-dialog form { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.note-dialog h2 { margin: 0; font: 600 20px/1.2 var(--serif); }
.note-dialog .eyebrow { margin: -6px 0 0; }
.note-dialog small { color: var(--muted); font-size: 13px; }
.note-dialog textarea { font: 16px/1.5 var(--sans); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; min-height: 110px; }
.note-actions { justify-content: flex-end; }
#feedback-hint.error { color: var(--late); }
.text-input { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-width: 0; width: 100%; box-sizing: border-box; }
.reader-hint { margin: 0; padding: 8px 16px; text-align: center; font-size: 13px; color: var(--muted); background: var(--accent-soft); }
.plan-body { flex: 1; overflow-y: auto; padding: 8px 16px 40px; max-width: 680px; width: 100%; margin: 0 auto; }
.plan-tools { justify-content: space-between; margin-bottom: 14px; }
.review-body { flex: 1; overflow-y: auto; padding: 16px 16px 40px; max-width: 680px; width: 100%; margin: 0 auto; }
.review-group { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 16px; overflow: hidden; }
.review-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; padding: 12px 16px; background: var(--accent-soft); border: 0; cursor: pointer; font: 600 17px/1.3 var(--serif); text-align: left; }
.review-head span { font: 400 13px var(--sans); color: var(--muted); }
.review-verse { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 6px 8px 14px 16px; border-top: 1px solid var(--line); }
/* Reference and unmark share the top line so the verse text gets the card's full width. */
.review-verse > div { grid-area: 2 / 1 / 3 / 3; padding-right: 8px; }
.review-verse > .icon-btn { grid-area: 1 / 2; }
.review-ref { font: 600 13px/1.5 var(--sans); color: var(--accent); white-space: nowrap; display: flex; align-items: baseline; gap: 6px; }
.review-ref small { font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .03em; }
.review-verse p { margin: 0; font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-leading); text-align: var(--read-align); hyphens: var(--read-hyphens); -webkit-hyphens: var(--read-hyphens); }
.review-verse p.muted { font: 14px var(--sans); color: var(--muted); }
.review-verse .icon-btn { padding: 8px; }
.review-verse p sup { font: 600 .55em var(--sans); color: var(--accent); margin-right: 3px; }
.review-note { display: block; width: 100%; margin-top: 8px; padding: 8px 12px; border: 0; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--accent-soft); color: var(--ink); font: 15px/1.5 var(--sans); text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.review-actions { display: flex; gap: 18px; margin-top: 4px; }
.review-add-note, .review-ask { font-weight: 600; text-decoration: none; }
.review-note + .review-ask { display: inline-block; margin-top: 6px; }
.mark-bar a.link-btn { text-decoration: none; }
.review-body .copyright { font: 12px/1.5 var(--sans); color: var(--muted); margin: 8px 4px; }
.review-body .copyright a { color: var(--accent); }
.week-nav { display: flex; align-items: center; gap: 2px; }
.week-nav .icon-btn { padding: 4px; }
.week-meta { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.week-meta strong { color: var(--ink); font-weight: 600; }
.week-meta > span { white-space: nowrap; }
.week-bar { margin-bottom: 10px; }
.week-bar .fill { background: var(--done); }
#behind h2, .eyebrow.late { color: var(--late); }
.eyebrow.done { color: var(--done); }
#reader-sub { white-space: pre-line; }
.empty { color: var(--muted); font-size: 15px; margin: 0; }

.toast { position: fixed; left: 16px; right: 16px; width: fit-content; margin: 0 auto; bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 16px; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.toast .link-btn { color: var(--accent-soft); font-weight: 600; font-size: 15px; }

.month { margin-bottom: 18px; }
.month h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item.is-today { background: var(--accent-soft); }
.item .date { width: 92px; flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.item .open { flex: 1; text-align: left; background: none; border: 0; padding: 4px 0; cursor: pointer; font-family: var(--serif); font-size: 17px; }
.item.read .open { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.item.late .date { color: var(--late); }

.tick { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: none; cursor: pointer; display: grid; place-items: center; padding: 0; }
.tick svg { opacity: 0; }
.read .tick { background: var(--done); border-color: var(--done); color: var(--surface); }
.read .tick svg { opacity: 1; }

/* Sheets */
dialog.sheet { border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; background: var(--bg); color: var(--ink); }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet:focus { outline: none; }
dialog::backdrop { background: rgba(0,0,0,.3); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 8px 10px; border-bottom: 1px solid var(--line); max-width: 720px; width: 100%; margin: 0 auto; }
.sheet-title { flex: 1; text-align: center; }
#review-sub { white-space: pre-line; }
.spacer { width: 38px; }
/* The summary's Listen button balances the close button, so the title stays centered. */
.sheet-head:has(> .listen-toggle:not([hidden])) > .spacer { display: none; }

.scripture { flex: 1; overflow-y: auto; padding: 20px 16px 40px; max-width: 680px; width: 100%; margin: 0 auto; font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-leading); }
.scripture h3 { font-family: var(--read-font); font-size: .75em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 8px; font-weight: 600; }
.scripture h3:first-child { margin-top: 0; }
.scripture p:not(.copyright):not(.status):not(.line), .sample p { text-align: var(--read-align); hyphens: var(--read-hyphens); -webkit-hyphens: var(--read-hyphens); }
.scripture h4.section { font-family: var(--read-font); font-size: .9em; font-weight: 600; margin: 1.4em 0 .4em; }
.scripture h3 + h4.section { margin-top: 0; }
.scripture .psalm-title { font-style: italic; font-size: .9em; color: var(--muted); margin: 0 0 .6em; }
.scripture .para { margin: 0 0 .8em; }
/* Poetry: levels start at .5em, 1.5em, 2.5em; wrapped text indents past them all,
   so a wrapped line never looks like the next level. */
.scripture .line { margin: 0; padding-left: 3em; text-indent: -2.5em; }
.scripture .line.q2 { text-indent: -1.5em; }
.scripture .line.q3 { padding-left: 3.5em; text-indent: -1em; }
.scripture .line.stanza, .scripture .para + .line { margin-top: .8em; }
.scripture .line + .para, .scripture .line + .copyright { margin-top: .8em; }
.verse { border-radius: 4px; cursor: pointer; transition: background .2s; }
.verse sup, .sample sup { font-family: var(--sans); font-size: .55em; color: var(--accent); margin-right: 3px; font-weight: 600; }
.verse.speaking { background: var(--highlight); }
.commentary-body { flex: 1; overflow-y: auto; padding: 20px 16px 40px; max-width: 680px; width: 100%; margin: 0 auto; font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-leading); overflow-wrap: anywhere; }
.summary-body { font-size: var(--read-size); }
.summary-body p { text-align: var(--read-align); hyphens: var(--read-hyphens); -webkit-hyphens: var(--read-hyphens); border-radius: 4px; transition: background .2s; }
.summary-body p.speaking { background: var(--highlight); box-shadow: 0 0 0 6px var(--highlight); }
.listen-toggle { color: var(--accent); }
.commentary-body h3 { font-size: .75em; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 8px; font-weight: 600; }
.commentary-body h3:first-child, .comm-intro + h3 { margin-top: 0; }
.comm-note { margin: 0; padding: .7em 0 .2em; }
.comm-note + .comm-note { border-top: 1px solid var(--line); }
.comm-note p { margin: 0 0 .5em; }
.comm-note p, .comm-intro p { text-align: var(--read-align); hyphens: var(--read-hyphens); -webkit-hyphens: var(--read-hyphens); }
.comm-ref { font-family: var(--sans); font-size: .85em; color: var(--accent); margin-right: 2px; }
.comm-none { color: var(--muted); font-style: italic; }
.comm-intro { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 24px; }
.comm-intro summary { cursor: pointer; font: 600 15px/1.4 var(--sans); color: var(--accent); }
.comm-intro p { margin: .6em 0 0; }
.commentary-body .copyright { font: 12px/1.5 var(--sans); color: var(--muted); margin-top: 32px; }
.commentary-body .copyright a { color: var(--accent); }
.status { font-family: var(--sans); color: var(--muted); font-size: 15px; text-align: center; padding: 40px 0; }

.player { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.player > .btn { min-width: 92px; padding: 8px 12px; font-size: 14px; }
.player-controls { display: flex; align-items: center; gap: 6px; }
.play-btn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: var(--surface); display: grid; place-items: center; cursor: pointer; }
.play-btn .i-pause, .listen-toggle .i-pause { display: none; }
.play-btn.playing .i-pause, .listen-toggle.playing .i-pause { display: block; }
.play-btn.playing .i-play, .listen-toggle.playing .i-play { display: none; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.file-btn { flex-direction: row !important; font-weight: 600 !important; }
.fine a { color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 8px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.swatch { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600; }
.swatch[aria-checked="true"] { border-color: var(--accent); }
.swatch .preview { height: 44px; border-radius: 9px; display: flex; align-items: flex-end; gap: 4px; padding: 7px; border: 1px solid rgba(127,127,127,.25); }
.swatch .preview i { display: block; height: 8px; border-radius: 4px; }
.swatch .preview i:first-child { width: 40%; }
.swatch .preview i:last-child { width: 14px; height: 14px; border-radius: 50%; margin-left: auto; }

.banner { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; margin-bottom: 20px; }
.banner p { margin: 0 0 12px; }
.banner[hidden] { display: none; }

.sync [hidden] { display: none !important; }
.sync-message.error, #sync-status.error { color: var(--late); }

/* Reading text */
.settings .sublabel { margin: 4px 0 -2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sample { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 10px; font-family: var(--read-font); font-size: var(--read-size); line-height: var(--read-leading); }
.sample p { margin: 0 0 6px; }
.sample small { display: block; font-family: var(--sans); line-height: 1.4; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.segmented.fonts { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 440px) { .segmented.fonts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.seg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; padding: 6px 4px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 600; line-height: 1.2; text-align: center; }
.seg:hover { background: var(--accent-soft); }
.seg[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.seg .aa { font-size: 22px; font-weight: 400; line-height: 1.1; }
.seg .lines { display: flex; flex-direction: column; justify-content: center; width: 22px; height: 18px; }
.seg .lines i { display: block; height: 2px; border-radius: 1px; background: currentColor; opacity: .7; }
.seg .lines.align-left, .seg .lines.align-justify { gap: 4px; }
.seg .lines.align-left i:nth-child(2) { width: 70%; }
.seg .lines.align-left i:last-child { width: 85%; }

/* Settings layout: headed groups of rows in cards */
.settings { padding: 8px 16px 40px; max-width: 560px; width: 100%; margin: 0 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.set-group h3 { margin: 0 0 8px 4px; font: 600 13px/1.2 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.set-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); margin: 0; }
.set-row:first-child { border-top: 0; }
.set-row.stacked { flex-direction: column; align-items: stretch; gap: 10px; }
.set-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-name { font-weight: 600; }
.settings small, .fine { color: var(--muted); font-weight: 400; font-size: 13px; line-height: 1.4; }
.fine { text-align: center; margin: 0; }
.settings input[type=date], .settings input[type=time], .settings select, .settings input[type=email], .settings input[type=url] { font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-width: 0; }
.set-row:not(.stacked) > input[type=date], .set-row:not(.stacked) > input[type=time], .set-row:not(.stacked) > select { flex: none; max-width: 52%; }
.settings input[type=range] { width: 100%; }
.row.nowrap { flex-wrap: nowrap; }
.row.nowrap > input, .row.nowrap > select { flex: 1; }
.set-row .btn { align-self: flex-start; }
.row .btn { align-self: auto; }
.file-btn { display: inline-flex; align-items: center; }
.sync-message.error, #sync-status.error, #remind-hint.error { color: var(--late); }
.sync #sync-paste { display: flex; flex-direction: column; gap: 8px; }
.sync [hidden] { display: none !important; }

/* iOS-style switch */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Copyright & credits page */
.credits { padding-top: 24px; padding-bottom: 48px; }
.credits h1 { margin: 12px 0 20px; }
.credits h2 { font-size: 17px; margin: 22px 0 6px; }
.credits p { margin: 0 0 10px; color: var(--ink); font-size: 15px; }
.credits a { color: var(--accent); }

/* Getting started */
.text-options { display: flex; flex-direction: column; gap: 10px; }
.onboarding .ob-top { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 16px 6px; max-width: 560px; width: 100%; margin: 0 auto; }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background .2s, width .2s; }
.ob-dots i.on { background: var(--accent); width: 20px; border-radius: 4px; }
.ob-body { flex: 1; overflow-y: auto; padding: 8px 16px 24px; max-width: 560px; width: 100%; margin: 0 auto; }
.ob-step { display: flex; flex-direction: column; gap: 14px; }
.ob-step h2 { font-size: 26px; line-height: 1.2; margin-top: 8px; }
.ob-step > p { margin: 0; color: var(--muted); }
.ob-step .sublabel { margin: 6px 0 -4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ob-logo { border-radius: 14px; margin-top: 12px; }
.ob-note { font-size: 13px; color: var(--muted); margin: 0; }
.ob-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ob-card small, .onboarding small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.onboarding input[type=email], .onboarding input[type=url], .ob-date { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-width: 0; }
.ob-date { background: var(--surface); align-self: flex-start; }
.onboarding .row.nowrap > input { flex: 1; }
.onboarding #ob-paste { display: flex; flex-direction: column; gap: 8px; }
.ob-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ob-days .seg.wide { grid-column: 1 / -1; }
.ob-options { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.ob-option { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 16px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; font-size: 16px; }
.ob-option:first-child { border-top: 0; }
.ob-option small { font-size: 12px; color: var(--muted); }
.ob-option[aria-checked="true"] { background: var(--accent-soft); font-weight: 600; }
.ob-option[aria-checked="true"]::after { content: "✓"; color: var(--accent); font-weight: 700; }
.ob-option .tags { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.ob-preview-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.ob-preview-list li { display: flex; gap: 10px; font-size: 15px; }
.ob-preview-list li span { width: 92px; flex: none; color: var(--muted); font-size: 13px; padding-top: 2px; }
.ob-preview-list li.today { font-weight: 600; }
.ob-nav { display: flex; justify-content: space-between; gap: 10px; padding: 12px max(16px, calc((100% - 528px) / 2)) calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.ob-nav .btn { min-width: 110px; }
.ob-nav #ob-back[hidden] { display: block !important; visibility: hidden; }

.ob-share-card { gap: 8px; }
.ob-share-label { margin: 2px 0 0; font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ob-facts { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ob-facts li { display: flex; gap: 12px; align-items: flex-start; }
.ob-facts li > span:last-child { display: flex; flex-direction: column; gap: 1px; font-size: 15px; }
.ob-facts strong { font-weight: 600; }
.ob-facts li > span:last-child > span { color: var(--muted); font-size: 14px; }
.ob-fact-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 18px; }
.ob-share-btn { width: 100%; padding: 14px; font-size: 16px; }
.ob-center { text-align: center; }

.ob-celebrate { font-size: 52px; line-height: 1; margin: 12px 0 0; animation: ob-pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes ob-pop { from { transform: scale(.3) rotate(-15deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ob-celebrate { animation: none; } }
.ob-invite { border-color: var(--accent); background: var(--accent-soft); }
.ob-invite .ob-fact-icon { background: var(--surface); }

.code-input { font-family: 'SF Mono', Menlo, Consolas, monospace !important; letter-spacing: .3em; font-size: 20px !important; text-align: center; }
