:root {
  --ink: #1c2430;
  --muted: #5a6578;
  --blue: #412986;
  --blue-soft: #5a45a8;
  --sand: #f7f4ee;
  --card: #ffffff;
  --line: rgba(65, 41, 134, 0.12);
  --accent: #007f50;
  --accent-soft: rgba(0, 127, 80, 0.12);
  --ready: #006b45;
  --reading: 1.12rem;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #2b1f6b;
  color: var(--ink);
  font-family: var(--sans);
}

button, a { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.update-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.update-banner[hidden] { display: none !important; }

.update-banner button {
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top right, rgba(0, 127, 80, 0.12), transparent 40%),
    linear-gradient(180deg, #efecf7 0%, var(--sand) 38%, var(--sand) 100%);
}

.view[hidden] { display: none !important; }

.home-actions .pill-btn.ghost {
  background: rgba(255, 255, 255, 0.12);
}

.view-home {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.home-hero {
  padding: calc(28px + var(--safe-top)) 20px 22px;
  color: #f7f4ee;
  background:
    radial-gradient(circle at 85% 20%, rgba(0, 127, 80, 0.35), transparent 42%),
    linear-gradient(145deg, #412986 0%, #5a45a8 55%, #412986 100%);
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
}

.home-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.home-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 8vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.home-sub {
  margin: 8px 0 0;
  opacity: 0.9;
  font-size: 1rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.home-main {
  padding: 20px 18px calc(28px + var(--safe-bottom));
}

.verse-of-day,
.today-card {
  padding: 20px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(65, 41, 134, 0.08);
}

.verse-of-day {
  margin-bottom: 14px;
  background:
    linear-gradient(180deg, rgba(65, 41, 134, 0.04), transparent 48%),
    var(--card);
}

.vod-date {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.vod-text {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 4.2vw, 1.4rem);
  line-height: 1.45;
  color: var(--blue);
}

.vod-ref {
  margin: 0 0 4px;
  font-weight: 800;
  color: var(--accent);
}

.vod-meta {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.verse-of-day .pill-btn {
  margin-top: 4px;
}

.biy-progress {
  margin: 8px 0 0;
  color: var(--ready);
  font-size: 0.88rem;
  font-weight: 700;
}

.view-biy {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.biy-main {
  padding: 16px 16px calc(28px + var(--safe-bottom));
}

.biy-day-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.biy-day-card {
  padding: 20px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
}

.biy-summary {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.biy-readings {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.biy-reading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f0edf7;
  color: var(--blue);
  font-weight: 700;
}

.biy-reading span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.biy-reading.is-done {
  background: rgba(0, 107, 69, 0.12);
  border-color: rgba(0, 107, 69, 0.28);
}

#biy-mark-read {
  width: 100%;
}

.today-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.today-card h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 5vw, 1.75rem);
  color: var(--blue);
  line-height: 1.25;
}

.today-card #today-date,
.today-card #today-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.today-card .pill-btn {
  margin-top: 14px;
}

.update-panel {
  margin-top: 16px;
  display: grid;
  gap: 8px;
  justify-items: start;
}

.update-panel .pill-btn {
  width: 100%;
}

.update-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.home-foot {
  margin: 22px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.view-study {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.study-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: rgba(247, 244, 238, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 6px 16px rgba(0, 127, 80, 0.28);
}

.home-btn .home-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.home-btn:active { transform: scale(0.98); }

.icon-btn {
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 700;
  color: var(--blue);
  font-size: 0.85rem;
}

.icon-btn.dark { background: #f0edf7; }

.study-bar-copy {
  min-width: 0;
}

.study-bar-copy strong {
  display: block;
  font-family: var(--serif);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.study-bar-copy span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reading {
  padding: 18px 18px 28px;
  font-size: var(--reading);
  line-height: 1.7;
}

.reading h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--blue);
}

.reading .theme {
  margin: 0 0 8px;
  color: var(--muted);
}

/* Keep Word soft line breaks; normal paragraphs still wrap naturally */
.reading .speakable {
  white-space: pre-line;
}

.soon-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.scripture-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.verse-chip {
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  background: transparent;
  color: var(--blue);
  border: 1px solid rgba(65, 41, 134, 0.18);
  font-weight: 700;
  font-size: 0.82rem;
}

.verse-chip:active { background: #ece8f6; }

.reading .lesson-section {
  margin: 0 0 1.1rem;
  padding: 0 0 0.85rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.reading .lesson-section:last-of-type {
  border-bottom: 0;
}

.reading h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--blue);
}

.reading p,
.reading li { font-weight: 400; }
.reading strong { font-weight: 700; }
.reading em { font-style: italic; }
.reading p { margin: 0 0 0.85rem; }
.reading ul, .reading ol { margin: 0 0 0.85rem; padding-left: 1.2rem; }
.reading li { margin-bottom: 0.4rem; }
.reading li.nested { margin-left: 0.85rem; list-style-type: circle; }

.reading .ref-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  background: none;
  padding: 0;
  border: 0;
  display: inline;
  cursor: pointer;
}

.coming-soon, .notice {
  padding: 16px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(0, 127, 80, 0.25);
  margin-bottom: 14px;
}

.coming-soon strong,
.notice strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--blue);
}

.notice button {
  margin-top: 10px;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.foot {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.study-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
}

.audio-bar {
  display: grid;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(65, 41, 134, 0.96);
  color: #f7f4ee;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.audio-bar[hidden] { display: none !important; }

.audio-chip {
  justify-self: start;
  min-height: 36px;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.88rem;
}

.audio-panel {
  display: grid;
  gap: 8px;
}

.audio-bar.is-collapsed .audio-panel { display: none; }
.audio-bar:not(.is-collapsed) .audio-chip { display: none; }

.audio-copy strong {
  display: block;
  font-family: var(--serif);
  font-size: 0.95rem;
}

.audio-copy span {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  opacity: 0.85;
}

.audio-controls {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 6px;
}

.audio-btn {
  min-height: 40px;
  border-radius: 12px;
  padding: 0.45rem 0.7rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

.audio-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
}

.reading .is-speaking {
  background: rgba(0, 127, 80, 0.16);
  box-shadow: inset 3px 0 0 var(--accent);
  border-radius: 8px;
  transition: background 0.2s ease;
}

.study-dock {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 8px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: rgba(247, 244, 238, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.nav-btn {
  border-radius: 14px;
  padding: 12px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 700;
  color: var(--blue);
}

.nav-btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.nav-btn:disabled { opacity: 0.4; }

.install-btn {
  grid-column: 1 / -1;
  border-radius: 14px;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--blue);
  font-weight: 700;
}

.pill-btn {
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.pill-btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}

.pill-btn.dark { background: var(--blue); }
.pill-btn.ghost.dark {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--blue);
}

.verse-sheet, .sheet {
  width: min(640px, calc(100vw - 16px));
  max-height: min(88vh, 860px);
  margin: auto;
  border: 0;
  border-radius: 22px;
  padding: 0;
  color: var(--ink);
  background: var(--card);
}

.verse-sheet {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0 auto;
  width: min(720px, 100%);
  border-radius: 24px 24px 0 0;
  max-height: 82vh;
}

.verse-sheet::backdrop, .sheet::backdrop {
  background: rgba(24, 17, 61, 0.55);
}

.verse-sheet header, .sheet header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--card);
}

.verse-sheet header strong, .sheet header strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--blue);
}

.verse-sheet header span, .sheet header span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.verse-body {
  padding: 16px 18px 8px;
  overflow: auto;
  max-height: 55vh;
  font-size: 1.08rem;
  line-height: 1.75;
}

.verse-body .verse-line { margin: 0 0 0.85rem; }
.verse-body .verse-line sup {
  color: var(--accent);
  font-weight: 800;
  margin-right: 4px;
}

.verse-loading, .verse-error { color: var(--muted); }
.verse-error { color: #a33; }

.verse-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--line);
}

#month-grids {
  padding: 12px 14px 20px;
  display: grid;
  gap: 18px;
  overflow: auto;
}

.month h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  color: var(--blue);
}

.weekdays, .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.weekdays span {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
}

.grid button, .grid .empty {
  aspect-ratio: 1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.grid .empty { visibility: hidden; }

.grid button {
  border: 1px solid var(--line);
  background: var(--sand);
  color: var(--ink);
}

.grid button.in-schedule.has-content {
  background: rgba(0, 107, 69, 0.12);
  border-color: rgba(0, 107, 69, 0.28);
}

.grid button.in-schedule:not(.has-content) {
  background: var(--accent-soft);
  border-color: rgba(0, 127, 80, 0.28);
}

.grid button.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.grid button[aria-current="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.grid button:disabled { opacity: 0.35; }

.install-steps {
  padding: 16px 18px calc(20px + var(--safe-bottom));
}

.install-steps ol {
  margin: 10px 0 0;
  padding-left: 1.2rem;
}

.install-steps a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.status {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 420px) {
  .study-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .home-btn { justify-self: start; }

  .tools { justify-content: space-between; }
}


/* ==== House of Hope brand refresh (v30) ==== */
:root { --gold: #c9a227; --gold-light: #f4e7b8; --purple-deep: #2b1f6b; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.home-hero :focus-visible, .audio-bar :focus-visible { outline-color: var(--gold); }

/* Home header: church logo, clear primary action */
.home-hero {
  padding: calc(22px + var(--safe-top)) 20px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 85% 10%, rgba(0, 127, 80, 0.28), transparent 40%),
    linear-gradient(160deg, #412986 0%, #352578 55%, #2b1f6b 100%);
}
.home-logo {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  padding: 8px;
  border-radius: 22px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 8px 20px rgba(24, 17, 61, 0.35);
}
.home-kicker { color: var(--gold-light); opacity: 1; font-weight: 700; }
.home-hero h1 { font-size: clamp(2.3rem, 9vw, 2.9rem); letter-spacing: -0.01em; }
.home-sub { max-width: 22rem; margin: 8px auto 0; }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.home-actions .pill-btn { min-height: 46px; font-size: 0.95rem; }
.home-actions #open-today { grid-column: 1 / -1; min-height: 52px; font-size: 1.05rem; background: var(--accent); box-shadow: 0 8px 18px rgba(0, 107, 69, 0.35); }
.home-actions #open-install-home { grid-column: 1 / -1; min-height: 40px; background: transparent; border: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Cards */
.home-main { display: grid; gap: 14px; }
.verse-of-day, .today-card { border-radius: 20px; box-shadow: 0 10px 26px rgba(65, 41, 134, 0.08); }
.today-label { color: var(--ready) !important; }
.today-label::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  margin-bottom: 8px;
  border-radius: 3px;
  background: var(--gold);
}
.today-card h2, .verse-of-day h2 { color: var(--blue); }
.pill-btn.dark { background: var(--blue); }
.pill-btn { min-height: 44px; }

/* Lesson header: quieter Home button, clearer title */
.study-bar { background: rgba(255, 255, 255, 0.96); }
.home-btn {
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  background: var(--blue);
  box-shadow: none;
  font-weight: 700;
}
.study-bar-copy strong { color: var(--blue); font-size: 1.05rem; }
.icon-btn { color: var(--blue); }

/* Lesson text */
.reading { padding-bottom: 36px; }
.reading h2 { color: var(--blue); }
.reading a { color: var(--ready); }

/* Bottom controls: one slim dock; Listen floats as a chip instead of a full-width bar */
.audio-bar.is-collapsed {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 8px;
  background: transparent;
  border-top: 0;
  pointer-events: none;
}
.audio-bar.is-collapsed .audio-chip { pointer-events: auto; box-shadow: 0 6px 16px rgba(0, 107, 69, 0.35); }
.audio-bar:not(.is-collapsed) { background: rgba(43, 31, 107, 0.97); }
.audio-chip::before { content: "\25B6"; margin-right: 6px; font-size: 0.75em; }
.study-dock { background: rgba(255, 255, 255, 0.97); padding-top: 8px; padding-bottom: calc(8px + var(--safe-bottom)); }
.study-dock .install-btn { display: none !important; }
.nav-btn { padding: 11px 10px; }
.nav-btn.primary { background: var(--blue); border-color: var(--blue); }

/* Reading-aloud highlight in brand gold */
.reading .is-speaking { background: rgba(201, 162, 39, 0.18); box-shadow: inset 3px 0 0 var(--gold); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
.view-study { background: #fff; }
