:root {
  --color-bg: #f7f4ec;
  --color-bg-alt: #ffffff;
  --color-primary: #0f5132;
  --color-primary-dark: #0a3a24;
  --color-gold: #b8860b;
  --color-text: #2b2b26;
  --color-muted: #6b6b5f;
  --color-border: #e3ddc9;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 81, 50, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--color-bg) 0%, #efe9d8 100%);
  color: var(--color-text);
  min-height: 100vh;
}

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

.site-header {
  background: linear-gradient(120deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fdfaf0;
  padding: 22px 20px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.3));
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.06) 0, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(255,255,255,0.06) 0, transparent 40%);
  pointer-events: none;
}

.site-header h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.site-header p {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: #dfe9df;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #fdfaf0;
  background: rgba(255,255,255,0.12);
  padding: 7px 16px;
  border-radius: 999px;
  position: absolute;
  left: 16px;
  top: 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: background 0.2s ease;
}

.back-link:hover {
  background: rgba(255,255,255,0.22);
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.search-bar {
  margin: 20px auto 20px;
  max-width: 780px;
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

.search-bar input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-bar input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15,81,50,0.15);
}

.surah-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.surah-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.surah-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15,81,50,0.14);
}

.surah-badge {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8e6 0%, #f4e6bd 100%);
  border: 1.5px solid var(--color-gold);
  color: var(--color-primary-dark);
  font-weight: 600;
  font-size: 0.95rem;
}

.surah-info {
  flex: 1;
  min-width: 0;
}

.surah-info .name {
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--color-primary-dark);
}

.surah-info .meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 2px;
}

.surah-arabic-mini {
  font-family: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  font-size: 1.3rem;
  color: var(--color-primary);
  direction: rtl;
}

.state-msg {
  text-align: center;
  color: var(--color-muted);
  padding: 40px 10px;
  font-size: 0.95rem;
}

/* Search results (ayah reference / text search) */
.search-results {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.search-results.visible {
  display: flex;
}

.search-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold);
  font-weight: 700;
  margin-bottom: -2px;
}

.ayah-hit {
  display: block;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ayah-hit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15,81,50,0.14);
}

.ayah-hit-direct {
  border-color: var(--color-gold);
  background: #fffaf0;
}

.ayah-hit-ref {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}

.ayah-hit-arabic {
  font-family: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  font-size: 1.4rem;
  direction: rtl;
  text-align: right;
  line-height: 2;
  color: var(--color-text);
  margin-bottom: 8px;
}

.ayah-hit-translation {
  font-size: 0.88rem;
  color: var(--color-muted);
  line-height: 1.55;
}

/* Surah reading page */
.surah-title-block {
  text-align: center;
  margin-bottom: 22px;
}

.surah-title-block .arabic-name {
  font-family: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  font-size: 2.1rem;
  color: var(--color-primary-dark);
  margin-bottom: 4px;
}

.surah-title-block .latin-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}

.surah-title-block .sub {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 2px;
}

.bismillah {
  text-align: center;
  font-family: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  font-size: 1.7rem;
  color: var(--color-primary);
  margin: 22px 0 28px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--color-border);
}

.ayah-block {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  scroll-margin-top: 90px;
  transition: background 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease;
}

.ayah-block.ayah-highlight {
  background: #fff6df;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.18), var(--shadow);
}

.ayah-number-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.ayah-number {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fdfaf0;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
  box-shadow: 0 2px 6px rgba(15,81,50,0.25);
}

.ayah-number span {
  transform: rotate(-45deg);
}

.ayah-arabic {
  font-family: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  font-size: 2.15rem;
  line-height: 2.7;
  direction: rtl;
  text-align: right;
  color: var(--color-text);
  margin-bottom: 18px;
  letter-spacing: 0.3px;
}

.ayah-translation {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--color-text);
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.ayah-translation p {
  margin: 0;
}

.ayah-translation .label {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold);
  font-weight: 700;
  margin-bottom: 8px;
  background: rgba(184, 134, 11, 0.1);
  padding: 3px 10px;
  border-radius: 999px;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.nav-buttons a {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fdfaf0;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: background 0.2s ease;
}

.nav-buttons a:hover {
  background: var(--color-primary-dark);
}

.nav-buttons a.disabled {
  pointer-events: none;
  opacity: 0.4;
}

@media (min-width: 640px) {
  .ayah-arabic {
    font-size: 2.5rem;
  }
  .site-header h1 {
    font-size: 1.9rem;
  }
  .ayah-hit-arabic {
    font-size: 1.6rem;
  }
}

/* Mobile: surah reading page header — stack back button above centred title
   so they never overlap. Only affects headers that contain a .back-link
   (i.e. the surah page); the home page header is unaffected. */
@media (max-width: 639px) {
  .site-header:has(.back-link) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px 20px;
  }

  .site-header:has(.back-link) .back-link {
    position: relative;
    left: auto;
    top: auto;
    margin-bottom: 10px;
    font-size: 0.85rem;
    padding: 8px 18px;
  }

  .site-header:has(.back-link) h1 {
    width: 100%;
    text-align: center;
    font-size: 1.25rem;
    letter-spacing: 1.5px;
  }
}

@media (max-width: 420px) {
  .ayah-arabic {
    font-size: 1.85rem;
    line-height: 2.4;
  }
  .ayah-block {
    padding: 20px 16px 18px;
  }
}

/* ─── Hamburger button ──────────────────────────────────────────── */
.hamburger-btn {
  position: absolute;
  right: 16px;
  top: 18px;
  width: 42px;
  height: 42px;
  border: none;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  z-index: 10;
  transition: background 0.2s ease;
}

.hamburger-btn:hover {
  background: rgba(255,255,255,0.24);
}

.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fdfaf0;
  border-radius: 2px;
}

/* Prevent title from sliding under the hamburger on surah page */
.site-header:has(.back-link) h1 {
  padding: 0 58px;
}

/* ─── Menu overlay ──────────────────────────────────────────────── */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.menu-overlay.open {
  opacity: 1;
  pointer-events: all;
}

body.menu-open {
  overflow: hidden;
}

/* ─── Sliding drawer ────────────────────────────────────────────── */
.menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 300px;
  max-width: 88vw;
  height: 100%;
  background: var(--color-bg);
  z-index: 300;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 40px rgba(0,0,0,0.18);
  overflow-y: auto;
}

.menu-drawer.open {
  transform: translateX(0);
}

.menu-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(120deg, var(--color-primary), var(--color-primary-dark));
  color: #fdfaf0;
  flex-shrink: 0;
}

.menu-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
}

.menu-close-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fdfaf0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.menu-close-btn:hover {
  background: rgba(255,255,255,0.26);
}

/* ─── Menu items ────────────────────────────────────────────────── */
.menu-items {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  flex: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 22px;
  font-size: 0.96rem;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.menu-item:hover:not(.menu-item-disabled) {
  background: rgba(15,81,50,0.08);
  color: var(--color-primary-dark);
}

.menu-item-active {
  background: rgba(15,81,50,0.1);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.menu-item-icon {
  width: 28px;
  font-size: 1.15rem;
  flex-shrink: 0;
  text-align: center;
}

.menu-item-label {
  flex: 1;
}

.menu-item-disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.menu-item-btn {
  cursor: pointer;
}

.menu-badge-soon {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-gold);
  background: rgba(184,134,11,0.12);
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* ─── Drawer footer ─────────────────────────────────────────────── */
.menu-drawer-footer {
  padding: 16px 22px;
  font-size: 0.76rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  text-align: center;
  flex-shrink: 0;
}

.menu-drawer-footer p {
  margin: 0;
}

/* ─── Library page ──────────────────────────────────────────────── */
.library-intro {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.95rem;
  margin: 0 0 24px;
}

.library-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.library-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.library-card-active {
  border-color: var(--color-primary);
  border-left: 4px solid var(--color-primary);
}

.library-card-active:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15,81,50,0.15);
}

.library-card-soon {
  opacity: 0.75;
}

.library-card-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,81,50,0.07);
  border-radius: 12px;
}

.library-card-body {
  flex: 1;
  min-width: 0;
}

.library-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-primary-dark);
  margin-bottom: 3px;
}

.library-card-desc {
  font-size: 0.82rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.library-card-arrow {
  color: var(--color-primary);
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.library-badge-soon {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-gold);
  background: rgba(184,134,11,0.12);
  padding: 3px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ─── Dashboard page ────────────────────────────────────────────── */
.dash-hero {
  text-align: center;
  padding: 28px 0 10px;
}

.dash-bismillah {
  font-family: "Amiri Quran", "Amiri", serif;
  font-size: 1.75rem;
  color: var(--color-gold);
  line-height: 1.8;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px rgba(184,134,11,0.15);
}

.dash-welcome {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ── Card grid wrapper ─────────────────────────────────────────── */
.dash-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 32px;
}

/* ── Shared card base ─────────────────────────────────────────── */
.dash-card {
  display: block;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  cursor: pointer;
}

.dash-card:not(.dash-card-disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15,81,50,0.14);
}

/* ── Featured card (Qur'on Karim) ────────────────────────────── */
.dash-card-featured {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  background: linear-gradient(120deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fdfaf0;
  box-shadow: 0 4px 20px rgba(15,81,50,0.28);
  position: relative;
  overflow: hidden;
}

.dash-card-featured::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 90% 10%, rgba(255,255,255,0.07) 0, transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.05) 0, transparent 45%);
  pointer-events: none;
}

.dash-card-featured-left {
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
}

.dash-card-featured-icon {
  font-size: 2.4rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
  flex-shrink: 0;
}

.dash-card-featured-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fdfaf0;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.dash-card-featured-desc {
  font-size: 0.8rem;
  color: rgba(253,250,240,0.72);
  font-weight: 400;
}

.dash-card-featured-arrow {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-gold);
  position: relative;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.dash-card-featured:hover .dash-card-featured-arrow {
  transform: translateX(4px);
}

/* ── 2×2 secondary grid ──────────────────────────────────────── */
.dash-secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dash-card-secondary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px 20px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  text-align: center;
  min-height: 120px;
}

.dash-card-icon-wrap {
  font-size: 2rem;
  line-height: 1;
}

.dash-card-sec-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  letter-spacing: 0.2px;
}

.dash-card-sec-desc {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: -4px;
}

.dash-card-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.dash-badge-soon {
  display: inline-block;
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--color-gold);
  background: rgba(184,134,11,0.1);
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

/* Dark mode overrides for dashboard */
html.dark .dash-card-secondary {
  background: var(--color-bg-alt);
  border-color: var(--color-border);
}

html.dark .dash-card-sec-title {
  color: #e4e0d0;
}

html.dark .dash-card-featured {
  background: linear-gradient(120deg, #0c3d24 0%, #071910 100%);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ─── Ayah action buttons ────────────────────────────────────────── */
.ayah-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.ayah-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  line-height: 1;
}

.ayah-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ayah-action-btn:hover {
  background: rgba(15,81,50,0.07);
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
}

.ayah-action-btn:active {
  transform: scale(0.95);
}

/* Bookmark button */
.ayah-action-btn--bookmark {
  color: var(--color-gold);
  border-color: rgba(184,134,11,0.3);
}

.ayah-action-btn--bookmark:hover {
  background: rgba(184,134,11,0.08);
  color: var(--color-gold);
  border-color: var(--color-gold);
}

.ayah-action-btn--bookmark.is-bookmarked {
  background: rgba(184,134,11,0.1);
  color: var(--color-gold);
  border-color: var(--color-gold);
}

.ayah-action-btn--bookmark.is-bookmarked:hover {
  background: rgba(184,134,11,0.18);
}

/* Audio button pushed to the right */
.ayah-action-btn--audio {
  margin-left: auto;
  color: var(--color-muted);
  border-color: var(--color-border);
}

.ayah-action-btn--audio:hover {
  background: rgba(15,81,50,0.07);
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
}

/* Toast notification */
.ayah-copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--color-primary-dark);
  color: #fdfaf0;
  padding: 9px 22px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 500;
  font-family: "Poppins", sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}

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

/* Dark mode */
html.dark .ayah-action-btn:hover {
  background: rgba(255,255,255,0.07);
  color: #e4e0d0;
}

html.dark .ayah-copy-toast {
  background: #0c3d24;
}

@media (max-width: 420px) {
  .ayah-action-btn span {
    display: none;
  }
  .ayah-action-btn {
    padding: 8px 10px;
  }
  .ayah-action-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* ─── Reading controls bar ───────────────────────────────────────── */
.reading-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.rc-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.rc-nav-group {
  gap: 8px;
}

.rc-size-group {
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  padding: 0 14px;
}

.rc-trans-group {
  margin-left: auto;
}

.rc-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  margin-right: 2px;
}

.rc-indicator {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
  min-width: 44px;
  text-align: center;
  white-space: nowrap;
}

.rc-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
  line-height: 1.5;
}

.rc-btn:hover:not(:disabled) {
  background: rgba(15,81,50,0.07);
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
}

.rc-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.rc-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.rc-btn-active {
  background: var(--color-primary);
  color: #fdfaf0;
  border-color: var(--color-primary);
}

.rc-btn-active:hover:not(:disabled) {
  background: var(--color-primary-dark);
  color: #fdfaf0;
  border-color: var(--color-primary-dark);
}

.rc-trans-btn {
  color: var(--color-gold);
  border-color: rgba(184,134,11,0.3);
}

.rc-trans-btn:hover:not(:disabled) {
  background: rgba(184,134,11,0.08);
  color: var(--color-gold);
  border-color: var(--color-gold);
}

/* Arabic size overrides */
.arabic-size-small  .ayah-arabic { font-size: 1.5rem !important;  line-height: 2.3 !important; }
.arabic-size-large  .ayah-arabic { font-size: 2.85rem !important; line-height: 3.1 !important; }

@media (min-width: 640px) {
  .arabic-size-small  .ayah-arabic { font-size: 1.75rem !important; }
  .arabic-size-large  .ayah-arabic { font-size: 3.3rem !important;  }
}

/* Translation hidden */
.translations-hidden .ayah-translation {
  display: none;
}

/* Reading controls — mobile stacking */
@media (max-width: 639px) {
  .reading-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    position: static; /* don't sticky-overlap mobile header */
  }
  .rc-size-group {
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 6px 0;
  }
  .rc-trans-group {
    margin-left: 0;
  }
  .rc-nav-group {
    justify-content: space-between;
  }
  .rc-indicator {
    flex: 1;
  }
}

/* Dark mode */
html.dark .reading-controls {
  background: var(--color-bg-alt);
}

html.dark .rc-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.07);
  color: #e4e0d0;
}

/* ─── Hadith reading page ────────────────────────────────────────── */

.hr-container {
  max-width: 680px;
}

/* Loading dots */
.hr-loading {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 60px 0;
}

.hr-loading-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: hrPulse 1.2s ease-in-out infinite;
}

.hr-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.hr-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes hrPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40%           { opacity: 1;    transform: scale(1);   }
}

/* Meta strip */
.hr-meta-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hr-collection-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary-dark);
  background: rgba(15,81,50,0.09);
  padding: 4px 12px;
  border-radius: 999px;
}

html.dark .hr-collection-tag {
  color: #a0d4b0;
  background: rgba(15,81,50,0.2);
}

.hr-grade {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 999px;
}

/* Arabic text block */
.hr-arabic-block {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px 28px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hr-arabic-block::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold));
}

.hr-arabic-deco {
  font-family: "Amiri Quran", "Amiri", serif;
  font-size: 1.5rem;
  color: var(--color-gold);
  opacity: 0.6;
  margin-bottom: 18px;
  direction: rtl;
}

.hr-arabic-text {
  font-family: "Amiri Quran", "Amiri", serif;
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  line-height: 2.2;
  color: var(--color-text);
  direction: rtl;
  text-align: right;
  margin: 0;
  word-spacing: 0.12em;
}

html.dark .hr-arabic-block {
  background: #182018;
  border-color: #253025;
}

/* Info grid */
.hr-info-grid {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.hr-info-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--color-border);
}

.hr-info-row:last-child {
  border-bottom: none;
}

.hr-info-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-muted);
  min-width: 72px;
  flex-shrink: 0;
}

.hr-info-value {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.5;
}

.hr-narrator-arabic {
  font-family: "Amiri", serif;
  font-size: 1rem;
  direction: rtl;
}

/* Action buttons row */
.hr-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hr-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  box-shadow: var(--shadow);
}

.hr-action-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.hr-action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  background: rgba(15,81,50,0.06);
}

/* Save active state */
.hr-save-btn.hr-save-active {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: rgba(184,134,11,0.08);
}

.hr-save-btn.hr-save-active svg {
  fill: var(--color-gold);
  stroke: var(--color-gold);
}

html.dark .hr-action-btn {
  background: #182018;
  border-color: #253025;
}

html.dark .hr-action-btn:hover {
  background: rgba(15,81,50,0.2);
  border-color: var(--color-primary);
  color: #a0d4b0;
}

/* Toast */
.hr-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1a3d28;
  color: #e8f5ec;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  z-index: 999;
}

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

/* Prev / Next nav */
.hr-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 40px;
}

.hr-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-alt);
  color: var(--color-text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  box-shadow: var(--shadow);
}

.hr-nav-btn svg {
  width: 14px;
  height: 14px;
}

.hr-nav-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.hr-nav-btn:not(:disabled):hover {
  border-color: var(--color-primary);
  background: rgba(15,81,50,0.06);
}

html.dark .hr-nav-btn {
  background: #182018;
  border-color: #253025;
}

.hr-nav-counter {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
}

/* ─── Hadith list page ───────────────────────────────────────────── */

/* Info bar beneath header */
.hl-info-bar {
  background: var(--color-primary);
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
}

.hl-info-arabic {
  font-family: "Amiri", serif;
  font-size: 1.3rem;
  color: rgba(253,250,240,0.95);
  line-height: 1.4;
  direction: rtl;
  flex-shrink: 0;
}

.hl-info-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hl-info-chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-primary-dark);
  background: rgba(253,250,240,0.92);
  padding: 3px 11px;
  border-radius: 999px;
}

.hl-info-author {
  font-size: 0.78rem;
  color: rgba(253,250,240,0.72);
  font-style: italic;
}

/* Count label */
.hl-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 12px;
}

/* Hadith cards */
.hl-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hl-card:hover {
  border-color: rgba(15,81,50,0.3);
  box-shadow: 0 4px 16px rgba(15,81,50,0.1);
}

.hl-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

/* Number badge — diamond shape matching ayah-number */
.hl-num-badge {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fdfaf0;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
  box-shadow: 0 2px 6px rgba(15,81,50,0.25);
}

.hl-num-badge span {
  transform: rotate(-45deg);
}

.hl-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}

.hl-book-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.hl-source {
  font-size: 0.73rem;
  color: var(--color-muted);
  font-weight: 500;
}

/* Grade pill */
.hl-grade {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
}

.hl-grade-sahih {
  color: #1a6638;
  background: rgba(15,81,50,0.1);
}

.hl-grade-hasan {
  color: #7a5c00;
  background: rgba(184,134,11,0.12);
}

.hl-grade-daif {
  color: #7a2a2a;
  background: rgba(180,40,40,0.1);
}

.hl-grade-other {
  color: var(--color-muted);
  background: rgba(0,0,0,0.05);
}

/* Excerpt text */
.hl-excerpt {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--color-text);
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--color-border);
}

.hl-excerpt-arabic {
  font-family: "Amiri Quran", "Amiri", serif;
  font-size: 1.1rem;
  line-height: 2;
  direction: rtl;
  display: block;
  text-align: right;
  color: var(--color-text);
}

/* Card footer */
.hl-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hl-narrator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-muted);
  font-style: italic;
}

.hl-narrator svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.hl-read-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 8px;
  border: 1.5px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary-dark);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.hl-read-link:hover {
  background: var(--color-primary);
  color: #fdfaf0;
}

html.dark .hl-read-btn {
  border-color: #3a6e50;
  color: #a0d4b0;
}

html.dark .hl-read-link:hover {
  background: #1a5c38;
  color: #e8f5ec;
}

/* Dark mode overrides */
html.dark .hl-grade-sahih {
  color: #7ecfa0;
  background: rgba(15,81,50,0.2);
}

html.dark .hl-grade-hasan {
  color: var(--color-gold);
  background: rgba(184,134,11,0.15);
}

html.dark .hl-book-name {
  color: #c8d4c0;
}

/* ─── Hadith collections page ────────────────────────────────────── */
.hadith-collections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hadith-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  position: relative;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.hadith-card-soon {
  opacity: 0.78;
  cursor: default;
}

.hadith-card-left {
  flex-shrink: 0;
  padding-top: 2px;
}

.hadith-card-icon {
  font-size: 2rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15,81,50,0.06);
  border-radius: 12px;
}

.hadith-card-body {
  flex: 1;
  min-width: 0;
}

.hadith-card-arabic {
  font-family: "Amiri", serif;
  font-size: 1.25rem;
  direction: rtl;
  color: var(--color-gold);
  line-height: 1.5;
  margin-bottom: 4px;
}

.hadith-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 6px;
  letter-spacing: 0.1px;
}

.hadith-card-desc {
  font-size: 0.84rem;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.hadith-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hadith-meta-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-primary-dark);
  background: rgba(15,81,50,0.08);
  padding: 2px 10px;
  border-radius: 999px;
}

.hadith-card-link {
  text-decoration: none;
  cursor: pointer;
}

.hadith-card-link:hover {
  border-color: rgba(15,81,50,0.35);
  box-shadow: 0 4px 20px rgba(15,81,50,0.12);
}

.hadith-card-link:hover .hadith-card-arrow {
  transform: translateX(4px);
}

.hadith-card-arrow {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-gold);
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
  padding-left: 12px;
  transition: transform 0.2s ease;
}

.hadith-badge-soon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--color-gold);
  background: rgba(184,134,11,0.1);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Dark mode */
html.dark .hadith-card-icon {
  background: rgba(255,255,255,0.06);
}

html.dark .hadith-card-title {
  color: #e4e0d0;
}

html.dark .hadith-meta-tag {
  background: rgba(255,255,255,0.07);
  color: #c8d4c0;
}

/* ─── Continue reading banner ────────────────────────────────────── */
.continue-reading-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.crb-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.crb-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-muted);
}

.crb-ref {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crb-btn {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 8px 18px;
  background: var(--color-primary);
  color: #fdfaf0;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.crb-btn:hover {
  background: var(--color-primary-dark);
}

html.dark .crb-ref {
  color: #e4e0d0;
}

/* ─── Bookmarks page ─────────────────────────────────────────────── */
.bm-count {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin: 0 0 14px;
  font-weight: 500;
}

.bm-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.bm-card-removing {
  opacity: 0;
  transform: translateX(12px);
}

.bm-card-ref {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.bm-surah-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: rgba(15,81,50,0.08);
  padding: 3px 10px;
  border-radius: 999px;
}

.bm-ayah-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-gold);
  background: rgba(184,134,11,0.1);
  padding: 3px 10px;
  border-radius: 999px;
}

.bm-arabic {
  font-family: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  font-size: 1.65rem;
  direction: rtl;
  text-align: right;
  line-height: 2.1;
  color: var(--color-text);
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--color-border);
  margin-bottom: 14px;
}

.bm-translation {
  margin-bottom: 16px;
}

.bm-translation p {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--color-text);
}

.bm-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.bm-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  text-decoration: none;
  border: 1px solid transparent;
}

.bm-btn:active {
  transform: scale(0.96);
}

.bm-btn-read {
  background: var(--color-primary);
  color: #fdfaf0;
  border-color: var(--color-primary);
}

.bm-btn-read:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.bm-btn-delete {
  background: transparent;
  color: var(--color-muted);
  border-color: var(--color-border);
  margin-left: auto;
}

.bm-btn-delete:hover {
  background: rgba(180,40,40,0.07);
  color: #b42828;
  border-color: rgba(180,40,40,0.35);
}

/* Empty state */
.bm-empty {
  text-align: center;
  padding: 56px 20px 40px;
}

.bm-empty-icon {
  font-size: 3rem;
  margin-bottom: 14px;
  line-height: 1;
}

.bm-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.bm-empty-desc {
  font-size: 0.86rem;
  color: var(--color-muted);
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto 24px;
}

.bm-go-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--color-primary);
  color: #fdfaf0;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.bm-go-btn:hover {
  background: var(--color-primary-dark);
}

/* Dark mode */
html.dark .bm-surah-name {
  background: rgba(255,255,255,0.08);
  color: #e4e0d0;
}

html.dark .bm-btn-delete:hover {
  background: rgba(180,40,40,0.12);
}

/* ─── Settings page ─────────────────────────────────────────────── */
.settings-group {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.settings-group-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding: 14px 18px 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-top: 1px solid var(--color-border);
}

.settings-row:first-of-type {
  border-top: none;
}

.settings-row-icon {
  font-size: 1.4rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.settings-row-body {
  flex: 1;
  min-width: 0;
}

.settings-row-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 2px;
}

.settings-row-desc {
  font-size: 0.78rem;
  color: var(--color-muted);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 999px;
  transition: background 0.22s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  transition: transform 0.22s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
}

html.dark .toggle-track {
  background: #3a4a3a;
}

/* ─── Dark mode ─────────────────────────────────────────────────── */
html.dark {
  --color-bg: #111a13;
  --color-bg-alt: #182018;
  --color-text: #e4e0d0;
  --color-muted: #8a9082;
  --color-border: #253025;
}

html.dark body {
  background: linear-gradient(180deg, #111a13 0%, #0d1710 100%);
}

html.dark .site-header {
  background: linear-gradient(120deg, #0c3d24 0%, #071910 100%);
}

html.dark .search-bar input {
  background: #182018;
  color: #e4e0d0;
  border-color: #253025;
}

html.dark .search-bar input::placeholder {
  color: #8a9082;
}

html.dark .menu-drawer {
  background: #111a13;
  border-left: 1px solid #253025;
}

html.dark .menu-drawer-header {
  background: linear-gradient(120deg, #0c3d24, #071910);
}

html.dark .menu-item:hover:not(.menu-item-disabled) {
  background: rgba(255,255,255,0.06);
  color: #e4e0d0;
}

html.dark .menu-item-active {
  background: rgba(255,255,255,0.07);
  color: #e4e0d0;
}

html.dark .library-card-icon {
  background: rgba(255,255,255,0.06);
}

html.dark .ayah-hit-direct {
  background: #1e2a1a;
}

/* Mobile: keep hamburger absolute even inside the flex-column surah header */
@media (max-width: 639px) {
  .site-header:has(.back-link) h1 {
    padding: 0 52px 0 0;
  }
}
