@font-face {
  font-family: 'IndoPak Nastaleeq';
  src: url('../fonts/IndoPakNastaleeq.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'SolaimanLipi';
  src: url('../fonts/SolaimanLipi.ttf') format('truetype');
  font-display: swap;
}

:root {
  --green: #0F3D2E;
  --green-2: #0B2F23;
  --primary: #0F5132;
  --gold: #D9B45A;
  --gold-text: #8A5E0F;
  --bg: #FAF7F0;
  --card: #FFFFFF;
  --ink: #1B2421;
  --muted: #4F5A55;
  --line: #E6E0D2;
  --soft: #F1ECDF;
  --active: #FBF3DC;
  --arabic: #0F2A20;
  --mark: #F6E2A6;
  --ar-size: 34px;
  --font-bn: 'SolaimanLipi', 'Noto Sans Bengali', sans-serif;
  --font-ar: 'IndoPak Nastaleeq', 'Amiri Quran', 'me_quran', 'Scheherazade New', serif;
  --font-en: 'Source Serif 4', Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E1714;
  --card: #15211C;
  --ink: #ECE6D8;
  --muted: #A9B3AD;
  --line: #2A3A33;
  --soft: #1D2C25;
  --active: #2B2A18;
  --arabic: #F1E3B8;
  --gold-text: #E2BF6A;
  --primary: #1F7A52;
  --mark: #6B5418;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1714; --card: #15211C; --ink: #ECE6D8; --muted: #A9B3AD; --line: #2A3A33;
    --soft: #1D2C25; --active: #2B2A18; --arabic: #F1E3B8; --gold-text: #E2BF6A; --primary: #1F7A52; --mark: #6B5418;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-bn); font-size: 17px; line-height: 1.6; }
a { color: var(--primary); }
:root[data-theme="dark"] a { color: #8FD3B0; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }
.narrow { max-width: 900px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: #fff; color: #000; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ar { font-family: var(--font-ar); font-weight: 400; }
mark { background: var(--mark); color: inherit; padding: 0 3px; border-radius: 4px; }
.eyebrow { font-size: 14px; font-weight: 700; color: var(--gold-text); letter-spacing: .02em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; text-decoration: none; cursor: pointer; font-size: 16px; line-height: 1.2; background: transparent; }
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--line); background: var(--card); color: var(--ink) !important; }
.btn-ghost:hover { border-color: var(--muted); }
.btn-gold { background: var(--gold); color: #1B2421 !important; font-weight: 700; }
.btn-gold-outline { border-color: var(--gold); color: #E8CB7E !important; font-weight: 600; min-height: 52px; }
.btn-light-outline { border-color: rgba(245,239,224,.35); color: #F5EFE0 !important; min-height: 52px; }
.btn-light-outline:hover { background: rgba(255,255,255,.08); }
.btn.big { min-height: 56px; padding: 0 28px; font-size: 18px; border-radius: 14px; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 0; background: rgba(255,255,255,.08); color: #F5EFE0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* ---------- header / footer ---------- */
.site-header { background: var(--green); color: #F5EFE0; }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #F5EFE0 !important; text-decoration: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 20px; }
.brand small { font-size: 13px; color: #CFC6B0; }
.main-nav { display: flex; flex-wrap: wrap; gap: 2px; order: 3; width: 100%; }
@media (min-width: 900px) { .main-nav { order: 0; width: auto; } }
.main-nav a { color: #F5EFE0 !important; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-size: 16px; }
.main-nav a:hover, .main-nav a[aria-current] { background: rgba(255,255,255,.10); }
.main-nav a.nav-random { background: var(--gold); color: #1B2421 !important; font-weight: 700; }
.site-footer { background: var(--green); color: #D8D0BC; margin-top: 56px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-top: 28px; padding-bottom: 28px; font-size: 15px; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-row a { color: #F5EFE0 !important; }

/* ---------- home ---------- */
.hero { background: var(--green); color: #F5EFE0; padding: 32px 0 80px; }
.hero-inner { max-width: 880px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.hero-ar { font-size: clamp(40px, 8vw, 58px); line-height: 1.6; color: #E8CB7E; }
.hero h1 { font-size: clamp(24px, 4.5vw, 36px); }
.hero-sub { color: #D8D0BC; font-size: 18px; max-width: 640px; }
.hero-search { width: 100%; margin-top: 6px; }
.search-box { display: flex; align-items: center; gap: 6px; background: #fff; color: #1B2421; border-radius: 14px; padding: 6px 6px 6px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.search-box svg { flex: none; color: #5B6660; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 18px; padding: 12px 6px; color: #1B2421; }
.home-body { margin-top: -44px; display: flex; flex-direction: column; gap: 32px; }
.cards-row { display: flex; flex-wrap: wrap; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; text-decoration: none; color: var(--ink) !important; box-shadow: 0 4px 16px rgba(15,61,46,.06); }
.card:hover { border-color: var(--gold); }
.continue-card { flex: 1 1 300px; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-size: 22px; font-weight: 700; }
.daily-card { flex: 2 1 460px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.daily-ar { font-size: 30px; line-height: 2; color: var(--arabic); }
.daily-bn { font-size: 18px; line-height: 1.7; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stats div { background: var(--soft); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; }
.stats b { font-size: 28px; color: var(--primary); }
:root[data-theme="dark"] .stats b { color: #8FD3B0; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 26px; }
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter label { font-size: 15px; color: var(--muted); }
.filter input, .search-row input, select { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 44px; background: var(--card); }
.filter input { width: 200px; }
.surah-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.surah-grid a { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 64px; text-decoration: none; color: var(--ink) !important; }
.surah-grid a:hover { border-color: var(--gold); }
.num { flex: none; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--soft); color: var(--primary); font-weight: 700; }
:root[data-theme="dark"] .num { color: #8FD3B0; }
.sname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sname b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
.sname small { font-size: 14px; color: var(--muted); }
.sar { flex: none; font-size: 22px; color: var(--arabic); }

/* ---------- reader ---------- */
.page-banner { background: var(--soft); border-bottom: 1px solid var(--line); }
.banner-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 28px; padding-bottom: 28px; }
.banner-row h1 { font-size: clamp(26px, 5vw, 34px); }
.banner-ar { font-size: clamp(34px, 6vw, 48px); color: var(--gold-text); line-height: 1.5; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted) !important; }
.reader { max-width: 1000px; display: flex; flex-direction: column; gap: 18px; padding-top: 22px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; }
.player { flex: 2 1 420px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.player-btns { display: flex; align-items: center; gap: 8px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.round.big { width: 54px; height: 54px; border: 0; background: var(--primary); color: #fff; }
.i-pause { display: none; }
.player.playing .i-play { display: none; }
.player.playing .i-pause { display: block; }
.player-info { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: 15px; }
.bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar span { display: block; height: 6px; width: 0; background: var(--gold); transition: width .3s; }
.mode { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.mode select { font-size: 15px; color: var(--ink); }
.settings { flex: 1 1 280px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.size { display: flex; align-items: center; gap: 6px; }
.size span { min-width: 44px; text-align: center; font-size: 14px; color: var(--muted); }
.sq { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.chk { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--primary); }
.bismillah { text-align: center; font-size: calc(var(--ar-size) * 0.95); color: var(--gold-text); line-height: 2; }
.ayah-list { display: flex; flex-direction: column; gap: 14px; }
.juz-surah { font-size: 22px; padding: 18px 0 4px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.juz-surah .ar { color: var(--gold-text); font-size: 28px; }
.ayah { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 140px; transition: background .2s, border-color .2s; }
@media (min-width: 640px) { .ayah { padding: 24px; } }
.ayah.is-playing { background: var(--active); border-color: var(--gold); }
.ayah-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.ref-chip { font-weight: 700; color: var(--gold-text) !important; text-decoration: none; padding: 6px 12px; border-radius: 8px; background: var(--soft); }
.ayah-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tool { min-width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0 10px; }
.tool:hover { border-color: var(--muted); }
.tool[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1B2421; }
.tool-text { font-size: 15px; background: var(--soft); }
.ayah-ar { font-size: var(--ar-size); line-height: 2.4; color: var(--arabic); text-align: right; }
.ayah-ar.big { font-size: calc(var(--ar-size) * 1.05); }
.tr-bn { font-size: 19px; line-height: 1.75; }
.tr-en { font-family: var(--font-en); font-size: 17px; line-height: 1.7; color: var(--muted); }
:root[data-hide~="bn"] .ayah [data-tr="bn"], :root[data-hide~="en"] .ayah [data-tr="en"] { display: none; }
.words { display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.word { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 14px; border-radius: 10px; background: var(--soft); min-width: 70px; }
.word .ar { font-size: 24px; line-height: 1.8; color: var(--arabic); }
.word span:last-child { font-size: 14px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; }
.pager.top { padding: 0; }

/* ---------- single ayah ---------- */
.ayah-page { display: flex; flex-direction: column; gap: 20px; padding-top: 28px; }
.ayah-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.url-chip { font-size: 14px; color: var(--muted); background: var(--soft); padding: 6px 12px; border-radius: 8px; }
.ayah.single { padding: 28px; gap: 20px; border-radius: 20px; }
.single-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.single-head h1 { font-size: 24px; }
.single-sname { font-size: 30px; color: var(--gold-text); }
.tr-block { display: flex; flex-direction: column; gap: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); padding-top: 18px; }
.tafsir { padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.tafsir-text { line-height: 1.8; }

/* ---------- random ---------- */
.random-page { background: var(--green); color: #F5EFE0; margin-bottom: -56px; padding: 36px 0 72px; }
.random-page a:not(.btn) { color: #E8CB7E; }
.random-inner { display: flex; flex-direction: column; gap: 24px; max-width: 980px; }
.random-head { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.random-head .ar { font-size: 30px; color: #E8CB7E; }
.random-head h1 { font-size: clamp(26px, 5vw, 34px); }
.random-head p { color: #CFC6B0; }
.scopes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; font-size: 15px; background: var(--card); }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.scopes .pill { background: transparent; border-color: rgba(245,239,224,.35); color: #F5EFE0; }
.scopes .pill.on { background: #F5EFE0; border-color: #F5EFE0; color: var(--green); }
.surah-pick select { background: #F5EFE0; color: #1B2421; }
.verse-card { background: #FBF7EC; color: #1B2421; border-radius: 24px; padding: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.35); transition: opacity .2s; }
.verse-card.loading { opacity: .5; }
.verse-frame { border: 2px solid var(--gold); border-radius: 16px; padding: clamp(22px, 5vw, 44px); display: flex; flex-direction: column; gap: 22px; outline: 1px solid #E7D7A8; outline-offset: -9px; }
.verse-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.verse-ref { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--green) !important; font-size: 18px; font-weight: 700; }
.ref-badge { min-width: 56px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--green); color: #F5EFE0; display: inline-flex; align-items: center; justify-content: center; }
.verse-top .muted { color: #5B5A4F; font-size: 14px; }
.verse-ar { font-size: clamp(28px, 5vw, 40px); line-height: 2.1; text-align: center; color: #0F2A20; }
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.verse-bn { font-size: clamp(18px, 3vw, 21px); line-height: 1.75; text-align: center; }
.verse-en { font-family: var(--font-en); font-style: italic; font-size: 17px; line-height: 1.7; text-align: center; color: #4A4A40; }
.verse-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chk.light { color: #CFC6B0; justify-content: center; align-self: center; }
.chk.light input { accent-color: var(--gold); }
.history h2, .daily-box h2 { font-size: 18px; }
.history { display: flex; flex-direction: column; gap: 10px; }
.history-list { display: flex; flex-wrap: wrap; gap: 8px; }
.history-list button { min-height: 40px; padding: 6px 14px; border-radius: 10px; border: 1px solid rgba(245,239,224,.25); background: rgba(255,255,255,.06); color: #F5EFE0; cursor: pointer; }
.daily-box { background: rgba(255,255,255,.06); border: 1px solid rgba(245,239,224,.18); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 10px; color: #CFC6B0; }
.daily-box h2 { color: #F5EFE0; }
.daily-box code { background: var(--green-2); padding: 10px 12px; border-radius: 10px; color: #E8CB7E; overflow-wrap: anywhere; }

/* ---------- search ---------- */
.search-top { background: var(--soft); border-bottom: 1px solid var(--line); }
.search-form { max-width: 1000px; padding-top: 24px; padding-bottom: 24px; display: flex; flex-direction: column; gap: 12px; }
.lbl { font-weight: 700; color: var(--muted); }
.search-row { display: flex; flex-wrap: wrap; gap: 10px; }
.search-row input { flex: 1 1 280px; min-width: 0; font-size: 18px; min-height: 52px; }
.search-row .btn { min-height: 52px; padding: 0 28px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sel { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; }
.search-body { max-width: 1000px; display: flex; flex-direction: column; gap: 14px; padding-top: 24px; }
.result-count { font-size: 18px; color: var(--muted); font-weight: 600; }
.result { display: flex; flex-direction: column; gap: 10px; }
.result-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 15px; }
.result-head b { color: var(--gold-text); }
.result-ar { font-size: 28px; line-height: 1.9; color: var(--arabic); text-align: right; }
.result-bn { font-size: 18px; line-height: 1.7; }
.result-en { font-family: var(--font-en); color: var(--muted); }
.tips ul { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- misc ---------- */
.prose { padding-top: 40px; display: flex; flex-direction: column; gap: 14px; }
.prose h1 { font-size: 30px; }
.prose h2 { font-size: 22px; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1B2421; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.share-dialog { border: 0; border-radius: 18px; padding: 0; max-width: min(560px, 94vw); background: var(--card); color: var(--ink); }
.share-dialog::backdrop { background: rgba(0,0,0,.6); }
.share-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.share-body canvas { width: 100%; height: auto; border-radius: 12px; background: var(--soft); }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
@media (max-width: 520px) {
  .toolbar { position: static; }
  .stats b { font-size: 22px; }
  .filter input { width: 100%; }
  .filter { width: 100%; }
}
@media print {
  .site-header, .site-footer, .toolbar, .ayah-tools, .actions, .pager { display: none !important; }
  .ayah { break-inside: avoid; border: 0; }
}