/* QuranStream — main stylesheet (mobile-first, RTL) */

:root {
  --ivory: #f6f1e7;
  --paper: #fffcf6;
  --sand: #ece4d3;
  --line: #e2d8c4;
  --ink: #13202f;
  --ink-soft: #3c4a5a;
  --muted: #6a7482;
  --navy: #0b2038;
  --navy-2: #12304f;
  --navy-3: #1b3f63;
  --gold: #a87a28;
  --gold-2: #c99a45;
  --gold-3: #e6c785;
  --live: #e0394c;
  --ok: #2f9e6e;

  --font-ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Amiri", "Times New Roman", serif;
  --font-quran: "Amiri Quran", "Amiri", serif;

  --radius: 14px;
  --radius-lg: 22px;
  --header-h: 64px;
  --dock-h: 68px;
  --shadow: 0 1px 2px rgba(11, 32, 56, .06), 0 8px 24px -12px rgba(11, 32, 56, .18);
  --shadow-lg: 0 30px 60px -30px rgba(11, 32, 56, .45);
  --container: 1200px;
  --gutter: 16px;
}

@media (min-width: 768px) { :root { --gutter: 28px; --header-h: 72px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--ivory);
  padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 768px) { body { font-size: 17px; } }
body.nav-open { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; text-decoration: none; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
  border: 1.5px solid transparent; transition: background .2s, color .2s, border-color .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 1rem; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .875rem; }
.btn-gold { background: var(--gold-2); color: var(--navy); }
.btn-gold:hover { background: var(--gold-3); }
.btn-outline { border-color: var(--line); background: var(--paper); color: var(--ink); }
.btn-outline:hover { border-color: var(--gold-2); }
.btn-ghost-light { border-color: rgba(255,255,255,.55); color: #fff; background: rgba(255,255,255,.06); backdrop-filter: blur(4px); }
.btn-ghost-light:hover { background: rgba(255,255,255,.16); }
.btn-outline-light { border-color: rgba(255,255,255,.25); color: #fff; background: transparent; }
.btn-outline-light:hover { border-color: var(--gold-3); color: var(--gold-3); }
.btn .icon { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 0; background: transparent; color: var(--muted);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--sand); color: var(--ink); }
.fav-btn.on { color: var(--gold-2); }
.fav-btn.on .icon { fill: currentColor; }
.link-btn { border: 0; background: none; color: var(--gold); font-weight: 600; padding: 4px 0; }
.link-arrow { color: var(--gold); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.link-arrow::after { content: "←"; transition: transform .2s; }
.link-arrow:hover::after { transform: translateX(-4px); }

.kicker { font-size: .8rem; font-weight: 600; letter-spacing: .02em; color: var(--gold); margin-bottom: 6px; }
.kicker-light { color: var(--gold-3); }
.lead { color: var(--ink-soft); font-size: 1.05rem; max-width: 62ch; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(11,32,56,.2); border-top-color: currentColor;
  animation: spin .8s linear infinite; display: none;
}
.spinner.dark { display: inline-block; color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; box-shadow: 0 0 0 0 rgba(224,57,76,.6); }
.is-live-playing .live-dot, .live-chip:not(.offline) .live-dot { animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(224,57,76,.55); } 70% { box-shadow: 0 0 0 9px rgba(224,57,76,0); } 100% { box-shadow: 0 0 0 0 rgba(224,57,76,0); } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: rgba(246,241,231,.92); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px -16px rgba(11,32,56,.35); }
.header-inner { height: 100%; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); min-width: 0; }
.brand-logo { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; white-space: nowrap; }
.brand-text small { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.brand-light { color: #fff; }
.brand-light .brand-text small { color: rgba(255,255,255,.6); }

.main-nav { display: none; margin-inline: auto; gap: 2px; }
.main-nav a {
  text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .92rem; font-weight: 500; color: var(--ink-soft);
  transition: background .2s, color .2s;
}
.main-nav a:hover { color: var(--navy); background: var(--sand); }
.main-nav a.active { color: var(--navy); background: var(--sand); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.header-library { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--navy); }
.header-library:hover, .header-library.active { background: var(--sand); }
.header-live {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid rgba(224,57,76,.35); background: rgba(224,57,76,.06);
  color: #b2172b; font-weight: 600; font-size: .9rem;
}
.header-live.is-playing { background: var(--live); color: #fff; border-color: var(--live); }
.header-live.is-playing .live-dot { background: #fff; }
.menu-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: var(--navy); }
.menu-btn:hover { background: var(--sand); }

@media (min-width: 1140px) {
  .main-nav { display: flex; }
  .menu-btn { display: none; }
  .header-actions { margin-inline-start: 0; }
}
@media (max-width: 420px) {
  .brand-text small { display: none; }
  .header-live-label { display: none; }
  .header-live { width: 38px; padding: 0; justify-content: center; }
}

.mobile-nav {
  position: fixed; inset: var(--header-h) 0 0; z-index: 39; background: var(--ivory);
  overflow-y: auto; padding: 8px var(--gutter) calc(var(--dock-h) + 24px);
  animation: fadeIn .18s ease;
}
.mobile-nav nav { display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.mobile-nav a {
  display: flex; align-items: center; justify-content: space-between; text-decoration: none;
  padding: 16px 4px; font-size: 1.1rem; font-weight: 600; border-bottom: 1px solid var(--line); color: var(--navy);
}
.soon { font-size: .72rem; font-weight: 600; color: var(--gold); background: rgba(201,154,69,.12); padding: 2px 10px; border-radius: 999px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; color: #fff; overflow: hidden;
  min-height: min(calc(100svh - var(--header-h)), 760px); display: flex; align-items: flex-end;
}
.hero-media, .hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero-media img { object-fit: cover; object-position: 66% 35%; }
.hero-overlay {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, rgba(7,19,34,.94) 0%, rgba(7,19,34,.72) 32%, rgba(7,19,34,.18) 62%, rgba(7,19,34,.35) 100%),
    linear-gradient(to left, rgba(7,19,34,.45), rgba(7,19,34,0) 55%);
}
.hero-content { padding-block: 80px 120px; }
.hero-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; font-size: .9rem; }
.live-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 12px; border-radius: 999px;
  background: rgba(224,57,76,.18); border: 1px solid rgba(255,140,150,.45); font-weight: 600;
}
.live-chip.offline { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
.live-chip.offline .live-dot { background: #aab; animation: none; }
.hero-fm { color: rgba(255,255,255,.75); direction: ltr; letter-spacing: .03em; }
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 5rem); line-height: 1.15; text-shadow: 0 2px 24px rgba(0,0,0,.35);
}
.hero-sub { font-family: var(--font-display); font-size: clamp(1.25rem, 3.4vw, 1.8rem); color: var(--gold-3); margin-top: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-credit {
  position: absolute; top: 10px; left: 12px; font-size: .68rem; color: rgba(255,255,255,.6);
  text-decoration: none; font-family: var(--font-ui);
}
.hero-credit:hover { color: #fff; }
@media (max-width: 600px) {
  .hero { min-height: 640px; }
  .hero-media img { object-position: 64% 40%; }
  .hero-content { padding-block: 90px 110px; }
  .hero-actions .btn { flex: 1 1 100%; }
}

/* ---------- Sections ---------- */
.section { padding-block: 56px; }
@media (min-width: 900px) { .section { padding-block: 80px; } }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2, .principles h2 { font-family: var(--font-display); font-size: clamp(1.8rem, 4.5vw, 2.6rem); color: var(--navy); }

/* ---------- Live card ---------- */
.live-section { padding-block: 0; margin-top: -72px; position: relative; z-index: 2; }
.quran-home { padding-top: 56px; }
.live-card {
  background: var(--navy); color: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: grid; gap: 24px; padding: 24px;
  background-image: radial-gradient(600px 300px at 0% 0%, rgba(201,154,69,.16), transparent 70%);
}
.live-card-id { display: flex; align-items: center; gap: 16px; }
.live-card-id img { width: 64px; height: 64px; border-radius: 50%; flex: none; }
.live-card h2 { font-family: var(--font-display); font-size: 1.5rem; }
.live-state { color: rgba(255,255,255,.72); font-size: .92rem; margin-top: 2px; }
.live-card-controls { display: flex; align-items: center; gap: 20px; }
.play-xl {
  position: relative; width: 84px; height: 84px; border-radius: 50%; border: 0; flex: none;
  background: var(--gold-2); color: var(--navy); display: grid; place-items: center;
  box-shadow: 0 10px 30px -10px rgba(201,154,69,.8); transition: transform .15s, background .2s;
}
.play-xl:hover { background: var(--gold-3); transform: scale(1.03); }
.play-xl .icon { width: 34px; height: 34px; }
.play-xl .spinner { width: 32px; height: 32px; border-color: rgba(11,32,56,.25); border-top-color: var(--navy); }
.i-pause { display: none; }
.is-playing .i-play { display: none; }
.is-playing .i-pause { display: block; }
.is-busy .i-play, .is-busy .i-pause { display: none; }
.is-busy .spinner { display: block; }
.play-xl.is-playing::after {
  content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid rgba(230,199,133,.5);
  animation: ring 2.2s ease-out infinite;
}
@keyframes ring { from { transform: scale(.95); opacity: 1; } to { transform: scale(1.22); opacity: 0; } }

.live-wave { flex: 1; display: flex; align-items: center; gap: 5px; height: 48px; min-width: 0; overflow: hidden; }
.live-wave i { flex: 1; max-width: 6px; height: 6px; border-radius: 3px; background: rgba(230,199,133,.35); }
.is-live-playing .live-wave i { animation: wave 1.1s ease-in-out infinite; background: var(--gold-3); }
.live-wave i:nth-child(3n) { animation-delay: -.35s !important; }
.live-wave i:nth-child(3n+1) { animation-delay: -.7s !important; }
.live-wave i:nth-child(4n) { animation-delay: -.15s !important; }
@keyframes wave { 0%, 100% { height: 8px; } 50% { height: 44px; } }

.live-facts { display: grid; grid-template-columns: repeat(3, auto); gap: 12px 24px; margin: 0; justify-content: start; }
.live-facts dt { font-size: .75rem; color: rgba(255,255,255,.6); }
.live-facts dd { margin: 0; font-weight: 600; font-size: 1rem; color: #fff; }
.live-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.sleep-field select, .select {
  appearance: none; -webkit-appearance: none; min-height: 40px; padding: 0 14px 0 34px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper) no-repeat left 12px center / 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236a7482' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  font-size: .9rem; max-width: 100%;
}
.sleep-field select { border-color: rgba(255,255,255,.25); background-color: transparent; color: #fff; min-height: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.sleep-field option { color: var(--ink); background: #fff; }

@media (min-width: 900px) {
  .live-card { grid-template-columns: 1.1fr 1fr 1.1fr; align-items: center; padding: 32px 36px; gap: 36px; }
}
@media (max-width: 520px) {
  .live-facts { grid-template-columns: repeat(2, auto); }
}

/* ---------- Home: Quran ---------- */
.quran-home-grid { display: grid; gap: 24px; }
.quran-home-intro .lead { margin-bottom: 20px; }
.stat-row { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0; }
.stat-row li {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-row b { font-weight: 700; color: var(--gold); font-size: 1.05rem; }
.stat-row span { color: var(--ink-soft); font-size: .95rem; }
.quick-surahs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-surahs a {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line); text-decoration: none; font-family: var(--font-display);
  font-size: 1.25rem; color: var(--navy); transition: border-color .2s, transform .15s;
}
.quick-surahs a::after { content: "←"; font-family: var(--font-ui); color: var(--gold-2); font-size: 1rem; }
.quick-surahs a:hover { border-color: var(--gold-2); transform: translateY(-2px); }
.continue-card {
  grid-column: 1 / -1; padding: 22px; border-radius: var(--radius-lg); background: var(--paper);
  border: 1px solid var(--line); border-inline-start: 4px solid var(--gold-2); box-shadow: var(--shadow);
}
.continue-card h3 { font-family: var(--font-display); font-size: 1.6rem; color: var(--navy); }
.continue-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
@media (min-width: 900px) {
  .quran-home-grid { grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
}

/* ---------- Daily ayah ---------- */
.daily-section { padding-top: 0; }
.daily-ayah {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 32px 22px; text-align: center; box-shadow: var(--shadow);
}
.daily-ayah::before, .daily-ayah::after {
  content: ""; position: absolute; inset-inline: 22px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
}
.daily-ayah::before { top: 12px; }
.daily-ayah::after { bottom: 12px; }
.daily-text { margin: 10px auto 18px; max-width: 46ch; font-family: var(--font-quran); font-size: clamp(1.5rem, 4.4vw, 2.2rem); line-height: 2.1; color: var(--navy); }
.daily-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.daily-ref { color: var(--muted); font-size: .95rem; }
.daily-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- Ayah number marker ---------- */
.ayah-num {
  display: inline-grid; place-items: center; min-width: 1.75em; height: 1.75em; padding: 0 .25em;
  font-family: var(--font-ui); font-size: .5em; font-weight: 600; line-height: 1; color: var(--gold);
  border: 1.5px solid var(--gold-2); border-radius: 50%; vertical-align: .35em; margin-inline: .15em;
  background: rgba(201,154,69,.07);
}

/* ---------- Reciters ---------- */
.reciter-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.reciter-chip {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px; border-radius: 999px;
  background: var(--paper); border: 1.5px solid var(--line); flex: none; scroll-snap-align: start; text-align: start;
  transition: border-color .2s;
}
.reciter-chip strong { display: block; font-weight: 600; font-size: .95rem; white-space: nowrap; }
.reciter-chip small { display: block; color: var(--muted); font-size: .78rem; }
.reciter-chip:hover { border-color: var(--gold-2); }
.reciter-chip.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.reciter-chip.active small { color: rgba(255,255,255,.65); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--sand); color: var(--navy); font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
}
.reciter-chip.active .avatar { background: var(--gold-2); }
.avatar-lg { width: 56px; height: 56px; font-size: 1.6rem; }
@media (min-width: 900px) {
  .reciter-strip { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; }
  .reciter-chip strong { white-space: normal; }
}

.reciter-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .reciter-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .reciter-grid { grid-template-columns: repeat(3, 1fr); } }
.reciter-card {
  display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center; padding: 18px;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius-lg);
}
.reciter-card.active { border-color: var(--gold-2); box-shadow: var(--shadow); }
.reciter-card h2 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.reciter-card p { color: var(--muted); font-size: .85rem; }
.reciter-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Principles ---------- */
.principles { background: var(--sand); }
.principles-grid { display: grid; gap: 32px; }
.principles .lead { margin: 14px 0 18px; }
.principles-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.principles-list li { background: var(--paper); padding: 18px 20px; display: flex; flex-direction: column; }
.principles-list strong { color: var(--navy); }
.principles-list span { color: var(--muted); font-size: .92rem; }
@media (min-width: 900px) {
  .principles-grid { grid-template-columns: 1fr 1fr; align-items: center; gap: 60px; }
  .principles-list { grid-template-columns: 1fr 1fr; }
}

.program-row { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.program-row time { color: var(--gold); font-weight: 600; direction: ltr; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: rgba(255,255,255,.78); padding-top: 56px; margin-top: 0; }
.footer-grid { display: grid; gap: 32px; padding-bottom: 36px; }
.footer-brand p { margin-top: 14px; max-width: 40ch; font-size: .92rem; }
.footer-social { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; }
.footer-social a, .site-footer nav a { color: rgba(255,255,255,.78); text-decoration: none; font-size: .92rem; }
.footer-social a:hover, .site-footer nav a:hover, .footer-credits a:hover { color: var(--gold-3); }
.site-footer h3 { color: #fff; font-size: .95rem; margin-bottom: 12px; }
.site-footer nav { display: flex; flex-direction: column; gap: 8px; }
.footer-credits p { font-size: .82rem; margin-bottom: 8px; }
.footer-credits a { color: rgba(255,255,255,.9); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-block: 18px; font-size: .82rem; color: rgba(255,255,255,.55); }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.4fr; } }

/* ---------- Dock (sticky player) ---------- */
.dock {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
  background: rgba(11,32,56,.97); backdrop-filter: blur(10px); color: #fff;
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -10px 30px -18px rgba(0,0,0,.6);
}
.dock-progress { height: 3px; background: rgba(255,255,255,.08); }
.dock-progress i { display: block; height: 100%; width: 0; background: var(--gold-2); transition: width .25s linear; }
.dock-inner { height: calc(var(--dock-h) - 3px); display: flex; align-items: center; gap: 12px; }
.dock-play {
  width: 46px; height: 46px; border-radius: 50%; border: 0; flex: none; display: grid; place-items: center;
  background: var(--gold-2); color: var(--navy);
}
.dock-play:hover { background: var(--gold-3); }
.dock-play .icon { width: 22px; height: 22px; }
.dock-play .spinner { border-color: rgba(11,32,56,.25); border-top-color: var(--navy); }
.dock-info { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; line-height: 1.35; }
.dock-title { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-sub { font-size: .78rem; color: rgba(255,255,255,.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-quran, .dock-tools { display: flex; align-items: center; gap: 4px; }
.dock-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: #fff; display: grid; place-items: center; }
.dock-btn:hover { background: rgba(255,255,255,.1); }
.dock-mute .i-muted { display: none; }
.dock-mute.is-muted .i-vol { display: none; }
.dock-mute.is-muted .i-muted { display: block; }
.dock-volume { display: none; }
.dock-volume input { width: 110px; accent-color: var(--gold-2); }
.dock-sleep { display: none; font-size: .75rem; color: var(--gold-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dock-switch {
  display: none; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.dock-switch:hover { border-color: var(--gold-3); }
@media (min-width: 768px) {
  .dock-volume { display: block; }
  .dock-sleep:not([hidden]) { display: inline; }
  .dock-switch:not([hidden]) { display: inline-flex; }
}
@media (max-width: 767px) {
  .dock-mute { display: none; }
  body:not(.dock-active) .dock-mute { display: none; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + 16px + env(safe-area-inset-bottom)); z-index: 70;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: .9rem;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Generic page ---------- */
.page-head { padding: 40px 0 28px; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3rem); color: var(--navy); margin-bottom: 8px; }
.page-error { padding: 80px var(--gutter); text-align: center; }
.page-error h1 { font-family: var(--font-display); font-size: 2rem; margin-bottom: 10px; }
.page-error .btn { margin-top: 18px; }
.prose { max-width: 820px; padding-bottom: 60px; }
.prose h2 { font-size: 1.2rem; color: var(--navy); margin: 28px 0 8px; }
.prose p { color: var(--ink-soft); }
.prose a { color: var(--gold); }
.pending-note {
  display: inline-block; padding: 8px 14px; border-radius: 10px; background: var(--sand); color: var(--muted) !important; font-size: .92rem;
}
.soon-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; }
.soon-card ul { color: var(--ink-soft); padding-inline-start: 20px; margin: 12px 0 22px; }
.soon-badge { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--gold); background: rgba(201,154,69,.14); padding: 3px 12px; border-radius: 999px; margin-bottom: 12px; }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.contact-list li { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--paper); }
.source-note { color: var(--muted); font-size: .82rem; margin: 28px 0 40px; text-align: center; }
.empty-state { color: var(--muted); padding: 28px; text-align: center; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); list-style: none; grid-column: 1 / -1; }

/* ---------- Quran index ---------- */
.index-toolbar { display: grid; gap: 12px; margin-bottom: 18px; }
.search-field {
  display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 50px; border-radius: 999px;
  background: var(--paper); border: 1.5px solid var(--line); color: var(--muted);
}
.search-field:focus-within { border-color: var(--gold-2); }
.search-input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; font-size: 1rem; color: var(--ink); }
.field-inline { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--muted); }
.field-inline .select { flex: 1; }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--sand); border-radius: 999px; overflow-x: auto; max-width: 100%; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-size: .9rem; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }
.seg button.active { background: var(--paper); color: var(--navy); font-weight: 700; box-shadow: var(--shadow); }
@media (min-width: 900px) {
  .index-toolbar { grid-template-columns: 1.4fr 1fr auto; align-items: center; }
}
.resume-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--navy); color: #fff; text-decoration: none; font-size: .92rem;
}
.resume-bar .icon { color: var(--gold-3); }
.result-count { color: var(--muted); font-size: .88rem; margin-bottom: 10px; min-height: 1px; }

.surah-grid { list-style: none; margin: 0 0 40px; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .surah-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .surah-grid { grid-template-columns: repeat(3, 1fr); } }
.surah-item {
  display: flex; align-items: center; gap: 4px; padding-inline-end: 8px; background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius); transition: border-color .2s;
}
.surah-item:hover { border-color: var(--gold-2); }
.surah-item.is-current { border-color: var(--navy); box-shadow: inset 4px 0 0 var(--gold-2); }
.surah-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 12px 14px; text-decoration: none; }
.surah-no {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: .9rem; color: var(--navy);
  background: var(--ivory); border: 1.5px solid var(--gold-3); transform: rotate(45deg); border-radius: 10px;
}
.surah-no { position: relative; }
.surah-item .surah-no { transform: none; border-radius: 50%; }
.surah-body { display: flex; flex-direction: column; min-width: 0; }
.surah-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--navy); line-height: 1.3; }
.surah-meta { font-size: .82rem; color: var(--muted); }
.play-btn-sm { color: var(--navy); }
.play-btn-sm .icon { width: 18px; height: 18px; }

/* ---------- Reader ---------- */
.reader-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 100px 0; color: var(--muted); }
.reader-head { padding: 28px 0 22px; text-align: center; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--gold); text-decoration: none; }
.reader-title { font-family: var(--font-display); font-size: clamp(2.2rem, 7vw, 3.4rem); color: var(--navy); }
.reader-meta { color: var(--muted); font-size: .92rem; margin-top: 6px; }

.reader-toolbar {
  position: sticky; top: var(--header-h); z-index: 30; background: rgba(246,241,231,.95); backdrop-filter: blur(10px);
  border-block: 1px solid var(--line);
}
.toolbar-inner { display: flex; align-items: center; gap: 8px; padding-block: 10px; overflow-x: auto; scrollbar-width: none; }
.toolbar-inner::-webkit-scrollbar { display: none; }
.reader-play { flex: none; }
.reader-play .icon { width: 16px; height: 16px; }
.tool-group { display: flex; align-items: center; gap: 4px; flex: none; }
.toolbar-inner .field-inline { flex: none; }
.select-compact { min-height: 40px; font-size: .88rem; max-width: 210px; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 10px; justify-content: center;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink-soft); font-size: .85rem; flex: none;
}
.tool-btn:hover { border-color: var(--gold-2); }
.tool-btn.on { border-color: var(--gold-2); color: var(--gold); background: rgba(201,154,69,.1); }
.tool-btn.on .icon { fill: none; }
.tool-btn[aria-pressed="true"] .icon { fill: currentColor; }
.tool-label { white-space: nowrap; }
.font-glyph { font-weight: 700; font-size: .95rem; }
@media (max-width: 600px) {
  .tool-label { display: none; }
  .toolbar-inner { flex-wrap: wrap; overflow: visible; row-gap: 8px; }
  .reader-play { flex: 1 1 auto; }
  .toolbar-inner .field-inline { flex: 1 1 50%; }
  .toolbar-inner .select-compact { max-width: none; width: 100%; }
  .tool-group { flex: 1 1 auto; justify-content: flex-start; }
  .tool-group + .tool-group { justify-content: flex-end; }
}

.reader-body { padding-top: 24px; }
.mushaf {
  max-width: 880px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px 18px 32px; box-shadow: var(--shadow); position: relative;
}
.mushaf::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid rgba(201,154,69,.35); border-radius: calc(var(--radius-lg) - 6px); pointer-events: none;
}
@media (min-width: 768px) { .mushaf { padding: 44px 52px 48px; } }
.basmala { text-align: center; font-family: var(--font-quran); font-size: calc(1.7rem * var(--qscale, 1)); color: var(--navy); margin-bottom: 18px; line-height: 2; }
.mushaf-text {
  --qscale: 1;
  font-family: var(--font-quran); font-size: calc(1.55rem * var(--qscale)); line-height: 2.35; color: var(--ink);
  text-align: justify; text-align-last: center; word-spacing: .04em;
}
@media (min-width: 768px) { .mushaf-text { font-size: calc(1.85rem * var(--qscale)); } }
.ayah {
  cursor: pointer; border-radius: 8px; padding: .05em .1em; transition: background .25s, color .25s;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.ayah:hover { background: rgba(201,154,69,.10); }
.ayah:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 1px; }
.ayah.is-active { background: rgba(201,154,69,.22); color: var(--navy); }
.ayah.is-selected { background: rgba(11,32,56,.09); text-decoration: underline; text-decoration-color: var(--gold-2); text-decoration-thickness: 2px; text-underline-offset: .45em; }
.ayah.is-bookmarked .ayah-num { background: var(--gold-2); color: #fff; border-color: var(--gold-2); }
.ayah.is-flash { animation: flash 2.2s ease; }
@keyframes flash { 0%, 40% { background: rgba(201,154,69,.35); } 100% { background: transparent; } }
.sajda { color: var(--gold); }

.surah-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 880px; margin: 24px auto 0; }
.pager-link {
  display: flex; flex-direction: column; padding: 14px 18px; border-radius: var(--radius); background: var(--paper);
  border: 1.5px solid var(--line); text-decoration: none; transition: border-color .2s;
}
.pager-link:hover { border-color: var(--gold-2); }
.pager-link small { color: var(--muted); font-size: .8rem; }
.pager-link strong { font-family: var(--font-display); font-size: 1.25rem; color: var(--navy); }
.pager-link.next { text-align: end; }

.follow-btn {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + 14px + env(safe-area-inset-bottom)); z-index: 45;
  border: 0; border-radius: 999px; padding: 10px 18px; background: var(--gold-2); color: var(--navy); font-weight: 600; font-size: .88rem;
  box-shadow: var(--shadow-lg);
}

.ayah-sheet {
  position: fixed; inset-inline: 12px; bottom: calc(var(--dock-h) + 12px + env(safe-area-inset-bottom)); z-index: 55;
  max-width: 560px; margin-inline: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px -20px rgba(11,32,56,.5); padding: 12px 14px 14px; animation: sheetIn .2s ease;
}
@keyframes sheetIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sheet-head strong { color: var(--navy); font-size: .95rem; }
.sheet-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sheet-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 0; border-radius: 12px;
  background: var(--ivory); color: var(--navy); font-size: .78rem; font-weight: 600;
}
.sheet-btn:hover { background: var(--sand); }
.sheet-btn.on { color: var(--gold); }
.sheet-btn.on .icon { fill: currentColor; }
body.sheet-open .follow-btn { display: none; }

/* ---------- Library ---------- */
.library { padding-bottom: 40px; }
.library-block { margin-bottom: 32px; }
.library-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.library-head h2 { font-size: 1.2rem; color: var(--navy); }
.library-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.library-list li { display: flex; align-items: center; gap: 6px; padding-inline-end: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.library-item { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 16px; text-decoration: none; }
.library-item strong { color: var(--navy); }
.library-item span { color: var(--muted); font-size: .85rem; }
.library-item .quran-snippet { font-family: var(--font-quran); font-size: 1.1rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 2; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
