:root {
  --bg: #f6f1e6;
  --surface: #fffdf8;
  --surface-2: #efe7d6;
  --text: #1f2a24;
  --muted: #6b6a5e;
  --primary: #0f5c46;
  --primary-ink: #ffffff;
  --header-bg: #0f5c46;
  --header-ink: #ffffff;
  --gold: #b08a3e;
  --border: #e2d8c3;
  --live: #c0392b;
  --shadow: 0 10px 30px rgba(31, 42, 36, .08);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1613;
    --surface: #16211c;
    --surface-2: #1d2a24;
    --text: #ece6d6;
    --muted: #a39f8f;
    --primary: #3fa883;
    --primary-ink: #08110d;
    --header-bg: #0c3a2d;
    --header-ink: #f3ecda;
    --gold: #d4b26a;
    --border: #26352e;
    --live: #ef6b5b;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.6;
}
[lang=ar] { font-family: "Amiri", serif; }

.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }

.site-header {
  background: var(--header-bg);
  color: var(--header-ink);
  padding: 36px 0 72px;
  text-align: center;
}
.site-header h1 {
  font-family: "Lora", serif;
  font-size: clamp(1.5rem, 4.4vw, 2.1rem);
  margin: 0;
}
.tagline { margin: 6px 0 0; opacity: .85; }

/* ---------- Network brand ---------- */
.brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 18px; }
.brand::after {
  content: ""; width: 72px; height: 2px; margin-top: 16px;
  background: var(--gold); border-radius: 2px; opacity: .8;
}
.logo { display: block; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .18)); }
.network-ar { font-family: "Amiri", serif; font-weight: 700; font-size: clamp(1.6rem, 5.5vw, 2.2rem); line-height: 1.4; margin: 10px 0 0; }
.network-en { font-size: .74rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; margin: 2px 0 0; opacity: .85; }

.brand-slim { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; margin-bottom: 14px; }
.brand-slim > span { display: flex; flex-direction: column; }
.brand-slim .network-ar { font-size: 1.35rem; margin: 0; line-height: 1.3; }
.brand-slim .network-en { font-size: .62rem; }

/* ---------- Player ---------- */
.player {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  margin-top: -48px;
  position: relative;
}
.player-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: .85rem;
  font-weight: 500;
}
.badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.badge.live .dot { background: var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}

.link-btn {
  background: none; border: 0; color: var(--primary);
  font: inherit; font-size: .9rem; cursor: pointer; text-decoration: underline;
}

.now { text-align: center; padding: 18px 0 8px; }
.now-label { margin: 0; color: var(--gold); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; }
.now-surah { font-family: "Lora", serif; font-size: clamp(1.8rem, 6vw, 2.6rem); margin: 4px 0 0; line-height: 1.25; }
.now-ar { margin: 0; color: var(--gold); font-size: 1.35rem; min-height: 1.6em; }
.now-title { margin: 0; color: var(--muted); min-height: 1.7em; }
.now-mufassir { margin: 4px 0 0; font-weight: 700; color: var(--primary); }

.progress { display: flex; align-items: center; gap: 10px; direction: ltr; margin-top: 8px; }
.progress input { flex: 1; }
.time { font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--muted); min-width: 3.5em; text-align: center; }

input[type=range] { accent-color: var(--primary); }
input[type=range]:disabled { opacity: .5; }

.controls { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 14px 0 6px; direction: ltr; }
.ctl {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .12s ease, background .2s;
}
.ctl:hover { transform: scale(1.06); }
.ctl:active { transform: scale(.96); }
.ctl svg { width: 22px; height: 22px; fill: currentColor; }
svg[hidden] { display: none; }
.ctl-main { width: 68px; height: 68px; background: var(--primary); color: var(--primary-ink); border: 0; }
.ctl-main svg { width: 32px; height: 32px; }
.ctl:disabled { opacity: .4; cursor: default; transform: none; }

.volume { display: flex; align-items: center; gap: 8px; justify-content: center; direction: ltr; }
.volume svg { width: 18px; height: 18px; fill: var(--muted); }
.volume input { width: 140px; }

.status { text-align: center; color: var(--muted); font-size: .85rem; min-height: 1.5em; margin: 6px 0 0; }

/* ---------- Library ---------- */
.library { margin: 28px 0 40px; }
.lib-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lib-head h2 { font-family: "Lora", serif; font-size: 1.6rem; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: .9rem; }

.filters { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; margin-bottom: 14px; }
.filters select, .filters input {
  font: inherit; font-size: .95rem;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-width: 0;
}
@media (max-width: 620px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
}

.tracks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.track {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.track:hover { border-color: var(--primary); }
.track.playing { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.track .num {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-2); color: var(--gold);
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.track .meta { flex: 1; min-width: 0; }
.track .t1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .t2 { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .dur { flex: none; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; direction: ltr; }

.empty {
  text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: 14px; padding: 28px 16px;
}
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; direction: ltr; display: inline-block; }

.site-footer {
  text-align: center; padding: 26px 0 34px;
  color: var(--gold);
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--primary); }
.footer-links { margin: 14px 0 0; font-size: .9rem; }
.verse-ar { font-size: 1.4rem; margin: 0; }

/* ---------- About page ---------- */
.site-header-slim { padding: 24px 0 28px; text-align: left; }
.home-link { color: var(--header-ink); opacity: .85; text-decoration: none; font-size: .9rem; }
.home-link:hover { opacity: 1; text-decoration: underline; }
.prose { padding-top: 12px; padding-bottom: 32px; max-width: 720px; }
.prose h2 { font-family: "Lora", serif; font-size: 1.5rem; margin: 28px 0 8px; }
.prose h3 { font-size: 1rem; margin: 18px 0 4px; }
.prose p { margin: 0 0 10px; }
.prose a { color: var(--primary); }
.verse-en { font-family: "Lora", serif; font-style: italic; font-size: .95rem; color: var(--muted); margin: 6px 0 0; }
