:root {
  --ink: #0B0F1E;
  --violet: #241640;
  --gold: #F2A65A;
  --rose: #E8607B;
  --paper: #F7F3EA;
  --paper-55: rgba(247, 243, 234, 0.55);
  --paper-40: rgba(247, 243, 234, 0.4);
  --hairline: rgba(255, 255, 255, 0.08);
  --card: rgba(255, 255, 255, 0.04);
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #050710;
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

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

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--ink);
  overflow-x: hidden;
}

/* ---- Starfield (ambient, decorative) ---- */
#starfield {
  position: fixed;
  inset: 0;
  max-width: 480px;
  margin: 0 auto;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0.5;
  animation: twinkle 3.5s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .star { animation: none; opacity: 0.35; }
}

main {
  position: relative;
  z-index: 1;
  padding: 3.5rem 1.25rem 6.5rem;
}

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 0.35rem;
}

h1.headline {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.scar-line { width: 9rem; height: 1rem; margin: 0.75rem 0 0; opacity: 0.9; }

/* ---- Cards ---- */
.card {
  background: linear-gradient(150deg, var(--violet), var(--ink));
  border: 1px solid var(--hairline);
  border-radius: 1rem;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.dose-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-weight: 600; }

.quote-text { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.45; margin: 0.75rem 0; }

.quote-who { font-size: 0.75rem; color: var(--paper-55); margin: 0; }

.row-between { display: flex; align-items: center; justify-content: space-between; }

/* ---- Chips ---- */
.chip-row { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.15rem 0 0.5rem; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--hairline);
  background: var(--card);
  color: var(--paper-55);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip[aria-pressed="true"] { color: var(--ink); background: var(--gold); border-color: var(--gold); font-weight: 700; }

/* ---- Section headers ---- */
.section-title { font-size: 0.9rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.see-all { font-size: 0.72rem; color: var(--gold); display: inline-flex; align-items: center; gap: 0.1rem; }

/* ---- Poem card ---- */
.poem-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  text-align: left;
  width: 100%;
}
.poem-dot { flex-shrink: 0; width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.audio-meta { flex: 1; min-width: 0; }
.audio-title { font-size: 0.85rem; font-weight: 600; margin: 0 0 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-sub { font-size: 0.72rem; color: var(--paper-55); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poem-source { font-size: 0.6rem; color: var(--gold); margin-top: 0.2rem; }

/* ---- Inline audio player (poem detail) ---- */
.audio-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 1rem;
  padding: 0.85rem;
}
.play-btn {
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.progress-track { height: 3px; border-radius: 3px; background: rgba(255,255,255,0.1); margin-top: 0.5rem; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; width: 0%; transition: width 0.2s linear; }

/* ---- Poem detail screen ---- */
.poem-detail-body {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--paper);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 1rem;
  padding: 1.25rem;
  margin-top: 0.75rem;
}
.poem-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

/* ---- Reads ---- */
.reads-scroll { display: flex; gap: 0.75rem; overflow-x: auto; padding: 0.15rem 0.15rem 0.5rem; scrollbar-width: none; }
.reads-scroll::-webkit-scrollbar { display: none; }
.read-tile { flex-shrink: 0; width: 8rem; height: 10rem; border-radius: 0.85rem; padding: 0.75rem; display: flex; align-items: flex-end; }
.read-tile span { font-size: 0.72rem; font-weight: 700; color: var(--ink); line-height: 1.25; }

.read-row {
  display: flex; align-items: center; gap: 1rem;
  background: var(--card); border: 1px solid var(--hairline); border-radius: 1rem; padding: 0.85rem; margin-bottom: 0.65rem;
}
.read-swatch { width: 3.4rem; height: 4rem; border-radius: 0.5rem; flex-shrink: 0; }
.read-tag { font-size: 0.6rem; letter-spacing: 0.04em; color: var(--gold); margin-top: 0.25rem; }

/* ---- Page header (sub-screens) ---- */
.page-header { display: flex; align-items: center; gap: 0.5rem; padding-bottom: 0.25rem; }
.back-btn { display: flex; align-items: center; }
.page-header h1 { font-family: var(--font-display); font-size: 1.25rem; margin: 0; }
.page-sub { font-size: 0.75rem; color: var(--paper-55); margin: 0.35rem 0 1rem; }

/* ---- Quotes screen ---- */
.quote-card { min-height: 15rem; display: flex; flex-direction: column; justify-content: space-between; }
.quote-nav { display: flex; justify-content: space-between; margin-top: 1rem; }
.nav-btn { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; padding: 0.5rem 0.9rem; border-radius: 999px; }
.nav-btn.prev { background: var(--card); color: var(--paper); }
.nav-btn.next { background: var(--gold); color: var(--ink); font-weight: 700; }
.icon-btn { color: var(--paper-55); }
.icon-btn[aria-pressed="true"] { color: var(--rose); }

/* ---- Bible screen ---- */
.bible-card { text-align: center; padding: 2rem 1.25rem; }
.bible-cta { display: block; width: 100%; margin-top: 1.5rem; padding: 0.85rem; border-radius: 999px; background: var(--gold); color: var(--ink); font-weight: 700; font-size: 0.9rem; text-align: center; text-decoration: none; }
.bible-note { font-size: 0.65rem; color: var(--paper-40); margin-top: 0.6rem; }

/* ---- Tab bar ---- */
nav#tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; justify-content: space-around;
  padding: 0.6rem 0.5rem calc(1.1rem + env(safe-area-inset-bottom));
  background: rgba(11, 15, 30, 0.94);
  border-top: 1px solid var(--hairline);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.tab-btn { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.25rem 0.4rem; color: var(--paper-40); }
.tab-btn[aria-current="page"] { color: var(--gold); }
.tab-btn span { font-size: 0.58rem; }

/* ---- Splash screen (initial launch frame) ---- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: radial-gradient(ellipse at 50% 42%, var(--violet) 0%, var(--ink) 70%);
  transition: opacity 0.6s ease;
}
#splash.splash-hide {
  opacity: 0;
  pointer-events: none;
}
#splash img {
  width: 128px;
  height: 128px;
  border-radius: 28px;
  box-shadow: 0 0 60px rgba(242, 166, 90, 0.25);
  animation: splash-pulse 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  #splash img { animation: none; }
}
@keyframes splash-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}
#splash-wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
#splash-scars-to {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--paper);
}
#splash-stars {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  letter-spacing: 0.08em;
  color: var(--gold);
}

/* ---- Age gate ---- */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 7, 16, 0.94);
  backdrop-filter: blur(6px);
}
.age-gate.visible { display: flex; }
.age-gate-card {
  max-width: 380px;
  width: 100%;
  background: linear-gradient(160deg, var(--violet), var(--ink));
  border: 1px solid var(--hairline);
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem;
  text-align: center;
}
.age-gate-card .headline { font-size: 1.3rem; }
.age-gate-card .page-sub { text-align: left; }

/* ---- Utility ---- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
