/* ==========================================================================
   Dharma Path: design tokens
   Ivory and ink with antique gold. Editorial serif for display, Inter for UI,
   Noto Serif Devanagari for scripture.
   ========================================================================== */
:root {
  --bg: #f6f1e9;
  --surface: #fffcf7;
  --surface-2: #efe7da;
  --ink: #1d1915;
  --ink-2: #4a4239;
  --muted: #877c6f;
  --line: rgba(29, 25, 21, 0.1);
  --line-strong: rgba(29, 25, 21, 0.18);
  --gold: #9c7633;
  --gold-soft: rgba(156, 118, 51, 0.12);
  --kumkum: #8e2b20;
  --night: #16120e;
  --night-2: #241d16;
  --night-ink: #f3ead9;
  --night-muted: #b8a88f;
  --night-gold: #d4b06a;
  --shadow: 0 1px 2px rgba(29, 25, 21, 0.04), 0 8px 24px rgba(29, 25, 21, 0.05);
  --radius: 20px;
  --radius-sm: 14px;
  --display: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --deva: "Noto Serif Devanagari", "Tiro Devanagari Sanskrit", serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f0d0b;
  --surface: #18140f;
  --surface-2: #221c16;
  --ink: #f1e9dc;
  --ink-2: #d2c6b4;
  --muted: #9a8d7c;
  --line: rgba(241, 233, 220, 0.09);
  --line-strong: rgba(241, 233, 220, 0.16);
  --gold: #d1ac64;
  --gold-soft: rgba(209, 172, 100, 0.12);
  --kumkum: #d77a69;
  --night: #1c1712;
  --night-2: #2a2219;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button { font: inherit; color: inherit; }

.app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.32rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand .mark {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--deva);
  font-size: 0.95rem;
  line-height: 1;
}
.icon-btn {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn svg, .tabbar svg, .ico {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 600px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tabbar a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.tabbar a.active { color: var(--ink); }
.tabbar a.active svg { stroke: var(--gold); }
.tabbar a.active::before {
  content: "";
  position: absolute;
  top: -9px;
  width: 18px; height: 2px;
  border-radius: 2px;
  background: var(--gold);
}

/* ---------- Layout & type ---------- */
main { padding: 6px 18px 28px; outline: none; }
.section { margin-top: 30px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 2px 12px;
}
.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: 0.005em;
}
.section-head a, .link {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--gold);
}
.lede { color: var(--ink-2); margin: 4px 2px 18px; }
.meta { color: var(--muted); font-size: 0.8rem; }
.page-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 2.1rem;
  line-height: 1.1;
  margin: 10px 2px 6px;
}
.page-sub { color: var(--muted); margin: 0 2px 18px; font-size: 0.9rem; }

.greeting { margin: 10px 2px 0; }
.greeting .date { color: var(--muted); font-size: 0.82rem; letter-spacing: 0.02em; }
.greeting h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.12;
  margin: 2px 0 4px;
}
.greeting .hindu { color: var(--gold); font-size: 0.82rem; letter-spacing: 0.02em; }

/* ---------- Surfaces ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}
a.card { display: block; text-decoration: none; color: inherit; }
.card.flush { padding: 0; overflow: hidden; }

.night {
  position: relative;
  overflow: hidden;
  color: var(--night-ink);
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(212, 176, 106, 0.18), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(142, 43, 32, 0.22), transparent 60%),
    linear-gradient(160deg, var(--night-2), var(--night));
  border-radius: 24px;
  padding: 26px 22px;
  box-shadow: 0 18px 40px rgba(22, 18, 14, 0.18);
  text-decoration: none;
  display: block;
  margin-bottom: 14px;
}
.night .eyebrow { color: var(--night-gold); }
.night .meta { color: var(--night-muted); }
.night .mandala {
  position: absolute;
  right: -70px; top: -70px;
  width: 260px; height: 260px;
  color: var(--night-gold);
  opacity: 0.16;
  pointer-events: none;
}
.night > *:not(.mandala) { position: relative; }

.verse-hero .deva-text {
  font-family: var(--deva);
  color: var(--night-gold);
  font-size: 1.04rem;
  line-height: 1.85;
  margin: 14px 0 12px;
  white-space: pre-line;
}
.verse-hero blockquote {
  margin: 0 0 14px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.42rem;
  line-height: 1.32;
}
.verse-hero .cite { font-size: 0.78rem; color: var(--night-muted); letter-spacing: 0.04em; }

/* ---------- Ornament ---------- */
.orn { display: flex; align-items: center; gap: 10px; margin: 26px 0; color: var(--gold); }
.orn::before, .orn::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.orn span { width: 6px; height: 6px; transform: rotate(45deg); border: 1px solid currentColor; }

/* ---------- Seal: Devanagari monogram ---------- */
.seal {
  flex: none;
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--deva);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1;
  text-align: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--gold) 22%, transparent);
}
.seal.m { font-size: 0.82rem; }
.seal.s { font-size: 0.66rem; }
.seal.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.35rem; }
.seal.lg.m { font-size: 1.05rem; }
.seal.lg.s { font-size: 0.85rem; }
.night .seal { background: rgba(212, 176, 106, 0.12); color: var(--night-gold); border-color: rgba(212, 176, 106, 0.3); }

/* ---------- Grouped lists ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--line);
}
.list > .row:first-child { border-top: 0; }
.row .body { flex: 1; min-width: 0; }
.row h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.25;
}
.row p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.row .chev { color: var(--muted); font-size: 1.1rem; }
a.row:active { background: var(--surface-2); }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.tag.gold { border-color: color-mix(in srgb, var(--gold) 45%, transparent); color: var(--gold); }
.night .tag { border-color: rgba(243, 234, 217, 0.25); color: var(--night-ink); }

/* ---------- Date block ---------- */
.dateblock {
  flex: none;
  width: 50px;
  text-align: center;
  line-height: 1;
}
.dateblock .d { display: block; font-family: var(--display); font-weight: 600; font-size: 1.7rem; }
.dateblock .m { display: block; margin-top: 4px; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }

/* ---------- Chips & buttons ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px; padding: 2px 20px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.chip .dv { font-family: var(--deva); color: var(--gold); font-size: 0.85rem; }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.active .dv { color: var(--bg); opacity: 0.8; }
.night .chip { background: transparent; color: var(--night-ink); border-color: rgba(243, 234, 217, 0.22); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.gold { background: var(--night-gold); border-color: var(--night-gold); color: #1a140d; }
.night .btn.ghost { color: var(--night-ink); border-color: rgba(243, 234, 217, 0.28); }
.btn[disabled] { opacity: 0.5; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.segmented {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  gap: 2px;
  margin-bottom: 14px;
}
.segmented button {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 7px 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.search {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 16px 11px 40px;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}
.search:focus { border-color: var(--gold); }
.search-wrap { position: relative; margin-bottom: 12px; }
.search-wrap .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-head .title { flex: 1; }
.cal-head h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.4rem; line-height: 1.1; }
.cal-head .meta { margin-top: 3px; }
.cal-nav {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
}
.cal-nav.off { opacity: 0.25; pointer-events: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .wd { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.12em; color: var(--muted); padding-bottom: 8px; }
.cell {
  position: relative;
  aspect-ratio: 1 / 1.02;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.cell.out { visibility: hidden; }
.cell.past { color: var(--muted); }
.cell .moon { position: absolute; top: 2px; right: 4px; font-size: 0.58rem; color: var(--muted); line-height: 1; }
.cell .dots { display: flex; gap: 3px; height: 5px; margin-top: 3px; }
.cell .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: 0.55; }
.cell .dots i.f { background: var(--gold); opacity: 1; }
.cell.fest .n { color: var(--gold); font-weight: 700; }
.cell.today { background: var(--ink); color: var(--bg); }
.cell.today .n, .cell.today .moon { color: var(--bg); }
.cell.today .dots i { background: var(--bg); }
.cal-legend { display: flex; gap: 16px; justify-content: center; margin-top: 12px; color: var(--muted); font-size: 0.7rem; flex-wrap: wrap; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.cal-legend i.f { background: var(--gold); }

.loc-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 0.78rem; margin: 2px 2px 14px; }
.loc-line a { color: var(--gold); text-decoration: none; font-weight: 500; }

/* Day hero */
.day-hero { text-align: center; padding: 28px 54px; }
.day-hero .big { font-family: var(--display); font-weight: 600; font-size: 4.4rem; line-height: 1; margin: 8px 0 2px; }
.day-hero .month { font-family: var(--display); font-size: 1.3rem; }
.day-hero .hindu { margin-top: 12px; color: var(--night-gold); font-size: 0.86rem; letter-spacing: 0.03em; }
.day-hero .sun { display: flex; justify-content: center; gap: 18px; margin-top: 10px; font-size: 0.76rem; color: var(--night-muted); }
.day-hero .nav { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(243, 234, 217, 0.22); color: var(--night-ink); text-decoration: none; }
.day-hero .nav.prev { left: 12px; }
.day-hero .nav.next { right: 12px; }

/* ---------- Prose ---------- */
.prose p { margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose h3 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 22px 0 8px; }
.prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.15rem; margin: 0 0 12px; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--gold); }
.prose strong { font-weight: 600; }
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; margin-bottom: 14px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--display);
  font-weight: 600; font-size: 0.95rem;
}

.detail-head { display: flex; gap: 16px; align-items: center; margin: 12px 2px 20px; }
.detail-head h2 { margin: 2px 0 2px; font-family: var(--display); font-weight: 600; font-size: 1.85rem; line-height: 1.1; }
.detail-head p { margin: 0; color: var(--muted); font-size: 0.86rem; }

/* ---------- Prayers ---------- */
.moment-card .title { font-family: var(--display); font-weight: 600; font-size: 1.75rem; line-height: 1.15; margin: 6px 0 2px; }
.moment-card .deva-line { font-family: var(--deva); color: var(--night-gold); font-size: 1rem; margin: 14px 0 0; white-space: pre-line; line-height: 1.85; }
.mini-list { margin-top: 18px; border-top: 1px solid rgba(243, 234, 217, 0.14); }
.mini-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(243, 234, 217, 0.1); color: var(--night-ink); text-decoration: none; font-size: 0.92rem; }
.mini-list a:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-list a span:last-child { color: var(--night-muted); font-size: 0.74rem; white-space: nowrap; }

.stanza { padding: 22px 0; border-bottom: 1px solid var(--line); }
.stanza:first-child { padding-top: 6px; }
.stanza:last-child { border-bottom: 0; padding-bottom: 4px; }
.stanza .label { display: block; margin-bottom: 8px; }
.stanza .dev { font-family: var(--deva); font-size: calc(1.12rem * var(--scale, 1)); line-height: 1.95; color: var(--ink); white-space: pre-line; margin: 0; }
.stanza .rom { font-style: italic; color: var(--ink-2); white-space: pre-line; margin: 8px 0 0; font-size: calc(0.92rem * var(--scale, 1)); line-height: 1.65; }
.stanza .en { font-family: var(--display); font-size: calc(1.16rem * var(--scale, 1)); line-height: 1.5; color: var(--ink); margin: 10px 0 0; }
.stanza.refrain .dev { color: var(--gold); }
.hide-dev .stanza .dev, .hide-rom .stanza .rom, .hide-en .stanza .en { display: none; }

/* ---------- Japa ---------- */
.japa { text-align: center; }
.japa-dev { font-family: var(--deva); color: var(--gold); font-size: 1.2rem; line-height: 1.85; margin: 12px 0 0; white-space: pre-line; }
.japa-say { font-family: var(--display); font-weight: 600; font-size: 1.6rem; line-height: 1.25; margin: 6px 0 0; white-space: pre-line; }
.japa-mean { font-family: var(--display); font-style: italic; font-size: 1.12rem; line-height: 1.45; color: var(--ink-2); margin: 10px auto 16px; max-width: 30em; }
.japa-ring {
  position: relative;
  width: 232px; height: 232px;
  margin: 18px auto 10px;
  border-radius: 50%;
  border: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(212, 176, 106, 0.22), transparent 60%),
    linear-gradient(160deg, var(--night-2), var(--night));
  color: var(--night-ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 18px 40px rgba(22, 18, 14, 0.25), inset 0 0 0 1px rgba(212, 176, 106, 0.35);
  transition: transform 0.08s;
}
.japa-ring .count { position: relative; display: block; font-family: var(--display); font-weight: 600; font-size: 4.2rem; line-height: 1; }
.japa-ring .of { position: relative; display: block; margin-top: 6px; font-size: 0.68rem; letter-spacing: 0.18em; color: var(--night-muted); }
.japa-ring svg { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); transform: rotate(-90deg); }
.japa-ring circle { fill: none; stroke-width: 2; }
.japa-ring:active { transform: scale(0.985); }
select.chip {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 128px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}
.tile .dv { font-family: var(--deva); color: var(--gold); font-size: 1.45rem; line-height: 1.2; }
.tile h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.22rem; line-height: 1.15; }
.tile p { margin: 3px 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.4; }

/* Book cards */
.book { padding: 0; overflow: hidden; }
.book .cover { margin: 0; border-radius: 0; box-shadow: none; padding: 24px 22px 22px; }
.book .cover .dv { font-family: var(--deva); font-size: 1.5rem; color: var(--night-gold); line-height: 1.3; }
.book .cover h3 { margin: 6px 0 2px; font-family: var(--display); font-weight: 600; font-size: 1.75rem; line-height: 1.1; }
.book .cover p { margin: 0; color: var(--night-muted); font-size: 0.84rem; }
.book .foot { padding: 14px 20px 18px; }

.progress { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; background: var(--gold); }

/* ---------- Reader ---------- */
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; margin-top: 8px; }
.sec-tile {
  display: grid; place-items: center;
  min-height: 46px; padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600; font-size: 0.78rem;
  text-align: center;
}
.sec-tile.here { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.reader-head { padding: 12px 2px 16px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.reader-head h2 { font-family: var(--display); font-weight: 600; font-size: 2.1rem; margin: 4px 0 2px; line-height: 1.1; }
.reader-head .meta { margin: 0; }
.reader-tools { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.reader { font-size: calc(1.08rem * var(--read-scale, 1)); line-height: 1.75; }
.reader .verse { padding: 20px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 80px; }
.reader .verse.highlight { background: var(--gold-soft); border-radius: 16px; padding: 20px 14px; border-bottom-color: transparent; }
.reader .vnum { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.16em; color: var(--gold); }
.reader .sanskrit { font-family: var(--deva); font-size: 1.04em; line-height: 1.9; margin: 8px 0 2px; white-space: pre-line; }
.reader .translit { font-style: italic; color: var(--ink-2); font-size: 0.84em; margin: 0 0 8px; white-space: pre-line; }
.reader .vtext { margin: 8px 0 0; font-family: var(--display); font-size: 1.14em; line-height: 1.55; }
.reader .para { font-family: var(--display); font-size: 1.14em; line-height: 1.6; margin: 0 0 1em; }
.reader .para.sub { font-family: var(--sans); font-size: 0.84em; color: var(--muted); font-style: italic; text-align: center; }
.reader .para.fn { font-family: var(--sans); font-size: 0.76em; color: var(--muted); margin-bottom: 0.5em; }
.reader-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 28px 0 10px; }
.read-progress { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(66px + env(safe-area-inset-bottom)); width: 100%; max-width: 600px; height: 2px; z-index: 21; }
.read-progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.2s; }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.footer-note { text-align: center; color: var(--muted); font-size: 0.76rem; margin-top: 28px; }
.fade-in { animation: fade 0.35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (min-width: 640px) {
  main { padding-left: 24px; padding-right: 24px; }
  .chips { margin: 0 -24px; padding-left: 26px; padding-right: 26px; }
}

[id] { scroll-margin-top: 76px; }

/* ---------- Audio ---------- */
.player { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.btn .ico { width: 16px; height: 16px; margin-left: -4px; }
.btn.on { background: var(--gold); border-color: var(--gold); color: #1a140d; }
.stanza.playing { position: relative; }
.stanza.playing::before {
  content: "";
  position: absolute;
  left: -20px; top: 18px; bottom: 18px;
  width: 2px;
  border-radius: 2px;
  background: var(--gold);
}
.stanza.playing .dev { color: var(--gold); }
.voice-panel { margin: 0 0 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.voice-panel[hidden] { display: none; }
.voice-panel .vrow { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; min-width: 0; }
.voice-panel select.chip { flex: 1 1 0; width: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.credit { text-align: center; color: var(--muted); font-size: 0.66rem; letter-spacing: 0.08em; opacity: 0.8; margin: 6px 0 0; }

/* ---------- Scripture extras ---------- */
.reader .para.intro { font-family: var(--sans); font-size: 0.86em; line-height: 1.65; color: var(--ink-2); }
.reader .para.intro:last-of-type { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.reader .vhead { margin: 26px 0 0; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.reader .vnote { margin: 12px 0 0; padding-left: 14px; border-left: 2px solid var(--line-strong); }
.reader .vnote p { margin: 0 0 8px; font-family: var(--sans); font-size: 0.82em; line-height: 1.65; color: var(--ink-2); }
.reader.hide-notes .vnote { display: none; }

/* ---------- Search ---------- */
.row p.where { color: var(--gold); font-size: 0.72rem; letter-spacing: 0.04em; margin-top: 1px; }
.row p.snip { color: var(--ink-2); margin-top: 4px; }
mark { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: inset 0 -1px 0 var(--gold); }
button.row.more { width: 100%; justify-content: center; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--gold); font-weight: 600; font-size: 0.84rem; cursor: pointer; }

/* ---------- Sheets, toasts, marks ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 0.84rem; font-weight: 500;
  z-index: 60; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15, 12, 9, 0); transition: background 0.2s; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop.open { background: rgba(15, 12, 9, 0.45); }
.sheet {
  width: 100%; max-width: 600px; max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.22s ease;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet .grip { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 14px; }
.sheet-deva { font-family: var(--deva); color: var(--gold); white-space: pre-line; line-height: 1.85; margin: 10px 0 0; }
.sheet-preview { font-family: var(--display); font-size: 1.12rem; line-height: 1.45; margin: 8px 0 12px; }
.sheet-note { width: 100%; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg); color: var(--ink); font: inherit; font-size: 0.92rem; padding: 10px 12px; resize: vertical; outline: none; }
.sheet-note:focus { border-color: var(--gold); }
.sheet-actions { display: grid; gap: 8px; margin-top: 12px; }
.sheet-actions .btn { width: 100%; }
.reader .verse, .reader .para:not(.intro), #stanzas .stanza { cursor: pointer; }
.reader .is-hl .vtext, .reader .para.is-hl { background: linear-gradient(transparent 8%, var(--gold-soft) 8%, var(--gold-soft) 92%, transparent 92%); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.reader .para.is-hl { border-radius: 4px; }
.reader .is-bm { position: relative; }
.reader .is-bm::after { content: ""; position: absolute; right: -2px; top: 18px; width: 10px; height: 16px; background: var(--gold); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.reader .para.is-bm::after { top: 4px; right: -14px; }
.mnote { margin: 10px 0 1em; padding: 10px 12px; border-radius: 12px; background: var(--gold-soft); font-family: var(--sans); font-size: 0.8em; line-height: 1.55; color: var(--ink); white-space: pre-line; }
.mnote::before { content: "Your note · "; font-weight: 600; color: var(--gold); }
.note-snip { font-style: italic; color: var(--ink) !important; margin-top: 4px !important; }
.note-snip::before { content: "Note: "; font-style: normal; color: var(--gold); font-weight: 600; }
.hl-snip { background: var(--gold-soft); border-radius: 4px; padding: 0 3px; }
.hero-wrap { position: relative; }
.hero-wrap .night { margin-bottom: 14px; }
.hero-share { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(243, 234, 217, 0.25); background: rgba(22, 18, 14, 0.4); color: var(--night-ink); cursor: pointer; }
.hero-share .ico { width: 18px; height: 18px; }

/* ---------- Aarti mode ---------- */
body.immersive .topbar, body.immersive .tabbar { display: none; }
body.immersive { overflow: hidden; }
.aarti {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  color: var(--night-ink);
  background:
    radial-gradient(80% 50% at 50% 0%, rgba(212, 176, 106, 0.16), transparent 70%),
    radial-gradient(90% 70% at 0% 100%, rgba(142, 43, 32, 0.22), transparent 65%),
    linear-gradient(170deg, #241d16, #0f0c09);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  user-select: none; -webkit-user-select: none;
}
.aarti .eyebrow { color: var(--night-gold); }
.aarti-top { display: flex; align-items: center; gap: 12px; padding: 12px 14px 0; max-width: 980px; width: 100%; margin: 0 auto; }
.aarti-title { flex: 1; min-width: 0; text-align: center; }
.aarti-title .eyebrow { font-size: 0.62rem; }
.aarti-title h2 { margin: 2px 0 0; font-family: var(--display); font-weight: 600; font-size: 1.3rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aarti-icon {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(243, 234, 217, 0.18); background: rgba(243, 234, 217, 0.04);
  color: var(--night-ink); cursor: pointer;
}
.aarti-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.aarti-icon.lg { width: 54px; height: 54px; }
.aarti-icon.lg svg { width: 24px; height: 24px; }
.aarti-icon.active { background: rgba(212, 176, 106, 0.18); border-color: rgba(212, 176, 106, 0.5); color: var(--night-gold); }
.aarti-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 12px 16px 0; }
.aarti-opts .chip { background: transparent; color: var(--night-ink); border-color: rgba(243, 234, 217, 0.22); }
.aarti-opts .chip.active { background: var(--night-gold); border-color: var(--night-gold); color: #1a140d; }

.diya { position: relative; width: 64px; height: 58px; margin: 10px auto 0; flex: none; }
.diya .halo { position: absolute; left: 50%; top: 10px; width: 120px; height: 120px; margin-left: -60px; margin-top: -40px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 196, 92, 0.32), rgba(255, 160, 60, 0.08) 45%, transparent 70%); animation: halo 3.2s ease-in-out infinite; }
.diya .flame {
  position: absolute; left: 50%; top: 2px; width: 16px; height: 28px; margin-left: -8px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 78%, #fff6d6 0%, #ffd27a 32%, #f29a3a 62%, rgba(214, 90, 30, 0.85) 82%, transparent 100%);
  transform-origin: 50% 90%;
  box-shadow: 0 0 18px 4px rgba(255, 170, 70, 0.45);
  animation: flicker 2.4s ease-in-out infinite;
}
.diya .wick { position: absolute; left: 50%; top: 28px; width: 2px; height: 6px; margin-left: -1px; background: #3b2a1a; border-radius: 1px; }
.diya .bowl { position: absolute; left: 50%; bottom: 6px; width: 60px; height: 22px; margin-left: -30px; border-radius: 0 0 30px 30px / 0 0 22px 22px; background: linear-gradient(180deg, #d4b06a, #8a6630); box-shadow: inset 0 3px 0 rgba(255, 236, 190, 0.35); }
.diya .bowl::before { content: ""; position: absolute; left: 4px; right: 4px; top: -3px; height: 6px; border-radius: 50%; background: #5a4123; }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1) skewX(0deg); opacity: 1; }
  20% { transform: scale(0.94, 1.06) skewX(2deg); }
  40% { transform: scale(1.04, 0.96) skewX(-2deg); opacity: 0.92; }
  60% { transform: scale(0.97, 1.08) skewX(1deg); }
  80% { transform: scale(1.02, 0.97) skewX(-1deg); opacity: 0.96; }
}
@keyframes halo { 0%, 100% { opacity: 0.85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }

.aarti-stage {
  --fs: 34px;
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 22px; cursor: pointer;
}
.aarti-verse { width: 100%; max-width: 920px; text-align: center; animation: fade 0.4s ease both; }
.aarti-verse .eyebrow { margin-bottom: calc(var(--fs) * 0.45); }
.aarti-verse .dev { font-family: var(--deva); font-size: var(--fs); line-height: 1.7; white-space: pre-line; margin: 0; color: var(--night-ink); }
.aarti-verse .rom { font-family: var(--display); font-style: italic; font-size: calc(var(--fs) * 0.72); line-height: 1.4; white-space: pre-line; margin: calc(var(--fs) * 0.4) 0 0; color: var(--night-ink); opacity: 0.88; }
.aarti-verse .en { font-family: var(--sans); font-size: max(13px, calc(var(--fs) * 0.42)); line-height: 1.55; margin: calc(var(--fs) * 0.55) auto 0; max-width: 40em; color: var(--night-muted); }
.aarti-verse.refrain .dev, .aarti-verse.refrain .rom { color: var(--night-gold); }
.aarti.hide-dev .aarti-verse .dev, .aarti.hide-rom .aarti-verse .rom, .aarti.hide-en .aarti-verse .en { display: none; }
.aarti.hide-dev .aarti-verse .rom { font-size: calc(var(--fs) * 0.95); margin-top: 0; }
.aarti-end .dev { color: var(--night-gold); }
.aarti-end .btn-row { justify-content: center; margin-top: 26px; }
.aarti-end .btn { font-size: 0.9rem; }
.aarti-end .btn.ghost { color: var(--night-ink); border-color: rgba(243, 234, 217, 0.28); }
.aarti-end .btn:not(.ghost) { background: var(--night-gold); border-color: var(--night-gold); color: #1a140d; }

.aarti-foot { flex: none; width: 100%; max-width: 560px; margin: 0 auto; padding: 6px 18px 18px; }
.aarti-progress { height: 3px; border-radius: 3px; background: rgba(243, 234, 217, 0.12); overflow: hidden; margin-bottom: 14px; }
.aarti-progress span { display: block; height: 100%; width: 0; background: var(--night-gold); border-radius: 3px; transition: width 0.35s ease; }
.aarti-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.aarti-play { min-width: 132px; padding: 14px 22px; font-size: 0.95rem; background: var(--night-gold); border-color: var(--night-gold); color: #1a140d; }
.aarti-play.on { background: transparent; color: var(--night-gold); }
.aarti-hint { color: var(--night-muted); font-size: 0.8rem; }
@media (prefers-reduced-motion: reduce) {
  .diya .flame, .diya .halo { animation: none; }
  .aarti-verse { animation: none; }
}

/* ---------- Practice ---------- */
:root {
  --hm-0: var(--surface-2);
  --hm-1: #e4c990;
  --hm-2: #c9a053;
  --hm-3: #9c7430;
  --hm-4: #664716;
}
:root[data-theme="dark"] {
  --hm-0: #241e17;
  --hm-1: #45381f;
  --hm-2: #745c2b;
  --hm-3: #a9863f;
  --hm-4: #e2c27c;
}
a.card.practice-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 0; }
.pc-num { flex: none; width: 64px; text-align: center; }
.pc-num strong { display: block; font-family: var(--display); font-size: 2.6rem; font-weight: 600; line-height: 1; color: var(--ink); }
.pc-num span { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.pc-body { flex: 1; min-width: 0; }
.pc-body .meta { margin: 6px 0 0; font-size: 0.8rem; }
.practice-card .chev { color: var(--muted); }
.week-dots { display: flex; gap: 8px; margin-top: 8px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.wd i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.wd.on i { background: var(--gold); border-color: var(--gold); }
.wd.today i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold-soft); }
.wd b { font-size: 0.6rem; font-weight: 600; color: var(--muted); }
.wd.today b { color: var(--ink); }
.night .wd i { border-color: rgba(243, 234, 217, 0.3); }
.night .wd.on i { background: var(--night-gold); border-color: var(--night-gold); }
.night .wd.today i { box-shadow: 0 0 0 2px var(--night-2), 0 0 0 3.5px rgba(212, 176, 106, 0.35); }
.night .wd b { color: var(--night-muted); }
.night .wd.today b { color: var(--night-ink); }
.practice-hero .streak-num { font-family: var(--display); font-size: 4.2rem; font-weight: 600; line-height: 1; margin: 8px 0 6px; }
.practice-hero .streak-num span { font-size: 1.1rem; font-weight: 500; margin-left: 8px; color: var(--night-muted); }
.practice-hero .meta { margin: 0 0 14px; max-width: 30em; }
.practice-hero .week-dots { gap: 12px; }
.practice-hero .wd i { width: 18px; height: 18px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.stat-v { font-family: var(--sans); font-size: 1.9rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 0.82rem; font-weight: 600; margin-top: 2px; }
.stat-s { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.heatmap { padding: 16px 16px 14px; }
.hm-months, .hm-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.hm-months { margin-left: 34px; margin-bottom: 4px; }
.hm-months span { font-size: 0.64rem; color: var(--muted); white-space: nowrap; overflow: visible; }
.hm-body { display: flex; gap: 6px; }
.hm-days { width: 28px; flex: none; display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.hm-days span { font-size: 0.6rem; color: var(--muted); display: flex; align-items: center; }
.hm-grid { flex: 1; }
.hm-col { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.hm-cell { display: block; aspect-ratio: 1; width: 100%; max-width: 30px; border: 0; padding: 0; border-radius: 4px; background: var(--hm-0); cursor: pointer; }
.hm-cell.future { background: transparent; cursor: default; }
.hm-cell.l1 { background: var(--hm-1); }
.hm-cell.l2 { background: var(--hm-2); }
.hm-cell.l3 { background: var(--hm-3); }
.hm-cell.l4 { background: var(--hm-4); }
.hm-cell.today { box-shadow: 0 0 0 1.5px var(--ink); }
.hm-cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.hm-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.hm-readout { margin: 0; font-size: 0.8rem; color: var(--ink-2); flex: 1 1 200px; min-height: 1.3em; }
.hm-key { display: flex; align-items: center; gap: 3px; font-size: 0.66rem; color: var(--muted); }
.hm-key .hm-cell { width: 11px; height: 11px; border-radius: 3px; cursor: default; }
.hm-key .hm-cell:first-of-type { margin-left: 4px; }
.hm-key .hm-cell:last-of-type { margin-right: 4px; }
.row.static { cursor: default; }

/* ---------- Reminders ---------- */
.remind-times { padding: 4px 18px; }
.rt { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.rt:first-child { border-top: 0; }
.rt span { flex: 1; font-size: 0.92rem; }
.rt input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); margin: 0; flex: none; }
.time-input {
  font: inherit; font-size: 0.86rem; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 6px 8px; min-width: 0; color-scheme: inherit;
}
.time-input:focus { outline: none; border-color: var(--gold); }
.card-h { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 4px 0 6px; }
.small-note { font-size: 0.76rem; margin: 12px 0 0; }
.row.tomorrow .eyebrow { color: var(--kumkum); }

/* ---------- Your recordings ---------- */
.recorder audio, .rec-row audio { width: 100%; height: 40px; margin-top: 8px; display: block; }
.rec-live { display: flex; align-items: center; gap: 14px; }
.rec-live strong { font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rec-dot { width: 16px; height: 16px; border-radius: 50%; background: #c8402e; flex: none; box-shadow: 0 0 0 0 rgba(200, 64, 46, 0.5); animation: recpulse 1.4s ease-out infinite; }
.rec-dot.sm { width: 10px; height: 10px; animation: none; box-shadow: none; }
@keyframes recpulse { 0% { box-shadow: 0 0 0 0 rgba(200, 64, 46, 0.5); } 100% { box-shadow: 0 0 0 14px rgba(200, 64, 46, 0); } }
.btn.ghost.danger { color: var(--kumkum); }
.rec-row { align-items: flex-start; }
.rec-row .body a { text-decoration: none; color: inherit; }
.rec-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }

/* ---------- Academy: courses and lessons ---------- */
.plate {
  margin: 0; position: relative; overflow: hidden; border-radius: 22px; aspect-ratio: 16 / 10;
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(212, 176, 106, 0.18), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(142, 43, 32, 0.22), transparent 60%),
    linear-gradient(160deg, #241d16, #16120e);
  box-shadow: 0 14px 34px rgba(22, 18, 14, 0.16);
}
.plate img { color: transparent; display: block; width: 100%; height: 100%; object-fit: cover; }
.plate::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255, 236, 200, 0.08); }
.plate.lesson-art img, .plate.rite-hero img, .plate.course-hero img { animation: plate-drift 40s ease-in-out infinite alternate; transform-origin: 50% 60%; }
@keyframes plate-drift { from { transform: scale(1); } to { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .plate img { animation: none !important; } }
.plate.thumb { flex: none; width: 74px; height: 74px; aspect-ratio: auto; border-radius: 16px; box-shadow: none; }
.plate.mini { flex: none; width: 64px; height: 64px; aspect-ratio: auto; border-radius: 14px; box-shadow: none; border: 1px solid rgba(243, 234, 217, 0.12); }
.course-row { align-items: flex-start; }
.course-row .course-meta { color: var(--gold); font-size: 0.74rem; margin-top: 4px; }
.continue-lesson { display: flex; align-items: center; gap: 14px; padding: 16px; margin: 4px 0 22px; }
.continue-lesson .body { flex: 1; min-width: 0; }
.continue-lesson h3 { margin: 2px 0 2px; font-family: var(--display); font-weight: 600; font-size: 1.22rem; line-height: 1.2; }
.continue-lesson .chev { color: var(--night-muted); }
.course-hero { margin: 8px 0 18px; }
.course-head { margin: 0 2px 18px; }
.course-head .page-title { margin-top: 6px; }
.course-head .page-sub { margin-bottom: 10px; }
.course-progress { margin: 6px 0 6px; }
.lesson-row .num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-strong); font-size: 0.8rem; font-weight: 600; color: var(--ink-2);
}
.lesson-row.done .num { background: var(--gold); border-color: var(--gold); color: var(--surface); }
.lesson-row h3 { font-size: 1.08rem; }
.lesson-page { padding-top: 6px; }
.lesson-page .course-link, .rite-page .course-link { text-decoration: none; display: inline-block; }
.lesson-title { font-family: var(--display); font-weight: 600; font-size: 2.15rem; line-height: 1.08; margin: 8px 0 6px; letter-spacing: -0.01em; }
.lesson-meta { margin: 0 0 18px; }
.lesson-art { margin: 0 0 8px; }
.caption { color: var(--muted); font-size: 0.78rem; font-style: italic; margin: 0 4px 22px; text-align: center; }
.lesson-art + .lesson-body { margin-top: 22px; }
.lesson-body { font-size: 1.02rem; line-height: 1.72; color: var(--ink); margin-bottom: 22px; }
.lesson-body p { margin: 0 0 14px; }
.lesson-body h3 { font-size: 1.42rem; margin: 26px 0 8px; }
.lesson-body li { margin-bottom: 9px; }
.lesson-body em { color: var(--ink-2); }
.lesson-body blockquote { margin: 18px 0; padding: 4px 0 4px 18px; border-left: 2px solid var(--gold); font-family: var(--display); font-size: 1.22rem; line-height: 1.45; color: var(--ink); }
.lesson-body blockquote .deva { display: block; font-family: var(--deva); font-size: 0.86em; color: var(--gold); margin-bottom: 6px; }
.terms dl { margin: 10px 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.terms dt { font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.2; }
.terms dd { margin: 2px 0 0; color: var(--ink-2); font-size: 0.9rem; }
.practice { background: var(--gold-soft); border-color: transparent; box-shadow: none; }
.practice p { margin: 8px 0 0; font-family: var(--display); font-size: 1.18rem; line-height: 1.45; }
.lesson-links { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.lesson-links .row:first-child { border-top: 0; }
.lesson-links h3 { font-size: 1.02rem; }
.lesson-done { margin: 22px 0 14px; }
.lesson-done .btn { width: 100%; padding: 14px 18px; font-size: 0.92rem; }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 10px; }
.lesson-nav a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: var(--ink); min-width: 0; }
.lesson-nav a span:last-child { font-family: var(--display); font-weight: 600; font-size: 1rem; line-height: 1.25; }
.lesson-nav a.next { text-align: right; }
@media (min-width: 640px) {
  .lesson-title { font-size: 2.5rem; }
}

/* ---------- Rites of passage ---------- */
.rites-feature { margin-top: 4px; }
.rites-hero-card { padding: 24px 22px 20px; margin-bottom: 12px; }
.rites-hero-card h3 { font-family: var(--display); font-weight: 600; font-size: 1.65rem; line-height: 1.15; margin: 8px 0 8px; max-width: 16em; }
.rites-hero-card p { margin: 0 0 14px; color: var(--night-muted); font-size: 0.9rem; max-width: 30em; }
.rhc-cta { color: var(--night-gold); font-weight: 600; font-size: 0.86rem; }
.rite-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 14px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rite-strip::-webkit-scrollbar { display: none; }
.rite-chip { flex: none; width: 132px; scroll-snap-align: start; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; }
.rite-chip .plate.mini { width: 132px; height: 92px; border-radius: 16px; }
.rite-chip b { display: block; font-family: var(--display); font-weight: 600; font-size: 1.02rem; line-height: 1.2; }
.rite-chip small { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 2px; }

.rites-top { padding: 26px 22px 22px; margin-top: 8px; }
.rites-top h2 { font-family: var(--display); font-weight: 600; font-size: 2.3rem; line-height: 1.05; margin: 8px 0 10px; }
.rites-top p { margin: 0; color: var(--night-muted); max-width: 32em; }
.rt-stats { display: flex; gap: 18px; margin-top: 16px; font-size: 0.8rem; color: var(--night-muted); }
.rt-stats b { font-family: var(--display); font-size: 1.6rem; color: var(--night-gold); margin-right: 6px; font-weight: 600; }

.journey { position: relative; margin: 8px 0 10px; padding-left: 26px; }
.journey::before { content: ""; position: absolute; left: 9px; top: 14px; bottom: 30px; width: 2px; border-radius: 2px; background: linear-gradient(var(--gold), var(--gold-soft)); opacity: 0.6; }
.stage { margin-bottom: 18px; }
.stage-head { display: flex; align-items: center; gap: 12px; margin: 0 0 10px -26px; position: relative; }
.stage-dv { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--bg); font-size: 0; }
.stage-head h3 { font-family: var(--display); font-weight: 600; font-size: 1.45rem; line-height: 1.1; margin: 0; }
.stage-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }
.rite-node { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 10px; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.rite-node::before { content: ""; position: absolute; left: -21px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--bg); border: 2px solid var(--gold); }
.rite-node .plate.thumb { width: 70px; height: 70px; }
.rite-node .body { flex: 1; min-width: 0; }
.rite-node .when { display: block; color: var(--gold); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; }
.rite-node h4 { margin: 2px 0 2px; font-family: var(--display); font-weight: 600; font-size: 1.2rem; line-height: 1.15; }
.rite-node p { margin: 0; color: var(--muted); font-size: 0.8rem; }
.rite-node .dv, .rite-sanskrit .dv { font-family: var(--deva); color: var(--gold); }
.rite-node .chev { color: var(--muted); }

.rite-page { padding-top: 4px; }
.rite-hero { margin: 4px 0 18px; }
.rite-sanskrit { margin: 0 0 10px; color: var(--ink-2); font-size: 0.92rem; }
.rite-sanskrit .dv { font-size: 1.05rem; margin-right: 6px; }
.rite-summary { font-family: var(--display); font-size: 1.3rem; line-height: 1.4; margin: 0 0 18px; color: var(--ink); }
.glance { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 8px; }
.glance div { background: var(--surface); padding: 12px 14px; min-width: 0; }
.glance span { display: block; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.glance b { display: block; font-weight: 500; font-size: 0.86rem; line-height: 1.4; margin-top: 3px; color: var(--ink); }
.rite-verse { text-align: center; padding: 24px 20px; margin: 4px 0 6px; }
.rite-verse .v-dev { font-family: var(--deva); color: var(--night-gold); font-size: 1.15rem; line-height: 1.8; margin: 0; }
.rite-verse .v-rom { font-style: italic; color: var(--night-muted); font-size: 0.86rem; margin: 6px 0 10px; }
.rite-verse .v-en { font-family: var(--display); font-size: 1.3rem; line-height: 1.35; margin: 0 0 8px; }
.rite-verse .meta { margin: 0; }
.need-list { padding: 4px 16px; }
.need { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; font-size: 0.92rem; line-height: 1.45; }
.need:first-child { border-top: 0; }
.need input { flex: none; width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--gold); }
.need input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--gold); }
.phase { font-family: var(--display); font-weight: 600; font-size: 1.25rem; margin: 6px 0 10px; color: var(--gold); }
.rite-steps { list-style: none; margin: 0 0 16px; padding: 0; position: relative; }
.rite-steps::before { content: ""; position: absolute; left: 15px; top: 16px; bottom: 16px; width: 1px; background: var(--line-strong); }
.rite-steps li { position: relative; display: flex; gap: 14px; padding: 0 0 16px; }
.rite-steps .n { flex: none; position: relative; width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--gold); color: var(--gold); font-weight: 600; font-size: 0.82rem; }
.rite-steps h4 { margin: 4px 0 3px; font-family: var(--display); font-weight: 600; font-size: 1.15rem; line-height: 1.2; }
.rite-steps p { margin: 0; color: var(--ink-2); font-size: 0.92rem; line-height: 1.6; }
.m-jump { margin: 6px 0 4px; white-space: normal; text-align: left; color: var(--ink); border-color: var(--gold); }
#riteMantras { scroll-margin-top: 76px; }
.mantra-basis { margin: 0 4px 16px; color: var(--ink-2); font-size: 0.92rem; line-height: 1.6; }
.mantra-list { margin-bottom: 18px; }
.mantra { padding: 16px 18px; margin-bottom: 12px; }
.mantra .m-at { display: flex; align-items: center; gap: 10px; }
.mantra .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); font-weight: 600; font-size: 0.74rem; }
.mantra h4 { margin: 0; flex: 1; font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.25; }
.mantra .m-use { flex: none; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 999px; padding: 3px 8px; }
.mantra .m-use.core { background: var(--gold); color: var(--bg); }
.mantra .m-use.some { border: 1px solid var(--line-strong); color: var(--muted); }
.mantra .m-do { margin: 8px 0 12px; color: var(--ink-2); font-size: 0.9rem; line-height: 1.55; }
.mantra .m-sa { margin: 0 0 4px; font-family: var(--deva); font-size: 1.08rem; line-height: 1.85; white-space: pre-line; color: var(--ink); }
.mantra .m-tr { margin: 0 0 10px; font-style: italic; color: var(--ink-2); font-size: 0.84rem; line-height: 1.6; white-space: pre-line; }
.mantra .m-en { margin: 0 0 10px; line-height: 1.6; }
.mantra .m-src { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.76rem; line-height: 1.5; color: var(--muted); }
.mantra .m-src a { color: var(--gold); text-decoration: none; font-weight: 500; white-space: nowrap; }
.customs .row h3 { font-size: 1.02rem; }
.customs .row p { color: var(--ink-2); }
.rite-notes { display: grid; gap: 12px; margin: 6px 0 4px; }
.rite-notes .card { margin: 0; }
.rite-notes p { margin: 8px 0 0; color: var(--ink-2); font-size: 0.92rem; }
@media (min-width: 560px) { .rite-notes { grid-template-columns: 1fr 1fr; } }

/* ---------- Backup and restore ---------- */
.bk-have { margin: 6px 0 4px; color: var(--ink); line-height: 1.6; }
.bk-have span { white-space: nowrap; }
.bk-rec { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; font-size: 0.92rem; color: var(--ink); cursor: pointer; }
.bk-rec input { flex: none; width: 19px; height: 19px; margin: 0; accent-color: var(--gold); }
.card.notice { border-color: var(--gold); }
.card.notice p { margin: 6px 0 0; color: var(--ink-2); font-size: 0.92rem; }
.footer-note a, .card.notice a { color: var(--gold); }
