/* ==========================================
   FivePrayer — Quran Reader Module
   Mobile-first reader UI built on blog.css tokens
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Amiri+Quran&family=Scheherazade+New:wght@400;500;600;700&family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  /* Quran-specific tokens layered on top of blog.css design system */
  --font-arabic: 'Amiri Quran', 'Scheherazade New', 'Cairo', 'Naskh Arabic', serif;
  --reading-bg: #FDFBF5;
  --reading-bg-soft: #FBF8EE;
  --arabic-size: 32px;
  --arabic-size-mobile: 26px;
  --arabic-line-height: 2.0;
  --arabic-color: var(--accent-deep);

  --player-height: 88px;
  --player-mini-height: 56px;

  --shadow-card: 0 1px 3px rgba(0, 50, 49, 0.04), 0 1px 2px rgba(0, 50, 49, 0.06);
  --shadow-card-hover: 0 8px 24px rgba(0, 50, 49, 0.06), 0 2px 6px rgba(0, 50, 49, 0.04);
  --shadow-card-active: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent), 0 10px 30px rgba(40, 148, 145, 0.18);
  --shadow-player: 0 -8px 32px rgba(0, 50, 49, 0.08), 0 -2px 6px rgba(0, 50, 49, 0.04);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================
   1. Quran Hero — landing page
   ========================================== */
.quran-hero {
  position: relative;
  padding: 48px 0 32px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.quran-hero::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.quran-hero::after {
  content: '';
  position: absolute;
  bottom: -180px;
  left: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent-2) 10%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.quran-hero-inner {
  position: relative;
  z-index: 1;
}
.quran-hero .eyebrow {
  margin-bottom: 14px;
  display: block;
}
.quran-hero h1 {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.025em;
  line-height: 1.06;
  color: var(--accent-deep);
  margin: 0 0 20px;
  max-width: 18ch;
}
.quran-hero h1 .arabic-mark {
  font-family: var(--font-arabic);
  color: var(--accent);
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 8px;
  display: inline-block;
  vertical-align: middle;
}
.quran-hero p.quran-hero-deck {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--fg-muted);
  font-weight: 500;
  line-height: 1.5;
  max-width: 56ch;
  margin: 0 0 28px;
}

/* Stats deck — 6236 ayahs · 114 surahs · 30 juz */
.quran-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px 28px;
  margin: 0 0 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
}
.quran-stats__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.quran-stats__num {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.quran-stats__sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--fg-dim);
  display: inline-block;
}

/* ==========================================
   2. Search bar
   ========================================== */
.quran-search {
  position: relative;
  margin: 0 0 24px;
  z-index: 30;
  transition: all 0.25s var(--ease-out);
}
.quran-search.sticky {
  position: sticky;
  top: 64px;
  padding: 12px 0;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
  margin-left: -32px;
  margin-right: -32px;
  padding-left: 32px;
  padding-right: 32px;
}
.quran-search__wrap {
  position: relative;
  max-width: 640px;
}
.quran-search__icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--fg-dim);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.quran-search__icon svg {
  width: 100%;
  height: 100%;
}
.quran-search__input {
  width: 100%;
  height: 56px;
  padding: 0 56px 0 52px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  box-shadow: var(--shadow-card);
}
.quran-search__input::placeholder {
  color: var(--fg-dim);
  font-weight: 500;
}
.quran-search__input:hover {
  border-color: var(--line-strong);
}
.quran-search__input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 14%, transparent), var(--shadow-card);
}
.quran-search__clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  opacity: 0;
  pointer-events: none;
}
.quran-search__input:not(:placeholder-shown) ~ .quran-search__clear {
  opacity: 1;
  pointer-events: all;
}
.quran-search__clear:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.quran-search__kbd {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--fg-dim);
  border: 1px solid var(--line);
  pointer-events: none;
}
.quran-search__input:not(:placeholder-shown) ~ .quran-search__kbd {
  opacity: 0;
}

/* ==========================================
   3. Pill tabs — Surah | Juz | Manzil
   ========================================== */
.quran-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 0 0 28px;
}
.quran-tabs__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--fg-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}
.quran-tabs__btn:hover {
  color: var(--accent-deep);
}
.quran-tabs__btn.active {
  background: var(--accent-deep);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 50, 49, 0.18);
}
.quran-tabs__count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: inherit;
  opacity: 0.7;
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in oklab, currentColor 12%, transparent);
}

/* Prayer-time suggestion card */
.quran-suggest {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklab, var(--accent) 20%, transparent);
  border-radius: 14px;
  margin: 0 0 24px;
  max-width: 640px;
}
.quran-suggest__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.quran-suggest__icon svg {
  width: 20px;
  height: 20px;
}
.quran-suggest__body {
  flex: 1;
  min-width: 0;
}
.quran-suggest__title {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: -0.005em;
  margin: 0 0 2px;
}
.quran-suggest__hint {
  font-size: 12px;
  font-weight: 500;
  color: color-mix(in oklab, var(--accent-deep) 75%, transparent);
  margin: 0;
}
.quran-suggest__cta {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--accent-deep);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  border: 0;
  flex-shrink: 0;
  transition: filter 0.15s, transform 0.15s;
}
.quran-suggest__cta:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ==========================================
   4. Surah grid
   ========================================== */
.surah-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 0 0 40px;
}

.surah-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  isolation: isolate;
}
.surah-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 5%, transparent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
  z-index: -1;
}
.surah-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
}
.surah-card:hover::before {
  opacity: 1;
}
.surah-card:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--accent) 50%, transparent);
  outline-offset: 2px;
}

/* Top row: number badge + arabic name */
.surah-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.surah-card__badge {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  /* Rotated octagon shape */
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  transform: rotate(0deg);
  transition: background 0.2s, color 0.2s, transform 0.3s var(--ease-spring);
}
.surah-card:hover .surah-card__badge {
  background: var(--accent);
  color: #fff;
  transform: rotate(22.5deg);
}

.surah-card__number {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.surah-card__name-arabic {
  font-family: var(--font-arabic);
  font-size: 28px;
  font-weight: 400;
  color: var(--accent-deep);
  line-height: 1;
  text-align: right;
  direction: rtl;
  letter-spacing: 0;
}

.surah-card__name-en {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 2px;
}

.surah-card__name-translit {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  line-height: 1.2;
}

.surah-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.surah-card__meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}
.surah-card__meta-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ==========================================
   5. Juz strip & Manzil chips
   ========================================== */
.juz-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 0 18px;
  margin: 0 -32px 32px;
  padding-left: 32px;
  padding-right: 32px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.juz-strip::-webkit-scrollbar {
  height: 6px;
}
.juz-strip::-webkit-scrollbar-track {
  background: transparent;
}
.juz-strip::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

.juz-chip,
.manzil-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 12px 18px;
  min-width: 132px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s var(--ease-out);
  flex-shrink: 0;
  cursor: pointer;
}
.juz-chip:hover,
.manzil-chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
}
.juz-chip__num,
.manzil-chip__num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.juz-chip__label,
.manzil-chip__label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: -0.01em;
}
.juz-chip__sub,
.manzil-chip__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-top: 2px;
}
.juz-chip.active,
.manzil-chip.active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}
.juz-chip.active .juz-chip__num,
.manzil-chip.active .manzil-chip__num {
  color: var(--accent-soft);
}
.juz-chip.active .juz-chip__label,
.manzil-chip.active .manzil-chip__label {
  color: #fff;
}
.juz-chip.active .juz-chip__sub,
.manzil-chip.active .manzil-chip__sub {
  color: rgba(255, 255, 255, 0.65);
}

/* ==========================================
   6. Single surah header
   ========================================== */
.surah-header {
  position: relative;
  width: 100%;
  padding: 56px 0 44px;
  background: linear-gradient(135deg, var(--accent-deep) 0%, #0E4A48 100%);
  color: #fff;
  text-align: center;
  overflow: hidden;
}
.surah-header::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -100px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 50%, transparent), transparent 70%);
  pointer-events: none;
}
.surah-header::after {
  content: '';
  position: absolute;
  bottom: -160px;
  left: -120px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 30%, transparent), transparent 70%);
  pointer-events: none;
}
.surah-header-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 32px;
}
.surah-header__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--accent-soft) 70%, transparent);
  margin: 0 0 14px;
}
.surah-header__arabic {
  font-family: var(--font-arabic);
  font-size: clamp(56px, 9vw, 96px);
  font-weight: 400;
  line-height: 1.1;
  color: #fff;
  margin: 0 0 12px;
  direction: rtl;
  letter-spacing: 0;
  text-shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
}
.surah-header__name {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0 0 6px;
}
.surah-header__name-en {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.04em;
  margin: 0 0 22px;
}
.surah-header__meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 26px;
}
.surah-header__meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.surah-header__meta-num {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.surah-header__meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
}

/* Controls — round 40px icon buttons */
.surah-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.surah-control-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.surah-control-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}
.surah-control-btn:active {
  transform: translateY(0);
}
.surah-control-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  width: 48px;
  height: 48px;
}
.surah-control-btn.primary:hover {
  background: color-mix(in oklab, var(--accent) 85%, white);
  filter: brightness(1.05);
}
.surah-control-btn svg {
  width: 18px;
  height: 18px;
}
.surah-control-btn.primary svg {
  width: 22px;
  height: 22px;
}
.surah-control-btn__label {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

/* Bismillah strip */
.surah-bismillah {
  width: 100%;
  background: color-mix(in oklab, var(--accent-soft) 75%, var(--bg-card));
  padding: 28px 24px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.surah-bismillah__arabic {
  font-family: var(--font-arabic);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  line-height: 1.6;
  color: var(--accent-deep);
  direction: rtl;
  letter-spacing: 0;
  margin: 0;
}
.surah-bismillah__translation {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  font-style: italic;
  color: var(--fg-muted);
  margin: 8px 0 0;
  letter-spacing: 0.01em;
}

/* ==========================================
   7. Ayah list & cards
   ========================================== */
.ayah-list {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px calc(var(--player-height) + 64px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ayah-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), transform 0.2s var(--ease-out);
  scroll-margin-top: 120px;
}
.ayah-card:hover {
  border-color: var(--line-strong);
}
.ayah-card--active {
  border-color: var(--accent);
  box-shadow: var(--shadow-card-active);
  background: color-mix(in oklab, var(--accent-soft) 35%, var(--bg-card));
}
.ayah-card--flash {
  animation: ayahFlash 1.2s var(--ease-out);
}
@keyframes ayahFlash {
  0% { background: var(--bg-card); }
  20% { background: color-mix(in oklab, var(--accent) 22%, var(--bg-card)); box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 22%, transparent); }
  100% { background: var(--bg-card); }
}

/* Head row: number left, actions right */
.ayah-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ayah-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.ayah-card--active .ayah-number {
  background: var(--accent);
  color: #fff;
}
.ayah-number__prefix {
  opacity: 0.55;
  margin-right: 4px;
  font-weight: 600;
}

.ayah-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ayah-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.ayah-action-btn:hover {
  background: var(--bg-elev);
  color: var(--accent-deep);
}
.ayah-action-btn:active {
  transform: scale(0.95);
}
.ayah-action-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.ayah-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Arabic ayah body — always RTL */
.ayah-arabic {
  font-family: var(--font-arabic);
  font-size: var(--arabic-size);
  font-weight: 400;
  line-height: var(--arabic-line-height);
  color: var(--arabic-color);
  direction: rtl;
  text-align: right;
  letter-spacing: 0;
  margin: 0;
  word-spacing: 0.05em;
}
.ayah-arabic .ayah-end-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  margin: 0 0.2em;
  font-family: var(--font-arabic);
  font-size: 0.55em;
  color: var(--accent);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 95,30 95,70 50,95 5,70 5,30' fill='none' stroke='%23289491' stroke-width='4'/></svg>") center/contain no-repeat;
  vertical-align: middle;
}

/* Transliteration — italic, toggleable */
.ayah-transliteration {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  font-style: italic;
  font-weight: 500;
  color: var(--fg-muted);
  margin: 0;
  letter-spacing: -0.005em;
  transition: opacity 0.2s, max-height 0.3s var(--ease-out);
}
.ayah-transliteration.hidden {
  display: none;
}
.ayah-transliteration mark {
  background: color-mix(in oklab, var(--accent-2) 25%, transparent);
  color: inherit;
  padding: 1px 2px;
  border-radius: 3px;
}

/* Translation — primary reading text */
.ayah-translation {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--fg);
  margin: 0;
  letter-spacing: -0.005em;
}
.ayah-translation strong {
  color: var(--accent-deep);
  font-weight: 700;
}
.ayah-translation__attribution {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* Tafsir collapsible */
.ayah-tafsir {
  margin-top: 4px;
  border-radius: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.2s;
}
.ayah-tafsir[open] {
  border-color: color-mix(in oklab, var(--accent) 40%, var(--line));
}
.ayah-tafsir > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-deep);
  letter-spacing: -0.005em;
  user-select: none;
}
.ayah-tafsir > summary::-webkit-details-marker {
  display: none;
}
.ayah-tafsir > summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 400;
  color: var(--fg-muted);
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease-out);
}
.ayah-tafsir[open] > summary::after {
  transform: rotate(45deg);
  color: var(--accent);
}
.ayah-tafsir__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ayah-tafsir__source {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid var(--line);
}
.ayah-tafsir__body {
  padding: 4px 16px 16px;
  font-size: 14px;
  line-height: 1.65;
  font-weight: 500;
  color: var(--fg-muted);
}
.ayah-tafsir__body p {
  margin: 0 0 10px;
}
.ayah-tafsir__body p:last-child {
  margin-bottom: 0;
}

/* Per-card translation toggle row */
.ayah-card__toggles {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ayah-card__toggle {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg-muted);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
}
.ayah-card__toggle:hover {
  border-color: var(--line-strong);
  color: var(--accent-deep);
}
.ayah-card__toggle.is-on {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
  color: var(--accent-deep);
}

/* Foot navigation — large prev/next ghost buttons */
.surah-nav-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 760px;
  margin: 24px auto 0;
  padding: 0 24px calc(var(--player-height) + 32px);
}
.surah-nav-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 24px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.surah-nav-link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
}
.surah-nav-link--prev {
  text-align: left;
}
.surah-nav-link--next {
  text-align: right;
}
.surah-nav-link__direction {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.surah-nav-link--next .surah-nav-link__direction {
  justify-content: flex-end;
}
.surah-nav-link__name {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.surah-nav-link__arabic {
  font-family: var(--font-arabic);
  font-size: 22px;
  color: var(--accent);
  direction: rtl;
  letter-spacing: 0;
  margin-top: 2px;
}
.surah-nav-link:hover .surah-nav-link__name {
  color: var(--accent);
}
.surah-nav-link--disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ==========================================
   8. Audio player — sticky bottom
   ========================================== */
.quran-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  height: var(--player-height);
  padding: 12px 20px;
  background: color-mix(in oklab, var(--bg-card) 86%, transparent);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-player);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  transition: height 0.3s var(--ease-out), padding 0.3s var(--ease-out), border-radius 0.3s var(--ease-out);
}
.quran-player--mini {
  height: var(--player-mini-height);
  left: auto;
  right: 16px;
  width: auto;
  min-width: 240px;
  bottom: 16px;
  border-radius: 999px;
  padding: 8px 14px 8px 8px;
  border: 1px solid var(--line);
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  box-shadow: 0 12px 40px rgba(0, 50, 49, 0.16);
}

/* Track info */
.quran-player__track {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.quran-player__cover {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  overflow: hidden;
}
.quran-player--mini .quran-player__cover {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.quran-player__info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.quran-player__surah {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quran-player__ayah {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

/* Controls (center) */
.quran-player__controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.quran-player__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.quran-player__btn:hover {
  background: var(--bg-elev);
}
.quran-player__btn:active {
  transform: scale(0.94);
}
.quran-player__btn.primary {
  width: 56px;
  height: 56px;
  background: var(--accent-deep);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 50, 49, 0.28);
}
.quran-player__btn.primary:hover {
  background: var(--accent);
  filter: brightness(1.05);
}
.quran-player--mini .quran-player__btn {
  width: 32px;
  height: 32px;
}
.quran-player--mini .quran-player__btn.primary {
  width: 40px;
  height: 40px;
  box-shadow: 0 4px 12px rgba(0, 50, 49, 0.2);
}
.quran-player__btn svg {
  width: 18px;
  height: 18px;
}
.quran-player__btn.primary svg {
  width: 22px;
  height: 22px;
}

/* Progress bar — waveform-style */
.quran-player__bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-elev);
  cursor: pointer;
  flex: 1;
  overflow: hidden;
}
.quran-player__bar-track {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 2px;
}
.quran-player__bar-tick {
  flex: 1;
  height: 100%;
  background: var(--line-strong);
  border-radius: 1px;
  transform-origin: center;
  transition: background 0.2s, transform 0.2s;
}
.quran-player__bar-tick.played {
  background: var(--accent);
}
.quran-player__bar-tick.current {
  background: var(--accent);
  transform: scaleY(1.6);
}
.quran-player__bar-fill {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  border-radius: 999px;
  pointer-events: none;
  transition: width 0.1s linear;
  width: 35%;
}
.quran-player__time {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.quran-player__progress {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Right: reciter + extras */
.quran-player__right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.quran-player__reciter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F5F5F' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  padding-right: 32px;
  transition: border-color 0.15s, background-color 0.15s;
}
.quran-player__reciter:hover {
  border-color: var(--line-strong);
}
.quran-player__reciter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 14%, transparent);
}
.quran-player__speed {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s;
}
.quran-player__speed:hover {
  border-color: var(--line-strong);
  color: var(--accent-deep);
}
.quran-player__speed.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 30%, transparent);
  color: var(--accent-deep);
}

.quran-player--hidden {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

/* ==========================================
   9. Settings panel & bookmarks
   ========================================== */
.quran-settings {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease-out);
  pointer-events: none;
}
.quran-settings.is-open {
  transform: translateX(0);
  pointer-events: all;
}
.quran-settings__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 50, 49, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
  z-index: -1;
}
.quran-settings.is-open .quran-settings__overlay {
  opacity: 1;
}
.quran-settings__panel {
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 48px rgba(0, 50, 49, 0.16);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.quran-settings__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in oklab, var(--bg-card) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2;
}
.quran-settings__title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: -0.01em;
  margin: 0;
}
.quran-settings__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 0;
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.quran-settings__close:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.quran-settings__body {
  flex: 1;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.quran-settings__group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.quran-settings__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
.quran-settings__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  transition: border-color 0.15s;
}
.quran-settings__row:hover {
  border-color: var(--line-strong);
}
.quran-settings__row-label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.quran-settings__row-hint {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-top: 2px;
}
.quran-settings__sizer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.quran-settings__sizer-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}
.quran-settings__sizer-btn:hover {
  background: var(--bg-elev);
  color: var(--accent-deep);
}
.quran-settings__sizer-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-deep);
  min-width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Toggle switch */
.quran-settings__toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.quran-settings__toggle input {
  opacity: 0;
  position: absolute;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.quran-settings__toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s;
}
.quran-settings__toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 50, 49, 0.18);
  transition: transform 0.25s var(--ease-spring);
}
.quran-settings__toggle input:checked + .quran-settings__toggle-track {
  background: var(--accent);
}
.quran-settings__toggle input:checked + .quran-settings__toggle-track::after {
  transform: translateX(20px);
}

/* Bookmarks */
.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bookmark-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.bookmark-item:hover {
  border-color: var(--accent);
  transform: translateX(-2px);
  text-decoration: none;
  box-shadow: var(--shadow-card-hover);
}
.bookmark-item__badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.bookmark-item__body {
  flex: 1;
  min-width: 0;
}
.bookmark-item__title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: -0.01em;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bookmark-item__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
}
.bookmark-item__remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.bookmark-item__remove:hover {
  background: color-mix(in oklab, #C13030 12%, transparent);
  color: #C13030;
}
.bookmark-list:empty::before {
  content: 'No bookmarks yet.';
  display: block;
  padding: 18px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
  color: var(--fg-dim);
  text-align: center;
  background: var(--bg-elev);
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
}

/* ==========================================
   10. Skeleton loaders
   ========================================== */
.skeleton-ayah {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.skeleton-ayah__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.skeleton-line {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    var(--bg-elev) 0%,
    color-mix(in oklab, var(--bg-elev) 60%, #fff) 50%,
    var(--bg-elev) 100%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}
.skeleton-line--arabic {
  height: 28px;
  border-radius: 8px;
  width: 100%;
  margin: 4px 0;
}
.skeleton-line--arabic-2 {
  width: 78%;
  margin-left: auto;
}
.skeleton-line--xs {
  height: 10px;
  width: 60px;
  border-radius: 999px;
}
.skeleton-line--sm {
  height: 12px;
  width: 40%;
}
.skeleton-line--md {
  width: 90%;
}
.skeleton-line--lg {
  width: 100%;
}
.skeleton-line--xl {
  height: 16px;
  width: 80%;
}

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

/* ==========================================
   11. Section heads (in-page)
   ========================================== */
.quran-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 18px;
}
.quran-section-head h2 {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.02em;
  color: var(--accent-deep);
  margin: 0;
  line-height: 1.2;
}
.quran-section-head__hint {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
}

/* ==========================================
   12. RTL support
   Ayah Arabic is always RTL regardless of doc dir.
   When the surrounding page is RTL, mirror layout
   for chrome (controls, breadcrumbs) but keep
   tabular numbers and the surah header centered.
   ========================================== */
[dir="rtl"] .quran-search__icon {
  left: auto;
  right: 18px;
}
[dir="rtl"] .quran-search__input {
  padding: 0 52px 0 56px;
}
[dir="rtl"] .quran-search__clear,
[dir="rtl"] .quran-search__kbd {
  right: auto;
  left: 12px;
}
[dir="rtl"] .quran-search__kbd { left: 16px; }
[dir="rtl"] .surah-card__top {
  flex-direction: row-reverse;
}
[dir="rtl"] .surah-card__name-arabic {
  text-align: left;
}
[dir="rtl"] .surah-card__meta {
  flex-direction: row-reverse;
}
[dir="rtl"] .ayah-card__head {
  flex-direction: row-reverse;
}
[dir="rtl"] .ayah-actions {
  flex-direction: row-reverse;
}
[dir="rtl"] .ayah-card__toggles {
  flex-direction: row-reverse;
}
[dir="rtl"] .ayah-tafsir > summary {
  flex-direction: row-reverse;
}
[dir="rtl"] .ayah-translation,
[dir="rtl"] .ayah-transliteration,
[dir="rtl"] .ayah-translation__attribution {
  text-align: right;
}
[dir="rtl"] .quran-suggest {
  flex-direction: row-reverse;
  text-align: right;
}
[dir="rtl"] .surah-nav-link--prev {
  text-align: right;
}
[dir="rtl"] .surah-nav-link--next {
  text-align: left;
}
[dir="rtl"] .surah-nav-link--next .surah-nav-link__direction {
  justify-content: flex-start;
}
[dir="rtl"] .quran-player {
  direction: rtl;
}
[dir="rtl"] .quran-player__track {
  flex-direction: row-reverse;
}
[dir="rtl"] .quran-settings {
  right: auto;
  left: 0;
  transform: translateX(-100%);
}
[dir="rtl"] .quran-settings.is-open {
  transform: translateX(0);
}
[dir="rtl"] .quran-settings__panel {
  border-left: 0;
  border-right: 1px solid var(--line);
}
[dir="rtl"] .bookmark-item:hover {
  transform: translateX(2px);
}
[dir="rtl"] .quran-stats,
[dir="rtl"] .surah-header__meta {
  flex-direction: row-reverse;
}

/* Arabic ayah body always stays RTL regardless of context */
.ayah-arabic,
.surah-card__name-arabic,
.surah-header__arabic,
.surah-bismillah__arabic,
.surah-nav-link__arabic {
  direction: rtl !important;
  unicode-bidi: isolate;
}

/* ==========================================
   13. Reading-mode tinted background
   ========================================== */
.quran-reading-mode {
  background: var(--reading-bg);
}
.quran-reading-mode .ayah-card {
  background: var(--bg-card);
}
.quran-reading-mode .ayah-list {
  background: var(--reading-bg);
}

/* ==========================================
   14. Responsive — tablet & mobile
   ========================================== */
@media (max-width: 1080px) {
  .surah-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 820px) {
  .surah-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .quran-hero {
    padding: 36px 0 24px;
  }
  .quran-hero h1 {
    font-size: clamp(28px, 7vw, 40px);
    max-width: 100%;
  }
  .quran-stats {
    gap: 12px 20px;
    font-size: 12px;
  }
  .quran-stats__num {
    font-size: 16px;
  }
  .quran-search__input {
    height: 50px;
    padding-left: 48px;
    padding-right: 16px;
    font-size: 15px;
  }
  .quran-search__icon {
    left: 14px;
    width: 18px;
    height: 18px;
  }
  .quran-search__kbd {
    display: none;
  }
  .quran-suggest {
    padding: 12px 14px;
    gap: 10px;
  }
  .quran-suggest__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .quran-suggest__cta {
    padding: 8px 12px;
    font-size: 12px;
  }
  .surah-header {
    padding: 44px 0 36px;
  }
  .surah-header-inner {
    padding: 0 24px;
  }
  .ayah-list {
    padding: 28px 18px calc(var(--player-height) + 56px);
    gap: 14px;
  }
  .ayah-card {
    padding: 20px;
    gap: 12px;
    border-radius: 14px;
  }
  .ayah-arabic {
    font-size: var(--arabic-size-mobile);
    line-height: 1.95;
  }
  .ayah-translation {
    font-size: 16px;
    line-height: 1.6;
  }
  .ayah-transliteration {
    font-size: 14px;
  }
  .surah-nav-foot {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 18px calc(var(--player-height) + 24px);
  }
  .surah-nav-link {
    padding: 18px 20px;
    border-radius: 14px;
  }
  .surah-nav-link__name {
    font-size: 16px;
  }
  .quran-player {
    grid-template-columns: auto 1fr auto;
    padding: 10px 14px;
    gap: 12px;
    height: 76px;
  }
  .quran-player__cover {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  .quran-player__surah {
    font-size: 13px;
  }
  .quran-player__ayah {
    font-size: 10px;
  }
  .quran-player__btn {
    width: 36px;
    height: 36px;
  }
  .quran-player__btn.primary {
    width: 48px;
    height: 48px;
  }
  .quran-player__progress {
    display: none;
  }
  .quran-player__reciter {
    display: none;
  }
  .quran-player__speed {
    display: none;
  }
  .quran-player--mini {
    right: 12px;
    bottom: 12px;
    min-width: 200px;
  }
  .juz-strip {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }
  .juz-chip,
  .manzil-chip {
    min-width: 116px;
    padding: 10px 14px;
  }
  .quran-search.sticky {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
    top: 56px;
  }
}

@media (max-width: 540px) {
  .surah-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .quran-tabs {
    width: 100%;
    justify-content: space-between;
  }
  .quran-tabs__btn {
    flex: 1;
    justify-content: center;
    padding: 9px 12px;
    font-size: 13px;
  }
  .surah-header {
    padding: 36px 0 30px;
  }
  .surah-header__arabic {
    font-size: clamp(48px, 14vw, 72px);
  }
  .surah-header__name {
    font-size: 20px;
  }
  .surah-controls {
    gap: 8px;
  }
  .surah-control-btn {
    width: 38px;
    height: 38px;
  }
  .surah-control-btn.primary {
    width: 46px;
    height: 46px;
  }
  .ayah-list {
    padding: 22px 14px calc(var(--player-height) + 40px);
  }
  .ayah-card {
    padding: 18px 16px;
    border-radius: 14px;
  }
  .ayah-card__head {
    gap: 8px;
  }
  .ayah-number {
    min-width: 40px;
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }
  .ayah-arabic {
    font-size: 24px;
    line-height: 1.9;
  }
  .ayah-action-btn {
    width: 30px;
    height: 30px;
  }
  .quran-settings {
    width: 100vw;
  }
  .surah-bismillah {
    padding: 22px 18px;
  }
}

@media (max-width: 400px) {
  .quran-hero {
    padding: 28px 0 18px;
  }
  .quran-stats {
    gap: 10px 14px;
  }
  .quran-stats__num {
    font-size: 14px;
  }
  .ayah-arabic {
    font-size: 22px;
    line-height: 1.9;
  }
  .quran-player__cover {
    width: 36px;
    height: 36px;
  }
}

/* ==========================================
   15. Print mode — strip chrome, keep text
   ========================================== */
@media print {
  .quran-player,
  .quran-settings,
  .quran-search,
  .surah-controls,
  .ayah-actions,
  .quran-tabs,
  .surah-nav-foot {
    display: none !important;
  }
  .ayah-card {
    border-color: transparent;
    box-shadow: none;
    page-break-inside: avoid;
    padding: 12px 0;
  }
  .surah-header {
    background: transparent;
    color: var(--accent-deep);
    padding: 32px 0 24px;
  }
  .surah-header__arabic,
  .surah-header__name,
  .surah-header__name-en {
    color: var(--accent-deep);
    text-shadow: none;
  }
  .surah-header::before,
  .surah-header::after {
    display: none;
  }
  body {
    background: #fff;
  }
}

/* ==========================================
   16. Reduced motion
   ========================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .skeleton-line {
    animation: none;
    background: var(--bg-elev);
  }
  .ayah-card--flash {
    animation: none;
    background: color-mix(in oklab, var(--accent) 12%, var(--bg-card));
  }
}

/* ==========================================
   17. Focus states (a11y)
   ========================================== */
.surah-card:focus-visible,
.juz-chip:focus-visible,
.manzil-chip:focus-visible,
.surah-nav-link:focus-visible,
.bookmark-item:focus-visible,
.quran-tabs__btn:focus-visible,
.quran-player__btn:focus-visible,
.surah-control-btn:focus-visible,
.ayah-action-btn:focus-visible,
.ayah-card__toggle:focus-visible,
.quran-suggest__cta:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--accent) 55%, transparent);
  outline-offset: 2px;
}
.quran-search__input:focus-visible {
  outline: none;
}

/* Selection color */
.ayah-arabic::selection,
.ayah-translation::selection,
.ayah-transliteration::selection {
  background: color-mix(in oklab, var(--accent) 28%, transparent);
  color: var(--accent-deep);
}
