:root {
  --bg: #f4f8fb;
  --bg-elev: #ffffff;
  --bg-soft: #e5eef5;
  --text: #1a2935;
  --text-soft: #4a5d70;
  --text-mute: #7f8d9c;
  --border: #c8d6e2;
  --border-soft: #e2eaf1;
  --accent: #4a90c2;
  --accent-hover: #6cacd3;
  --accent-soft: #dceaf3;
  --highlight: #fff3c4;
  --shadow-sm: 0 1px 2px rgba(30, 50, 70, 0.06);
  --shadow: 0 4px 14px rgba(30, 50, 70, 0.1);
  --shadow-lg: 0 12px 32px rgba(30, 50, 70, 0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --max-w: 760px;
  --max-w-wide: 1100px;
}

[data-theme="dark"] {
  --bg: #0d1721;
  --bg-elev: #18232e;
  --bg-soft: #1f2b39;
  --text: #d8e4ee;
  --text-soft: #95a8be;
  --text-mute: #6e7f93;
  --border: #2c3a4e;
  --border-soft: #1f2a3a;
  --accent: #6cacd3;
  --accent-hover: #8fc4e0;
  --accent-soft: #1d2c3a;
  --highlight: #3a3c1d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ===== Header ===== */
.site-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.brand-mark {
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--serif);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav a {
  color: var(--text-soft);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
}

.nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--accent);
}

.version-select {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  max-width: 11rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.version-select:hover { border-color: var(--accent); }
.version-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ===== Layout ===== */
main {
  flex: 1;
  width: 100%;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.2rem;
}

/* En la home, la tarjeta de versículo va más arriba (el .container sigue al hero) */
.hero + .container {
  padding-top: 0.5rem;
}

.container-wide {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 2.5rem 1.2rem;
}

/* ===== Hero (home) ===== */
.hero {
  text-align: center;
  padding: 1.6rem 1.2rem 0.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.hero p {
  color: var(--text-soft);
  font-size: 1.1rem;
  margin: 0 0 1.8rem;
}

.hero-actions {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.98rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-soft);
  text-decoration: none;
  border-color: var(--text-mute);
}

/* ===== Cards ===== */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow);
}

.cards {
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card-link {
  text-decoration: none;
  color: var(--text);
  display: block;
}

.card-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.card-link h3 {
  font-family: var(--serif);
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--text);
  font-weight: 600;
}

.card-link p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ===== Versículo del día ===== */
.vod {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.8rem;
  margin: 2.5rem 0;
  position: relative;
  box-shadow: var(--shadow);
}

.vod-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.vod-text {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  line-height: 1.6;
  color: var(--text);
  font-weight: 400;
  margin: 0 0 1rem;
}

.vod-ref {
  font-size: 0.92rem;
  color: var(--text-soft);
  font-style: italic;
}

.vod-ref a {
  color: var(--accent);
  font-weight: 500;
}

/* ===== Fragmento aleatorio (home) ===== */
.frag {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
  margin: 1rem 0 2.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.frag-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.2rem;
}

.frag-body {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.55;
  color: var(--text);
  text-align: center;
  margin: 0 auto 1.3rem;
  max-width: 620px;
  min-height: 2.4em;
}

.frag-ref {
  font-size: 0.95rem;
  color: var(--text-soft);
  font-style: italic;
  margin: 0 0 1.6rem;
}

.frag-ref a {
  color: var(--accent);
  font-weight: 500;
  font-style: normal;
}

.frag-actions {
  display: flex;
  justify-content: center;
}

/* Descargar / compartir imagen del fragmento */
.frag-share {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.frag-share .btn {
  padding: 0.6rem 1.1rem;
  font-size: 0.92rem;
}

.frag-share .btn.cargando {
  opacity: 0.6;
  pointer-events: none;
}

/* Menú de compartir (PC) */
.share-wrap {
  position: relative;
  display: inline-block;
}

.share-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: 260px;
  max-width: 86vw;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  text-align: left;
}

.share-menu[hidden] {
  display: none;
}

.share-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  text-align: left;
}

.share-item:hover {
  background: var(--bg-soft);
}

.share-item svg {
  color: var(--accent);
  flex-shrink: 0;
}

.share-sep {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  font-weight: 600;
  padding: 0.7rem 0.7rem 0.4rem;
  border-top: 1px solid var(--border-soft);
  margin-top: 0.4rem;
}

.share-nets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.2rem 0.4rem 0.4rem;
}

.share-net {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 46%;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.share-net-icon {
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.75rem;
  font-weight: 800;
}

.share-note {
  margin: 0.25rem 0.4rem 0.35rem;
  color: var(--text-mute);
  font-size: 0.75rem;
  line-height: 1.35;
}

.share-net:hover {
  color: #fff;
  text-decoration: none;
  filter: brightness(1.08);
}

.net-wa { background: #25d366; }
.net-x { background: #14171a; }
.net-fb { background: #1877f2; }
.net-tg { background: #2aabee; }
.net-gmail { background: #ea4335; }
.net-pin { background: #e60023; }
.net-ig {
  background: #d6249f;
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}

[data-theme="dark"] .net-x { background: #2b3137; }

/* Aviso flotante (toast) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(1rem);
  background: var(--text);
  color: var(--bg);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.btn-lg {
  padding: 0.95rem 1.9rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.btn-lg:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

/* ===== Lector / Libros ===== */
.section-title {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  letter-spacing: -0.005em;
}

.section-sub {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin: 2rem 0 0.8rem;
  font-weight: 600;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.book-tile {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.book-tile:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
}

.book-tile-count {
  font-size: 0.78rem;
  color: var(--text-mute);
}

/* ===== Selector capítulos ===== */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 0.4rem;
  margin: 1.2rem 0 2rem;
}

.chapter-tile {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: all 0.12s ease;
}

.chapter-tile:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}

.chapter-tile.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== Breadcrumb (páginas estáticas) ===== */
.breadcrumb {
  max-width: 680px;
  margin: 0 auto 0.5rem;
  font-size: 0.82rem;
  color: var(--text-mute);
  line-height: 1.5;
}

.breadcrumb a {
  color: var(--text-soft);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb .sep {
  margin: 0 0.35rem;
  color: var(--border);
  user-select: none;
}

.breadcrumb .current {
  color: var(--text);
}

/* ===== Reading view ===== */
.reader-header {
  text-align: center;
  margin: 1.5rem 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.reader-book {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-mute);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.reader-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.reader-body {
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.85;
  color: var(--text);
  max-width: 680px;
  margin: 0 auto;
}

.reader-body p {
  margin: 0 0 1rem;
  text-align: justify;
  hyphens: auto;
}

.verse {
  display: inline;
}

.verse-num {
  font-family: var(--sans);
  font-size: 0.7em;
  font-weight: 600;
  color: var(--accent);
  vertical-align: super;
  line-height: 0;
  margin-right: 0.25em;
  margin-left: 0.15em;
  user-select: none;
}

.verse:first-child .verse-num {
  margin-left: 0;
}

.verse:target,
.verse.highlight {
  background: var(--highlight);
  border-radius: 3px;
  padding: 0 3px;
  transition: background 1.2s ease;
}

/* Navegación entre capítulos */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-soft);
}

.chapter-nav a {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  max-width: 48%;
}

.chapter-nav a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  text-decoration: none;
}

.chapter-nav a.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.chapter-nav .next {
  justify-content: flex-end;
  text-align: right;
  margin-left: auto;
}

.chapter-nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  display: block;
}

.chapter-nav-text {
  font-weight: 500;
}

/* ===== Marcas con notas (guardadas en el navegador) ===== */
.marcar {
  max-width: 680px;
  margin: 2.5rem auto 0;
  text-align: center;
}

.marcar-form {
  margin: 0 auto;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.marcar-form textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}

.marcar-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.marcar-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.marcada {
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}

.marcada-estado {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.marcada-nota {
  color: var(--text);
  white-space: pre-wrap;
  margin: 0.3rem 0 0.8rem;
}

.marcada-nota.vacia {
  color: var(--text-mute);
  font-style: italic;
}

/* Página "Mis marcas" */
.marca-item {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.8rem;
  box-shadow: var(--shadow-sm);
}

.marca-item-ref {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.marca-item-nota {
  color: var(--text-soft);
  white-space: pre-wrap;
  margin: 0.3rem 0;
  line-height: 1.55;
}

.marca-item-fecha {
  font-size: 0.78rem;
  color: var(--text-mute);
}

.marca-item-acciones {
  margin-top: 0.6rem;
  display: flex;
  gap: 1rem;
  font-size: 0.88rem;
}

.marca-item-nota.vacia {
  color: var(--text-mute);
  font-style: italic;
}

.marcada-link {
  margin: 0.8rem 0 0;
  font-size: 0.9rem;
}

/* Barra Exportar / Importar de "Mis marcas" */
.marcas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
}

.marcas-cuenta {
  color: var(--text-mute);
  font-size: 0.85rem;
}

.marcas-acciones {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.marcas-acciones .btn {
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
}

/* ===== Buscador ===== */
.search-box {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.search-input {
  flex: 1;
  padding: 0.85rem 1.1rem;
  font-size: 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-info {
  color: var(--text-soft);
  font-size: 0.92rem;
  margin: 1rem 0;
}

.search-result {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.search-result:last-child {
  border-bottom: none;
}

.search-ref {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.search-ref a {
  color: var(--accent);
}

.search-text {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--text);
}

.search-text mark {
  background: var(--highlight);
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
}

.search-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-mute);
}

/* ===== Form helpers ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 1rem 0;
}

.field label {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 500;
}

.field select {
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

/* ===== Pages: misc ===== */
.lead {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--text-soft);
  line-height: 1.65;
}

.prose h2 {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  margin: 2.2rem 0 0.6rem;
  letter-spacing: -0.005em;
}

.prose h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.6rem 0 0.4rem;
}

.prose p, .prose ul, .prose ol {
  margin: 0.8rem 0;
  line-height: 1.7;
}

.prose ul {
  padding-left: 1.4rem;
}

.prose li {
  margin: 0.3rem 0;
}

.callout {
  border-left: 3px solid var(--accent);
  background: var(--bg-elev);
  padding: 1rem 1.2rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5rem 0;
}

.callout p {
  margin: 0;
}

.code-block {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9rem;
  overflow-x: auto;
  color: var(--text);
}

/* ===== Loader ===== */
.loader {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-mute);
}

.loader::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border-soft);
  background: var(--bg-elev);
  padding: 2rem 1.2rem;
  text-align: center;
  margin-top: 3rem;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.site-footer p {
  margin: 0.25rem 0;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.site-footer a {
  color: var(--text-soft);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header-inner {
    padding: 0.7rem 1rem;
  }
  .brand {
    font-size: 1.05rem;
  }
  .nav a {
    padding: 0.4rem 0.6rem;
    font-size: 0.88rem;
  }
  .nav {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .version-select {
    font-size: 0.8rem;
    max-width: 9rem;
    padding: 0.35rem 0.5rem;
  }
  .container, .container-wide {
    padding: 1.8rem 1rem;
  }
  .hero {
    padding: 2rem 1rem 1.5rem;
  }
  .vod {
    padding: 1.5rem 1.2rem;
  }
  .reader-body {
    font-size: 1.22rem;
    line-height: 1.8;
  }
  .reader-body p {
    text-align: left;
    hyphens: none;
  }
  .chapter-nav a {
    padding: 0.7rem 0.85rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 420px) {
  .nav a {
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
  }
  .theme-toggle {
    width: 34px;
    height: 34px;
  }
}

/* Print friendly */
@media print {
  .site-header, .site-footer, .chapter-nav { display: none; }
  body { background: #fff; color: #000; }
  .reader-body { font-size: 12pt; }
}
