/* ==========================================================================
   In Woods of God-Realization — Sanctuary Design System
   Themes: Parchment Light (default), Warm Sepia, Midnight Dark
   Responsive: Native 100dvh Mobile · Two-Column Desktop Sanctuary (>=768px)
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg: #faf6ee;
  --bg-alt: #f3ece0;
  --surface: #ffffff;
  --surface-hover: #fffaf1;
  --rail-bg: #f4ede0;
  --edge: #e4d7c1;
  --edge-strong: #cfbda0;
  --ink: #261d14;
  --ink-soft: #433526;
  --muted: #786752;
  --faint: #9e8f79;
  --accent: #b84d16;
  --accent-deep: #8f370c;
  --accent-soft: #f5e3d1;
  --gold: #a37409;
  --gold-soft: #f7eed8;
  --green: #46663e;
  --green-soft: #eaf1e6;
  --story: #265947;
  --story-soft: #e4efe9;
  --header-a: #461d12;
  --header-b: #6e3319;
  --header-ink: #f8eedf;
  --player-bg: #26150e;
  --player-ink: #f8eedf;
  --shadow-sm: 0 2px 10px rgba(60, 35, 15, 0.06);
  --shadow-md: 0 10px 30px rgba(60, 35, 15, 0.10);
  --reading-scale: 1;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Noto Serif Devanagari", "Times New Roman", serif;
}

[data-theme="sepia"] {
  --bg: #efe3cc;
  --bg-alt: #e6d7bb;
  --surface: #f8efdd;
  --surface-hover: #fbf4e6;
  --rail-bg: #e7d8bc;
  --edge: #d3c09f;
  --edge-strong: #bca47d;
  --ink: #2b1e10;
  --ink-soft: #463420;
  --muted: #6e5940;
  --faint: #8e785c;
  --accent: #9e3f10;
  --accent-deep: #7a2d08;
  --accent-soft: #edd6be;
  --gold: #8c6205;
  --gold-soft: #efe1bf;
  --green: #3c5b35;
  --green-soft: #dfe9d9;
  --story: #214e3e;
  --story-soft: #d8e7df;
  --header-a: #3f1b11;
  --header-b: #632e17;
  --header-ink: #f6e9d5;
  --player-bg: #24140d;
  --player-ink: #f6e9d5;
  --shadow-sm: 0 2px 10px rgba(45, 25, 10, 0.09);
  --shadow-md: 0 10px 28px rgba(45, 25, 10, 0.14);
}

[data-theme="dark"] {
  --bg: #14110f;
  --bg-alt: #1b1613;
  --surface: #211b17;
  --surface-hover: #29221d;
  --rail-bg: #191411;
  --edge: #352b24;
  --edge-strong: #4d3e33;
  --ink: #efe5d8;
  --ink-soft: #d8cab8;
  --muted: #a99883;
  --faint: #7d6e5d;
  --accent: #e5883b;
  --accent-deep: #f2a35e;
  --accent-soft: #382417;
  --gold: #dfb04b;
  --gold-soft: #2e2515;
  --green: #88b87c;
  --green-soft: #1d281b;
  --story: #6ec2a3;
  --story-soft: #182b24;
  --header-a: #1d120e;
  --header-b: #2e1a12;
  --header-ink: #f5eadb;
  --player-bg: #0f0c0a;
  --player-ink: #f5eadb;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.48);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  transition: background-color 0.18s ease, color 0.18s ease;
}

a {
  color: var(--accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Top Sanctuary Bar ---------- */
.sanctuary-header {
  background: linear-gradient(135deg, var(--header-a), var(--header-b));
  color: var(--header-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 40;
}

.sh-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sh-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--header-ink);
  text-decoration: none;
}

.sh-om {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(243, 217, 168, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #f3d9a8;
  flex: none;
}

.sh-brand-text {
  display: flex;
  flex-direction: column;
}

.sh-brand-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
}

.sh-brand-sub {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
}

.sh-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12.5px;
}

.sh-link {
  color: rgba(248, 238, 223, 0.85);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 99px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.sh-link:hover,
.sh-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.sh-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
}

.theme-group,
.font-group {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  padding: 2px;
}

.tool-btn {
  background: none;
  border: none;
  color: rgba(248, 238, 223, 0.8);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.tool-btn:hover {
  color: #ffffff;
}

.tool-btn.active {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* ---------- Front Door (index.html) ---------- */
.home-hero {
  background: radial-gradient(960px 500px at 50% 0%, var(--header-b), var(--header-a) 72%);
  color: var(--header-ink);
  padding: 48px 20px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.home-hero .hero-om {
  font-size: 64px;
  line-height: 1;
  color: #f3d9a8;
  margin-bottom: 10px;
  opacity: 0.92;
}

.home-hero .kicker {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.8;
}

.home-hero h1 {
  font-size: clamp(30px, 5.5vw, 48px);
  font-weight: 600;
  line-height: 1.1;
  margin: 10px auto 8px;
  max-width: 780px;
}

.home-hero .lead {
  font-size: clamp(16px, 2.1vw, 19px);
  line-height: 1.62;
  max-width: 660px;
  margin: 10px auto 26px;
  opacity: 0.92;
}

.hero-quick-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.hero-pill {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: #f8eedf;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(243, 217, 168, 0.3);
  padding: 7px 14px;
  border-radius: 99px;
  text-decoration: none;
  transition: background 0.15s, transform 0.12s;
}

.hero-pill:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.home-main {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.door-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

@media (max-width: 680px) {
  .door-grid {
    grid-template-columns: 1fr;
  }
}

.door-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 20px;
  padding: 26px 24px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, border-color 0.18s ease;
}

.door-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.door-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #8f370c);
  margin-bottom: 14px;
}

.door-card.ask .door-icon {
  background: linear-gradient(145deg, #2b634f, #1d4436);
}

.door-card h2 {
  font-size: 23px;
  font-weight: 600;
  margin-bottom: 8px;
}

.door-card p {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.62;
  color: var(--muted);
  flex: 1;
}

.door-cta {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent-deep);
  margin-top: 16px;
}

.door-card.ask .door-cta {
  color: var(--story);
}

.section-head {
  margin-bottom: 16px;
}

.section-kicker {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-head h2 {
  font-size: 24px;
  font-weight: 600;
  margin-top: 3px;
}

.section-head p {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 4px;
}

/* Volumes 1-4 Shelf */
.vol-shelf {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 42px;
}

@media (max-width: 920px) {
  .vol-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .vol-shelf {
    grid-template-columns: 1fr;
  }
}

.vol-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.vol-card.live {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.vol-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--sans);
}

.vol-num {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.vol-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--story-soft);
  color: var(--story);
}

.vol-badge.upcoming {
  background: var(--gold-soft);
  color: var(--gold);
}

.vol-card h3 {
  font-size: 17px;
  line-height: 1.28;
}

.vol-card p {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  flex: 1;
}

.vol-stats {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding-top: 6px;
  border-top: 1px dashed var(--edge);
}

/* Channels & Android App Ecosystem Grid */
.eco-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

@media (max-width: 860px) {
  .eco-grid {
    grid-template-columns: 1fr;
  }
}

.eco-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.eco-tag {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.eco-card h3 {
  font-size: 19px;
  font-weight: 600;
}

.eco-card p {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.58;
  color: var(--muted);
  flex: 1;
}

.eco-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* ---------- Two-Column Sanctuary Layout (library.html) ---------- */
.sanctuary-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .sanctuary-shell {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    align-items: start;
  }
}

.sanctuary-rail {
  background: var(--rail-bg);
  border-bottom: 1px solid var(--edge);
  padding: 14px;
  font-family: var(--sans);
}

@media (min-width: 768px) {
  .sanctuary-rail {
    position: sticky;
    top: 56px;
    height: calc(100dvh - 56px);
    overflow-y: auto;
    border-right: 1px solid var(--edge);
    border-bottom: none;
    padding: 18px 14px 110px;
  }
}

.rail-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 6px 6px;
}

.rail-section-label:first-child {
  margin-top: 0;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 767px) {
  .rail-nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 6px;
  }
  .rail-chapters-wrap {
    display: none;
  }
}

.rail-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

@media (max-width: 767px) {
  .rail-btn {
    width: auto;
    background: var(--surface);
    border-color: var(--edge);
    border-radius: 99px;
    padding: 7px 13px;
    font-size: 12px;
  }
}

.rail-btn:hover {
  background: var(--surface);
}

.rail-btn.active {
  background: linear-gradient(145deg, var(--accent), #8f370c);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(184, 77, 22, 0.25);
}

.rail-count {
  font-size: 11px;
  opacity: 0.8;
  font-weight: 600;
}

/* Volume mini switcher in rail */
.vol-mini-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.vol-mini-btn {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.vol-mini-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* Rail quick chapter list (desktop) */
.rail-ch-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}

.rail-ch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.rail-ch-item:hover {
  background: var(--surface);
}

.rail-ch-item.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

.rail-ch-num {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rail-ch-item.active .rail-ch-num {
  background: var(--accent);
  color: #ffffff;
}

.rail-ch-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Center Reading Canvas (68ch serif sanctuary) */
.sanctuary-main {
  min-width: 0;
  padding: 24px 20px 128px;
}

.reading-canvas {
  max-width: 68ch;
  width: 100%;
  margin: 0 auto;
  font-size: calc(1rem * var(--reading-scale));
}

.browse-canvas {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

/* Search & Filter Controls */
.search-bar-wrap {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  padding: 11px 15px;
  border-radius: 12px;
  border: 1px solid var(--edge-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 77, 22, 0.18);
}

/* Cards: Chapters, Stories, Principles, Glossary */
.ch-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  text-align: left;
  width: 100%;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.16s ease, background 0.16s ease;
}

.ch-card.clickable {
  cursor: pointer;
}

.ch-card.clickable:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.ch-num {
  flex: none;
  width: 48px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--accent), #8f370c);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.ch-num.story {
  background: linear-gradient(150deg, #2b634f, #1d4436);
}

.ch-num small {
  font-family: var(--sans);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  opacity: 0.88;
}

.ch-num b {
  font-size: 21px;
  line-height: 1.05;
}

.ch-main {
  flex: 1;
  min-width: 0;
}

.ch-title {
  font-size: calc(1.12rem * var(--reading-scale));
  font-weight: 600;
  line-height: 1.28;
}

.ch-note {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
}

.story-snip {
  font-size: calc(0.92rem * var(--reading-scale));
  color: var(--ink-soft);
  line-height: 1.55;
  margin-top: 6px;
  font-style: italic;
}

.story-illus {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--story);
  margin-top: 7px;
  line-height: 1.45;
}

.ch-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.pill {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  text-decoration: none;
}

.pill.g {
  background: var(--story-soft);
  color: var(--story);
}

.pill.y {
  background: var(--gold-soft);
  color: var(--gold);
}

/* Chapter Reading Header & Tabs */
.chapter-hero {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 18px;
  padding: 20px 22px 0;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.ch-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-family: var(--sans);
}

.back-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--edge);
  background: var(--bg-alt);
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
}

.back-pill:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.chapter-hero h1 {
  font-size: calc(1.65rem * var(--reading-scale));
  line-height: 1.2;
  font-weight: 600;
}

.chapter-hero .lecture-note {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
}

.chapter-tabs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  border-top: 1px solid var(--edge);
}

.ch-tab {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  padding: 11px 14px;
  border: none;
  background: none;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.ch-tab.active {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
}

/* Audio Banner & Controls Row */
.audio-banner {
  background: var(--gold-soft);
  border: 1px solid var(--edge-strong);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.audio-banner code {
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11.5px;
}

.ab-head {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent-deep);
  margin-bottom: 4px;
}

.ab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.14s, transform 0.1s;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn.story-cta {
  background: #2b634f;
  border-color: #2b634f;
  color: #ffffff;
}

.btn.ghost {
  background: transparent;
  border-color: var(--edge-strong);
  color: var(--ink-soft);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.controls-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-family: var(--sans);
  font-size: 12.5px;
}

.resume-chip {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  cursor: pointer;
}

/* Segment Cards */
.seg {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 15px;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.seg::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: background 0.2s;
}

.seg.active {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.seg.active::before {
  background: var(--accent);
}

.seg.flash {
  animation: segFlash 1.6s ease;
}

@keyframes segFlash {
  0%, 30% { background: var(--accent-soft); }
  100% { background: var(--surface); }
}

.seg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  cursor: pointer;
  user-select: none;
}

.seg-num {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seg.active .seg-num {
  background: var(--accent);
  color: #ffffff;
}

.seg-titles {
  flex: 1;
  min-width: 0;
}

.seg-title {
  font-size: calc(1.04rem * var(--reading-scale));
  font-weight: 600;
  line-height: 1.3;
}

.seg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
}

.tag {
  padding: 1px 8px;
  border-radius: 99px;
  font-weight: 700;
}

.tag.story {
  background: var(--story-soft);
  color: var(--story);
}

.tag.statement {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.seg-actions-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.icon-action {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 13px;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}

.icon-action:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.icon-action.saved {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold);
}

.seg-caret {
  color: var(--faint);
  font-size: 13px;
  transition: transform 0.18s;
  padding-left: 2px;
}

.seg.open .seg-caret {
  transform: rotate(180deg);
  color: var(--accent-deep);
}

.seg-prog {
  height: 3px;
  background: transparent;
  position: relative;
}

.seg-prog i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent);
}

.seg-body {
  display: none;
  padding: 4px 18px 18px;
}

.seg.open .seg-body,
.seg.static-open .seg-body {
  display: block;
}

.seg-body p,
.prose-body p {
  font-size: calc(1.03rem * var(--reading-scale));
  line-height: 1.74;
  margin: 11px 0;
  color: var(--ink-soft);
}

.callout {
  border-radius: 11px;
  padding: 12px 15px;
  margin-top: 12px;
}

.callout .lab {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.takeaway {
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
}

.takeaway .lab {
  color: var(--gold);
}

.takeaway div {
  font-size: calc(0.94rem * var(--reading-scale));
  line-height: 1.56;
  color: var(--ink);
}

.reflection {
  background: var(--green-soft);
  border-left: 3px solid var(--green);
}

.reflection .lab {
  color: var(--green);
}

.reflection div {
  font-size: calc(0.94rem * var(--reading-scale));
  line-height: 1.56;
  font-style: italic;
  color: var(--ink);
}

.seg-foot-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--edge);
  font-family: var(--sans);
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
}

.mini-chip:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.mini-chip.active {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold);
}

.note-box {
  margin-top: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--edge);
  border-radius: 11px;
  padding: 10px 12px;
  font-family: var(--sans);
}

.note-box textarea {
  width: 100%;
  min-height: 68px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.note-status {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

/* Principle Cards */
.prin-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 15px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.prin-card h3 {
  font-size: calc(1.08rem * var(--reading-scale));
  font-weight: 600;
  line-height: 1.3;
  color: var(--accent-deep);
  margin-bottom: 6px;
}

.prin-card p {
  font-size: calc(0.95rem * var(--reading-scale));
  line-height: 1.62;
  color: var(--ink-soft);
}

.prin-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.lnk {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 99px;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}

.lnk.teach {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.lnk.story {
  background: var(--story-soft);
  color: var(--story);
}

.lnk.share {
  background: var(--bg);
  border-color: var(--edge);
  color: var(--muted);
}

.lnk:hover {
  filter: brightness(0.96);
}

/* Glossary Cards */
.glossary-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 15px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.glossary-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.glossary-term {
  font-size: calc(1.14rem * var(--reading-scale));
  font-weight: 700;
  color: var(--accent-deep);
}

.glossary-sanskrit {
  font-size: 15px;
  color: var(--gold);
  font-weight: 600;
}

/* Sticky Full-Width Bottom Player Bar */
.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--player-bg);
  color: var(--player-ink);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.32);
  padding: 10px 18px 12px;
}

.player-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pbtn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--player-ink);
  border-radius: 99px;
  height: 34px;
  padding: 0 10px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pbtn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.play-main-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #eb973e, #c2571b);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(194, 87, 27, 0.45);
}

.player-info {
  flex: 1;
  min-width: 180px;
  font-family: var(--sans);
}

.player-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sub {
  font-size: 11px;
  opacity: 0.72;
  font-variant-numeric: tabular-nums;
}

.player-extras {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
}

.speed-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f3d9a8;
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.seek-slider {
  width: 100%;
  accent-color: #eb973e;
  height: 5px;
  cursor: pointer;
}

/* ---------- Ask Rama Sanctuary (ask.html) ---------- */
.ask-shell {
  flex: 1;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ask-intro-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.ask-intro-card h1 {
  font-size: calc(1.55rem * var(--reading-scale));
  margin-bottom: 6px;
}

.ask-intro-card p {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.lang-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 10px 0 8px;
}

.lang-tab {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}

.lang-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.starter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.starter-chip {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--accent-deep);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.starter-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.ask-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg-you {
  align-self: flex-end;
  background: linear-gradient(145deg, var(--accent), #8f370c);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 18px 18px 4px 18px;
  max-width: 85%;
  font-size: calc(1rem * var(--reading-scale));
  box-shadow: var(--shadow-sm);
}

.ans-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.ans-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.ans-card blockquote {
  border-left: 3.5px solid var(--gold);
  background: var(--gold-soft);
  padding: 13px 16px;
  border-radius: 0 12px 12px 0;
  font-size: calc(1.05rem * var(--reading-scale));
  line-height: 1.65;
  color: var(--ink);
}

.ans-card blockquote cite {
  display: block;
  font-style: normal;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}

.ans-summary {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-top: 12px;
}

.ans-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ans-expand {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--edge);
}

.ans-expand h4 {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.ask-composer {
  position: sticky;
  bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--edge-strong);
  border-radius: 24px;
  padding: 8px 10px 8px 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.ask-composer textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.45;
  padding: 6px 0;
  resize: none;
  max-height: 130px;
}

.ask-composer textarea:focus {
  outline: none;
}

.ask-send-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #eb973e, var(--accent));
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Static SEO Pages (chapters/*.html & parables/*.html) ---------- */
.seo-page-wrap {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 64px;
  font-size: calc(1rem * var(--reading-scale));
}

.breadcrumb {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--accent-deep);
  text-decoration: none;
  font-weight: 600;
}

.seo-hero-card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 20px;
  padding: 26px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-md);
}

.seo-hero-card h1 {
  font-size: calc(1.85rem * var(--reading-scale));
  line-height: 1.18;
  margin: 8px 0 10px;
}

.seo-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 600px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}

.related-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.14s, transform 0.12s;
}

.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.related-card h4 {
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--accent-deep);
}

.related-card p {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--edge);
  background: var(--bg-alt);
  padding: 24px 20px;
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

.site-footer a {
  color: var(--accent-deep);
  text-decoration: none;
  font-weight: 600;
}

/* Toast Notification */
.sanctuary-toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: #23160f;
  color: #f8eedf;
  border: 1px solid rgba(243, 217, 168, 0.35);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 99px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

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