/* ==========================================================================
   श्रीमद्भगवद्गीता — Enterprise & Android-Native Design System (v2.1 Complete)
   Themes: AMOLED Black (Default) | Manuscript Sepia | Daylight Ivory
   ========================================================================== */

:root,
[data-theme="amoled"] {
  --bg-base: #000000;
  --bg-surface: #0a0a0d;
  --bg-elevated: #121218;
  --bg-hover: #1b1b24;
  --bg-glass: rgba(0, 0, 0, 0.88);

  --border-subtle: #1f1f29;
  --border-strong: #2e2e3d;

  --text-primary: #f5f5f7;
  --text-secondary: #a1a1b5;
  --text-muted: #6e6e82;

  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --accent-border: rgba(245, 158, 11, 0.35);

  --secondary-accent: #38bdf8;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;

  --sanskrit-color: #fcd34d;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.85);
}

[data-theme="sepia"] {
  --bg-base: #f4ecd8;
  --bg-surface: #efe4ca;
  --bg-elevated: #e7d9b8;
  --bg-hover: #dfd0ac;
  --bg-glass: rgba(244, 236, 216, 0.92);

  --border-subtle: #d6c5a0;
  --border-strong: #bfa87d;

  --text-primary: #261c12;
  --text-secondary: #5c4732;
  --text-muted: #7d674f;

  --accent: #9a3412;
  --accent-hover: #7c2d12;
  --accent-soft: rgba(154, 52, 18, 0.11);
  --accent-border: rgba(154, 52, 18, 0.35);

  --secondary-accent: #1d4ed8;
  --success: #15803d;
  --warning: #a16207;
  --danger: #b91c1c;

  --sanskrit-color: #7c2d12;
  --shadow-sm: 0 2px 10px rgba(68, 46, 20, 0.08);
  --shadow-lg: 0 18px 40px rgba(68, 46, 20, 0.18);
}

[data-theme="light"] {
  --bg-base: #f8f9fb;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f4f9;
  --bg-hover: #e5ebf4;
  --bg-glass: rgba(255, 255, 255, 0.9);

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-soft: rgba(180, 83, 9, 0.1);
  --accent-border: rgba(180, 83, 9, 0.3);

  --secondary-accent: #1d4ed8;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;

  --sanskrit-color: #1e3a8a;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.14);
}

:root {
  --font-ui: 'Inter', 'Noto Sans Devanagari', system-ui, -apple-system, sans-serif;
  --font-sanskrit: 'Tiro Devanagari Sanskrit', 'Noto Sans Devanagari', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --reader-font-size: 18px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --topbar-h: 66px;
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --max-w: 1280px;
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ==========================================================================
   Reset, Base Typography & Touch Ergonomics
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  overflow-x: clip;
}

[data-theme="sepia"],
[data-theme="light"] {
  color-scheme: light;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-y: contain;
}

a {
  color: inherit;
  text-decoration: none;
}

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

code,
kbd {
  font-family: var(--font-mono);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 0.72rem;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Layout Containers */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.app-main {
  flex: 1;
  padding: 1.65rem 0 3.5rem;
}

/* ==========================================================================
   Sticky Top Navigation Bar & Android Native Bottom Tab Bar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  max-width: var(--max-w);
  height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.95rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
  min-width: 0;
}

.brand-emblem {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-family: var(--font-sanskrit);
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent);
}

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

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.48rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.nav-link svg {
  width: 16px;
  height: 16px;
}

.nav-link:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.83rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.cmd-trigger svg {
  width: 15px;
  height: 15px;
}

.cmd-trigger:hover {
  border-color: var(--accent-border);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.vault-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.vault-pill:hover {
  border-color: var(--accent-border);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.synced {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.status-dot.syncing {
  background: var(--accent);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.icon-btn.sm {
  width: 34px;
  height: 34px;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--bg-elevated);
}

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

/* Native Android Bottom Tab Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding: 0 0.25rem var(--safe-bottom);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 48px;
  padding: 0.35rem 0.2rem;
  border-radius: var(--radius-md);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition), transform 120ms ease;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-item.active svg {
  filter: drop-shadow(0 0 8px var(--accent-soft));
}

.mobile-only {
  display: none;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-strong);
  margin: 0.55rem auto 0.2rem;
  flex-shrink: 0;
}

/* ==========================================================================
   Buttons, Chips, Badges & Form Controls
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  min-height: 40px;
  padding: 0.56rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn.full {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.78rem;
  font-size: 0.8rem;
}

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

[data-theme="sepia"] .btn-primary,
[data-theme="light"] .btn-primary {
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

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

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

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

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

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.24);
}

.btn-success {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.24);
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  flex-wrap: wrap;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.36rem 0.78rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.badge-accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.badge-speaker-krishna {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--secondary-accent);
}

.badge-speaker-arjuna {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}

.badge-speaker-sanjaya {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.4);
  color: #c084fc;
}

.badge-speaker-dhritarashtra {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger);
}

.mono-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.16rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent);
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  min-height: 40px;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.textarea-input {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

/* ==========================================================================
   Hero, Verse of the Day & KPI Strip (Home View)
   ========================================================================== */
.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.hero-card,
.votd-card,
.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.55rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 55%),
    var(--bg-surface);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.hero-title {
  font-size: clamp(1.75rem, 3.6vw, 2.55rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 60ch;
  margin-bottom: 1.35rem;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-subtle);
}

.kpi-item {
  display: flex;
  flex-direction: column;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.votd-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  border-color: var(--accent-border);
}

.votd-sanskrit {
  font-family: var(--font-sanskrit);
  font-size: 1.26rem;
  line-height: 1.8;
  color: var(--sanskrit-color);
  white-space: pre-line;
}

.votd-trans {
  font-size: 0.92rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Section Headers */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.section-head p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   18-Chapter Bento Grid
   ========================================================================== */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.chapter-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
  overflow: hidden;
  min-width: 0;
}

.chapter-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  background: var(--bg-elevated);
}

.chapter-num-watermark {
  position: absolute;
  top: 0.55rem;
  right: 0.9rem;
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text-primary);
  opacity: 0.05;
  pointer-events: none;
  line-height: 1;
}

.chapter-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chapter-card h3 {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
}

.chapter-meaning {
  font-size: 0.83rem;
  color: var(--accent);
  font-weight: 500;
}

.chapter-summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.chapter-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mini-progress {
  width: 90px;
  height: 5px;
  border-radius: 99px;
  background: var(--border-subtle);
  overflow: hidden;
}

.mini-progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

/* ==========================================================================
   Chapter Explorer, Verse Cards & Clickable Sanskrit Lexicon
   ========================================================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

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

.chapter-banner {
  background:
    radial-gradient(circle at right top, var(--accent-soft), transparent 60%),
    var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.55rem;
  margin-bottom: 1.35rem;
}

.chapter-banner h1 {
  font-size: clamp(1.45rem, 3.2vw, 2.15rem);
  margin: 0.35rem 0 0.5rem;
}

.chapter-summary-full {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.85rem;
  line-height: 1.75;
}

.toolbar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.verse-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(345px, 1fr));
  gap: 1rem;
}

.verse-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.28rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition), transform var(--transition);
  min-width: 0;
}

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

.verse-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.verse-ref {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.22rem 0.62rem;
  border-radius: 6px;
}

.sanskrit-text {
  font-family: var(--font-sanskrit);
  font-size: calc(var(--reader-font-size) * 1.12);
  line-height: 1.85;
  color: var(--sanskrit-color);
  white-space: pre-line;
  word-break: break-word;
}

.iast-text {
  font-size: calc(var(--reader-font-size) * 0.86);
  color: var(--text-muted);
  font-style: italic;
  white-space: pre-line;
  word-break: break-word;
}

.translation-text {
  font-size: var(--reader-font-size);
  color: var(--text-primary);
  line-height: 1.75;
  word-break: break-word;
}

.verse-card .sanskrit-text {
  font-size: 1.12rem;
}

.verse-card .translation-text {
  font-size: 0.93rem;
  color: var(--text-secondary);
}

.verse-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

/* Clickable Sanskrit Words (C-SALT Lexicon Lookup) */
.slok-word-btn {
  display: inline;
  background: transparent;
  border: none;
  border-bottom: 1px dashed transparent;
  padding: 0 2px;
  border-radius: 4px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.slok-word-btn:hover,
.slok-word-btn:focus-visible {
  background: var(--accent-soft);
  border-bottom-color: var(--accent);
  outline: none;
}

/* ==========================================================================
   Immersive Single-Shloka Study Studio
   ========================================================================== */
.study-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 1.35rem;
  align-items: start;
}

.shloka-hero {
  background:
    radial-gradient(circle at top center, var(--accent-soft), transparent 55%),
    var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.9rem;
  margin-bottom: 1.25rem;
  text-align: center;
  touch-action: pan-y;
}

.shloka-hero .sanskrit-text {
  font-size: calc(var(--reader-font-size) * 1.36);
  margin: 1rem 0 0.85rem;
}

.shloka-hero .iast-text {
  margin-bottom: 1.1rem;
}

.audio-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.58rem;
  padding: 0.75rem 1rem;
  margin-top: 1.2rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.commentary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.commentary-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.commentary-author {
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.wiki-link-btn {
  border: none;
  background: transparent;
  color: var(--secondary-accent);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  transition: background var(--transition);
}

.wiki-link-btn:hover {
  background: var(--bg-elevated);
}

.commentary-block {
  margin-top: 0.85rem;
}

.commentary-block-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.commentary-body {
  font-size: var(--reader-font-size);
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-line;
  word-break: break-word;
}

.study-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: calc(var(--topbar-h) + 1rem);
}

.stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

/* On-Demand Translation & BYOK Socratic AI Panel */
.pro-widget-box {
  padding: 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ai-answer-box {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-line;
}

/* ==========================================================================
   Side-by-Side Commentator Comparator & Diff Highlights
   ========================================================================== */
.compare-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.compare-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.diff-add {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
  padding: 0 2px;
  border-radius: 3px;
}

.diff-del {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  text-decoration: line-through;
  padding: 0 2px;
  border-radius: 3px;
}

[data-theme="sepia"] .diff-add,
[data-theme="light"] .diff-add {
  color: #166534;
}

[data-theme="sepia"] .diff-del,
[data-theme="light"] .diff-del {
  color: #991b1b;
}

/* ==========================================================================
   Pro Hub: Gita Compass, Knowledge Graph, Memorizer, SRS, Plans & Heatmap
   ========================================================================== */
.compass-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 1rem;
}

.compass-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.compass-card:hover,
.compass-card.active {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateY(-2px);
}

.graph-canvas {
  width: 100%;
  height: 500px;
  border-radius: var(--radius-md);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
}

/* Kanthastha Progressive Memorizer */
.memo-stage {
  padding: 1.65rem;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.memo-word {
  display: inline-block;
  margin: 0 3px 5px 0;
  padding: 2px 6px;
  border-radius: 5px;
  transition: filter 180ms ease, background 180ms ease;
}

.memo-word.masked {
  filter: blur(7px);
  background: var(--accent-soft);
  cursor: pointer;
  user-select: none;
}

.memo-word.masked.revealed {
  filter: none;
  background: transparent;
}

/* SM-2 Spaced Repetition Flashcard Deck */
.srs-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.srs-answer {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  text-align: left;
}

.srs-rating-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 1.25rem;
}

/* Structured Reading Plans */
.plan-card {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.3rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.plan-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

/* 365-Day Study Activity Heatmap */
.heatmap-wrap {
  overflow-x: auto;
  padding: 0.5rem 0;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-flow: column;
  gap: 3px;
  width: max-content;
}

.heat-cell {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.heat-cell.l1 {
  background: rgba(245, 158, 11, 0.28);
  border-color: transparent;
}

.heat-cell.l2 {
  background: rgba(245, 158, 11, 0.52);
  border-color: transparent;
}

.heat-cell.l3 {
  background: rgba(245, 158, 11, 0.78);
  border-color: transparent;
}

.heat-cell.l4 {
  background: var(--accent);
  border-color: transparent;
}

/* QR Share Box */
.qr-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #000000;
  width: max-content;
  margin: 0.5rem auto;
}

/* Zen Recitation Room Fullscreen Theater */
.zen-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(1rem + var(--safe-top)) 1.5rem calc(1.25rem + var(--safe-bottom));
}

.zen-overlay[hidden] {
  display: none;
}

.zen-topbar,
.zen-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.zen-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 0;
  overflow-y: auto;
}

.zen-sanskrit {
  font-family: var(--font-sanskrit);
  font-size: clamp(1.45rem, 4vw, 2.45rem);
  line-height: 1.75;
  color: var(--sanskrit-color);
  white-space: pre-line;
  margin-bottom: 1rem;
}

.zen-iast {
  font-size: clamp(0.92rem, 2vw, 1.12rem);
  color: var(--text-muted);
  font-style: italic;
  white-space: pre-line;
  margin-bottom: 1.2rem;
}

.zen-trans {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--text-primary);
  line-height: 1.75;
  max-width: 62ch;
  margin-bottom: 0.65rem;
}

/* ==========================================================================
   Search, Library & Analytics Views
   ========================================================================== */
.search-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.35rem;
}

.search-input-lg-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-lg-wrap svg {
  position: absolute;
  left: 1rem;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.search-input-lg {
  width: 100%;
  height: 50px;
  padding: 0 1rem 0 2.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-base);
  font-size: 1rem;
}

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

mark {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0 2px;
  border-radius: 3px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.chart-box {
  position: relative;
  height: 320px;
  width: 100%;
  margin-top: 0.85rem;
}

.mastery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.mastery-tile {
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color var(--transition);
}

.mastery-tile:hover {
  border-color: var(--accent-border);
}

/* ==========================================================================
   Modals, Command Palette, Info Dialog & Preferences Drawer
   ========================================================================== */
.modal-backdrop,
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(6px);
  display: flex;
}

.modal-backdrop[hidden],
.drawer-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 1rem 1rem;
  overflow-y: auto;
}

.cmd-dialog,
.poster-dialog,
.info-dialog {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.cmd-dialog {
  max-width: 640px;
}

.poster-dialog {
  max-width: 840px;
}

.info-dialog {
  max-width: 600px;
}

.info-dialog-body {
  padding: 1.25rem;
  max-height: 70dvh;
  overflow-y: auto;
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.cmd-input-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 0.98rem;
  outline: none;
  min-width: 0;
}

.cmd-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.5rem;
}

.cmd-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition);
}

.cmd-item:hover,
.cmd-item.selected {
  background: var(--accent-soft);
}

.cmd-item-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.cmd-item-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.cmd-footer {
  display: flex;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Preferences Drawer */
.drawer-backdrop {
  justify-content: flex-end;
}

.drawer-panel {
  width: min(420px, 100vw);
  height: 100dvh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-header h2 {
  font-size: 1.05rem;
}

.drawer-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.25rem calc(1.5rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.pref-group {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pref-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.pref-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

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

.theme-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.theme-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.theme-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}

.swatch-amoled {
  background: #000000;
}

.swatch-sepia {
  background: #f4ecd8;
}

.swatch-light {
  background: #ffffff;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 0.85rem;
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.range-input {
  width: 100%;
  accent-color: var(--accent);
}

.vault-box {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: var(--bg-base);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 220ms ease;
}

/* Poster Studio v2 Modal */
.poster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.poster-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.poster-body {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.25rem;
  padding: 1.25rem;
  max-height: 80dvh;
  overflow-y: auto;
}

.poster-preview-wrap {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: grid;
  place-items: center;
}

#poster-canvas {
  width: 100%;
  max-height: 430px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.poster-controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

/* ==========================================================================
   States: Empty, Skeleton & Toast Notifications
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 2.75rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-secondary);
}

.empty-state h3 {
  color: var(--text-primary);
  margin: 0.65rem 0 0.35rem;
}

.skeleton-line,
.skeleton-card {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line.lg {
  height: 34px;
  width: 44%;
  margin-bottom: 0.85rem;
}

.skeleton-line.md {
  height: 18px;
  width: 65%;
  margin-bottom: 1.5rem;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.skeleton-card {
  height: 190px;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.toast-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 2rem));
  padding: 0.78rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 220ms ease;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.5);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.5);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 1.35rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-left p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.footer-right {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Android-Native Mobile & Tablet Responsive Rules
   ========================================================================== */
@media (max-width: 1060px) {
  .hero-grid,
  .study-layout,
  .analytics-grid,
  .poster-body {
    grid-template-columns: 1fr;
  }

  .study-sidebar {
    position: static;
  }

  .cmd-trigger-label {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-h: 56px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block;
  }

  .primary-nav {
    display: none !important;
  }

  .site-footer {
    display: none;
  }

  .mobile-bottom-nav {
    display: grid;
  }

  .app-main {
    padding: 0.95rem 0 calc(var(--bottom-nav-h) + var(--safe-bottom) + 1.45rem);
  }

  .container {
    padding: 0 0.85rem;
  }

  .topbar-inner {
    padding: 0 0.85rem;
    gap: 0.5rem;
  }

  .brand-emblem {
    width: 32px;
    height: 32px;
    font-size: 1.15rem;
    border-radius: 9px;
  }

  .brand-title {
    font-size: 0.96rem;
  }

  .brand-sub {
    font-size: 0.56rem;
    letter-spacing: 0.1em;
  }

  .cmd-trigger {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }

  .hero-card,
  .votd-card,
  .panel-card,
  .chapter-banner,
  .search-hero {
    padding: 1.12rem;
    border-radius: 14px;
  }

  .shloka-hero {
    padding: 1.25rem 1rem;
    border-radius: 14px;
  }

  .shloka-hero .sanskrit-text {
    font-size: clamp(1.18rem, 5.2vw, 1.48rem);
    line-height: 1.78;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .chapter-grid,
  .verse-list,
  .compare-columns,
  .compass-grid {
    grid-template-columns: 1fr;
  }

  .srs-rating-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar-bar {
    padding: 0.72rem 0.85rem;
    gap: 0.65rem;
  }

  .toolbar-bar .chip-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .toolbar-bar .chip-group::-webkit-scrollbar {
    display: none;
  }

  .graph-canvas {
    height: 360px;
  }

  /* Native Android Bottom-Sheet Modals & Preferences Drawer */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .cmd-dialog,
  .poster-dialog,
  .info-dialog {
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    max-height: 88dvh;
    padding-bottom: var(--safe-bottom);
  }

  .drawer-backdrop {
    align-items: flex-end;
  }

  .drawer-panel {
    width: 100vw;
    height: auto;
    max-height: 88dvh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 20px 20px 0 0;
  }

  .toast-stack {
    left: 0.85rem;
    right: 0.85rem;
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.75rem);
  }

  .toast {
    max-width: 100%;
  }
}

@media (max-width: 400px) {
  .brand-sub {
    display: none;
  }

  .stepper-bar {
    justify-content: space-between;
  }

  .stepper-bar .breadcrumb {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .mastery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Clean Print Layout
   ========================================================================== */
@media print {
  .topbar,
  .site-footer,
  .mobile-bottom-nav,
  .study-sidebar,
  .audio-dock,
  .stepper-bar,
  .modal-backdrop,
  .drawer-backdrop,
  .zen-overlay {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .study-layout {
    grid-template-columns: 1fr !important;
  }

  .shloka-hero,
  .commentary-card {
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    break-inside: avoid;
  }
}
/* ==========================================================================
   V3 ADDITIONS: Native View Transitions, Typography Tuning, Resume Banner,
   Daily Goal Ring, Panchang Pill, Parayana Book Mode, Multi-Color Highlights,
   Word-by-Word Grid, Concordance Bars, Markdown Preview & Voice Mic
   ========================================================================== */

:root {
  --reader-line-height: 1.8;
}

.sanskrit-text,
.commentary-body,
.translation-text {
  line-height: var(--reader-line-height);
}

[data-dyslexia="1"] .sanskrit-text,
[data-dyslexia="1"] .commentary-body,
[data-dyslexia="1"] .translation-text {
  letter-spacing: 0.045em;
  word-spacing: 0.16em;
  line-height: 2.05;
}

[data-font-family="noto-serif"] .sanskrit-text,
[data-font-family="noto-serif"] .votd-sanskrit,
[data-font-family="noto-serif"] .zen-sanskrit {
  font-family: 'Noto Serif Devanagari', Georgia, serif;
}

[data-font-family="noto-sans"] .sanskrit-text,
[data-font-family="noto-sans"] .votd-sanskrit,
[data-font-family="noto-sans"] .zen-sanskrit {
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
}

/* Native View Transitions API Crossfade */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 160ms;
}

/* Continue Reading & Daily Goal Strip */
.resume-strip {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.resume-card,
.goal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.resume-card {
  border-left: 3px solid var(--accent);
}

.goal-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  background: conic-gradient(var(--accent) calc(var(--goal-pct, 0) * 1%), var(--border-subtle) 0);
  flex-shrink: 0;
}

.goal-ring > span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: grid;
  place-items: center;
}

/* Panchang / Vikram Samvat Badge */
.panchang-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}

/* Continuous Parayana (Book) Mode & Sticky Teleprompter Bar */
.parayana-shell {
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.parayana-verse {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.parayana-verse:last-child {
  border-bottom: none;
}

.teleprompter-dock {
  position: sticky;
  bottom: 1rem;
  z-index: 90;
  max-width: 520px;
  margin: 1.25rem auto 0;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--accent-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Word-by-Word (Padaccheda) Chips Grid */
.padaccheda-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.pada-chip {
  display: inline-flex;
  flex-direction: column;
  padding: 0.42rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.pada-term {
  font-weight: 700;
  color: var(--accent);
}

.pada-gloss {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

/* In-Commentary Multi-Color Highlights */
.hl-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
}

.hl-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.hl-dot:hover {
  transform: scale(1.15);
}

.hl-dot.gold { background: #f59e0b; }
.hl-dot.blue { background: #38bdf8; }
.hl-dot.green { background: #22c55e; }

mark.hl-gold {
  background: rgba(245, 158, 11, 0.28);
  color: inherit;
  padding: 0 3px;
  border-radius: 4px;
}

mark.hl-blue {
  background: rgba(56, 189, 248, 0.25);
  color: inherit;
  padding: 0 3px;
  border-radius: 4px;
}

mark.hl-green {
  background: rgba(34, 197, 94, 0.25);
  color: inherit;
  padding: 0 3px;
  border-radius: 4px;
}

/* Markdown Study Notes Preview */
.md-preview {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  line-height: 1.7;
}

.md-preview ul,
.md-preview ol {
  padding-left: 1.25rem;
  margin: 0.4rem 0;
}

.md-preview blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  color: var(--text-secondary);
  margin: 0.45rem 0;
}

/* Search 18-Chapter Concordance Mini-Chart */
.concordance-strip {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  align-items: end;
  gap: 4px;
  height: 54px;
  padding-top: 0.5rem;
}

.concordance-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
}

.concordance-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: 0.85;
  transition: opacity 150ms ease;
}

.concordance-col:hover .concordance-bar {
  opacity: 1;
}

.concordance-lbl {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* Voice Search Active Pulse */
.mic-listening {
  border-color: var(--danger) !important;
  color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.14) !important;
  animation: pulse 1s infinite;
}

/* Driver.js Dark/AMOLED Override */
.driver-popover {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--accent-border) !important;
  border-radius: 14px !important;
}

.driver-popover-title {
  color: var(--accent) !important;
  font-family: var(--font-ui) !important;
}

.driver-popover-description {
  color: var(--text-secondary) !important;
  font-family: var(--font-ui) !important;
}

@media (max-width: 820px) {
  .resume-strip {
    grid-template-columns: 1fr;
  }

  .parayana-shell {
    padding: 1.15rem 0.9rem;
  }

  .teleprompter-dock {
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.65rem);
    border-radius: 14px;
  }
}

/* V3.1 FIX: Independent Sidebar Scroll, Markdown AI Box & Laptop Topbar Fit */
@media (min-width: 1061px) {
  .study-sidebar {
    max-height: calc(100dvh - var(--topbar-h) - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-gutter: stable;
  }
}

.ai-answer-box {
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
  white-space: normal;
}

.ai-answer-box.expanded {
  max-height: 68vh;
}

.ai-answer-box h1,
.ai-answer-box h2,
.ai-answer-box h3,
.ai-answer-box h4 {
  font-size: 0.95rem;
  color: var(--accent);
  margin: 0.7rem 0 0.35rem;
}

.ai-answer-box h1:first-child,
.ai-answer-box h2:first-child,
.ai-answer-box h3:first-child,
.ai-answer-box h4:first-child {
  margin-top: 0;
}

.ai-answer-box p {
  margin-bottom: 0.55rem;
}

.ai-answer-box ul,
.ai-answer-box ol {
  padding-left: 1.2rem;
  margin: 0.35rem 0 0.65rem;
}

.ai-answer-box li {
  margin-bottom: 0.28rem;
}

.ai-answer-box blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  color: var(--text-secondary);
  margin: 0.5rem 0;
}

@media (max-width: 1280px) {
  .cmd-trigger-label {
    display: none;
  }
  .nav-link {
    padding: 0.44rem 0.62rem;
    font-size: 0.84rem;
  }
  .topbar-inner {
    gap: 0.55rem;
  }
}

/* ==========================================================================
   V4 LAUNCH POLISH: Reading Progress Bar, Auto-Hide Mobile Header,
   Floating Audio Mini-Player, Offline/Install Banners, Back-to-Top,
   Onboarding Card, Related Shlokas, Key Verses Strip & WCAG 2.2 Focus
   ========================================================================== */

/* WCAG 2.2 Accessibility: Skip Link & High-Contrast Focus */
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 999;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #000000;
  font-weight: 700;
  transition: top 140ms ease;
}

.skip-link:focus {
  top: 0.75rem;
}

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

/* 2px Reading Progress Bar under Topbar */
.reading-progress-bar {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top));
  left: 0;
  height: 2.5px;
  width: 0%;
  z-index: 105;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 80ms linear;
  pointer-events: none;
}

/* Smooth Mobile Auto-Hide Header */
.topbar {
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 820px) {
  .topbar.topbar-hidden {
    transform: translateY(-105%);
  }
  .topbar.topbar-hidden + .reading-progress-bar {
    top: 0;
  }
}

/* Subtle Offline & Install App Banners */
.status-banner {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.status-banner[hidden] {
  display: none;
}

.status-banner-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.install-banner {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-border);
  color: var(--text-primary);
}

/* Persistent Floating Audio Mini-Player */
.mini-audio-bar {
  position: fixed;
  left: 50%;
  bottom: 1.15rem;
  transform: translateX(-50%);
  z-index: 150;
  width: min(480px, calc(100vw - 1.7rem));
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-pill);
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--accent-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.mini-audio-bar[hidden] {
  display: none;
}

.mini-audio-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
}

.mini-audio-meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Floating Back-to-Top Button */
.back-to-top-btn {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 130;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--accent-border);
  background: var(--bg-elevated);
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.back-to-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* First-Visit Onboarding Card */
.onboarding-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-surface));
  border: 1px solid var(--accent-border);
}

/* Key Verses Spotlight & Related Shlokas */
.key-verses-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition), transform var(--transition);
}

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

/* Advanced Settings Accordion */
.advanced-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  padding: 0.75rem 0.95rem;
}

.advanced-accordion summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.advanced-accordion[open] summary {
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--accent);
}

.advanced-accordion-body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

@media (max-width: 820px) {
  .mini-audio-bar {
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.6rem);
  }
  .back-to-top-btn {
    right: 0.9rem;
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.75rem);
  }
}

/* V4.0.3 FIX: Sub-384px Mobile Overflow & Shloka Screen Containment */
html,
body {
  overflow-x: clip;
  max-width: 100%;
}

.app-main,
.container,
.study-layout,
.study-layout > *,
.study-sidebar,
.study-sidebar > *,
.shloka-hero,
.commentary-card,
.commentary-block,
.pro-widget-box,
.panel-card,
.verse-card,
.chapter-card,
.chapter-banner,
.search-hero,
.toolbar-bar,
.compare-columns > *,
.analytics-grid > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.sanskrit-text,
.iast-text,
.commentary-body,
.translation-text,
.pref-help,
.pada-chip,
.pada-term,
.pada-gloss,
code {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.sanskrit-text {
  white-space: pre-wrap;
}

.slok-word-btn {
  display: inline;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
}

@media (max-width: 1060px) {
  .study-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 600px) {
  .container {
    padding-inline: 0.7rem;
  }

  .shloka-hero {
    padding: 1.15rem 0.85rem;
  }

  .shloka-hero .sanskrit-text {
    font-size: clamp(1.05rem, 4.9vw, 1.38rem);
    line-height: 1.85;
  }

  .shloka-hero .iast-text {
    font-size: 0.84rem;
  }

  .commentary-card,
  .pro-widget-box,
  .panel-card,
  .chapter-banner,
  .search-hero {
    padding: 0.95rem 0.85rem;
  }

  .commentary-card-head,
  .pref-row-between,
  .toolbar-bar,
  .audio-dock,
  .btn-row,
  .hl-toolbar,
  .stepper-bar {
    flex-wrap: wrap;
    max-width: 100%;
  }

  .commentary-card-head > *,
  .pref-row-between > *,
  .toolbar-bar > * {
    min-width: 0;
    max-width: 100%;
  }

  .badge,
  .mono-badge {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .select-input,
  .text-input,
  .textarea-input {
    min-width: 0 !important;
    max-width: 100%;
    width: 100%;
  }

  .audio-dock .select-input {
    width: auto;
    max-width: 100%;
  }

  .related-grid,
  .compare-controls,
  .compare-columns,
  .chapter-grid,
  .verse-list,
  .compass-grid,
  .analytics-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 400px) {
  .container {
    padding-inline: 0.55rem;
  }

  .shloka-hero {
    padding: 1rem 0.72rem;
  }

  .shloka-hero .sanskrit-text {
    font-size: clamp(0.98rem, 4.7vw, 1.2rem);
  }

  .audio-dock {
    padding: 0.55rem;
    gap: 0.4rem;
  }

  .audio-dock .btn,
  .shloka-hero .btn-sm {
    padding: 0.42rem 0.62rem;
    font-size: 0.78rem;
  }

  .pada-chip {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .back-to-top-btn {
    width: 38px;
    height: 38px;
  }
}

/* ==========================================================================
   VALMIKI RAMAYANA EXTENSIONS: Sarga Directory, Kanda Sync, Character Cards
   ========================================================================== */
.sarga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.85rem;
}

.sarga-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition), transform var(--transition);
}

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

.sarga-summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.character-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition);
}

.character-card:hover {
  border-color: var(--accent-border);
}

.faction-rama {
  background: rgba(245, 158, 11, 0.16);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.4);
}

.faction-ravana {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.faction-neutral {
  background: rgba(56, 189, 248, 0.14);
  color: var(--secondary-accent);
  border-color: rgba(56, 189, 248, 0.35);
}

.concordance-strip-7 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  height: 58px;
  padding-top: 0.5rem;
}

@media (max-width: 600px) {
  .sarga-grid,
  .character-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
