/* ===== Theme variables ===== */
:root {
  --font-scale: 1;                 /* JS adjusts this for A− / A+ */

  --bg: #fbf6ee;
  --surface: #ffffff;
  --surface-2: #f4ecdf;
  --text: #2a2018;
  --text-soft: #6b5d4d;
  --accent: #7a1f1f;               /* shrinathji maroon */
  --accent-soft: #f0dcdc;
  --gold: #c79a3a;
  --border: #e7ddcc;
  --shadow: 0 2px 10px rgba(80, 50, 20, 0.08);
}

[data-theme="dark"] {
  --bg: #15110d;
  --surface: #1f1a14;
  --surface-2: #261f17;
  --text: #f1e7d6;
  --text-soft: #b8a98f;
  --accent: #e6a23c;
  --accent-soft: #3a2a18;
  --gold: #e6c168;
  --border: #322a20;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Gujarati", "Shruti", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}

.topbar__title {
  flex: 1;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  font-family: "Noto Serif Gujarati", "Noto Sans Gujarati", serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions { display: flex; gap: 4px; }

.icon-btn {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1rem;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn:hover { background: rgba(255, 255, 255, 0.26); }

#backBtn { font-size: 1.8rem; line-height: 1; }

/* ===== Search ===== */
.searchwrap {
  position: sticky;
  top: 60px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px;
  padding: 4px 6px 4px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.searchwrap__icon { opacity: 0.6; }
.searchwrap__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 1.05rem;
  font-family: inherit;
  padding: 10px 4px;
}
.searchwrap__mic.listening {
  background: var(--accent);
  color: #fff;
  animation: pulse 1.1s ease-in-out infinite;
}
.searchwrap .icon-btn { background: var(--surface-2); color: var(--text); }
.searchwrap .icon-btn:hover { background: var(--accent-soft); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(199, 60, 60, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(199, 60, 60, 0); }
}

.voice-status {
  margin: -4px 14px 6px;
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* ===== Main / views ===== */
.main { max-width: 760px; margin: 0 auto; padding: 6px 0 40px; }
.view { padding: 6px 12px 0; }

/* ===== Continue card ===== */
.continue-card {
  display: block;
  width: 100%;
  text-align: right;
  background: linear-gradient(135deg, var(--accent), #9c3636);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.continue-card small { display: block; opacity: 0.85; font-size: 0.85rem; margin-bottom: 4px; }
.continue-card strong { font-size: 1.25rem; font-weight: 600; }

/* ===== Index list ===== */
.cat-group { margin-bottom: 18px; }
.cat-group__title {
  font-family: "Noto Serif Gujarati", serif;
  font-size: 1rem;
  color: var(--accent);
  margin: 6px 4px 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--accent-soft);
  font-weight: 600;
}

.paath-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: right;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.1s, border-color 0.15s;
}
.paath-item:active { transform: scale(0.99); }
.paath-item:hover { border-color: var(--accent); }

.paath-item__main { flex: 1; min-width: 0; }
.paath-item__title {
  font-size: 1.3rem;
  font-weight: 600;
  font-family: "Noto Serif Gujarati", serif;
  margin-bottom: 2px;
}
.paath-item__meta { font-size: 0.85rem; color: var(--text-soft); }
.paath-item__star { font-size: 1.2rem; color: var(--gold); }

/* status badge */
.badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge--review { background: var(--accent-soft); color: var(--accent); }
.badge--placeholder { background: #f3e2c2; color: #8a6a1f; }
[data-theme="dark"] .badge--placeholder { background: #3a2f18; color: var(--gold); }

/* ===== Search results ===== */
.search-results { margin-bottom: 12px; }
.search-results__empty { color: var(--text-soft); text-align: center; padding: 24px; }
.result-snippet { color: var(--text-soft); font-size: 0.95rem; margin-top: 4px; }
.result-snippet mark {
  background: var(--gold);
  color: #1a1207;
  border-radius: 3px;
  padding: 0 2px;
}

/* ===== Reader ===== */
.reader-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 4px 10px;
}
.reader-head__title {
  flex: 1;
  margin: 0;
  font-family: "Noto Serif Gujarati", serif;
  font-size: 1.7rem;
  color: var(--accent);
  font-weight: 700;
}
.reader-head__star { background: var(--surface-2); color: var(--gold); font-size: 1.4rem; }

.reader-note {
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 4px 14px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.reader-body { padding: 0 4px; }

.verse {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.verse__num {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  padding: 1px 10px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.verse__text {
  /* THE main reading text — scales with --font-scale */
  font-size: calc(1.55rem * var(--font-scale));
  line-height: 2;
  white-space: pre-wrap;
  font-family: "Noto Serif Gujarati", "Noto Sans Gujarati", serif;
  font-weight: 500;
  text-align: center;
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding: 0 4px;
}
.nav-btn {
  flex: 1;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 14px;
  border-radius: 14px;
  cursor: pointer;
}
.nav-btn:disabled { opacity: 0.4; cursor: default; }
.nav-btn:not(:disabled):active { transform: scale(0.98); }
