:root {
  --bg: #f4efe4;
  --bg-2: #fffaf2;
  --ink: #17211b;
  --muted: #5c675f;
  --line: rgba(23, 33, 27, 0.12);
  --green: #0f3d2e;
  --green-2: #1c5c45;
  --gold: #8d6a1d;
  --gold-soft: rgba(141, 106, 29, 0.14);
  --card: rgba(255, 250, 242, 0.86);
  --shadow: 0 18px 50px rgba(23, 33, 27, 0.08);
  --danger: #8c3a32;
  --radius: 22px;
  --header: 72px;
  --font: "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --display: "Literata", "Noto Sans Devanagari", serif;
  --arabic: "Noto Naskh Arabic", serif;
  --urdu: "Noto Nastaliq Urdu", serif;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #0b0b0b;
  --ink: #f8f1dc;
  --muted: #d4c39a;
  --line: rgba(212, 175, 55, 0.32);
  --green: #d4af37;
  --green-2: #f0d78c;
  --gold: #e8c872;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --card: #0c0c0c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 420px at 100% -10%, var(--gold-soft), transparent 60%),
    radial-gradient(700px 380px at -10% 0%, rgba(15, 61, 46, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.6;
}
html[dir="rtl"] body { font-family: var(--urdu), var(--font); }
html[data-theme="dark"] body {
  background:
    radial-gradient(820px 380px at 100% -8%, rgba(212, 175, 55, 0.14), transparent 62%),
    #000000;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--green);
  color: #fff;
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: max-content;
}
.brand img { width: 40px; height: 40px; }
.brand strong {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}
.brand span { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.nav {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav a, .icon-btn, .text-btn, .chip, .primary, .ghost {
  border: 0;
  text-decoration: none;
}
.nav a {
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.92rem;
}
.nav a.active, .nav a:hover { color: var(--ink); background: var(--gold-soft); }
.tools { display: flex; align-items: center; gap: 8px; }
select.tool, .icon-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; }
.menu-btn { display: none; }

.page { width: min(1120px, calc(100% - 32px)); margin: 28px auto 48px; flex: 1; }
.hero-slider {
  position: relative;
  overflow: hidden;
  min-height: 420px;
}
.hero-slider .slide {
  display: none;
  position: relative;
  min-height: 480px;
  background: #0c1411 72% center / cover no-repeat;
}
.hero-slider .slide.is-active { display: block; }
.hero-slider .slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 12, 10, 0.84) 0%, rgba(6, 12, 10, 0.5) 38%, rgba(6, 12, 10, 0.08) 68%);
}
.slide-copy {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  padding: 58px 24px 84px 68px;
  color: #f7f3e8;
}
.slide-copy h1,
.slide-copy .lede { color: #f7f3e8; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45); }
.slide-copy .lede { color: rgba(247, 243, 232, 0.86); }
.slide-copy .kicker { color: #e7c56a; }
.slide-copy .primary { background: #e7c56a; color: #142019; }
html[dir="rtl"] .slide-copy { text-align: right; }
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.slider-btn.prev { inset-inline-start: 14px; }
.slider-btn.next { inset-inline-end: 14px; }
.slider-dots {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.slider-dots button {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(247, 243, 232, 0.45);
}
.slider-dots button.active { width: 22px; background: var(--gold); }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-copy { padding: 36px; }
.kicker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 10px; }
h1 { font-size: clamp(2rem, 4vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 2vw, 2rem); }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 46rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.primary, .ghost, .text-btn, .chip {
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 700;
}
.primary { background: var(--green); color: #f7f3e8; }
html[data-theme="dark"] .primary { color: #000000; }
.ghost, .text-btn, .chip { background: transparent; border: 1px solid var(--line); }
.chip.active, .text-btn.active { background: var(--green); color: #f7f3e8; border-color: transparent; }
html[data-theme="dark"] .chip.active, html[data-theme="dark"] .text-btn.active { color: #000000; }
.hero-aside { padding: 22px; display: grid; gap: 12px; }
.stat { padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.stat b { display: block; font-family: var(--display); font-size: 1.3rem; }
.stat span { color: var(--muted); font-size: 0.9rem; }

.grid { display: grid; gap: 14px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); margin-top: 18px; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  display: block;
  padding: 18px;
  text-decoration: none;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  min-height: 140px;
}
.card:hover { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); }
.card em { font-style: normal; color: var(--gold); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.card p, .muted { color: var(--muted); }
.section { margin-top: 34px; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.searchbar {
  display: flex;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  margin: 8px 0 14px;
}
.searchbar input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.az { display: flex; flex-wrap: wrap; gap: 6px; }
.az button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2);
}
.az button.active { background: var(--green); color: #f7f3e8; border-color: transparent; }
html[data-theme="dark"] .az button.active { color: #000000; }

.list { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 16px 18px;
  text-decoration: none;
  align-items: center;
}
.row small { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.88rem; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }

.reader { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.side { padding: 12px; max-height: 72vh; overflow: auto; }
.side button, .side a {
  width: 100%;
  text-align: start;
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.side button.active, .side a.active, .side button:hover, .side a:hover { background: var(--gold-soft); }
.ayah {
  padding: 16px 4px 18px;
  border-bottom: 1px solid var(--line);
}
.arabic {
  font-family: var(--arabic);
  font-size: 1.85rem;
  line-height: 2.15;
  text-align: right;
  direction: rtl;
}
.translation { font-size: 1.05rem; margin-top: 8px; }
.translation.ur { font-family: var(--urdu); font-size: 1.35rem; line-height: 2.2; direction: rtl; text-align: right; }
.translation.hi { font-family: "Noto Sans Devanagari", sans-serif; }
.ayah-no {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  margin-inline-end: 8px;
}

.lyric-body {
  padding: 8px 4px 18px;
  white-space: pre-wrap;
  line-height: 2;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.browse-menu { position: relative; }
.browse-panel {
  display: none;
  position: absolute;
  z-index: 6;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  width: min(640px, 86vw);
  max-height: 70vh;
  overflow: auto;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.browse-menu:hover .browse-panel,
.browse-menu.open .browse-panel,
.browse-menu:focus-within .browse-panel { display: block; }
.browse-panel a {
  display: block;
  text-decoration: none;
  border-radius: 10px;
  padding: 7px 10px;
}
.browse-panel a:hover,
.browse-panel a.active { background: var(--gold-soft); }
.browse-panel h3 { margin: 12px 0 4px; font-size: 0.95rem; }
.video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 10px; }
.video-grid iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 14px; background: #000; }
.back-top { position: fixed; z-index: 24; bottom: 92px; inset-inline-end: 16px; }
.source-line { margin-top: 8px; color: var(--muted); font-size: 0.92rem; }
.lyric-body.ur { font-family: var(--urdu); direction: rtl; text-align: right; font-size: 1.55rem; line-height: 2.5; }
.lyric-body.hi { font-family: "Noto Sans Devanagari", sans-serif; }
.word {
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--gold);
  padding: 0;
  color: inherit;
  font: inherit;
}
.popover {
  position: fixed;
  z-index: 40;
  max-width: min(320px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.notice {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--gold-soft);
}
.form { display: grid; gap: 14px; max-width: 440px; padding: 22px; }
.form label { display: grid; gap: 6px; font-weight: 700; }
.form input {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
}
.form .error { color: var(--danger); background: transparent; padding: 0; }

.layout { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 16px; }
.prose p { color: var(--muted); }
.cover {
  width: 100%;
  height: 168px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 12px;
}
.thumb {
  width: 84px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
}
.row.has-thumb { grid-template-columns: auto 1fr auto; }
.player {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 12px;
  z-index: 25;
  display: none;
  grid-template-columns: 1.2fr 1.4fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.player.show { display: grid; }
.player input[type="range"] { width: 100%; }
.speeds { display: flex; flex-wrap: wrap; gap: 4px; }
.speeds button, .player .icon-btn { height: 34px; }
.speeds button { border-radius: 999px; border: 1px solid var(--line); background: transparent; padding: 0 8px; }
.speeds button.active { background: var(--green); color: #f7f3e8; }
html[data-theme="dark"] .speeds button.active { color: #000000; }

.drawer {
  display: none;
  position: fixed;
  inset: var(--header) 0 0 0;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  z-index: 28;
  padding: 16px;
}
.drawer.open { display: grid; align-content: start; gap: 8px; }
.drawer a { text-decoration: none; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }

.results h3 { margin-top: 18px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
footer.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
}
html[data-theme="dark"] footer.site-footer { background: #050505; }
.footer-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 28px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.8fr;
  gap: 28px 40px;
}
.footer-brand .brand { margin-bottom: 12px; }
.footer-brand p { margin: 0; max-width: 36rem; }
footer h2 {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.footer-links { display: grid; gap: 8px; }
footer a { color: var(--ink); text-decoration: none; }
footer a:hover { color: var(--gold); }
.footer-bar {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 14px 0 20px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

@media (max-width: 980px) {
  .nav { display: none; }
  .menu-btn { display: grid; }
  .site-header { padding: 0 12px; gap: 8px; }
  .site-header .brand span span { display: none; }
  .tools .ghost { display: none; }
  .reader, .layout, .cards-4, .cards-3, .cards-2 { grid-template-columns: 1fr; }
  .slide-copy { padding: 36px 56px 72px 22px; }
  .hero-slider, .hero-slider .slide { min-height: 420px; }
  .player { grid-template-columns: 1fr; }
  .video-grid, .footer-inner { grid-template-columns: 1fr; }
  .side { max-height: none; }
  .row strong, .row span { min-width: 0; }
}

@media (max-width: 640px) {
  .page { width: min(1120px, calc(100% - 24px)); margin: 16px auto 28px; }
  .site-header { height: 64px; }
  select.tool { padding: 7px 8px; font-size: 0.82rem; max-width: 96px; }
  .hero-slider, .hero-slider .slide { min-height: 340px; }
  .slide-copy { padding: 24px 48px 62px 16px; }
  .slide-copy .lede { font-size: 0.98rem; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .row { grid-template-columns: 1fr; align-items: start; }
  .row.has-thumb { grid-template-columns: 72px 1fr; }
  .row.has-thumb small { grid-column: 2; }
  .thumb { width: 72px; height: 54px; }
  .arabic { font-size: 1.45rem; line-height: 2; }
  .translation.ur, .lyric-body.ur { font-size: 1.2rem; }
  .footer-inner, .footer-bar { width: min(1120px, calc(100% - 28px)); }
  .player { left: 8px; right: 8px; }
  .form { padding: 16px; }
}
