/* Berean: the shell and pages from the study UX design (canvas "Study — UX design", v19).
   Inter for the interface, Source Serif 4 for reading (big ideas, passages, Scripture).
   Both are served from here: the CSP allows no third-party fonts. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin-wght-normal.woff2?v=f052ee44c3728dfd) format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin-wght-italic.woff2?v=ecbf4bcc5f736050) format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(fonts/source-serif-4-latin-wght-normal.woff2?v=42c9a2125f752f22) format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url(fonts/source-serif-4-latin-wght-italic.woff2?v=0f994f4882c7c386) format("woff2");
}

:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --raised: #f7fafc;
  --ink: #18212b;
  --ink-2: #3d4854;
  --muted: #55616e;
  --faint: #8995a1;
  --line: #dde3e8;
  --line-soft: #edf0f3;
  --line-strong: #c9d2da;
  --track: #e3e8ed;
  --accent: #1d5c87;
  --accent-hover: #123e5c;
  --accent-soft: #e6f0f7;
  --accent-line: #a9c9e2;
  --on-accent: #ffffff;
  --green: #1f5e4b;
  --green-soft: #e1f0ea;
  --amber: #7a4a06;
  --amber-soft: #fbefd9;
  --amber-line: #f0d9ae;
  --red: #9f1f1f;
  --red-soft: #fbeaea;
  --dock: #18212b;
  --dock-ink: #ffffff;
  --shadow: 0 4px 14px rgba(24, 33, 43, 0.06);
  --shadow-pop: 0 8px 24px rgba(24, 33, 43, 0.12);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --radius: 12px;
  --tabbar-h: 0px;
}
/* Dark: the device's setting, unless Preferences › Reading › Theme chose Light or Dark (data-theme on <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11161c;
    --surface: #1a2129;
    --raised: #202831;
    --ink: #e8edf2;
    --ink-2: #c9d2da;
    --muted: #a9b4bf;
    --faint: #7d8995;
    --line: #2a333d;
    --line-soft: #222a33;
    --line-strong: #3d4854;
    --track: #2f3944;
    --accent: #8cc3ea;
    --accent-hover: #b5daf3;
    --accent-soft: #16283a;
    --accent-line: #2f5878;
    --on-accent: #11161c;
    --green: #8fd3b6;
    --green-soft: #14302a;
    --amber: #f0c27a;
    --amber-soft: #2e2312;
    --amber-line: #5a4421;
    --red: #f2a7a7;
    --red-soft: #3a1b1b;
    --dock: #2a333d;
    --dock-ink: #ffffff;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11161c;
  --surface: #1a2129;
  --raised: #202831;
  --ink: #e8edf2;
  --ink-2: #c9d2da;
  --muted: #a9b4bf;
  --faint: #7d8995;
  --line: #2a333d;
  --line-soft: #222a33;
  --line-strong: #3d4854;
  --track: #2f3944;
  --accent: #8cc3ea;
  --accent-hover: #b5daf3;
  --accent-soft: #16283a;
  --accent-line: #2f5878;
  --on-accent: #11161c;
  --green: #8fd3b6;
  --green-soft: #14302a;
  --amber: #f0c27a;
  --amber-soft: #2e2312;
  --amber-line: #5a4421;
  --red: #f2a7a7;
  --red-soft: #3a1b1b;
  --dock: #2a333d;
  --dock-ink: #ffffff;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45);
}
:root[data-theme="light"] { color-scheme: light; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2, h3 { margin: 0; }
p { margin: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--line-soft);
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; padding: 8px 12px; background: var(--surface); border-radius: 8px; }
.skip:focus { left: 8px; }

.label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint { color: var(--muted); font-size: 14px; }
.count { color: var(--muted); font-weight: 500; }
.ref { font-family: var(--serif); font-weight: 600; color: var(--accent); }

/* ---------- Header ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  /* viewport-fit=cover: on an iPhone held sideways the sides clear the Dynamic Island and the rounded corners */
  padding: 12px max(32px, env(safe-area-inset-right)) 12px max(32px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.brand svg { color: var(--accent); }
.brand:hover { color: var(--ink); text-decoration: none; }
.main-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.main-nav a, .settings-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--ink-2);
  font-weight: 500;
}
.settings-link { font-size: 14px; padding: 0 12px; }
.main-nav a:hover, .settings-link:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.main-nav a[aria-current="page"], .settings-link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.spacer { flex: 1 1 40px; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 14px;
}
.avatar-menu > summary { display: inline-flex; padding: 4px; border-radius: 50%; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
}
.menu-panel .menu-name { padding: 8px 12px 6px; color: var(--muted); font-size: 13px; }
.menu-panel a, .menu-panel button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--line-soft); text-decoration: none; }

/* ---------- Phone tab bar ---------- */
.tabbar { display: none; }

/* ---------- Page frame ---------- */
.page {
  max-width: 972px;
  margin: 0 auto;
  padding: 32px max(32px, env(safe-area-inset-right)) 64px max(32px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.narrow { max-width: 720px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
}
.page-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.phone-only { display: none !important; }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: var(--ink);
}
.icon-button:hover { background: var(--line-soft); color: var(--ink); }
.icon-button svg { width: 24px; height: 24px; }

/* Breadcrumbs (desktop) and the phone's back link */
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 14px; color: var(--muted); }
.crumbs li { display: inline-flex; gap: 8px; min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--faint); }
.crumbs a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.crumbs a:hover { color: var(--accent); }
.crumbs li[aria-current="page"] span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.back { display: none; align-items: center; gap: 4px; min-height: 44px; color: var(--ink-2); font-size: 16px; font-weight: 500; }

/* ---------- Buttons, forms, chips, alerts ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.button:hover { border-color: var(--accent-line); color: var(--ink); text-decoration: none; background: var(--raised); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.button.quiet { min-height: 40px; padding: 0 12px; font-size: 14px; }
.button.danger { color: var(--red); }
.button.wide { width: 100%; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.inline-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-top: 4px; }
input {
  font: inherit;
  font-weight: 400;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
  width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.grey { background: var(--line-soft); color: var(--ink-2); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.blue { background: var(--accent-soft); color: var(--accent); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--amber-line);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.alert.error { border-color: transparent; background: var(--red-soft); color: var(--red); }
.flag { font-size: 13px; overflow-wrap: anywhere; }
.flag.warn { color: var(--amber); }
.flag.error { color: var(--red); }

/* ---------- Cards ---------- */
.card {
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.card-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.empty-card {
  padding: 28px;
  background: var(--accent-soft);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-2);
}
.empty-card .empty-title { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.empty-card p { max-width: 60ch; }

/* ---------- Inbox ---------- */
.status-line { color: var(--ink-2); font-size: 14px; max-width: 100%; }
.status-line > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  cursor: pointer;
  list-style: none;
}
.status-line > summary::-webkit-details-marker { display: none; }
.status-line[data-empty] > summary { cursor: default; }
.status-line > summary svg { flex: 0 0 auto; color: var(--muted); }
.status-line strong { color: var(--ink); }
.status-line strong.needs { color: var(--amber); }
.status-line[open] .chevron { transform: rotate(180deg); }
.status-panel {
  margin-top: 8px;
  padding: 8px 16px 10px;
  max-width: 680px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.status-panel section { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.queue-row:last-child { border-bottom: 0; }
.queue-title { flex: 0 1 260px; min-width: 0; font-weight: 600; color: var(--ink); }
a.queue-title:hover { color: var(--accent); }
.queue-why { flex: 1 1 220px; min-width: 0; color: var(--muted); }
.queue-row .flag { flex-basis: 100%; }

.stack-section { display: flex; flex-direction: column; gap: 10px; }
.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 0 0;
  min-width: 0;
}
.note-card:hover { border-color: var(--accent-line); }
.note-card-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  color: var(--ink);
  min-width: 0;
}
.note-card-link:hover { color: var(--ink); text-decoration: none; }
.note-card-link:hover .note-card-title { color: var(--accent); }
.note-card > .flag { padding: 0 20px; margin-top: -8px; }
.note-card > .flag:last-child { padding-bottom: 14px; }
.note-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; min-width: 0; }
.note-card-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.note-card-head .ref { font-size: 16px; }
.note-card-source { color: var(--muted); font-size: 14px; }
.note-card-idea {
  max-width: 68ch;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card-meta { color: var(--muted); font-size: 13px; }
.note-card-meta:empty { display: none; }
/* The speaker is a link of its own, so the meta line sits below the card's link instead of inside it */
.note-card > .note-card-meta { padding: 0 20px 8px; margin-top: -8px; }
.note-card > .note-card-meta:last-child { padding-bottom: 14px; }

.first-run { display: flex; flex-direction: column; gap: 20px; }
.hero { padding: 28px; background: var(--accent-soft); border-radius: 14px; display: flex; flex-direction: column; gap: 10px; }
.hero h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.hero p { max-width: 62ch; color: var(--ink-2); }
.starts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.starts li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.starts h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.starts p { color: var(--ink-2); }
.step {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.step.on { background: var(--accent); color: var(--on-accent); }

/* ---------- Note page ---------- */
.note-page { max-width: 900px; gap: 18px; }
.note-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.note-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 420px; }
.note-head h1 { font-size: 34px; overflow-wrap: anywhere; }
.note-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-2); font-size: 14px; }
.note-meta .series { color: var(--accent); font-weight: 600; }
.note-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.note-bar {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.pills {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }
.pills a {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}
.pills a:hover { border-color: var(--accent-line); color: var(--ink); text-decoration: none; }
.pills a[aria-current="location"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.player { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; }
.player audio { width: 100%; height: 40px; }
.player-ui { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.player-ui button {
  flex: 0 0 auto;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.player-ui .skip-back, .player-ui .skip-fwd { width: 40px; }
.player-ui .skip-back:hover, .player-ui .skip-fwd:hover { background: var(--line-soft); }
.player-ui .play {
  width: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.player-ui .play:hover { background: var(--accent-hover); }
.player .i-pause, .player.playing .i-play { display: none; }
.player.playing .i-pause { display: block; }
.player-ui .speed {
  min-width: 52px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.track { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.seek {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 0;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--track) var(--fill));
}
.seek::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
.seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}
.seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.seek:focus { outline: none; }
.seek:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sections { display: flex; flex-direction: column; gap: 18px; }
.sections > .card { scroll-margin-top: 96px; }
.card ul, .card ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.card li { padding-left: 2px; }
.card li::marker { color: var(--muted); }
.card a { overflow-wrap: anywhere; }
.card p + p { margin-top: 0; }
.card table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: 14px; }
.card td, .card th { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.card hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; width: 100%; }

.summary { background: var(--accent-soft); border-color: transparent; padding: 22px 26px; }
.summary .label { color: var(--accent); }
.summary .big-idea {
  max-width: 40ch;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
}
.summary ul { max-width: 68ch; font-size: 16px; }
.main-passage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-top: 4px; }
.main-passage .ref { font-size: 18px; }

.sec-insights ul { list-style: none; padding: 0; gap: 0; }
.sec-insights li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.sec-insights li:last-child { border-bottom: 0; }

.card blockquote {
  margin: 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--raised);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card blockquote p:first-child strong:only-child { color: var(--ink); }
.sec-commentary blockquote { background: var(--bg); }
.sec-scripture blockquote {
  padding: 16px 20px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 12px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
}
.sec-scripture blockquote + blockquote { border-width: 1px; border-color: var(--line); }
.sec-scripture blockquote p:first-child { font-size: 19px; font-family: var(--serif); }
.sec-scripture blockquote p:first-child a { color: var(--ink); font-weight: 700; }
/* The passage's heading, with a link on to its chapter in the library */
.sec-scripture .scripture-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.sec-scripture .scripture-head strong { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.sec-scripture blockquote p:first-child a.passage-page { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.sec-scripture > p { color: var(--muted); font-size: 12px; }

.sec-insights li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; }
.sec-insights li .ref { font-size: 15px; }

/* Whose words a card holds: the sermon's, or Enduring Word's (amber, as commentary is everywhere) */
.from-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.from-tag.ew { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.summary .from-tag { border-color: var(--accent-line); }
/* What only the commentary has, apart from the sermon's own key insights */
.ew-adds {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--amber-line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ew-adds .from-tag { align-self: flex-start; }
.sec-insights .ew-adds li { padding: 8px 0; }
/* The sermon compared with the commentary, group by group */
.comparison { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.comparison-scope { color: var(--muted); font-style: italic; }
.cmp-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cmp-group h3 { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cmp-group.cmp-adds h3 { color: var(--amber); }
.cmp-group ul { padding-left: 1.2em; }
.comparison + * { margin-top: 14px; }
.sec-flow ol { list-style: none; padding: 0; gap: 14px; counter-reset: step; }
.sec-flow li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: baseline; counter-increment: step; padding: 0; }
.sec-flow li > .ts { justify-self: start; }
.sec-flow .step-text { display: flex; flex-direction: column; gap: 2px; }
.sec-flow .step-text::before { content: none; }
.sec-flow .step-text > strong::before { content: counter(step) ". "; }
.sec-flow .step-text .ref { font-size: 15px; }
.sec-discuss ol { padding-left: 1.4em; }

a.ts {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  white-space: nowrap;
}
a.ts:hover { border-color: var(--accent); text-decoration: none; }

.sec-transcript blockquote { background: transparent; border: 0; padding: 0; gap: 10px; color: var(--ink-2); line-height: 1.65; }
.sec-transcript blockquote p:first-child strong:only-child { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* Transcript highlights (web/transcript.py): a passage said aloud is a solid-underlined link */
.tx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.segmented button.seg { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.segmented button.seg:hover { color: var(--ink); background: var(--surface); }
.segmented .seg[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 33, 43, 0.12); }
.tx-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tx-body a.tx-ref {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  background: var(--accent-soft);
  border-radius: 3px;
  padding: 0 2px;
}
.tx-body a.tx-ref:hover, .tx-body a.tx-ref.tx-open { color: var(--accent-hover); text-decoration-thickness: 2.5px; }
/* The transcript laid out (web/transcript_anchors.py): times and markers in a margin, the outline as headings */
/* The margin floats in the paragraph's padding, so a short paragraph grows to hold its markers */
.sec-transcript p:has(> .tx-gutter) { display: flow-root; padding-left: 84px; }
.tx-gutter {
  float: left;
  margin: 0.15em 0 0 -84px;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.tx-gutter a.ts { font-size: 12px; }
.sec-transcript h3.tx-section {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: baseline;
  column-gap: 10px;
  margin: 14px 0 0;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
}
.sec-transcript h3.tx-section > a.ts { justify-self: start; }
.sec-transcript h3.tx-section > span { min-width: 0; overflow-wrap: anywhere; }
a.tx-marker {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  text-decoration: none;
}
a.tx-marker:hover { text-decoration: none; }
/* Each kind keeps its own colour and its own mark style, so none is colour alone */
.tx-k-insight { --tx-ink: var(--accent); --tx-soft: var(--accent-soft); }
.tx-k-theme { --tx-ink: var(--green); --tx-soft: var(--green-soft); }
.tx-k-differ { --tx-ink: var(--red); --tx-soft: var(--red-soft); }
a.tx-marker { color: var(--tx-ink); background: var(--tx-soft); }
mark.tx-anchor { color: inherit; background: var(--tx-soft); border-radius: 3px; padding: 0 1px; }
mark.tx-k-insight { box-shadow: inset 0 -2px 0 var(--tx-ink); }
mark.tx-k-theme { text-decoration: underline wavy var(--tx-ink); text-decoration-thickness: 1px; text-underline-offset: 4px; }
mark.tx-k-differ { box-shadow: inset 0 -2px 0 var(--tx-ink); border-bottom: 1px dashed var(--tx-ink); }
mark.tx-anchor, .tx-at, [id^="insight-"], [id^="theme-"], [id^="divergence-"] { scroll-margin-top: 170px; scroll-margin-bottom: 120px; }
mark.tx-anchor:target, [id^="insight-"]:target, [id^="theme-"]:target, [id^="divergence-"]:target {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* A card item's way to its place in the transcript, and the time to play it from */
.tx-jumps { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-left: 4px; }
.tx-jumps a.tx-jump, .tx-themes a.tx-jump { font-size: 13px; font-weight: 600; white-space: nowrap; }
.tx-themes { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; min-width: 0; }
.tx-themes ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tx-themes li { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
.tx-themes a.tx-jump { color: var(--green); white-space: normal; }
/* Scripture read or quoted aloud (berean.read_aloud): in the serif italic the note's Scripture is set in, then its reference */
.tx-body .tx-quote {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink);
  background: var(--raised);
  box-shadow: inset 2px 0 0 var(--accent-line);
  border-radius: 3px;
  padding: 1px 3px 1px 6px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.tx-body a.tx-cite {
  display: inline-block;
  margin-left: 0.3em;
  padding: 0 6px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  vertical-align: 1px;
  white-space: nowrap;
}
.tx-body a.tx-cite:hover, .tx-body a.tx-cite.tx-open { border-color: var(--accent); color: var(--accent-hover); }
/* Plain: the same words, no highlights (note.js also takes the links out of the tab order) */
.tx-body.tx-plain a.tx-ref {
  color: inherit;
  font-weight: inherit;
  background: none;
  padding: 0;
  text-decoration: none;
  cursor: text;
}
.tx-body.tx-plain a.tx-cite { display: none; }
.tx-body.tx-plain .tx-quote { font: inherit; color: inherit; background: none; box-shadow: none; padding: 0; }
.tx-body.tx-plain mark.tx-anchor { background: none; box-shadow: none; border: 0; text-decoration: none; padding: 0; }
.tx-body.tx-plain a.tx-marker { display: none; }
@media (max-width: 640px) {
  .sec-transcript p:has(> .tx-gutter) { padding-left: 0; }
  .sec-transcript h3.tx-section { display: flex; gap: 10px; }
  .tx-gutter { float: none; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; margin: 0 0 4px; }
  .tx-gutter:empty { display: none; }
}
.tx-pop {
  position: absolute;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tx-pop > * { flex: 0 0 auto; }
.tx-pop p, .tx-pop ul { margin: 0; }
.tx-pop ul { padding-left: 1.1em; }
.tx-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.tx-card-head .ref { font-size: 16px; }
.tx-role {
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}
.tx-verses { font-family: var(--serif); color: var(--ink); }
.tx-verses sup { color: var(--muted); font-size: 0.7em; }
.tx-translation { color: var(--muted); font-family: var(--sans); font-size: 12px; font-weight: 600; }
.tx-card-label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--line-soft);
  border: 1px solid var(--line);
}
.segmented .seg {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.segmented a.seg:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.segmented .seg[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24, 33, 43, 0.12); }

.prev-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-width: 0;
}
.pn:hover { border-color: var(--accent-line); color: var(--ink); text-decoration: none; }
.pn.next { grid-column: 2; text-align: right; align-items: flex-end; }
.pn-dir { color: var(--muted); font-size: 13px; }
.pn-title { font-weight: 700; overflow-wrap: anywhere; }

/* ---------- Account, placeholders, sign-in ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.card .rows { padding-left: 0; gap: 0; }
.email-link > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.email-link[open] > summary { margin-bottom: 12px; }
.card > .field-label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.card .rows > li { padding-left: 0; }
.secret-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.secret-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; min-width: 0; }
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.link-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.link-list a:hover { border-color: var(--accent-line); text-decoration: none; }

.auth-page { max-width: 460px; padding-top: 56px; }
.auth-card {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-card h1 { font-size: 28px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- Narrow desktop: the player stacks above the pills ---------- */
@media (max-width: 1099px) {
  .note-bar { flex-direction: column-reverse; align-items: stretch; }
  .player { flex: 0 0 auto; }
  .pills { -webkit-mask-image: linear-gradient(to right, #000 92%, transparent); mask-image: linear-gradient(to right, #000 92%, transparent); }
}

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  :root { --tabbar-h: 64px; }
  body { font-size: 16px; }
  .has-nav .top { display: none; }
  .top { padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
  .page {
    padding: 16px max(16px, env(safe-area-inset-right)) calc(32px + var(--tabbar-h) + env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
    gap: 18px;
  }
  .phone-only { display: inline-flex !important; }
  h1 { font-size: 30px; }
  .page-head { flex-wrap: nowrap; }
  .page-head-text { flex: 1 1 auto; }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
  }
  .tabbar a:hover { text-decoration: none; color: var(--ink); }
  .tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }

  .crumbs { display: none; }
  .back { display: inline-flex; margin: -8px 0 -10px -6px; align-self: flex-start; }

  .status-line > summary { align-items: flex-start; }
  .status-line > summary svg { margin-top: 3px; }
  .note-card-link { padding: 14px 16px; }
  .note-card > .flag { padding: 0 16px; }
  .note-card > .note-card-meta { padding-left: 16px; padding-right: 16px; }
  .note-card-title { font-size: 17px; }
  .first-run .hero, .empty-card { padding: 22px; }
  .starts li { padding: 16px; }

  .note-head h1 { font-size: 28px; }
  .note-head-text { flex-basis: 100%; }
  .note-bar {
    top: 0;
    margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 0 calc(-1 * max(16px, env(safe-area-inset-left)));
    padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
    border-radius: 0;
    border-width: 0 0 1px;
    box-shadow: none;
  }
  .sections > .card { scroll-margin-top: 64px; }
  .card { padding: 18px 16px; }
  .summary { padding: 20px 18px; }
  .summary .big-idea { font-size: 21px; }
  .sec-scripture blockquote { padding: 14px 16px; }

  .prev-next { grid-template-columns: minmax(0, 1fr); }
  .pn.next { grid-column: 1; }
  .inline-form { grid-template-columns: minmax(0, 1fr); }
  .auth-page { padding-top: 24px; }
  .auth-card { padding: 24px 20px; }
}

/* ---------- The docked mini-player: on a phone, and on a phone held sideways ---------- */
/* Sideways, an iPhone is as wide as a small desktop but only about 440 px tall: a sticky player stacked over the
   pills would fill a third of it, so the player docks along the bottom in one row and the pills scroll away */
@media (max-width: 720px), (orientation: landscape) and (max-height: 500px) {
  /* Above the tab bar, as the design's mini-player (there is no tab bar sideways: --tabbar-h is 0) */
  .has-player .page { padding-bottom: calc(32px + 72px + var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .player {
    position: fixed;
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 6px);
    z-index: 35;
    padding: 6px 10px;
    border-radius: 16px;
    background: var(--dock);
    color: var(--dock-ink);
    box-shadow: var(--shadow-pop);
  }
  .player-ui button { color: var(--dock-ink); }
  .player-ui .skip-back:hover, .player-ui .skip-fwd:hover { background: rgba(255, 255, 255, 0.1); }
  .player-ui .play { background: #ffffff; color: #18212b; }
  .player-ui .play:hover { background: #e6f0f7; }
  .player-ui .speed { background: transparent; border-color: rgba(255, 255, 255, 0.35); }
  .player .time { color: rgba(255, 255, 255, 0.8); }
  .player .seek::-webkit-slider-runnable-track { background: linear-gradient(to right, #ffffff var(--fill), rgba(255, 255, 255, 0.3) var(--fill)); }
  .player .seek::-webkit-slider-thumb { background: #ffffff; border-color: var(--dock); }
  .player .seek::-moz-range-track { background: rgba(255, 255, 255, 0.3); }
  .player .seek::-moz-range-progress { background: #ffffff; }
}
@media (min-width: 721px) and (orientation: landscape) and (max-height: 500px) {
  .note-bar { position: static; }
  /* The player keeps to the page's width, as the rest of the page does, in one row: its time beside the scrubber */
  .player { max-width: 908px; margin: 0 auto; }
  .player .track { flex-direction: row; align-items: center; gap: 10px; }
}

/* Mark read at the end of a note (series read state) */
.read-end { display: flex; justify-content: flex-end; }
.note-actions form { display: contents; }

/* Read by screen readers, not shown */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Preferences › Reading › Text size: the note's reading text, set on <html> as data-text-size */
:root[data-text-size="small"] .note-page .sections { zoom: 0.92; }
:root[data-text-size="large"] .note-page .sections { zoom: 1.12; }
:root[data-text-size="x-large"] .note-page .sections { zoom: 1.25; }

/* Form controls beyond the text input */
input[type="checkbox"], input[type="radio"] {
  width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--accent);
}
select, textarea {
  font: inherit; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); min-width: 0; max-width: 100%;
}
select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.flag.review-flag { text-decoration: underline; text-underline-offset: 3px; }

/* A sermon still on its way (templates/processing.html): its steps, and its audio to listen to now */
.processing-card, .listen-card { gap: 12px; }
.processing-card h2, .listen-card h2 { font-size: 20px; font-weight: 700; }
.processing-card.failed h2 { color: var(--red); }
.card .steps, .steps { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card .steps > li { margin: 0; padding: 0; }
.step-row { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.step-mark {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 50%; border: 1.5px solid var(--line-strong); font-size: 13px; font-weight: 700;
}
.step-row.done { color: var(--ink-2); }
.step-row.done .step-mark { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.step-row.current { color: var(--ink); font-weight: 600; }
.step-row.current .step-mark { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.processing-card.failed .step-row.current .step-mark { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.listen-card audio { width: 100%; }
.processing-page .eyebrow { color: var(--accent); font-size: 14px; font-weight: 600; }
