/* Gita Sadhana website
   Ink-and-stone palette with one accent (Krishna blue) and lamp-gold for devotional marks.
   Marcellus for titles, EB Garamond for scripture, Noto Serif Devanagari for Sanskrit,
   the system face for interface text. Radius system: 12px surfaces, pill controls. */

@font-face { font-family: "Marcellus"; src: url("../assets/fonts/Marcellus_400Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../assets/fonts/EBGaramond_400Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../assets/fonts/EBGaramond_500Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../assets/fonts/EBGaramond_400Regular_Italic.woff2") format("woff2"); font-style: italic; font-display: swap; }
@font-face { font-family: "Noto Serif Devanagari"; src: url("../assets/fonts/NotoSerifDevanagari_400Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Serif Devanagari"; src: url("../assets/fonts/NotoSerifDevanagari_500Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-raised: #fbf9f4;
  --surface-muted: #eae6dc;
  --ink: #1b1f2e;
  --ink-soft: #555a6b;
  --ink-faint: #767a88;
  --hairline: rgba(27, 31, 46, 0.1);
  --accent: #2f4a8a;
  --accent-pressed: #243b70;
  --on-accent: #ffffff;
  --accent-soft: #e4e8f3;
  --flame: #9a5f18;
  --flame-soft: #f3e7d4;
  --danger: #b3261e;
  --danger-soft: #f8e3e1;
  --shadow: 0 1px 2px rgba(15, 18, 27, 0.05), 0 8px 24px rgba(15, 18, 27, 0.06);
  --shadow-raised: 0 10px 30px rgba(15, 18, 27, 0.12);

  --font-display: "Marcellus", "Noto Serif Devanagari", Georgia, serif;
  --font-serif: "EB Garamond", "Noto Serif Devanagari", Georgia, serif;
  --font-sanskrit: "Noto Serif Devanagari", "EB Garamond", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;

  --reading: 18px;
  --radius: 12px;
  --radius-lg: 18px;
  --gutter: 20px;
  --sidebar: 248px;
  --rail: 84px;
  --tabbar: 64px;
  --content: 1180px;
  --measure: 680px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f121b;
  --surface: #171b27;
  --surface-raised: #1d2231;
  --surface-muted: #252b3b;
  --ink: #ede8de;
  --ink-soft: #a6aab7;
  --ink-faint: #8a8f9f;
  --hairline: rgba(237, 232, 222, 0.1);
  --accent: #a9bcf0;
  --accent-pressed: #8fa6e3;
  --on-accent: #0f121b;
  --accent-soft: #222b45;
  --flame: #e3aa58;
  --flame-soft: #2b2418;
  --danger: #f2b8b5;
  --danger-soft: #3a1e1d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-raised: 0 12px 36px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 10px 16px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
.skip-link:focus { top: 12px; }

/* ───────── Type ───────── */
.display { font: 400 clamp(1.75rem, 1.2rem + 1.6vw, 2.4rem)/1.15 var(--font-display); margin: 0; letter-spacing: 0.005em; }
.title { font: 400 clamp(1.35rem, 1.1rem + 0.8vw, 1.7rem)/1.25 var(--font-display); margin: 0; }
.heading { font: 400 1.15rem/1.35 var(--font-display); margin: 0; }
.overline { font: 600 0.72rem/1.2 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 0; }
/* Letter-spacing breaks the joined letters of Indian scripts; keep it for Latin text only. */
:root:not([lang="en"]) .overline { letter-spacing: 0.02em; font-size: 0.78rem; }
.overline.flame { color: var(--flame); }
.overline.accent { color: var(--accent); }
.soft { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 0.875rem; }
.caption { font-size: 0.8rem; color: var(--ink-soft); }
.serif { font-family: var(--font-serif); }
.scripture { font: 400 var(--reading)/1.65 var(--font-serif); }
.sanskrit { font: 400 calc(var(--reading) + 4px)/1.9 var(--font-sanskrit); white-space: pre-line; }
.translit { font: italic 400 calc(var(--reading) - 1px)/1.6 var(--font-serif); color: var(--ink-soft); white-space: pre-line; }
.om { font-family: var(--font-sanskrit); color: var(--flame); }
.num { font-variant-numeric: lining-nums tabular-nums; }
/* Marcellus draws 1 like I; figures inside display type use the book face. */
.fig { font-family: var(--font-serif); font-weight: 500; font-variant-numeric: lining-nums; }
p { margin: 0; }

/* ───────── Shell ───────── */
.shell { min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px; background: var(--surface); border-right: 1px solid var(--hairline);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand img { width: 40px; height: 40px; border-radius: 50%; }
.brand span { font: 400 1.25rem/1 var(--font-display); }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: 10px; color: var(--ink-soft); font-size: 0.95rem;
  transition: background-color 0.15s, color 0.15s;
}
.nav-item i { font-size: 1.35rem; }
.nav-item:hover { background: var(--surface-muted); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-sep { height: 1px; background: var(--hairline); margin: 10px 12px; }
.sidebar-foot { margin-top: auto; padding: 14px 12px 0; display: grid; gap: 10px; }

.topbar {
  position: sticky; top: 0; z-index: 15;
  display: none; align-items: center; gap: 8px;
  height: 58px; padding: 0 12px 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .brand { padding: 0; margin-right: auto; }
.topbar .brand img { width: 32px; height: 32px; }
.topbar .brand span { font-size: 1.1rem; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: none;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--hairline);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-faint); font-size: 0.72rem; }
.tabbar a i { font-size: 1.5rem; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }

main { padding-left: var(--sidebar); }
.page { max-width: var(--content); margin: 0 auto; padding: 36px 40px 96px; }
.page.reading { max-width: calc(var(--measure) + 80px); }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.page-head > div { flex: 1; display: grid; gap: 6px; }

/* Tablet: icon rail */
@media (max-width: 1100px) {
  :root { --sidebar: var(--rail); }
  .sidebar { padding: 18px 10px; align-items: center; }
  .sidebar .brand { padding: 4px 0 14px; }
  .sidebar .brand span, .sidebar .nav-sep, .sidebar-foot { display: none; }
  .nav-item { flex-direction: column; justify-content: center; gap: 2px; width: 64px; min-height: 58px; padding: 6px 4px; font-size: 0.68rem; text-align: center; line-height: 1.1; }
  .nav-item.secondary { display: none; }
  .page { padding: 28px 32px 96px; }
}

/* Phone: top bar + bottom tabs */
@media (max-width: 760px) {
  :root { --gutter: 16px; --reading: 17px; }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .tabbar { display: flex; }
  main { padding-left: 0; }
  .page { padding: 20px var(--gutter) calc(var(--tabbar) + 40px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 20px; }
  body.has-player .page { padding-bottom: calc(var(--tabbar) + 150px + env(safe-area-inset-bottom)); }
}

/* ───────── Controls ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 0.95rem; white-space: nowrap;
  transition: background-color 0.15s, transform 0.12s var(--ease), opacity 0.15s;
}
.btn:hover { background: var(--accent-pressed); }
.btn:active { transform: scale(0.98); }
.btn i { font-size: 1.15rem; }
.btn.secondary { background: var(--surface-muted); color: var(--ink); }
.btn.secondary:hover { background: color-mix(in srgb, var(--surface-muted) 80%, var(--ink) 8%); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: var(--danger); color: var(--bg); }
.btn.sm { min-height: 38px; padding: 0 16px; font-size: 0.875rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-soft); flex: none;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn i { font-size: 1.35rem; }
.icon-btn:hover { background: var(--surface-muted); color: var(--ink); }
.icon-btn.on { color: var(--accent); }
.icon-btn.filled { background: var(--surface-muted); }
.icon-btn[disabled] { opacity: 0.35; pointer-events: none; }
.icon-btn .badge { position: absolute; transform: translate(9px, -9px); width: 9px; height: 9px; border-radius: 50%; background: var(--flame); border: 2px solid var(--bg); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--hairline); background: var(--surface); color: var(--ink); font-size: 0.9rem; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }

.segmented { display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-muted); }
.segmented button {
  flex: 1; min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-soft); font-size: 0.9rem; white-space: nowrap;
}
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--hairline);
}
.search:focus-within { border-color: var(--accent); }
.search i { color: var(--ink-faint); font-size: 1.2rem; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1rem; }
.search input::placeholder { color: var(--ink-faint); }

.field { display: grid; gap: 8px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%; min-height: 48px; padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink); font-size: 1rem;
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field ::placeholder { color: var(--ink-faint); }
.form-error { color: var(--danger); font-size: 0.9rem; }
.form { display: grid; gap: 18px; max-width: 560px; }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-muted); transition: background-color 0.2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── Surfaces ───────── */
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 22px; }
.group { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 12px 18px;
  border-top: 1px solid var(--hairline); width: 100%; text-align: left; background: transparent; border-left: 0; border-right: 0; border-bottom: 0;
}
.group > .row:first-child { border-top: 0; }
a.row:hover, button.row:hover { background: var(--surface-raised); }
.row > i:first-child { font-size: 1.4rem; color: var(--accent); flex: none; }
.row .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row .value { color: var(--ink-soft); font-size: 0.9rem; white-space: nowrap; }
.row .chev { color: var(--ink-faint); font-size: 1rem; }
.section { display: grid; gap: 14px; margin-top: 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.link { color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: var(--radius-lg); padding: 18px 8px; }
.stat { display: grid; justify-items: center; gap: 2px; text-align: center; }
.stat b { font: 500 1.6rem/1.2 var(--font-serif); font-variant-numeric: lining-nums tabular-nums; }
.stat span { font-size: 0.8rem; color: var(--ink-soft); }

.empty { display: grid; justify-items: center; gap: 12px; padding: 56px 20px; text-align: center; }
.empty .glyph { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.9rem; }
.empty p { max-width: 36ch; }

.skeleton { background: linear-gradient(90deg, var(--surface-muted), var(--surface-raised), var(--surface-muted)); background-size: 200% 100%; border-radius: var(--radius); animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.progress { height: 4px; border-radius: 4px; background: var(--surface-muted); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.om-rule { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--flame); }
.om-rule::before, .om-rule::after { content: ""; width: 52px; height: 1px; background: currentColor; opacity: 0.45; }
.om-rule span { font-family: var(--font-sanskrit); font-size: 1rem; }

/* ───────── Home ───────── */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 28px; align-items: start; }
.hero-verse {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 12px;
  min-height: 460px; padding: 32px; border-radius: 22px; overflow: hidden; color: #fff; isolation: isolate; background: #1b1f2e;
}
.hero-verse .scene { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.8s ease; }
.hero-verse .scene.on { opacity: 1; }
.hero-verse::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 12, 20, 0.08) 0%, rgba(10, 12, 20, 0.35) 42%, rgba(10, 12, 20, 0.84) 100%); }
.hero-verse .overline { color: rgba(255, 255, 255, 0.85); }
.hero-verse blockquote { margin: 0; font: 400 clamp(1.25rem, 1rem + 0.9vw, 1.6rem)/1.45 var(--font-serif); max-width: 34ch; }
.hero-verse .ref { font-size: 0.9rem; opacity: 0.85; }
.hero-verse .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.hero-verse .btn.secondary { background: rgba(255, 255, 255, 0.16); color: #fff; backdrop-filter: blur(8px); }
.hero-verse .btn.secondary:hover { background: rgba(255, 255, 255, 0.26); }
.side-stack { display: grid; gap: 16px; }
.col-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.flame-badge[data-tone="accent"] { background: var(--accent-soft); color: var(--accent); }

.continue { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-lg); background: var(--surface); }
.continue:hover { background: var(--surface-raised); }
.continue img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.streak-card { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); }
.streak-card:hover { background: var(--surface-raised); }
.flame-badge { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--flame-soft); color: var(--flame); font-size: 1.6rem; flex: none; }
.wisdom-card { display: grid; gap: 10px; padding: 24px; border-radius: var(--radius-lg); background: var(--surface); }
.wisdom-card .om { font-size: 1.5rem; line-height: 1; }

.chapter-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 112px; gap: 18px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.chapter-strip a { display: grid; justify-items: center; gap: 10px; text-align: center; scroll-snap-align: start; }
.ring { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; }
.chapter-strip span { font: 400 0.85rem/1.3 var(--font-display); }
.chapter-strip a:hover img { filter: brightness(1.06); }

@media (max-width: 1100px) { .home-grid { grid-template-columns: 1fr; } .side-stack { grid-template-columns: 1fr 1fr; } .side-stack .wisdom-card { grid-column: 1 / -1; } }
@media (max-width: 760px) { .hero-verse { min-height: 420px; padding: 22px; border-radius: 18px; } .side-stack { grid-template-columns: 1fr; } }

/* ───────── Chapters ───────── */
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.chapter-card { display: grid; grid-template-rows: auto 1fr; border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.chapter-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-raised); }
.chapter-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.chapter-card .body { display: grid; gap: 6px; padding: 16px 18px 18px; align-content: start; }
.chapter-card .meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chapter-card .meta .progress { flex: 1; }
@media (max-width: 760px) {
  .chapter-grid { grid-template-columns: 1fr; gap: 0; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
  .chapter-card { grid-template-rows: none; grid-template-columns: 84px 1fr; border-radius: 0; border-top: 1px solid var(--hairline); align-items: center; }
  .chapter-card:first-child { border-top: 0; }
  .chapter-card:hover { transform: none; box-shadow: none; }
  .chapter-card img { aspect-ratio: 1; margin: 12px 0 12px 12px; width: 72px; border-radius: 10px; }
  .chapter-card .body { padding: 12px 14px; }
}

.chapter-layout { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 40px; align-items: start; }
.chapter-aside { position: sticky; top: 28px; display: grid; gap: 18px; }
.chapter-aside > img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 20px; }
.verse-rows { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.verse-row { display: flex; align-items: center; border-top: 1px solid var(--hairline); }
.verse-row:first-child { border-top: 0; }
.verse-row .check { width: 56px; height: 56px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-faint); flex: none; }
.verse-row .check i { font-size: 1.45rem; }
.verse-row .check[aria-checked="true"] { color: var(--accent); }
.verse-row a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 18px 12px 0; }
.verse-row a:hover { color: var(--accent); }
.verse-row .text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.verse-row .text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); font-size: 0.9rem; }
@media (max-width: 900px) { .chapter-layout { grid-template-columns: 1fr; gap: 24px; } .chapter-aside { position: static; } .chapter-aside > img { aspect-ratio: 16 / 10; } }

/* ───────── Verse reader ───────── */
.reader { max-width: var(--measure); margin: 0 auto; display: grid; gap: 34px; }
.reader-top { display: flex; align-items: center; gap: 4px; }
.reader-top .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.sanskrit-block { display: grid; gap: 16px; text-align: center; }
.reader .translation { display: grid; gap: 12px; }
.reflection { display: grid; gap: 14px; padding: 26px; border-radius: var(--radius-lg); background: var(--surface); border-left: 3px solid var(--flame); }
.reflection .deep { font: 400 calc(var(--reading) - 1px)/1.7 var(--font-serif); }
.reflection .essence { color: var(--ink-soft); font-size: calc(var(--reading) - 3px); line-height: 1.65; padding-top: 14px; border-top: 1px solid var(--hairline); }
details.words { background: var(--surface); border-radius: var(--radius-lg); }
details.words summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 20px; cursor: pointer; font-weight: 600; }
details.words summary::-webkit-details-marker { display: none; }
details.words summary i:last-child { margin-left: auto; transition: transform 0.2s; }
details.words[open] summary i:last-child { transform: rotate(180deg); }
.word-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0 20px 14px; }
.word-list div { display: contents; }
.word-list dt, .word-list dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--hairline); }
.word-list dt { font: italic 400 1.05rem/1.4 var(--font-serif); }
.word-list dd { text-align: right; color: var(--ink-soft); }
.verse-note { display: grid; gap: 10px; }
.verse-note textarea { width: 100%; min-height: 96px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface); font: 400 1.05rem/1.55 var(--font-serif); resize: vertical; }
.verse-nav { display: flex; justify-content: space-between; gap: 12px; }
.verse-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); color: var(--ink-soft); }
.verse-nav a:hover { color: var(--accent); }

/* Player */
.player {
  position: fixed; left: var(--sidebar); right: 0; bottom: 0; z-index: 18;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--hairline);
}
.player-inner { max-width: calc(var(--measure) + 120px); margin: 0 auto; padding: 12px 24px 14px; display: grid; gap: 6px; }
.seek { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; font-size: 0.78rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.seek input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; cursor: pointer; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.controls .center { display: flex; align-items: center; gap: 14px; }
.play-btn { width: 56px; height: 56px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); transition: transform 0.12s var(--ease); }
.play-btn:hover { background: var(--accent-pressed); }
.play-btn:active { transform: scale(0.95); }
.play-btn i { font-size: 1.6rem; }
.speed { min-width: 52px; height: 34px; padding: 0 10px; border-radius: 999px; border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.player .notice { text-align: center; font-size: 0.8rem; color: var(--ink-soft); }
body.has-player .page { padding-bottom: 200px; }
@media (max-width: 760px) { .player { left: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); } .player-inner { padding: 8px 14px 10px; } }

/* ───────── Wisdom, saved, notes ───────── */
.quote-list { columns: 2 320px; column-gap: 18px; }
.quote { break-inside: avoid; margin: 0 0 18px; display: grid; gap: 12px; padding: 22px; border-radius: var(--radius-lg); background: var(--surface); }
.quote p { font: 400 1.12rem/1.6 var(--font-serif); }
.quote footer { display: flex; align-items: center; gap: 4px; color: var(--ink-soft); font-size: 0.85rem; }
.quote footer span { flex: 1; }
.verse-card { display: grid; gap: 8px; padding: 20px 22px; border-radius: var(--radius-lg); background: var(--surface); position: relative; }
.verse-card:hover { background: var(--surface-raised); }
.verse-card .first { font: 400 1rem/1.7 var(--font-sanskrit); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verse-card .tr { font: 400 1.08rem/1.55 var(--font-serif); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.verse-card .corner { position: absolute; top: 10px; right: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.theme-tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 4 / 3; padding: 18px; border-radius: var(--radius-lg); overflow: hidden; color: #fff; isolation: isolate; }
.theme-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform 0.6s var(--ease); }
.theme-tile::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 30%, rgba(10, 12, 20, 0.82)); }
.theme-tile:hover img { transform: scale(1.04); }
.theme-tile .om { color: #fff; opacity: 0.85; font-size: 1.4rem; }
.theme-tile b { font: 400 1.25rem/1.25 var(--font-display); }

/* ───────── Journey ───────── */
.journey-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 24px; align-items: start; }
.streak-hero { display: grid; justify-items: center; gap: 4px; padding: 30px; border-radius: 22px; background: var(--flame-soft); text-align: center; }
.streak-hero i { color: var(--flame); font-size: 2.2rem; }
.streak-hero b { font: 500 3.2rem/1.1 var(--font-serif); font-variant-numeric: lining-nums; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.calendar .dow { font-size: 0.75rem; color: var(--ink-faint); padding-bottom: 4px; }
.day { aspect-ratio: 1; max-width: 46px; width: 100%; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; font-size: 0.9rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.day.read { background: var(--flame); color: var(--bg); font-weight: 700; }
.day.future { color: var(--ink-faint); opacity: 0.5; }
.day.in-range { background: var(--accent-soft); }
.day.edge { background: var(--accent); color: var(--on-accent); font-weight: 700; }
button.day:hover { outline: 1px solid var(--accent); }
.period { display: flex; align-items: center; gap: 4px; }
.period .grow { flex: 1; font: 400 1.05rem/1.2 var(--font-display); }
.pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 900px) { .journey-grid { grid-template-columns: 1fr; } }

/* ───────── Gita AI ───────── */
.chat { display: grid; grid-template-rows: 1fr auto; height: calc(100dvh - 190px); min-height: 460px; max-width: 820px; margin: 0 auto; background: var(--surface); border-radius: 22px; overflow: hidden; }
.chat-log { overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: 78%; padding: 12px 16px; border-radius: 18px; line-height: 1.55; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.bubble.model { align-self: flex-start; background: var(--surface-raised); border: 1px solid var(--hairline); font: 400 1.08rem/1.6 var(--font-serif); border-bottom-left-radius: 6px; }
.bubble.model { white-space: normal; display: flex; flex-direction: column; gap: 8px; }
.bubble.model p { margin: 0; }
.bubble.model b, .bubble.model .rt-h { font-weight: 600; }
.bubble.model .rt-h { font-size: 1.1em; margin-top: 4px; }
.bubble.model .rt-q { font-style: italic; color: var(--ink-soft); }
.bubble.model .rt-li { padding-left: 1.1em; position: relative; }
.bubble.model .rt-li::before { content: "•"; position: absolute; left: 0; color: var(--flame); }
.chat-compose { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--hairline); background: var(--surface); }
.chat-compose textarea { flex: 1; min-height: 48px; max-height: 160px; padding: 12px 18px; border-radius: 24px; border: 1px solid var(--hairline); background: var(--bg); resize: none; line-height: 1.45; }
.chat-compose textarea:focus { outline: 0; border-color: var(--accent); }
.chat-empty { margin: auto; display: grid; justify-items: center; gap: 12px; text-align: center; max-width: 440px; }
.chat-empty img { width: 76px; height: 76px; border-radius: 50%; }
.prompt { width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--bg); }
.prompt:hover { border-color: var(--accent); }
.typing { display: inline-flex; gap: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.25; } }
@media (max-width: 760px) { .chat { height: calc(100dvh - 58px - var(--tabbar) - 40px - env(safe-area-inset-bottom)); border-radius: 16px; } .chat-log { padding: 16px; } .bubble { max-width: 88%; } }

/* ───────── Settings ───────── */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-grid .col { display: grid; gap: 28px; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }
.google-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; width: 100%;
  padding: 0 20px; border-radius: 999px; border: 1px solid #747775; background: #fff; color: #1f1f1f; font-weight: 500; font-size: 1rem;
}
.google-btn:hover { background: #f2f2f2; }
:root[data-theme="dark"] .google-btn { background: #131314; border-color: #8e918f; color: #e3e3e3; }
:root[data-theme="dark"] .google-btn:hover { background: #2a2b2d; }
.google-btn svg { width: 20px; height: 20px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); font: 400 1.4rem/1 var(--font-display); flex: none; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lang-option { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--surface); text-align: left; }
.lang-option b { font: 400 1.05rem/1.3 var(--font-serif); }
.lang-option span { font-size: 0.8rem; color: var(--ink-soft); }
.lang-option[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Legal */
.legal { max-width: var(--measure); display: grid; gap: 26px; }
.legal section { display: grid; gap: 8px; }
.legal p { color: var(--ink-soft); line-height: 1.7; }

/* ───────── Toast, dialog, popover ───────── */
.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(520px, calc(100% - 32px)); pointer-events: none; }
body.has-player .toasts { bottom: 170px; }
@media (max-width: 760px) { .toasts { bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); } body.has-player .toasts { bottom: calc(var(--tabbar) + 150px); } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-raised); font-size: 0.92rem;
  animation: toast-in 0.22s var(--ease);
}
:root[data-theme="dark"] .toast { background: var(--surface-raised); color: var(--ink); }
.toast .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--flame); flex: none; }
.toast.error .dot { background: var(--danger); }
.toast span { flex: 1; }
.toast button { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog { border: 0; padding: 0; border-radius: 20px; background: var(--surface); color: var(--ink); width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow-raised); }
dialog::backdrop { background: rgba(10, 12, 20, 0.5); }
dialog .dlg { display: grid; gap: 14px; padding: 24px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.menu { position: absolute; z-index: 40; min-width: 220px; max-height: 60vh; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-raised); border: 1px solid var(--hairline); }
.menu button { display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.menu button:hover { background: var(--surface-muted); }
.menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }

/* ───────── Footer ───────── */
.site-foot { max-width: var(--content); margin: 0 auto; padding: 0 40px 40px; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-faint); font-size: 0.85rem; }
.site-foot a:hover { color: var(--accent); }
@media (max-width: 1100px) { .site-foot { padding: 0 32px 40px; } }
.site-foot .credit { margin-left: auto; }
.site-foot .credit a { color: var(--ink-soft); }
@media (max-width: 760px) {
  .site-foot { padding: 8px var(--gutter) calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); gap: 6px 16px; font-size: 0.8rem; }
  .page:has(+ .site-foot), .page:has(+ .about) { padding-bottom: 32px; }
  .site-foot .credit { margin-left: 0; flex-basis: 100%; }
}

/* About and questions (English home) and the language links in pre-rendered footers */
.about { max-width: var(--content); margin: -40px auto 0; padding: 0 40px 56px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: start; }
.about-intro p { max-width: 52ch; }
.faq { display: grid; gap: 14px; }
.faq details { background: var(--surface); border-radius: var(--radius); }
.faq details + details { margin-top: -6px; }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary i { color: var(--ink-faint); transition: transform 0.2s var(--ease); }
.faq details[open] summary i { transform: rotate(180deg); }
.faq details p { padding: 0 18px 18px; color: var(--ink-soft); max-width: 68ch; }
.lang-links { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.lang-links a[aria-current] { color: var(--ink); }
/* With the recitation bar fixed at the bottom, the footer (not the page) keeps clear of it. */
body.has-player .page:has(+ .site-foot) { padding-bottom: 48px; }
body.has-player .site-foot { padding-bottom: 170px; }
@media (max-width: 760px) { body.has-player .site-foot { padding-bottom: calc(var(--tabbar) + 150px + env(safe-area-inset-bottom)); } }
@media (max-width: 1100px) { .about { grid-template-columns: 1fr; gap: 28px; padding: 0 32px 48px; } }
@media (max-width: 760px) { .about { margin-top: -24px; padding: 0 var(--gutter) 32px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
