/*
 * quran.css — قسم القرآن الكريم · مكتبة ليبيا الطيبة
 * Mushaf reader · v=33
 *
 * Design tokens (shared with the rest of the library):
 *   parchment #FAF6EE · gold #B89968 · ink #2C2418
 *   headings: Aref Ruqaa · body: Amiri · Quran text: Amiri Quran / Scheherazade New
 */

/* ─── Page shell ─────────────────────────────────────────────── */
.q-body {
  background: #FAF6EE;
  color: #2C2418;
  font-family: 'Amiri', 'Scheherazade New', serif;
  direction: rtl;
  min-height: 100vh;
}

[data-theme="sepia"] .q-body { background: #F4EAD5; color: #3a2f1d; }
[data-theme="dark"]  .q-body { background: #141824; color: #d8cfbe; }
[data-theme="oled"]  .q-body { background: #000000; color: #c9c0ad; }

/* ─── Header / top nav ───────────────────────────────────────── */
.q-nav-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(250, 246, 238, .94);
  border-bottom: 1px solid rgba(184, 153, 104, .35);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  padding: .75rem 1rem;
}
[data-theme="sepia"] .q-nav-bar { background: rgba(244,234,213,.96); }
[data-theme="dark"]  .q-nav-bar { background: rgba(20,24,36,.92); border-bottom-color: rgba(184,153,104,.18); }
[data-theme="oled"]  .q-nav-bar { background: rgba(0,0,0,.85);     border-bottom-color: rgba(184,153,104,.18); }

.q-nav-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.q-nav-logo {
  font-family: 'Aref Ruqaa', 'Reem Kufi', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.q-nav-logo-mark {
  width: 34px; height: 34px;
  background: #2C2418;
  color: #FAF6EE;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
[data-theme="dark"] .q-nav-logo-mark,
[data-theme="oled"] .q-nav-logo-mark {
  background: #B89968;
  color: #141824;
}
.q-nav-spacer { flex: 1; }
.q-nav-back, .q-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  color: inherit;
  text-decoration: none;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-weight: 600;
  padding: .4rem .8rem;
  border-radius: 10px;
  border: 1px solid rgba(184, 153, 104, .3);
  background: rgba(184, 153, 104, .08);
  cursor: pointer;
  transition: all 280ms ease;
}
.q-nav-back:hover, .q-theme-toggle:hover {
  color: #B89968;
  border-color: #B89968;
  background: rgba(184, 153, 104, .18);
}
.q-theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

/* ─── Main column ────────────────────────────────────────────── */
.q-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem 1rem 6rem;
  direction: rtl;
}

/* ─── Hero ───────────────────────────────────────────────────── */
.q-hero {
  text-align: center;
  padding: 1.75rem 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, rgba(184,153,104,.12), rgba(184,153,104,.04));
  border: 1px solid rgba(184,153,104,.3);
  border-radius: 22px;
  position: relative;
  overflow: hidden;
}
.q-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(184,153,104,.08), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(184,153,104,.08), transparent 60%);
  pointer-events: none;
}
.q-hero-title {
  font-family: 'Aref Ruqaa', 'Amiri', serif;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  color: #B89968;
  margin: 0 0 .35rem;
  position: relative;
}
.q-hero-sub {
  font-family: 'Amiri', serif;
  font-style: italic;
  font-size: 1rem;
  color: rgba(44, 36, 24, .68);
  margin: 0;
  position: relative;
}
[data-theme="dark"] .q-hero-sub,
[data-theme="oled"] .q-hero-sub { color: rgba(216, 207, 190, .7); }

/* ─── Toolbar (tabs + controls) ─────────────────────────────── */
.q-toolbar {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  background: rgba(184,153,104,.06);
  border: 1px solid rgba(184,153,104,.25);
  border-radius: 16px;
}

.q-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.q-tabs button {
  flex: 1;
  min-width: 7rem;
  padding: .55rem .9rem;
  border-radius: 10px;
  border: 1px solid rgba(184,153,104,.3);
  background: rgba(250,246,238,.5);
  color: inherit;
  cursor: pointer;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  transition: all 250ms ease;
}
.q-tabs button:hover {
  border-color: #B89968;
  background: rgba(184,153,104,.12);
  color: #B89968;
}
.q-tabs button.active {
  background: linear-gradient(135deg, #B89968, #9c7a48);
  border-color: #9c7a48;
  color: #FAF6EE;
  box-shadow: 0 4px 14px rgba(184,153,104,.3);
}
[data-theme="dark"] .q-tabs button,
[data-theme="oled"] .q-tabs button { background: rgba(20,24,36,.6); }

.q-controls {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.q-controls select {
  flex: 1 1 8rem;
  min-width: 0;
  padding: .5rem .75rem;
  border-radius: 10px;
  border: 1px solid rgba(184,153,104,.35);
  background: rgba(250,246,238,.8);
  color: inherit;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .88rem;
  cursor: pointer;
  transition: border-color 250ms ease;
}
.q-controls select:hover,
.q-controls select:focus { border-color: #B89968; outline: none; }
[data-theme="dark"] .q-controls select,
[data-theme="oled"] .q-controls select { background: rgba(20,24,36,.7); color: #d8cfbe; }

/* ─── Sura / Page nav strip ──────────────────────────────────── */
.q-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: 1.25rem;
  padding: .65rem .85rem;
  background: rgba(184,153,104,.05);
  border: 1px solid rgba(184,153,104,.2);
  border-radius: 14px;
  flex-wrap: wrap;
}
.q-nav-btn {
  padding: .45rem .9rem;
  border-radius: 10px;
  border: 1px solid rgba(184,153,104,.35);
  background: rgba(250,246,238,.7);
  color: inherit;
  cursor: pointer;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .88rem;
  font-weight: 600;
  transition: all 220ms ease;
  white-space: nowrap;
}
.q-nav-btn:hover:not(:disabled) {
  border-color: #B89968;
  color: #B89968;
  background: rgba(184,153,104,.15);
}
.q-nav-btn:disabled { opacity: .4; cursor: not-allowed; }
[data-theme="dark"] .q-nav-btn,
[data-theme="oled"] .q-nav-btn { background: rgba(20,24,36,.6); }

#suraSelect {
  flex: 1 1 14rem;
  min-width: 0;
  padding: .5rem .75rem;
  border-radius: 10px;
  border: 1px solid rgba(184,153,104,.35);
  background: rgba(250,246,238,.85);
  color: inherit;
  font-family: 'Amiri', 'Reem Kufi', serif;
  font-size: .95rem;
  cursor: pointer;
}
[data-theme="dark"] #suraSelect,
[data-theme="oled"] #suraSelect { background: rgba(20,24,36,.7); color: #d8cfbe; }

.q-page {
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .85rem;
  color: rgba(44,36,24,.7);
  white-space: nowrap;
}
[data-theme="dark"] .q-page,
[data-theme="oled"] .q-page { color: rgba(216,207,190,.7); }
.q-page input {
  width: 4.5rem;
  padding: .25rem .4rem;
  margin: 0 .35rem;
  border-radius: 8px;
  border: 1px solid rgba(184,153,104,.35);
  background: rgba(250,246,238,.85);
  color: inherit;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .9rem;
  text-align: center;
}
[data-theme="dark"] .q-page input,
[data-theme="oled"] .q-page input { background: rgba(20,24,36,.7); color: #d8cfbe; }

/* ─── The Mushaf page frame ──────────────────────────────────── */
.q-page-frame {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(184,153,104,.03) 0, rgba(184,153,104,.03) 1px, transparent 1px, transparent 4px),
    radial-gradient(ellipse at center, rgba(250,246,238,1) 0%, #F5EFE0 100%);
  border: 1px solid rgba(184,153,104,.45);
  border-radius: 20px;
  padding: 2.5rem 1.75rem 2rem;
  box-shadow:
    inset 0 0 0 6px rgba(184,153,104,.18),
    inset 0 0 0 7px rgba(184,153,104,.45),
    inset 0 0 0 8px rgba(184,153,104,.18),
    0 10px 40px rgba(44,36,24,.12);
  min-height: 60vh;
  overflow: hidden;
}
[data-theme="sepia"] .q-page-frame {
  background:
    repeating-linear-gradient(0deg, rgba(120,80,30,.03) 0, rgba(120,80,30,.03) 1px, transparent 1px, transparent 4px),
    radial-gradient(ellipse at center, #F4EAD5 0%, #ECDCB6 100%);
}
[data-theme="dark"] .q-page-frame {
  background:
    repeating-linear-gradient(0deg, rgba(184,153,104,.04) 0, rgba(184,153,104,.04) 1px, transparent 1px, transparent 4px),
    radial-gradient(ellipse at center, #1c2030 0%, #141824 100%);
  box-shadow:
    inset 0 0 0 6px rgba(184,153,104,.12),
    inset 0 0 0 7px rgba(184,153,104,.35),
    inset 0 0 0 8px rgba(184,153,104,.12),
    0 10px 40px rgba(0,0,0,.4);
}
[data-theme="oled"] .q-page-frame {
  background: #000;
  box-shadow:
    inset 0 0 0 6px rgba(184,153,104,.1),
    inset 0 0 0 7px rgba(184,153,104,.3),
    inset 0 0 0 8px rgba(184,153,104,.1);
}

/* Decorative ornamental corner marks */
.q-page-frame::before,
.q-page-frame::after {
  content: '۞';
  position: absolute;
  font-size: 1.25rem;
  color: #B89968;
  opacity: .55;
}
.q-page-frame::before { top: .6rem; right: .9rem; }
.q-page-frame::after  { bottom: .6rem; left: .9rem; }

/* Sura header (when starting a sura on this page) */
.q-sura-header {
  text-align: center;
  margin: 0 auto 1.25rem;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(180deg, rgba(184,153,104,.12), rgba(184,153,104,.05));
  border: 2px solid #B89968;
  border-radius: 14px;
  max-width: 92%;
  position: relative;
}
.q-sura-header-title {
  font-family: 'Aref Ruqaa', 'Amiri Quran', 'Amiri', serif;
  font-size: clamp(1.45rem, 3.4vw, 2rem);
  color: #B89968;
  margin: 0 0 .25rem;
  font-weight: 700;
}
.q-sura-header-meta {
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .8rem;
  color: rgba(44,36,24,.62);
  letter-spacing: .04em;
}
[data-theme="dark"] .q-sura-header-meta,
[data-theme="oled"] .q-sura-header-meta { color: rgba(216,207,190,.6); }

/* Bismillah */
.q-bismillah {
  text-align: center;
  font-family: 'Amiri Quran', 'Amiri', 'Scheherazade New', serif;
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
  color: #2C2418;
  margin: .75rem 0 1.5rem;
  letter-spacing: .02em;
  position: relative;
  padding-bottom: 1rem;
}
.q-bismillah::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184,153,104,.5), transparent);
}
[data-theme="dark"] .q-bismillah,
[data-theme="oled"] .q-bismillah { color: #e6dcc6; }

/* ─── The verses ─────────────────────────────────────────────── */
.q-verses {
  text-align: justify;
  text-align-last: center;
  font-family: 'Amiri Quran', 'Amiri', 'Scheherazade New', serif;
  font-size: var(--q-font-size, 1.7rem);
  line-height: 2.55;
  color: #2C2418;
  word-spacing: .12em;
  position: relative;
}
[data-theme="dark"] .q-verses,
[data-theme="oled"] .q-verses { color: #e6dcc6; }

.q-verse {
  cursor: pointer;
  border-radius: 4px;
  padding: 0 2px;
  transition: background 220ms ease, color 220ms ease;
  position: relative;
}
.q-verse:hover {
  background: rgba(184,153,104,.14);
  color: #8a6a3a;
}
.q-verse.q-playing {
  background: rgba(184,153,104,.22);
  color: #8a6a3a;
  box-shadow: 0 0 0 2px rgba(184,153,104,.35);
}
.q-verse.q-bookmarked .q-verse-num {
  background: linear-gradient(135deg, #b1373f, #8c2a30);
  color: #FAF6EE;
}
[data-theme="dark"] .q-verse:hover,
[data-theme="dark"] .q-verse.q-playing,
[data-theme="oled"] .q-verse:hover,
[data-theme="oled"] .q-verse.q-playing { color: #f0d39a; }

/* Verse number medallion (Mushaf-style) */
.q-verse-num {
  display: inline-block;
  vertical-align: middle;
  margin: 0 .35rem;
  min-width: 1.95rem;
  height: 1.95rem;
  line-height: 1.85rem;
  padding: 0 .35rem;
  border-radius: 50%;
  background: radial-gradient(circle, #d9b574 0%, #B89968 60%, #9c7a48 100%);
  color: #FAF6EE;
  font-family: 'Reem Kufi', 'Amiri Quran', serif;
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.18),
    0 1px 4px rgba(44,36,24,.18);
  user-select: none;
}

/* ─── Loading / empty / error states ─────────────────────────── */
.q-state {
  text-align: center;
  padding: 3rem 1rem;
  font-family: 'Amiri', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: rgba(44,36,24,.6);
}
[data-theme="dark"] .q-state,
[data-theme="oled"] .q-state { color: rgba(216,207,190,.55); }
.q-state-spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid rgba(184,153,104,.2);
  border-top-color: #B89968;
  border-radius: 50%;
  animation: q-spin 800ms linear infinite;
  margin-bottom: 1rem;
}
@keyframes q-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .q-state-spinner { animation: none; }
}
.q-state-error {
  color: #b1373f;
  background: rgba(177,55,63,.07);
  border: 1px solid rgba(177,55,63,.25);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: inline-block;
}

/* ─── Search tab ─────────────────────────────────────────────── */
.q-search-wrap {
  background: rgba(184,153,104,.06);
  border: 1px solid rgba(184,153,104,.25);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.q-search-input {
  width: 100%;
  padding: .7rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(184,153,104,.35);
  background: rgba(250,246,238,.85);
  color: inherit;
  font-family: 'Amiri', serif;
  font-size: 1rem;
  direction: rtl;
}
.q-search-input:focus { border-color: #B89968; outline: none; background: #FAF6EE; }
[data-theme="dark"] .q-search-input,
[data-theme="oled"] .q-search-input { background: rgba(20,24,36,.7); color: #d8cfbe; }
.q-search-hint {
  font-family: 'Amiri', serif;
  font-style: italic;
  font-size: .85rem;
  color: rgba(44,36,24,.6);
  margin: .6rem 0 0;
}
[data-theme="dark"] .q-search-hint,
[data-theme="oled"] .q-search-hint { color: rgba(216,207,190,.55); }
.q-search-results {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.q-search-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .9rem;
  background: rgba(184,153,104,.06);
  border: 1px solid rgba(184,153,104,.2);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 200ms ease;
}
.q-search-row:hover {
  background: rgba(184,153,104,.16);
  border-color: #B89968;
  transform: translateX(-2px);
}
.q-search-row-num {
  width: 2rem; height: 2rem; line-height: 2rem;
  text-align: center;
  border-radius: 50%;
  background: rgba(184,153,104,.18);
  color: #B89968;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.q-search-row-name {
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 1.1rem;
  color: inherit;
  flex: 1;
}
.q-search-row-meta {
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .75rem;
  color: rgba(44,36,24,.55);
}
[data-theme="dark"] .q-search-row-meta,
[data-theme="oled"] .q-search-row-meta { color: rgba(216,207,190,.55); }

/* ─── Bookmarks tab ──────────────────────────────────────────── */
.q-bookmarks {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.q-bookmark-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: rgba(184,153,104,.06);
  border: 1px solid rgba(184,153,104,.25);
  border-radius: 12px;
}
.q-bookmark-link {
  flex: 1;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.q-bookmark-title {
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 1rem;
  color: #B89968;
}
.q-bookmark-preview {
  font-family: 'Amiri', serif;
  font-size: .85rem;
  color: rgba(44,36,24,.7);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .q-bookmark-preview,
[data-theme="oled"] .q-bookmark-preview { color: rgba(216,207,190,.6); }
.q-bookmark-remove {
  background: none;
  border: 1px solid rgba(177,55,63,.3);
  color: #b1373f;
  border-radius: 8px;
  padding: .3rem .6rem;
  font-size: .8rem;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  cursor: pointer;
  transition: all 200ms ease;
}
.q-bookmark-remove:hover { background: rgba(177,55,63,.1); border-color: #b1373f; }

/* ─── Tafsir panel ───────────────────────────────────────────── */
.q-tafsir-panel {
  position: fixed;
  z-index: 80;
  background: #FAF6EE;
  border: 1px solid rgba(184,153,104,.4);
  border-left: 4px solid #B89968;
  box-shadow: -20px 0 60px rgba(44,36,24,.18);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.25rem 1.35rem 1.5rem;
  overflow-y: auto;
  transition: transform 320ms cubic-bezier(.34,1.36,.64,1), opacity 220ms ease;
  font-family: 'Amiri', serif;
}
[data-theme="sepia"] .q-tafsir-panel { background: #F4EAD5; }
[data-theme="dark"]  .q-tafsir-panel { background: #1a1f2e; border-color: rgba(184,153,104,.3); }
[data-theme="oled"]  .q-tafsir-panel { background: #0a0a0a; border-color: rgba(184,153,104,.25); }

/* Desktop: side panel on right (RTL = "right" visually) */
@media (min-width: 901px) {
  .q-tafsir-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 38vw);
    transform: translateX(100%);
  }
  .q-tafsir-panel:not([hidden]) { transform: translateX(0); }
}

/* Mobile: bottom sheet */
@media (max-width: 900px) {
  .q-tafsir-panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 70vh;
    border-top: 4px solid #B89968;
    border-left: 1px solid rgba(184,153,104,.4);
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -20px 60px rgba(44,36,24,.22);
  }
  .q-tafsir-panel:not([hidden]) { transform: translateY(0); }
}

.q-tafsir-close {
  position: absolute;
  top: .75rem;
  left: .75rem;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(184,153,104,.35);
  background: rgba(184,153,104,.1);
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 220ms ease;
}
.q-tafsir-close:hover {
  background: #B89968;
  color: #FAF6EE;
  border-color: #B89968;
  transform: rotate(90deg);
}

.q-tafsir-panel h3 {
  font-family: 'Aref Ruqaa', 'Amiri', serif;
  font-size: 1.15rem;
  color: #B89968;
  margin: 0 0 .25rem;
  padding-bottom: .75rem;
  padding-inline-start: 2.5rem;
  border-bottom: 1px solid rgba(184,153,104,.3);
}

.q-tafsir-arabic {
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 1.3rem;
  line-height: 2.1;
  color: #2C2418;
  background: rgba(184,153,104,.08);
  border-right: 3px solid #B89968;
  border-radius: 6px;
  padding: .85rem 1rem;
  margin: 0;
  text-align: justify;
}
[data-theme="dark"] .q-tafsir-arabic,
[data-theme="oled"] .q-tafsir-arabic { color: #e6dcc6; background: rgba(184,153,104,.1); }

.q-tafsir-text {
  font-family: 'Amiri', serif;
  font-size: 1rem;
  line-height: 1.95;
  color: #2C2418;
  margin: 0;
  text-align: justify;
}
[data-theme="dark"] .q-tafsir-text,
[data-theme="oled"] .q-tafsir-text { color: #d8cfbe; }

.q-tafsir-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  padding-top: .5rem;
  border-top: 1px dashed rgba(184,153,104,.3);
}
.q-tafsir-actions button {
  flex: 1;
  min-width: 7rem;
  padding: .55rem .85rem;
  border-radius: 10px;
  border: 1px solid rgba(184,153,104,.35);
  background: rgba(184,153,104,.08);
  color: inherit;
  cursor: pointer;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  transition: all 220ms ease;
}
.q-tafsir-actions button:hover {
  background: #B89968;
  color: #FAF6EE;
  border-color: #B89968;
}
.q-tafsir-actions button.q-active {
  background: linear-gradient(135deg, #B89968, #9c7a48);
  color: #FAF6EE;
  border-color: #9c7a48;
}

/* ─── Sticky audio bar ───────────────────────────────────────── */
.q-audio-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  background: linear-gradient(180deg, #2C2418, #1f1a11);
  color: #FAF6EE;
  border-top: 2px solid #B89968;
  box-shadow: 0 -8px 30px rgba(0,0,0,.25);
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
}

.q-audio-bar button {
  background: rgba(184,153,104,.18);
  border: 1px solid rgba(184,153,104,.4);
  color: #FAF6EE;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 220ms ease;
  flex-shrink: 0;
}
.q-audio-bar button:hover {
  background: #B89968;
  border-color: #B89968;
  transform: scale(1.06);
}
.q-audio-bar button.q-active {
  background: #B89968;
  color: #2C2418;
}
#qAudioVerse {
  font-family: 'Amiri', serif;
  font-size: .9rem;
  color: #d9b574;
  white-space: nowrap;
  min-width: 5.5rem;
}
#qAudioProgress {
  flex: 1;
  accent-color: #B89968;
  cursor: pointer;
  min-width: 6rem;
}

/* ─── Toast ──────────────────────────────────────────────────── */
.q-toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(184,153,104,.96);
  color: #FAF6EE;
  border-radius: 12px;
  padding: .6rem 1.2rem;
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  font-size: .88rem;
  font-weight: 600;
  z-index: 90;
  opacity: 0;
  transition: opacity 280ms ease, transform 280ms ease;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  white-space: nowrap;
  max-width: 90vw;
}
.q-toast.q-in {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Footer ─────────────────────────────────────────────────── */
.q-footer {
  max-width: 980px;
  margin: 3rem auto 0;
  padding: 2rem 1rem 4rem;
  border-top: 1px solid rgba(184,153,104,.25);
  font-family: 'Reem Kufi', 'Cairo', sans-serif;
  text-align: center;
  color: rgba(44,36,24,.62);
  font-size: .82rem;
}
[data-theme="dark"] .q-footer,
[data-theme="oled"] .q-footer { color: rgba(216,207,190,.55); }

/* ─── Mobile tweaks ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .q-main { padding: 1rem .65rem 6rem; }
  .q-page-frame {
    padding: 1.75rem 1.1rem 1.5rem;
    border-radius: 14px;
    box-shadow:
      inset 0 0 0 4px rgba(184,153,104,.18),
      inset 0 0 0 5px rgba(184,153,104,.45),
      inset 0 0 0 6px rgba(184,153,104,.18);
  }
  .q-tabs button { flex: 1 1 30%; font-size: .82rem; min-width: 0; }
  .q-controls select { font-size: .82rem; }
  .q-nav { padding: .5rem .65rem; }
  .q-nav-btn { padding: .4rem .7rem; font-size: .8rem; }
  .q-page { font-size: .78rem; }
  .q-audio-bar { gap: .5rem; padding: .55rem .65rem; }
  .q-audio-bar button { width: 36px; height: 36px; font-size: .95rem; }
  #qAudioVerse { font-size: .82rem; min-width: 4rem; }
}

/* ─── Print: clean parchment page ────────────────────────────── */
@media print {
  .q-nav-bar, .q-toolbar, .q-nav, .q-audio-bar, .q-tafsir-panel, .q-footer { display: none !important; }
  .q-page-frame { box-shadow: none; border: 1px solid #B89968; }
  body { background: #fff; color: #000; }
}
