/* ==========================================================================
   NUR — lembar gaya
   Tema gelap hangat (bukan hitam pekat) dengan mode terang kertas krem.
   ========================================================================== */

/* ---------- Token ---------- */
:root {
  --gold: #c9a96e;
  --gold-soft: #e0c795;
  --gold-dim: #9b8253;
  --accent: #7fb3a3;

  --ar-font: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  --ui-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ar-scale: 1;
  --ar-leading: 2.3;
  --measure: 58rem;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="dark"] {
  --bg: #0c0b09;
  --bg-2: #131110;
  --bg-3: #1a1715;
  --surface: #16130f;
  --surface-2: #1e1a15;
  --line: rgba(201, 169, 110, .16);
  --line-2: rgba(201, 169, 110, .30);
  --text: #ece3d4;
  --text-2: #b5a892;
  --text-3: #857a68;
  --verse-bg: #131110;
  --verse-hl: rgba(201, 169, 110, .10);
  --arabic: #f6efe2;
  --shadow: 0 14px 40px rgba(0, 0, 0, .5);
}

html[data-theme="light"] {
  --bg: #f7f3ea;
  --bg-2: #fdfbf6;
  --bg-3: #f1eadc;
  --surface: #fffdf8;
  --surface-2: #f6f0e4;
  --line: rgba(120, 96, 50, .18);
  --line-2: rgba(120, 96, 50, .34);
  --text: #2c2417;
  --text-2: #5d5241;
  --text-3: #877b67;
  --verse-bg: #fffdf8;
  --verse-hl: rgba(201, 169, 110, .16);
  --arabic: #241d12;
  --gold: #a8863f;
  --gold-soft: #b89a55;
  --gold-dim: #8a7038;
  --accent: #3f7d6c;
  --shadow: 0 10px 28px rgba(90, 70, 30, .14);
}

/* ---------- Dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 50% -180px, var(--bg-3), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  padding-bottom: 5.5rem;
}

body.preload *, body.preload *::before { transition: none !important; }

img, svg { max-width: 100%; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-soft); }

h1, h2, h3 { font-weight: 600; line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 1rem + .8vw, 1.6rem); }

p { margin: 0 0 1em; }

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1em .38em;
}

.muted { color: var(--text-2); }
.small { font-size: .84rem; }

::selection { background: rgba(201, 169, 110, .3); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--gold); color: #17130c; padding: .6rem 1rem; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 60;
  backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: .6rem clamp(.9rem, 3vw, 2rem);
  display: flex; align-items: center; gap: clamp(.6rem, 2vw, 1.6rem);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); flex: 0 0 auto; }
.brand-mark { color: var(--gold); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 1.06rem; letter-spacing: .22em; font-weight: 700; }
.brand-text em { font-style: normal; font-size: .62rem; letter-spacing: .16em; color: var(--text-3); text-transform: uppercase; }

.main-nav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  color: var(--text-2); padding: .42rem .75rem; border-radius: 999px;
  font-size: .9rem; white-space: nowrap; transition: background .18s var(--ease), color .18s var(--ease);
}
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a.is-active { color: var(--gold); background: var(--verse-hl); }

.header-tools { margin-left: auto; display: flex; gap: .3rem; }

.icon-btn {
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  width: 2.2rem; height: 2.2rem; border-radius: 999px; cursor: pointer;
  display: grid; place-items: center; font-size: .95rem; line-height: 1;
  transition: .18s var(--ease);
}
.icon-btn:hover { color: var(--gold); border-color: var(--line-2); background: var(--surface-2); }
.icon-btn.big { width: 2.7rem; height: 2.7rem; font-size: 1.1rem; color: var(--gold); }
.icon-btn[aria-pressed="true"] { color: #17130c; background: var(--gold); border-color: var(--gold); }

html[data-theme="dark"] .ico-sun,
html[data-theme="light"] .ico-moon { display: none; }

/* ---------- Panel pengaturan ---------- */
.panel {
  position: fixed; top: 3.6rem; right: clamp(.8rem, 3vw, 1.6rem); z-index: 70;
  width: min(23rem, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  max-height: calc(100vh - 5rem); overflow: auto;
  animation: drop .22s var(--ease);
}
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.panel-head h2 { margin: 0; font-size: 1rem; letter-spacing: .02em; }
.panel-body { padding: 1rem 1.1rem 1.3rem; display: grid; gap: 1rem; }
.panel-note {
  margin: 0; font-size: .78rem; color: var(--text-3); line-height: 1.55;
  padding: .6rem .75rem; border: 1px dashed var(--line); border-radius: var(--r-sm);
}

.panel fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: .7rem .85rem .9rem; margin: 0; }
.panel legend { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 0 .4rem; }
.panel input[type="range"] { width: 100%; accent-color: var(--gold); }
.panel output { font-size: .8rem; color: var(--text-2); }
.panel select, .panel input[type="search"] {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: .48rem .6rem; font: inherit; font-size: .9rem;
}
.toggles { display: grid; gap: .5rem; }
.toggles label { display: flex; align-items: center; gap: .55rem; font-size: .9rem; color: var(--text-2); cursor: pointer; }
.toggles input { accent-color: var(--gold); width: 1rem; height: 1rem; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: .52rem 1.15rem; font: inherit; font-size: .92rem; font-weight: 500;
  cursor: pointer; transition: .18s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #17130c; font-weight: 600; }
.btn.primary:hover { background: var(--gold-soft); color: #17130c; }
.btn.ghost { background: transparent; }
.btn.sm { padding: .3rem .7rem; font-size: .8rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Layar ---------- */
main { max-width: 1200px; margin: 0 auto; padding: clamp(1.2rem, 3vw, 2.4rem) clamp(.9rem, 3vw, 2rem) 4rem; }
.screen { animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.page-head { margin-bottom: 1.4rem; }
.page-head h1 { margin-bottom: .3rem; }
.page-head p { margin: 0; max-width: 60ch; }

/* ---------- Beranda ---------- */
.hero {
  position: relative; text-align: center; padding: 2.4rem 1.2rem 2.6rem;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background:
    radial-gradient(58% 120% at 50% -30%, rgba(201, 169, 110, .16), transparent 70%),
    linear-gradient(180deg, var(--surface-2), transparent 85%);
  margin-bottom: 2rem; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(201, 169, 110, .5) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .12;
  mask-image: radial-gradient(70% 70% at 50% 0%, #000, transparent 75%);
}
.bismillah {
  font-family: var(--ar-font); font-size: clamp(1.7rem, 1.1rem + 2.4vw, 2.9rem);
  color: var(--gold); margin: 0 0 1.1rem; line-height: 1.9;
  text-shadow: 0 2px 24px rgba(201, 169, 110, .25);
}
.hero h1 { margin-bottom: .6rem; letter-spacing: -.02em; }
.hero .rule { width: 3.2rem; height: 2px; margin: 0 auto 1rem; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.hero-sub { color: var(--text-2); max-width: 46ch; margin: 0 auto 1.4rem; font-size: 1.02rem; }
.hero-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

.search-inline { display: flex; gap: .5rem; max-width: 34rem; margin: 1.5rem auto 0; }
.search-inline input, .search-box input, .filter-text {
  flex: 1; min-width: 0; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; padding: .62rem 1.05rem; font: inherit; font-size: .95rem;
}
.search-inline input:focus, .search-box input:focus { border-color: var(--gold); outline: none; }

.stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 1.6rem; margin-top: 1.8rem; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 1.35rem; color: var(--gold); font-weight: 600; }
.stats span { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }

.quick { display: flex; justify-content: center; flex-wrap: wrap; gap: .45rem; margin-top: 1.5rem; }
.quick a {
  font-size: .84rem; color: var(--text-2); border: 1px solid var(--line);
  border-radius: 999px; padding: .28rem .8rem; transition: .18s var(--ease);
}
.quick a:hover { color: var(--gold); border-color: var(--line-2); background: var(--verse-hl); }

.list-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.list-head h2 { margin: 0; }
.filters { display: flex; gap: .35rem; }
.chip {
  background: transparent; border: 1px solid var(--line); color: var(--text-2);
  border-radius: 999px; padding: .28rem .85rem; font: inherit; font-size: .84rem; cursor: pointer;
  transition: .18s var(--ease);
}
.chip:hover { color: var(--gold); border-color: var(--line-2); }
.chip.is-active { background: var(--verse-hl); color: var(--gold); border-color: var(--line-2); }
.filter-text { margin-left: auto; max-width: 14rem; border-radius: 999px; padding: .42rem .95rem; font-size: .88rem; }

/* ---------- Kartu surah ---------- */
.surah-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); }
.surah-card {
  position: relative; display: flex; align-items: center; gap: .9rem;
  background: linear-gradient(140deg, var(--surface-2), var(--verse-bg) 60%);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: .85rem 1rem; color: var(--text);
  overflow: hidden; transition: .22s var(--ease);
}
.surah-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--gold), transparent);
  opacity: 0; transition: opacity .22s var(--ease);
}
.surah-card:hover, .surah-card:focus-visible {
  border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow);
}
.surah-card:hover::before { opacity: 1; }
.surah-no {
  flex: 0 0 auto; width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  font-size: .82rem; color: var(--gold); border: 1px solid var(--line-2);
  border-radius: 50%; position: relative;
}
.surah-no::after {
  content: ""; position: absolute; inset: 3px; border: 1px solid var(--line);
  border-radius: 50%; opacity: .6;
}
.surah-meta { flex: 1 1 auto; min-width: 0; }
.surah-meta b { display: block; font-size: 1rem; font-weight: 600; }
.surah-meta span { font-size: .78rem; color: var(--text-3); }
.surah-ar {
  font-family: var(--ar-font); font-size: 1.28rem; color: var(--gold-dim);
  direction: rtl; flex: 0 0 auto;
}
.surah-card .mark-read { color: var(--accent); font-size: .74rem; }

/* ---------- Juz ---------- */
.juz-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.juz-card {
  background: linear-gradient(140deg, var(--surface-2), var(--verse-bg) 65%);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.1rem;
  transition: .22s var(--ease);
}
.juz-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.juz-card b { color: var(--gold); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.juz-card p { margin: .4rem 0 .7rem; font-size: .9rem; color: var(--text-2); }
.juz-links { display: flex; flex-wrap: wrap; gap: .35rem; }
.juz-links a {
  font-size: .82rem; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .72rem;
  color: var(--text-2); transition: .18s var(--ease);
}
.juz-links a:hover { color: var(--gold); border-color: var(--line-2); background: var(--verse-hl); }

/* ---------- Pencarian ---------- */
.search-box { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .7rem; }
.search-box input { border-radius: var(--r-md); }
.search-box select {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: .58rem .8rem; font: inherit; font-size: .9rem;
}
#search-source { margin-bottom: 1rem; }
.result {
  position: relative; overflow: hidden;
  background: linear-gradient(140deg, var(--surface-2), var(--verse-bg) 70%);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1rem 1.15rem; margin-bottom: .75rem;
  transition: .2s var(--ease);
}
.result::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--gold), transparent);
}
.result:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.result h3 { margin: 0 0 .5rem; font-size: .9rem; color: var(--gold); font-weight: 600; }
.result .res-ar { font-family: var(--ar-font); direction: rtl; text-align: right; font-size: calc(1.32rem * var(--ar-scale)); color: var(--arabic); line-height: 2.1; margin: 0 0 .5rem; }
.result .res-id { margin: 0; color: var(--text-2); font-size: .94rem; }
mark { background: rgba(201, 169, 110, .3); color: inherit; border-radius: 3px; padding: 0 .12em; font-weight: 500; }
.hit { border-color: var(--gold); box-shadow: 0 0 0 2px var(--verse-hl); }

/* ---------- Bookmark ---------- */
.bm-row {
  display: flex; align-items: flex-start; gap: .8rem;
  background: var(--verse-bg); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: .85rem 1rem; margin-bottom: .6rem;
}
.bm-row .bm-body { flex: 1; min-width: 0; }
.bm-row .bm-body a { font-size: .86rem; }
.bm-row .bm-ar { font-family: var(--ar-font); direction: rtl; text-align: right; font-size: calc(1.2rem * var(--ar-scale)); color: var(--arabic); margin: 0; }
.bm-note { font-size: .84rem; color: var(--text-2); font-style: italic; margin: .3rem 0 0; }

/* ---------- Halaman surah ---------- */
.surah-hero {
  position: relative; text-align: center; padding: 1.7rem 1rem 1.9rem; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background:
    radial-gradient(60% 130% at 50% -40%, rgba(201, 169, 110, .18), transparent 70%),
    linear-gradient(180deg, var(--surface-2), transparent 88%);
  margin-bottom: 1.3rem;
}
.surah-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(201, 169, 110, .45) 1px, transparent 1px);
  background-size: 24px 24px; opacity: .12;
  mask-image: radial-gradient(65% 65% at 50% 0%, #000, transparent 78%);
}
.surah-hero .ar-name { font-family: var(--ar-font); font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3.1rem); color: var(--gold); line-height: 1.7; margin: 0; text-shadow: 0 2px 22px rgba(201, 169, 110, .25); }
.surah-hero .rule { width: 3rem; height: 2px; margin: .6rem auto .7rem; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.surah-hero .lat { margin: .2rem 0 .25rem; font-size: 1.1rem; font-weight: 600; }
.surah-hero .facts { color: var(--text-3); font-size: .84rem; }
.surah-hero .bism { font-family: var(--ar-font); font-size: clamp(1.3rem, 1rem + 1.4vw, 1.9rem); color: var(--gold-soft); margin: 1.1rem 0 0; line-height: 2; }

.surah-tools {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .75rem 0; border-bottom: 1px solid var(--line); margin-bottom: 1.3rem;
  position: sticky; top: 3.3rem; z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
}
.surah-tools .grow { flex: 1; }
.surah-tools label { display: flex; align-items: center; gap: .35rem; font-size: .84rem; color: var(--text-2); }

.verse {
  position: relative; overflow: hidden;
  background: var(--verse-bg); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1rem 1.15rem 1.15rem; margin-bottom: .7rem;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
  scroll-margin-top: 7rem;
}
.verse::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--gold), transparent 80%);
  opacity: 0; transition: opacity .2s var(--ease);
}
.verse:hover { border-color: var(--line-2); }
.verse:hover::before { opacity: .5; }
.verse:target, .verse.hit { border-color: var(--gold); background: var(--verse-hl); box-shadow: 0 0 0 1px var(--line-2); }
.verse:target::before, .verse.hit::before { opacity: 1; }
.verse-actions {
  display: flex; align-items: center; gap: .3rem; flex-wrap: wrap;
  padding-bottom: .5rem; margin-bottom: .6rem; border-bottom: 1px dashed var(--line);
}
.verse-no {
  display: inline-grid; place-items: center; min-width: 1.75rem; height: 1.75rem; padding: 0 .4rem;
  background: var(--verse-hl); color: var(--gold); border: 1px solid var(--line-2);
  border-radius: 999px; font-size: .76rem; font-weight: 600;
}
.verse-actions .sp { flex: 1; }

/* Bila tajwid dimatikan, teks Arab tampil sebagai teks biasa yang bersih. */
body.no-tajweed .verse .ar, body.no-tajweed .focus-body .ar { color: var(--arabic); }

.ar {
  font-family: var(--ar-font);
  font-size: calc(1.6rem * var(--ar-scale));
  line-height: var(--ar-leading);
  direction: rtl; text-align: right;
  color: var(--arabic);
  margin: 0 0 .85rem;
  word-spacing: .06em;
}
.ar .end-mark {
  font-size: .6em; color: #e8c88a; vertical-align: middle;
  background: rgba(201, 169, 110, .12);
  border: 1px solid rgba(201, 169, 110, .45); border-radius: 50%;
  display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; margin: 0 .35em;
  font-family: var(--ui-font); font-weight: 600; line-height: 1;
}

/* ---------- Tanda baca Al-Qur'an: diberi warna tegas agar mudah dikenali ---------- */
.ar .waqf, .focus-body .ar .waqf, .mushaf .ar .waqf {
  color: #ff9d6b;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 157, 107, .28);
  font-size: 1.06em;
  margin: 0 .06em;
}
.ar .waqf.waqf-stop { color: #ff7d6b; }
.ar .waqf.waqf-rub { color: #e8c88a; font-size: 1.12em; }
.ar .waqf.waqf-sujud { color: #7fd6a8; }

/* Legenda tanda baca */
.waqf-legend { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; font-size: .78rem; color: var(--text-2); direction: ltr; }
.waqf-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.waqf-legend .mark { font-family: var(--ar-font); font-size: 1.5rem; line-height: 1; }
.waqf-legend .m-waqf { color: #ff9d6b; }
.waqf-legend .m-rub { color: #e8c88a; }
.waqf-legend .m-sujud { color: #7fd6a8; }
.waqf-legend .m-end { color: var(--gold); }
html[data-theme="light"] .ar .waqf, html[data-theme="light"] .focus-body .ar .waqf {
  color: #b8560f; text-shadow: none;
}
html[data-theme="light"] .ar .end-mark { color: #8a6a24; background: rgba(168, 134, 63, .1); border-color: rgba(168, 134, 63, .45); }

/* Pewarnaan tajwid */
tajweed { color: inherit; }
body.no-tajweed .ar tajweed, body.no-tajweed .verse .ar tajweed { color: inherit !important; font-weight: inherit; }
body.no-ayahnum .end-mark { display: none; }
tajweed.ham_wasl, tajweed.laam_shamsiyah { color: #9aa7b5; }
tajweed.madda_normal { color: #e07b6a; }
tajweed.madda_permissible { color: #ef9f6d; }
tajweed.madda_necessary { color: #d9534f; font-weight: 500; }
tajweed.madda_obligatory { color: #c9484a; }
tajweed.ghunnah { color: #63b37a; }
tajweed.qalqalah { color: #5fa8d3; }
tajweed.ikhafa, tajweed.ikhafa_shafawi { color: #a98fd0; }
tajweed.idgham, tajweed.idgham_shafawi, tajweed.idgham_mutajanisayn, tajweed.idgham_mutaqaribayn { color: #d9a441; }
tajweed.iqlab { color: #4fb3a5; }
tajweed.silent { color: var(--text-3); opacity: .55; }
html[data-theme="light"] tajweed.ham_wasl, html[data-theme="light"] tajweed.laam_shamsiyah { color: #7d8794; }

.translit { margin: 0 0 .6rem; font-size: .92rem; color: var(--text-2); font-style: italic; }
.trans-id { margin: 0; font-size: 1.02rem; }
.trans-extra {
  margin-top: .7rem; padding-top: .6rem; border-top: 1px dashed var(--line);
  font-size: .92rem; color: var(--text-2);
}
.trans-extra b { color: var(--text-3); font-weight: 500; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: .2rem; }

.wbw-cap { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: .1rem 0 .35rem; direction: ltr; }
.wbw { display: flex; flex-wrap: wrap; gap: .4rem; direction: rtl; margin: .3rem 0 .8rem; }
.wbw .w {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: .3rem .55rem;
  background: var(--surface); text-align: center; min-width: 4.6rem; max-width: 11rem;
}
.wbw .w .wa { font-family: var(--ar-font); font-size: calc(1.1rem * var(--ar-scale)); line-height: 1.6; display: block; color: var(--arabic); }
.wbw .w .wt { font-size: .72rem; color: var(--text-3); display: block; direction: ltr; }

.tajweed-legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; font-size: .78rem; color: var(--text-2); margin: 0 0 1rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.tajweed-legend i { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; background: currentColor; }
.tajweed-legend .sw-ham_wasl { background: #9aa7b5; }
.tajweed-legend .sw-madda_normal { background: #e07b6a; }
.tajweed-legend .sw-madda_permissible { background: #ef9f6d; }
.tajweed-legend .sw-ghunnah { background: #63b37a; }
.tajweed-legend .sw-qalqalah { background: #5fa8d3; }
.tajweed-legend .sw-ikhafa { background: #a98fd0; }
.tajweed-legend .sw-idgham { background: #d9a441; }
.tajweed-legend .sw-iqlab { background: #4fb3a5; }
html[data-theme="light"] .tajweed-legend .sw-ham_wasl { background: #7d8794; }

/* Mode mushaf: ayat mengalir dalam satu kolom */
.mushaf-note { text-align: center; color: var(--text-3); font-size: .8rem; margin-bottom: 1rem; }
.mushaf .verse { background: transparent; border: none; border-radius: 0; padding: .3rem 0; margin: 0; }
.mushaf .verse-actions { opacity: 0; transition: opacity .2s var(--ease); border: none; margin: 0; padding: 0; }
.mushaf .verse:hover .verse-actions, .mushaf .verse:focus-within .verse-actions { opacity: 1; }
.mushaf .translit, .mushaf .trans-id, .mushaf .trans-extra { display: none; }
.mushaf .ar { margin: 0; text-align: justify; text-align-last: center; }
.mushaf .verse.hit { background: var(--verse-hl); }
.mushaf .verse.hit .trans-id, .mushaf .verse.hit .translit { display: block; text-align: right; }

/* Mode fokus satu ayat */
.focus-overlay {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: grid; grid-template-rows: auto 1fr auto; padding: 1rem clamp(.9rem, 4vw, 3rem);
  animation: fade .25s var(--ease);
}
.focus-head { display: flex; align-items: center; gap: .7rem; justify-content: space-between; }
.focus-body { display: grid; place-content: center; align-content: center; gap: 1.2rem; text-align: center; max-width: 62rem; margin: 0 auto; overflow: auto; }
.focus-body .ar { font-size: calc(2.3rem * var(--ar-scale)); line-height: 1.95; margin: 0; }
.focus-body .trans-id { font-size: 1.15rem; color: var(--text-2); }
.focus-body .translit { font-size: 1rem; }

/* ---------- Terakhir dibaca ---------- */
.last-card { background: var(--verse-bg); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 1.4rem; text-align: center; }
.last-card .ar { font-size: calc(1.5rem * var(--ar-scale)); margin-bottom: 1rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-2); }
.empty b { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: .4rem; }

/* ---------- Prosa (Tentang) ---------- */
.prose { background: var(--verse-bg); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem 1.5rem; max-width: 72ch; }
.prose h2 { font-size: 1.05rem; color: var(--gold); margin-top: 1.4rem; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2rem; color: var(--text-2); }
.prose li { margin-bottom: .45rem; }

/* ---------- Pemutar audio ---------- */
.player {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 80;
  width: min(60rem, 100%); background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line-2); border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise .25s var(--ease);
}
@keyframes rise { from { transform: translateX(-50%) translateY(100%); } }
.player-inner { display: flex; align-items: center; gap: 1rem; padding: .6rem clamp(.8rem, 3vw, 1.2rem); }
.now { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.now-dot {
  width: .6rem; height: .6rem; border-radius: 50%; background: var(--gold); flex: 0 0 auto;
  box-shadow: 0 0 0 0 rgba(201, 169, 110, .7); animation: pulse 1.8s infinite;
}
.player.is-paused .now-dot { animation: none; opacity: .45; }
@keyframes pulse { 70% { box-shadow: 0 0 0 .6rem rgba(201, 169, 110, 0); } }
.now-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.now-text strong { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.loop-box { display: flex; align-items: center; gap: .3rem; color: var(--text-2); cursor: pointer; }
.loop-box input { accent-color: var(--gold); }
.player-progress { height: 3px; background: var(--line); border-radius: 0 0 0 0; overflow: hidden; }
#pv-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .2s linear; }
.player select.qari-inline { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .3rem .5rem; font-size: .8rem; max-width: 9rem; }

/* ---------- Toast & tombol ke atas ---------- */
.toast {
  position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); z-index: 120;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 999px; padding: .5rem 1.1rem; font-size: .88rem; box-shadow: var(--shadow);
  animation: fade .2s var(--ease);
}
.to-top {
  position: fixed; right: 1rem; bottom: 5.4rem; z-index: 70;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--surface); color: var(--gold); border: 1px solid var(--line-2);
  cursor: pointer; box-shadow: var(--shadow); font-size: 1.05rem;
}
.to-top:hover { background: var(--surface-2); }

/* ---------- Kerangka memuat ---------- */
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-verse { height: 7rem; border-radius: var(--r-md); margin-bottom: .7rem; }
.skel-line { height: 1rem; margin-bottom: .6rem; }

.spinner {
  width: 1.5rem; height: 1.5rem; margin: 2rem auto; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--gold); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Penyempurnaan akhir ---------- */
/* Bilah gulir tipis agar tidak memotong suasana baca */
html { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); background-clip: content-box; }

/* Nomor ayat pada kepala kartu */
.verse-no {
  background: linear-gradient(140deg, var(--verse-hl), transparent);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* Tombol kecil pada kartu ayat */
.verse-actions .btn.sm { border-color: transparent; background: transparent; color: var(--text-3); }
.verse-actions .btn.sm:hover { background: var(--surface-2); border-color: var(--line); color: var(--gold); }
.verse-actions .btn.sm[aria-pressed="true"] { color: var(--gold); background: var(--verse-hl); border-color: var(--line-2); }

/* Keadaan kosong */
.empty { border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--surface); }
.empty b { font-size: 1.15rem; }
.empty .btn { margin-top: .8rem; }

/* Peringatan mode file:// */
.notice {
  max-width: 1200px; margin: 1rem auto 0; padding: .85rem 1.05rem;
  border: 1px solid var(--line-2); border-left: 3px solid #e2a33f;
  border-radius: var(--r-md); background: var(--surface);
  font-size: .88rem; line-height: 1.6; color: var(--text-2);
}
.notice b { color: var(--text); }

/* Pemutar murottal */
.player { border-color: var(--line-2); }
.player::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.player-controls .icon-btn:hover { transform: translateY(-1px); }
.player-controls .icon-btn.big {
  background: linear-gradient(140deg, var(--gold), var(--gold-dim));
  border-color: transparent; color: #17130c; box-shadow: 0 6px 18px rgba(201, 169, 110, .28);
}
.player-controls .icon-btn.big:hover { color: #17130c; filter: brightness(1.06); }
#pv-bar { background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-soft)); }

/* Notifikasi & tombol ke atas */
.toast { border-color: var(--line-2); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.to-top:hover { transform: translateY(-2px); color: var(--gold-soft); }

/* Panel pengaturan */
.panel { backdrop-filter: blur(14px); }
.panel fieldset:focus-within { border-color: var(--line-2); }

/* Mode fokus: bingkai halus agar terasa seperti ruang tersendiri */
.focus-overlay { background: radial-gradient(80% 60% at 50% 0%, var(--bg-3), var(--bg) 70%); }
.focus-body .ar { text-shadow: 0 2px 26px rgba(201, 169, 110, .14); }

/* ---------- Responsif ---------- */
@media (max-width: 780px) {
  .brand-text em { display: none; }
  .header-inner { gap: .4rem; }
  .main-nav a { padding: .38rem .58rem; font-size: .85rem; }
  .filter-text { margin-left: 0; max-width: none; width: 100%; }
  .surah-tools { top: 3rem; }
  .now-text strong { font-size: .82rem; }
  .focus-body .ar { font-size: calc(1.7rem * var(--ar-scale)); }
}
@media (max-width: 520px) {
  .surah-card { padding: .7rem .8rem; }
  .surah-ar { font-size: 1.1rem; }
  .stats { gap: 1rem; }
  .ar { font-size: calc(1.42rem * var(--ar-scale)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .app-header, .player, .surah-tools, .to-top, .panel, .verse-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .ar { color: #000; }
  .ar .waqf { color: #000; text-shadow: none; }
  .ar .end-mark { color: #333; background: transparent; border-color: #999; }
  .verse { break-inside: avoid; border-color: #ccc; }
  .tajweed-legend { break-inside: avoid; }
}
