:root {
  --bg: #f3efe3;
  --bg-2: #ece5d3;
  --card: #fffdf8;
  --card-2: #fbf7ec;
  --ink: #1b2b21;
  --ink-soft: #5f6f5a;
  --line: #e4dcc6;
  --accent: #0d6b4d;
  --accent-2: #109c6e;
  --gold: #b3862a;
  --gold-2: #e0b653;
  --glass: rgba(255, 253, 248, 0.72);
  --shadow-sm: 0 2px 10px rgba(28, 43, 33, 0.06);
  --shadow: 0 10px 34px rgba(28, 43, 33, 0.10);
  --shadow-lg: 0 24px 60px rgba(28, 43, 33, 0.16);
  --radius: 18px;
  --radius-lg: 26px;
  --arabic: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  --urdu: "Noto Nastaliq Urdu", "Amiri", serif;
  --display: "Reem Kufi", "Cormorant Garamond", serif;
  --serif: "Cormorant Garamond", Georgia, serif;
}
:root[data-theme="dark"] {
  --bg: #0a1310;
  --bg-2: #0d1a15;
  --card: #12211a;
  --card-2: #16281f;
  --ink: #e9efe3;
  --ink-soft: #9fb29a;
  --line: #223328;
  --accent: #2bb583;
  --accent-2: #46d29b;
  --gold: #dcb658;
  --gold-2: #f0d182;
  --glass: rgba(14, 26, 21, 0.68);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 26px 64px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.container { width: min(1120px, 92vw); margin: 0 auto; }
a { color: var(--accent); text-decoration: none; }
::selection { background: color-mix(in srgb, var(--gold) 40%, transparent); }

/* ---------- Decorative background ---------- */
.bg-decor {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 15% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    radial-gradient(50% 40% at 100% 15%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 70%),
    var(--bg);
}
.bg-decor::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='104' viewBox='0 0 60 104' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%230d6b4d' stroke-opacity='0.10' stroke-width='1.2'%3E%3Cpath d='M30 0 L60 17.3 L60 52 L30 69.3 L0 52 L0 17.3 Z'/%3E%3Cpath d='M30 34.6 L60 52 L60 86.6 L30 104 L0 86.6 L0 52 Z'/%3E%3C/g%3E%3C/svg%3E");
}
:root[data-theme="dark"] .bg-decor::before { opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='104' viewBox='0 0 60 104' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2346d29b' stroke-opacity='0.12' stroke-width='1.2'%3E%3Cpath d='M30 0 L60 17.3 L60 52 L30 69.3 L0 52 L0 17.3 Z'/%3E%3Cpath d='M30 34.6 L60 52 L60 86.6 L30 104 L0 86.6 L0 52 Z'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .3s, background .3s;
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; gap: 18px; height: 68px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 700; font-size: 1.18rem; line-height: 1.1; color: var(--ink); letter-spacing: .2px; }
.brand-mark {
  font-size: 1.5rem; line-height: 1;
  filter: drop-shadow(0 2px 7px color-mix(in srgb, var(--gold) 55%, transparent));
  animation: swordPulse 3.2s ease-in-out infinite;
}
@keyframes swordPulse { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.08); } }
.brand-text { display: flex; flex-direction: column; }
.brand-text small { display: block; font-family: var(--serif); font-size: .68rem; color: var(--gold); font-weight: 600; letter-spacing: 1px; font-style: italic; }
.main-nav { display: flex; gap: 4px; margin-left: auto; }
.main-nav a {
  position: relative; padding: 9px 18px; border-radius: 999px; color: var(--ink-soft);
  font-weight: 600; font-size: .95rem; transition: .22s;
}
.main-nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.main-nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.icon-btn {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid var(--line); border-radius: 50%;
  width: 42px; height: 42px; font-size: 1.1rem; cursor: pointer; color: var(--ink);
  display: grid; place-items: center; transition: .2s;
}
.icon-btn:hover { transform: translateY(-2px) rotate(-8deg); border-color: var(--accent); }
.nav-toggle { display: none; }

/* ---------- Generic ---------- */
main { padding: 34px 0 70px; min-height: 72vh; }
.page-head { margin-bottom: 26px; }
.page-title {
  font-family: var(--display); font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0 0 4px;
  letter-spacing: .3px; line-height: 1.15;
}
.page-title .accent {
  background: linear-gradient(120deg, var(--accent), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-sub { color: var(--ink-soft); margin: 0; font-family: var(--serif); font-size: 1.15rem; font-style: italic; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none;
  padding: 12px 22px; border-radius: 999px; font-weight: 700; cursor: pointer; font-size: .95rem;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 34%, transparent);
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 44%, transparent); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: var(--card); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.search-wrap { position: relative; margin-bottom: 22px; }
.search-wrap::before {
  content: "⌕"; position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  font-size: 1.35rem; color: var(--ink-soft); pointer-events: none;
}
.search {
  width: 100%; padding: 15px 20px 15px 50px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 1rem; box-shadow: var(--shadow-sm); transition: .2s;
}
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }

.muted { color: var(--ink-soft); }
.center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Skeleton loaders ---------- */
.skel {
  background: linear-gradient(100deg, var(--card) 30%, var(--card-2) 50%, var(--card) 70%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 14px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-row { height: 68px; margin-bottom: 12px; }
.skel-line { height: 14px; border-radius: 6px; margin: 8px 0; }

/* ---------- entrance animation ---------- */
.reveal { opacity: 0; transform: translateY(14px); animation: rise .5s forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal, .brand-mark { animation: none; opacity: 1; transform: none; }
}

/* ---------- Home / Hero ---------- */
.hero {
  position: relative; text-align: center; padding: 74px 26px 66px; overflow: hidden;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  background:
    radial-gradient(80% 120% at 50% -10%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%),
    linear-gradient(180deg, var(--card), var(--card-2));
  box-shadow: var(--shadow-lg); margin-bottom: 44px;
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23b3862a' stroke-opacity='0.16' stroke-width='1'%3E%3Ccircle cx='40' cy='40' r='30'/%3E%3Cpath d='M40 10 L64 40 L40 70 L16 40 Z'/%3E%3Cpath d='M19 19 L61 61 M61 19 L19 61'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent 80%);
  mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent 80%);
}
.hero > * { position: relative; }
.hero .bismillah {
  font-family: var(--arabic); font-size: clamp(2rem, 6vw, 3.1rem); direction: rtl; margin-bottom: 20px;
  background: linear-gradient(120deg, var(--gold), var(--gold-2), var(--gold));
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 5s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }
.hero h1 { font-family: var(--display); font-size: clamp(2.6rem, 8vw, 4.4rem); margin: 0 0 12px; letter-spacing: 1px; }
.hero .tag { display: inline-block; font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 1.05rem; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 8px; }
.hero p { color: var(--ink-soft); font-size: 1.15rem; max-width: 580px; margin: 0 auto 30px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.divider-orn { text-align: center; color: var(--gold); font-size: 1.4rem; letter-spacing: 8px; margin: 4px 0 30px; opacity: .8; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.tile {
  position: relative; display: block; padding: 34px 28px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .28s, box-shadow .28s, border-color .28s; color: var(--ink); overflow: hidden;
}
.tile::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, transparent, color-mix(in srgb, var(--gold) 50%, transparent), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .3s;
}
.tile:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: transparent; }
.tile:hover::after { opacity: 1; }
.tile .ic {
  width: 60px; height: 60px; display: grid; place-items: center; border-radius: 16px; font-size: 1.9rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--gold) 16%, transparent));
}
.tile h3 { font-family: var(--display); margin: 16px 0 6px; font-size: 1.4rem; }
.tile p { margin: 0; color: var(--ink-soft); font-size: .98rem; }
.tile .go { margin-top: 14px; color: var(--accent); font-weight: 700; font-size: .9rem; }

/* ---------- Lists ---------- */
.grid { display: grid; gap: 12px; content-visibility: auto; }
.grid.cols { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row-item {
  display: flex; align-items: center; gap: 15px; padding: 15px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 15px;
  cursor: pointer; transition: transform .18s, box-shadow .18s, border-color .18s; color: var(--ink);
}
.row-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
.row-num {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--gold) 14%, transparent));
  color: var(--accent); border-radius: 13px; font-weight: 800; font-size: 1.05rem;
  position: relative;
}
.row-main { flex: 1; min-width: 0; }
.row-main .t { font-weight: 700; font-size: 1.05rem; }
.row-main .s { font-size: .85rem; color: var(--ink-soft); }
.row-ar { font-family: var(--arabic); font-size: 1.7rem; color: var(--gold); white-space: nowrap; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.chip {
  padding: 9px 17px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-soft); cursor: pointer; font-size: .9rem; font-weight: 600;
  transition: .18s; box-shadow: var(--shadow-sm);
}
.chip:hover { transform: translateY(-2px); color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.chip.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 36%, transparent);
}

/* ---------- Quran reader ---------- */
.reader-head {
  position: relative; text-align: center; padding: 34px 26px; margin-bottom: 22px; overflow: hidden;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.reader-head::before {
  content: ""; position: absolute; inset: 0; opacity: .4;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 10 L64 40 L40 70 L16 40 Z' fill='none' stroke='%23b3862a' stroke-opacity='0.18'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(60% 80% at 50% 30%, #000, transparent); mask-image: radial-gradient(60% 80% at 50% 30%, #000, transparent);
}
.reader-head > * { position: relative; }
.reader-head .ar { font-family: var(--arabic); font-size: clamp(2rem, 7vw, 2.9rem); color: var(--gold); line-height: 1.4; }
.reader-head .en { font-family: var(--display); font-size: 1.4rem; font-weight: 700; margin-top: 4px; }
.reader-head .meta { color: var(--ink-soft); font-size: .92rem; font-family: var(--serif); font-style: italic; letter-spacing: .5px; }

.ayah { padding: 26px 26px; border-bottom: 1px solid var(--line); transition: background .3s; }
.ayah:last-child { border-bottom: none; }
.ayah:target, .ayah.active { background: color-mix(in srgb, var(--gold) 9%, transparent); }
.ayah-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ayah-badge {
  flex: none; min-width: 34px; height: 34px; padding: 0 9px; display: grid; place-items: center;
  border-radius: 9px; font-weight: 800; font-size: .82rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--gold) 14%, transparent));
  color: var(--accent);
}
.ayah .arabic {
  font-family: var(--arabic); font-size: clamp(1.7rem, 5vw, 2.3rem); line-height: 2.5; text-align: right;
  direction: rtl; color: var(--ink); font-weight: 700;
}
.ayah .translit { color: var(--gold); font-style: italic; margin-top: 10px; font-size: 1rem; font-family: var(--serif); }
.ayah .trans { color: var(--ink-soft); margin-top: 6px; font-size: 1.05rem; }
.play-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--accent);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: .8rem; transition: .18s;
}
.play-btn:hover { border-color: var(--accent); transform: scale(1.08); }
.play-btn.playing { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.reader-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.reader-nav .btn { flex: 1; justify-content: center; min-width: 130px; }

/* ---------- Entry cards (dua / hadith) ---------- */
.entry {
  position: relative; padding: 26px 28px; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: box-shadow .25s, transform .25s;
}
.entry:hover { box-shadow: var(--shadow-lg); }
.entry::before {
  content: ""; position: absolute; left: 0; top: 20px; bottom: 20px; width: 4px; border-radius: 4px;
  background: linear-gradient(var(--accent), var(--gold));
}
.entry .label { color: var(--accent); font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; }
.entry .arabic {
  font-family: var(--arabic); font-size: clamp(1.6rem, 4.5vw, 2.1rem); line-height: 2.3; text-align: right;
  direction: rtl; margin: 14px 0; color: var(--ink); font-weight: 700;
}
.entry .translit { color: var(--gold); font-style: italic; font-family: var(--serif); font-size: 1.05rem; }
.entry .trans { margin-top: 12px; font-size: 1.05rem; }
.entry .ref { margin-top: 14px; font-size: .85rem; color: var(--ink-soft); border-top: 1px dashed var(--line); padding-top: 12px; font-family: var(--serif); font-style: italic; }

.section-title { font-family: var(--display); font-size: 1.35rem; margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title .ic { font-size: 1.5rem; }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 28px; }
.pager span { color: var(--ink-soft); font-size: .9rem; font-weight: 600; }

.error-box { text-align: center; padding: 46px 24px; color: var(--ink-soft); }
.error-box .em { font-size: 2.4rem; display: block; margin-bottom: 8px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 34px 0; text-align: center; color: var(--ink-soft); font-size: .88rem; }
.footer-orn { font-family: var(--arabic); color: var(--gold); font-size: 1.5rem; margin-bottom: 12px; letter-spacing: 6px; }
.footer-note { margin-top: 6px; opacity: .8; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); color: var(--accent);
  font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow); opacity: 0; transform: translateY(20px);
  transition: .3s; z-index: 40; pointer-events: none;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); }

/* ---------- Language switcher ---------- */
.lang-switch { position: relative; }
.lang-toggle { font-family: var(--display); font-weight: 700; font-size: .82rem; width: auto; padding: 0 13px; border-radius: 999px; gap: 4px; }
.lang-menu {
  position: absolute; top: 50px; right: 0; min-width: 150px; display: none; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60;
}
.lang-menu.open { display: flex; }
.lang-opt { padding: 9px 14px; border-radius: 9px; color: var(--ink); font-weight: 600; font-size: .95rem; }
.lang-opt:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.lang-opt.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

/* ---------- Urdu ---------- */
.urdu {
  font-family: var(--urdu); direction: rtl; text-align: right;
  line-height: 2.9; font-size: 1.25rem;
}
.ayah .urdu, .entry .urdu { margin-top: 12px; color: var(--ink); }
.trans-label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); margin: 14px 0 2px; }

/* ---------- Reader toolbar ---------- */
.reader-tools {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  margin: 16px 0; padding: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow-sm);
}
.reader-tools .field { display: flex; align-items: center; gap: 7px; font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.nice-select {
  appearance: none; -webkit-appearance: none; padding: 8px 34px 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23888' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink); font-weight: 600; font-size: .88rem; cursor: pointer;
}
.nice-select:focus { outline: none; border-color: var(--accent); }

/* ---------- Card actions / share ---------- */
.card-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.act-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--ink-soft);
  font-size: .82rem; font-weight: 600; cursor: pointer; transition: .18s;
}
.act-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.act-btn.done { border-color: var(--accent); color: var(--accent); }

/* ---------- Share image modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  background: rgba(10, 16, 13, .68); backdrop-filter: blur(6px); padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 22px; max-width: 460px; width: 100%; text-align: center;
  max-height: 92vh; overflow: auto;
}
.modal-card h3 { font-family: var(--display); margin: 0 0 14px; }
.modal-card img { width: 100%; border-radius: 14px; border: 1px solid var(--line); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; justify-content: center; }
.modal-close { position: absolute; top: 18px; right: 20px; font-size: 1.6rem; color: #fff; cursor: pointer; background: none; border: none; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); opacity: 0; transition: .3s; z-index: 120; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Blog ---------- */
.tiles-4 { grid-template-columns: repeat(4, 1fr); }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.post-card {
  display: flex; gap: 16px; padding: 22px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); transition: transform .22s, box-shadow .22s, border-color .22s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.post-ic {
  flex: none; width: 56px; height: 56px; display: grid; place-items: center; font-size: 1.7rem; border-radius: 15px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--gold) 15%, transparent));
}
.post-ic.big { width: 84px; height: 84px; font-size: 2.6rem; margin: 0 auto 14px; }
.post-cbody { min-width: 0; }
.post-meta { font-size: .78rem; color: var(--ink-soft); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.post-card h3 { font-family: var(--display); margin: 6px 0 6px; font-size: 1.2rem; line-height: 1.25; }
.post-card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.post { max-width: 760px; margin: 0 auto; }
.post-hero { text-align: center; margin-bottom: 26px; }
.post-title { font-family: var(--display); font-size: clamp(1.7rem, 5vw, 2.6rem); margin: 8px 0 12px; line-height: 1.15; }
.post-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tag-chip { font-size: .78rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 4px 12px; border-radius: 999px; font-weight: 700; }
.post-content { font-size: 1.12rem; line-height: 1.9; }
.post-content h2 { font-family: var(--display); font-size: 1.5rem; margin: 30px 0 10px; color: var(--accent); }
.post-content p { margin: 0 0 16px; }
.post-content ul { padding-left: 22px; margin: 0 0 16px; }
.post-content li { margin-bottom: 8px; }
.post-content blockquote {
  margin: 20px 0; padding: 16px 22px; border-left: 4px solid var(--gold);
  background: var(--card-2); border-radius: 0 14px 14px 0; font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--ink);
}
:root[dir="rtl"] .post-content blockquote { border-left: none; border-right: 4px solid var(--gold); border-radius: 14px 0 0 14px; }

.tiles-auto { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* ---------- Today dashboard ---------- */
.today-board { margin: 34px 0 8px; }
.prayer-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px; border-radius: 999px; margin-bottom: 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 34%, transparent);
  font-weight: 700;
}
.prayer-strip.cta { justify-content: center; background: var(--card); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: var(--shadow-sm); }
.prayer-strip .ps-l { opacity: .9; font-size: .82rem; text-transform: uppercase; letter-spacing: 1px; }
.prayer-strip .ps-m { font-family: var(--display); font-size: 1.25rem; }
.prayer-strip .ps-r { font-variant-numeric: tabular-nums; }
.today-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.today-card { padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tc-label { font-size: .78rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.tc-body { display: block; color: var(--ink); }
.today-card .arabic { direction: rtl; text-align: right; font-family: var(--arabic); }
.today-card .ref { margin-top: 10px; font-size: .82rem; color: var(--ink-soft); font-family: var(--serif); font-style: italic; }
.today-card .card-actions { margin-top: 12px; }
@media (max-width: 760px) { .today-grid { grid-template-columns: 1fr; } }

/* ---------- Prayer times & Qibla ---------- */
.prayer-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin-bottom: 6px; }
.next-prayer {
  text-align: center; padding: 26px; margin-bottom: 14px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none;
}
.next-prayer .np-label { font-size: .82rem; text-transform: uppercase; letter-spacing: 2px; opacity: .85; font-weight: 700; }
.next-prayer .np-name { font-family: var(--display); font-size: 1.9rem; margin: 6px 0; }
.next-prayer .np-count { font-size: 1.15rem; font-variant-numeric: tabular-nums; font-weight: 600; opacity: .95; }
.hijri-line { text-align: center; color: var(--gold); font-family: var(--serif); font-style: italic; font-size: 1.05rem; margin-bottom: 16px; }
.pt-list { display: grid; gap: 10px; }
.pt-row {
  display: flex; align-items: center; gap: 14px; padding: 15px 20px; border-radius: 15px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: .2s;
}
.pt-row.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); box-shadow: var(--shadow); }
.pt-ic { font-size: 1.4rem; flex: none; }
.pt-name { flex: 1; font-weight: 700; font-size: 1.1rem; }
.pt-time { font-family: var(--display); font-size: 1.3rem; color: var(--accent); font-variant-numeric: tabular-nums; }

.compass-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.compass { position: relative; width: 260px; height: 260px; }
.compass-dial {
  position: absolute; inset: 0; border-radius: 50%; transition: transform .12s linear;
  background:
    radial-gradient(circle at 50% 50%, var(--card) 62%, transparent 63%),
    conic-gradient(from 0deg, color-mix(in srgb, var(--gold) 22%, transparent), transparent 25%, color-mix(in srgb, var(--accent) 18%, transparent) 50%, transparent 75%, color-mix(in srgb, var(--gold) 22%, transparent));
  border: 3px solid var(--line); box-shadow: var(--shadow-lg), inset 0 0 30px color-mix(in srgb, var(--accent) 12%, transparent);
}
.cmark { position: absolute; font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--ink-soft); transform: translate(-50%, -50%); }
.cmark.cn { top: 16px; left: 50%; color: var(--accent); }
.cmark.cs { bottom: 16px; left: 50%; top: auto; transform: translate(-50%, 50%); }
.cmark.ce { right: 12px; top: 50%; left: auto; transform: translate(50%, -50%); }
.cmark.cw { left: 16px; top: 50%; }
.compass-needle {
  position: absolute; left: 50%; top: 22px; bottom: 50%; width: 8px; transform-origin: 50% 100%;
  background: linear-gradient(var(--gold), var(--accent)); border-radius: 8px;
}
.needle-kaaba { position: absolute; top: -30px; left: 50%; transform: translateX(-50%); font-size: 1.9rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.compass-center { position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--gold); border: 3px solid var(--card); box-shadow: var(--shadow); }
.qibla-info { text-align: center; font-size: 1.05rem; line-height: 1.7; }
.qibla-info strong { font-family: var(--display); font-size: 1.5rem; color: var(--accent); }

/* ---------- Tools ---------- */
.tile-sm { padding: 22px 20px; }
.tile-sm .ic { width: 46px; height: 46px; font-size: 1.4rem; border-radius: 13px; }
.tile-sm h3 { font-size: 1.08rem; margin: 12px 0 4px; }
.tile-sm p { font-size: .85rem; }
.tool-form { padding: 24px; }
.zk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.zk-field span { display: block; font-size: .84rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.zk-in { margin: 0; width: 100%; padding: 12px 16px; }
.zk-out .np-name { font-size: 2.2rem; }
@media (max-width: 640px) { .zk-grid { grid-template-columns: 1fr; } }

.tasbih-card { padding: 30px 24px; text-align: center; }
.tasbih-btn {
  display: block; width: 210px; height: 210px; margin: 24px auto 18px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: 0 16px 44px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 -6px 18px rgba(0,0,0,.22);
  transition: transform .08s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.tasbih-btn:active { transform: scale(.94); }
.tasbih-progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; max-width: 300px; margin: 0 auto 10px; }
.tp-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .15s; }

.name-card { text-align: center; padding: 22px 16px; }
.name-card::before { display: none; }
.name-num { width: 30px; height: 30px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 50%; font-size: .78rem; font-weight: 800; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.name-ar { text-align: center !important; font-size: 2rem !important; margin: 4px 0 !important; }

.tafsir-box { margin-top: 14px; padding: 16px 18px; border-radius: 14px; background: var(--card-2); border: 1px dashed var(--line); }
.tafsir-title { font-weight: 800; color: var(--accent); font-size: .82rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.tafsir-text { white-space: pre-line; font-size: .98rem; color: var(--ink-soft); direction: ltr; text-align: left; }
.hide-trans .translit, .hide-trans .trans, .hide-trans .urdu { filter: blur(7px); transition: filter .2s; }
.hide-trans .translit:hover, .hide-trans .trans:hover, .hide-trans .urdu:hover { filter: none; }
.hide-ar .arabic { filter: blur(9px); transition: filter .2s; }
.hide-ar .arabic:hover { filter: none; }
.active-hide { background: color-mix(in srgb, var(--gold) 22%, var(--card)); border-color: var(--gold); }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .tiles, .tiles-4 { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr; }
  .main-nav { display: none; }
  .row-ar { font-size: 1.4rem; }
  .reader-nav .btn { min-width: 46%; }
  body { padding-bottom: 72px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; box-shadow: 0 -6px 22px rgba(0,0,0,.12);
  }
  .bn-item {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 1px;
    color: var(--ink-soft); font-size: .6rem; font-weight: 700; border-radius: 12px; transition: .18s;
  }
  .bn-lb { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bn-ic { font-size: 1.3rem; line-height: 1; filter: grayscale(.3); transition: .18s; }
  .bn-item.active { color: var(--accent); }
  .bn-item.active .bn-ic { filter: none; transform: translateY(-1px) scale(1.12); }
  .to-top { bottom: 82px; }
}
