/* ============================================================
   Quran Reading Practice — islamiebook.in official learning app
   Brand: Islamic eBook Library identity (dark purple + gold)
   + dedicated light mode, elegant off-white surfaces, Arabic RTL
   ============================================================ */

:root {
  /* Brand palette (from islamiebooks.in) */
  --bg: #0d0618;
  --bg-2: #150a26;
  --bg-3: #1c0e33;
  --purple-1: #8b3df6;
  --purple-2: #5a1fb3;
  --purple-3: #2a1054;
  --gold: #d4af37;
  --gold-light: #f5d97e;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --text: #efe6ff;
  --text-dim: #b9a8d9;
  --text-mute: #8a78ad;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(212, 175, 55, 0.45);
  --danger: #ff6b7a;
  --success: #5dd39e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  --grad-purple: linear-gradient(135deg, #6a2c91 0%, #3b1270 55%, #241046 100%);
  --grad-gold: linear-gradient(135deg, #f5d97e 0%, #d4af37 55%, #b8860b 100%);
  --font-body: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Amiri", Georgia, serif;
  --font-quran: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  --font-arabic: "Amiri", "Scheherazade New", serif;
  --accent-focus: #d4af37;

  /* Arabic text base size (adjusted by text-size setting) */
  --ar-base: 34px;
  --content-max: 1180px;
}

/* ---------- Light mode (elegant off-white + gold, brand-purple tints) ---------- */
html[data-theme="light"] {
  --bg: #faf7f2;
  --bg-2: #f3ede3;
  --bg-3: #efe4d4;
  --text: #2a1b3d;
  --text-dim: #5f5470;
  --text-mute: #8b7e9b;
  --purple-3: #6b3fa0;
  --purple-1: #7a2fd6;
  --surface: rgba(42, 27, 61, 0.045);
  --surface-2: rgba(42, 27, 61, 0.07);
  --border: rgba(42, 27, 61, 0.14);
  --border-gold: rgba(180, 140, 30, 0.5);
  --gold: #b8860b;
  --gold-light: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.18);
  --shadow: 0 18px 45px rgba(80, 50, 20, 0.14);
  --grad-purple: linear-gradient(135deg, #8b5fce 0%, #6a2c91 55%, #4a1b6b 100%);
  --success: #1f9d63;
  --danger: #d6455c;
  --accent-focus: #7a2fd6;
}

[data-theme="light"] .bg-pattern { filter: invert(0.85) opacity(0.5); }
[data-theme="light"] .glass { background: rgba(255, 255, 255, 0.7); }
[data-theme="light"] .page-title { color: #2a1b3d; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(1100px 600px at 85% -10%, rgba(107, 44, 145, 0.22), transparent 60%),
    radial-gradient(900px 550px at -10% 30%, rgba(58, 18, 112, 0.26), transparent 60%),
    radial-gradient(700px 500px at 55% 110%, rgba(139, 61, 246, 0.1), transparent 60%);
}

::selection { background: var(--gold); color: #1c0e33; }
[data-theme="light"] ::selection { color: #fff; }

.container { width: min(var(--content-max), 94%); margin-inline: auto; }
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Arabic + Tamil typography */
.arabic { font-family: var(--font-quran); direction: rtl; unicode-bidi: isolate; }
.ar-normal { font-family: var(--font-arabic); direction: rtl; unicode-bidi: isolate; }
.lang-ta { font-family: "Noto Sans Tamil", "Outfit", sans-serif; }

.gold-text {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---------- Background Islamic geometric pattern ---------- */
.bg-pattern {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23b98ae8' stroke-opacity='0.08' stroke-width='1'%3E%3Cpath d='M60 8 L112 60 L60 112 L8 60 Z'/%3E%3Cpath d='M60 30 L90 60 L60 90 L30 60 Z'/%3E%3Ccircle cx='60' cy='60' r='28'/%3E%3Cpath d='M60 4 V116 M4 60 H116'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px 120px;
}

/* ---------- Glass surfaces ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover { border-color: var(--border-gold); }

.page-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  margin-bottom: 4px;
}
.page-sub { color: var(--text-dim); margin-bottom: 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: 999px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  min-height: 48px;
}
.btn:hover { border-color: var(--border-gold); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent-focus); outline-offset: 2px; }

.btn-gold {
  background: var(--grad-gold);
  border: none;
  color: #24140a; font-weight: 700;
  box-shadow: 0 10px 24px rgba(212, 175, 55, 0.25);
}
.btn-gold:hover { filter: brightness(1.03); }

.btn-outline { background: transparent; }
.btn-lg { padding: 15px 26px; font-size: 1.05rem; }
.btn-sm { padding: 8px 14px; font-size: .88rem; min-height: 40px; font-weight: 600; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg-3) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .site-header { background: rgba(255,255,255,0.85); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.logo-mark { color: var(--gold); display: inline-flex; }
.logo b { color: var(--gold-light); }
[data-theme="light"] .logo b { color: var(--purple-3); }

.nav-auth { display: flex; align-items: center; gap: 10px; }
.nav-item {
  padding: 9px 15px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  color: var(--text-dim); border: 1px solid transparent;
}
.nav-item:hover, .nav-item.active { color: var(--text); border-color: var(--border-gold); background: var(--surface); }

.hdr-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; padding: 8px 12px; font-size: 1rem; min-height: 42px;
}
.hdr-btn:hover { border-color: var(--border-gold); }

/* ---------- Bottom mobile nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
  display: none;
  background: color-mix(in srgb, var(--bg-3) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
[data-theme="light"] .bottom-nav { background: rgba(255,255,255,0.94); }
.bottom-nav .bn-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 8px; font-size: .68rem; font-weight: 600; color: var(--text-mute);
}
.bn-item .ico { font-size: 1.3rem; }
.bn-item.active { color: var(--gold-light); }
[data-theme="light"] .bn-item.active { color: var(--purple-3); }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 34px; text-align: center; }
.hero-bismillah {
  font-size: clamp(24px, 5.4vw, 40px);
  color: var(--gold-light);
  margin-bottom: 22px; line-height: 1.6;
}
[data-theme="light"] .hero-bismillah { color: var(--purple-3); }
.hero h1 { font-size: clamp(30px, 6vw, 52px); font-weight: 800; line-height: 1.12; margin-bottom: 10px; }
.hero .hero-ta { font-size: clamp(16px, 3vw, 22px); color: var(--gold-light); font-weight: 700; margin-bottom: 16px; }
[data-theme="light"] .hero .hero-ta { color: var(--purple-3); }
.hero p.lead { max-width: 640px; margin: 0 auto 28px; color: var(--text-dim); font-size: 1.04rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* ---------- Section + panels ---------- */
.section { margin: 30px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(19px, 3.4vw, 25px); font-weight: 700; }
.section-head .link { color: var(--gold-light); font-weight: 600; font-size: .9rem; }
[data-theme="light"] .section-head .link { color: var(--purple-3); }

/* ---------- Progress dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; }
@media (max-width: 820px) { .dash-grid { grid-template-columns: 1fr; } }

.progress-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.progress-ring { position: relative; width: 150px; height: 150px; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.ring-fg {
  fill: none; stroke: url(#ringGrad); stroke-width: 11; stroke-linecap: round;
  transition: stroke-dashoffset .6s ease;
}
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 1.6rem; font-weight: 800; }
.ring-label { font-size: .74rem; color: var(--text-mute); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.stat .s-ico { font-size: 1.6rem; }
.stat .s-num { font-size: 1.35rem; font-weight: 800; }
.stat .s-lab { font-size: .8rem; color: var(--text-dim); }

/* ---------- Roadmap ---------- */
.roadmap { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .roadmap { grid-template-columns: 1fr; } }
.level {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .16s ease, border-color .16s ease;
}
.level:hover { border-color: var(--border-gold); transform: translateY(-2px); }
.level .lv-num {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 999px; display: grid; place-items: center;
  font-weight: 800; font-size: 1.15rem; border: 2px solid var(--border-gold); color: var(--gold-light);
}
[data-theme="light"] .level .lv-num { color: var(--purple-3); }
.level.locked { filter: grayscale(.5); opacity: .7; }
.level.locked .lv-num { border-color: var(--border); color: var(--text-mute); }
.level .lv-body { flex: 1; min-width: 0; }
.level .lv-title { font-weight: 700; font-size: 1.02rem; }
.level .lv-learnt { font-size: .82rem; color: var(--text-dim); margin-top: 2px; }
.level .lv-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.lv-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lv-bar i { display: block; height: 100%; background: var(--grad-gold); border-radius: 999px; }
.lv-pct { font-size: .78rem; color: var(--text-mute); font-weight: 700; }
.lv-badge { font-size: .72rem; font-weight: 700; color: var(--success); }

/* ---------- Daily practice ---------- */
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px dashed var(--border); }
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--border-gold);
  display: grid; place-items: center; color: #1c0e33; background: transparent; flex-shrink: 0;
  font-size: .9rem;
}
[data-theme="light"] .task-check { color: #fff; }
.task-check.done { background: var(--grad-gold); }
.task-row .t-label { flex: 1; font-weight: 600; }
.task-row .t-count { color: var(--text-mute); font-size: .85rem; }

/* ---------- Streak ---------- */
.streak-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.streak-hero .fire { font-size: 2.4rem; }
.streak-hero .num { font-size: 2rem; font-weight: 800; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; text-align: center; }
.week-grid .d { font-size: .72rem; color: var(--text-mute); font-weight: 600; }
.week-grid .c {
  width: 40px; height: 40px; margin: 4px auto 0; border-radius: 999px; display: grid; place-items: center;
  border: 1px solid var(--border); font-weight: 700; font-size: .82rem;
}
.week-grid .c.done {
  background: var(--grad-gold); color: #24140a; border: none;
  animation: pop .4s ease;
}
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ---------- Achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.ach {
  text-align: center; padding: 18px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.ach .a-ico { font-size: 2.2rem; }
.ach .a-name { font-weight: 700; margin-top: 6px; }
.ach .a-desc { font-size: .78rem; color: var(--text-dim); margin-top: 2px; }
.ach.locked .a-ico { filter: grayscale(1); opacity: .5; }

/* ---------- Letter learning ---------- */
.letter-stage { text-align: center; padding: 30px 20px; }
.big-letter {
  font-family: var(--font-quran); font-size: calc(var(--ar-base) * 3.1); line-height: 1.25;
  color: var(--gold-light); direction: rtl; margin-bottom: 8px;
}
[data-theme="light"] .big-letter { color: var(--purple-3); }
.letter-en { font-size: 1.5rem; font-weight: 800; }
.letter-ta { font-size: 1.25rem; color: var(--gold-light); font-weight: 700; }
[data-theme="light"] .letter-ta { color: var(--purple-3); }

.pronounce-box {
  margin: 18px auto; max-width: 520px; text-align: left; padding: 18px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.pronounce-box h4 { margin-bottom: 8px; color: var(--gold-light); }
[data-theme="light"] .pronounce-box h4 { color: var(--purple-3); }

.letter-examples { display: flex; justify-content: center; gap: 26px; margin: 18px 0 6px; }
.letter-example { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.letter-example .arabic { font-size: calc(var(--ar-base) * 1.5); }
.letter-example .tag { font-size: .78rem; color: var(--text-mute); }

.stage-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.dot-row { display: flex; gap: 6px; justify-content: center; flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.dot.current { background: var(--gold); border-color: var(--gold); }

/* Writing practice pad */
.writing-pad { display: flex; justify-content: center; gap: 14px; margin: 14px 0; flex-wrap: wrap; }
.writing-box {
  width: 74px; height: 74px; border-radius: var(--radius-sm);
  border: 1px dashed var(--border-gold);
  display: grid; place-items: center; font-family: var(--font-quran); font-size: calc(var(--ar-base)*1.4);
  color: var(--text-mute); background: var(--surface);
}
.writing-box.ghost { color: rgba(139,61,246,0); }
.writing-flash { text-align: center; color: var(--success); font-weight: 700; min-height: 1.4em; margin-top: 8px; }

/* ---------- Quiz / trainer ---------- */
.quiz-question { font-size: 1.25rem; font-weight: 700; text-align: center; }
.quiz-char { text-align: center; padding: 26px 0 16px; }
.quiz-char .arabic { font-size: calc(var(--ar-base)*2.6); }
.quiz-options { display: grid; gap: 12px; max-width: 460px; margin: 0 auto; }
.quiz-opt {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 1.05rem; text-align: left; min-height: 52px;
}
.quiz-opt .arabic { font-size: 1.6rem; }
.quiz-opt:hover { border-color: var(--border-gold); }
.quiz-opt.right { border-color: var(--success); background: rgba(93,211,158,.12); }
.quiz-opt.wrong { border-color: var(--danger); background: rgba(255,107,122,.1); }
.quiz-feedback { text-align: center; min-height: 1.8em; font-weight: 700; margin-top: 14px; font-size: 1.05rem; }
.quiz-feedback.ok { color: var(--success); }
.quiz-feedback.no { color: var(--danger); }
.quiz-score { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--text-dim); font-size: .9rem; }

/* ---------- Reading practice ---------- */
.read-stage { text-align: center; padding: 24px 14px; }
.read-arabic { font-size: calc(var(--ar-base)*2.6); line-height: 1.5; margin: 8px 0 12px; }
.read-ta { font-size: 1.5rem; font-weight: 800; color: var(--gold-light); }
[data-theme="light"] .read-ta { color: var(--purple-3); }

.word-card { text-align: center; padding: 26px 16px; }
.word-main { font-size: calc(var(--ar-base)*2.2); line-height: 1.5; margin-bottom: 10px; }
.word-en { font-size: 1.15rem; font-weight: 700; color: var(--text-dim); }
.word-ta { font-size: 1.05rem; color: var(--text-dim); }
.word-meaning { margin-top: 8px; font-size: 1.1rem; font-weight: 600; }

/* ---------- Breakdown ---------- */
.breakdown-wrap { margin-top: 18px; }
.breakdown-arabic { font-size: calc(var(--ar-base)*1.9); text-align: center; margin-bottom: 14px; }
.breakdown-parts { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.bpart {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-width: 76px; padding: 16px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-gold);
  animation: reveal .45s ease both;
}
.bpart .ar { font-family: var(--font-quran); font-size: 1.7rem; }
.bpart .ex { font-size: .72rem; color: var(--text-mute); }
.bpart .tr { font-size: .85rem; font-weight: 700; color: var(--gold-light); }
[data-theme="light"] .bpart .tr { color: var(--purple-3); }
@keyframes reveal { 0% { opacity: 0; transform: translateY(8px) scale(.9); } 100% { opacity: 1; transform: none; } }

/* ---------- Search ---------- */
.search-wrap { max-width: 640px; margin: 0 auto; }
.search-input {
  width: 100%; padding: 16px 20px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1.05rem; min-height: 56px;
}
.search-input:focus { outline: 2px solid var(--accent-focus); }
[data-theme="light"] .search-input { background: #fff; }
.search-results { margin-top: 20px; display: grid; gap: 14px; }

/* ---------- Controls bar (dark mode / text size / beginner) ---------- */
.controls-bar { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 60px; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 26px 0; flex-wrap: wrap; color: var(--text-mute); }
.footer-logo { font-weight: 700; color: var(--text); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--gold-light); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border-gold);
  border-radius: 999px; padding: 12px 20px; font-weight: 600; z-index: 90;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--accent-focus); outline-offset: 2px; }
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--gold); color: #1c0e33; padding: 10px 16px; border-radius: 8px; font-weight: 700;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .1ms !important; scroll-behavior: auto !important; }
}

html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation: none !important; transition: none !important;
}

/* Large / XLarge text modes */
html[data-textsize="large"] { --ar-base: 42px; }
html[data-textsize="xlarge"] { --ar-base: 48px; }
html[data-textsize="large"], html[data-textsize="large"] body { font-size: 1.08rem; }
html[data-textsize="xlarge"], html[data-textsize="xlarge"] body { font-size: 1.18rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .desktop-nav { display: none; }
  .bottom-nav { display: block; }
  main { padding-bottom: 90px; }
  .hero { padding: 40px 0 24px; }
  .page-title { font-size: 24px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .hero-actions .btn { width: 100%; }
  .week-grid .c { width: 34px; height: 34px; }
}

/* ---------- Brand header ---------- */
.brand { color: var(--gold-light); font-weight: 800; }
.brand-sub { color: var(--text-dim); font-weight: 600; font-size: .95rem; }
.logo-text .logo-sub { margin-left: 8px; padding-left: 10px; border-left: 1px solid var(--gold-soft); }
.start-cta { margin-right: 6px; }
@media (max-width: 480px) {
  .start-cta { display: none; }
  .brand-sub { display: none; }
}

/* ---------- Course grid ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.course-card { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-decoration: none; text-align: left; }
.course-card .c-ico { font-size: 1.8rem; }
.course-card .c-title { font-weight: 700; color: var(--gold-light); }
.course-card .c-sub { font-size: .85rem; color: var(--text-dim); }

/* ---------- Audio player card ---------- */
.audio-card { background: color-mix(in srgb, var(--bg-3) 60%, transparent); border: 1px solid var(--gold-soft); border-radius: var(--radius); padding: 14px; margin-top: 14px; }
.ac-head { display: flex; align-items: center; gap: 12px; }
.ac-play { width: 52px; height: 52px; min-width: 52px; border-radius: 50%; border: none; font-size: 1.4rem; background: linear-gradient(135deg, var(--gold), #b8860b); color: #1a1204; cursor: pointer; font-weight: 800; }
.ac-play.muted { background: var(--bg-3); color: var(--text-dim); }
.ac-title { flex: 1; }
.ac-text { font-size: 24px; }
.ac-note { font-size: .85rem; color: var(--text-dim); }
.ac-time { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-dim); margin: 6px 0; }
.ac-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.ac-btn { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-gold); background: transparent; color: var(--text); cursor: pointer; font-family: inherit; font-size: .9rem; }
.ac-btn:hover { background: var(--gold-soft); }
.ac-hint { font-size: .8rem; color: var(--text-dim); margin-top: 10px; }
.ac-time [data-ac=dur] { display: none; }

/* ---------- Settings ---------- */
.set-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-gold); }
.set-row:last-child { border-bottom: none; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn { border: none; background: transparent; color: var(--text-dim); padding: 8px 10px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: .85rem; }
.seg-btn.active { background: linear-gradient(135deg, var(--gold), #b8860b); color: #1a1204; font-weight: 700; }

/* ---------- Bookmarks ---------- */
.bm-row { display: flex; align-items: center; gap: 12px; }
.bm-ico { font-size: 1.5rem; }
.bm-body { flex: 1; }
.btn.ghost { background: transparent; border-color: var(--text-dim); color: var(--text-dim); }

/* ---------- Profile ---------- */
.avatar { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; background: var(--gold-soft); border: 2px solid var(--border-gold); }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.menu-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.menu-link .m-ico { font-size: 1.5rem; }

/* ---------- Recitation ---------- */
.rec-ayah { text-align: center; }
.rec-text { font-family: var(--font-quran); font-size: calc(var(--ar-base) * 1.6); line-height: 2; direction: rtl; margin-bottom: 10px; color: var(--gold-light); }
.rec-ta { font-size: 1.25rem; font-weight: 700; }
.rec-mean { font-size: .95rem; color: var(--text-dim); margin-top: 6px; }
.rec-record { text-align: center; }
.rec-btn { width: 140px; height: 140px; border-radius: 50%; border: 2px solid var(--border-gold); background: var(--bg-3); color: var(--gold-light); font-size: 1.1rem; font-weight: 700; cursor: pointer; margin-top: 10px; }
.rec-btn:active { transform: scale(.96); }
.rec-status { margin-top: 14px; font-weight: 700; color: var(--gold-light); }
.rec-status.big { font-size: 1.3rem; }
.rec-timer { font-size: 1.6rem; font-weight: 800; margin-top: 6px; }
.rec-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.quiet-hint { font-size: .82rem; color: var(--text-dim); }
.analysis { text-align: left; }
.analysis-words { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.social-hint { font-size: .82rem; color: var(--text-dim); background: var(--gold-soft); padding: 8px 10px; border-radius: 10px; margin: 8px 0; }
.aw-card { border: 1px solid var(--border-gold); border-radius: 12px; padding: 8px; text-align: center; }
.aw-card .arabic { font-size: 26px; display: block; margin-bottom: 6px; }
.aw-btns { display: flex; gap: 6px; }
.aw-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--text-dim); background: transparent; color: var(--text); cursor: pointer; font-weight: 800; }
.aw-btn.ok:hover { border-color: #2ecc71; color: #2ecc71; }
.aw-btn.warn:hover { border-color: var(--gold); color: var(--gold); }
.aw-btn.sel.ok { background: #2ecc71; color: #0d0618; border-color: #2ecc71; }
.aw-btn.sel.warn { background: var(--gold); color: #0d0618; border-color: var(--gold); }
.result-score { font-size: 1.3rem; margin: 10px 0; }
.side-list { display: grid; gap: 12px; margin: 12px 0; }
.hist-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; }
.h-title { font-weight: 700; }
.h-score { font-weight: 800; color: var(--gold-light); }
.h-date { font-size: .8rem; color: var(--text-dim); }

/* standalone levelCard needs hash-preserving */

/* ============================================================
   COMPLETE QURAN READER + GLOBAL PLAYER (quranreader.js)
   ============================================================ */
.dir-rtl { direction: rtl; text-align: right; }
.lang-en { font-family: var(--font-body); }
.arabic-mushaf { font-family: var(--font-quran); direction: rtl; unicode-bidi: isolate; }
.arabic-sub { font-family: var(--font-quran); direction: rtl; unicode-bidi: isolate; color: var(--gold-light); line-height: 1.7; }

.chip { display: inline-block; border: 1px solid var(--border-gold); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 6px 13px; font-size: .82rem; font-weight: 600; cursor: pointer; font-family: var(--font-body); }
.chip:hover { border-color: var(--gold); color: var(--gold-light); }

.input { width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font-family: var(--font-body); font-size: 1rem; }
.input:focus { outline: none; border-color: var(--gold); }

/* ----- reader shell ----- */
.qreader { padding-bottom: 130px; }
.qr-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.qr-head h2 { margin: 0; }
.q-en { color: var(--text-dim); font-size: .9rem; margin-top: 2px; }
.qr-nav, .qr-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.qr-tools { justify-content: center; }
.mini { font-size: .8rem; color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; }
.mini select { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; }

/* ----- ayah block ----- */
.qread-wrap { display: grid; gap: 14px; }
.ayah { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.ayah-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ayah-num { min-width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-gold); color: var(--gold-light); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
.ayah-meta { flex: 1; color: var(--text-mute); font-size: .75rem; }
.ayah-actions { display: flex; gap: 4px; }
.abtn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; font-size: .9rem; display: inline-flex; align-items: center; justify-content: center; }
.abtn:hover { border-color: var(--gold); color: var(--gold-light); }
.ayah-text { font-family: var(--font-quran); direction: rtl; unicode-bidi: isolate; text-align: right; line-height: 2; margin: 4px 0; color: var(--text); cursor: text; }
.aya-end { color: var(--gold); font-size: .85em; display: inline; }
.sajda-mark { color: var(--gold-light); font-size: 1.1em; margin: 0 4px; }
.ayah-tr { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); color: var(--text-dim); font-size: .95rem; line-height: 1.6; }

/* Arabic size settings */
.qreader[data-qsize="sm"] .ayah-text { font-size: 1.1rem; }
.qreader[data-qsize="md"] .ayah-text { font-size: 1.45rem; }
.qreader[data-qsize="lg"] .ayah-text { font-size: 1.85rem; }
.qreader[data-qsize="xl"] .ayah-text { font-size: 2.3rem; }
.qreader[data-qlh="tight"] .ayah-text { line-height: 1.55; }
.qreader[data-qlh="comfortable"] .ayah-text { line-height: 2; }
.qreader[data-qlh="loose"] .ayah-text { line-height: 2.6; }

/* word-by-word spans */
.qween, .qw { cursor: pointer; border-radius: 4px; }
.qw:hover { background: var(--gold-soft); }

/* ----- focus mode ----- */
body.q-focus .qr-tools, body.q-focus .qr-nav, body.q-focus .qr-head { display: none; }
body.q-focus header#header, body.q-focus #bottomNav { display: none !important; }
body.q-focus { padding-top: 0; }

/* ----- surah browser ----- */
.qurb-box { }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; justify-content: center; }
.surah-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.surah-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-decoration: none; }
.surah-row:hover { border-color: var(--gold); }
.s-surah-num { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-gold); color: var(--gold-light); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.s-surah-name { display: flex; flex-direction: column; }
.s-surah-name .arabic-mushaf { font-size: 1.3rem; }
.s-en { font-size: .8rem; color: var(--text-dim); }
.section-head h3 { margin: 0; }

/* ----- global player ----- */
#q-player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: var(--bg-3); border-top: 1px solid var(--border-gold); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
.qp-wrap { display: flex; align-items: center; gap: 8px; max-width: var(--content-max); margin: 0 auto; flex-wrap: wrap; }
.qp-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 1rem; }
.qp-btn:hover { border-color: var(--gold); }
.qp-main { border-color: var(--border-gold); color: var(--gold-light); background: var(--gold-soft); }
.qp-info { flex: 1; min-width: 140px; }
.qp-title { font-weight: 700; font-size: .9rem; }
.qp-sub { color: var(--text-dim); font-size: .78rem; }
.qp-progress { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.qp-bar { height: 100%; background: var(--grad-gold); width: 0%; border-radius: 3px; transition: width .2s linear; }
.qp-time { font-size: .75rem; color: var(--text-dim); min-width: 70px; text-align: right; }
.qp-ctrl { display: flex; align-items: center; gap: 6px; }
.qp-ctrl select { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; font-size: .8rem; }

/* ----- bottom sheet (word-by-word) ----- */
.q-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; background: var(--bg-3); border-top: 1px solid var(--border-gold); border-radius: 18px 18px 0 0; padding: 18px; transform: translateY(110%); transition: transform .25s ease; box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; }
.q-sheet.open { transform: translateY(0); }
.q-sheet-close { position: absolute; top: 10px; right: 14px; cursor: pointer; color: var(--text-dim); font-size: 1.1rem; }
.sheet-worddir { display: flex; align-items: center; gap: 14px; margin: 4px 0 10px; }
.sheet-worddir b { font-family: var(--font-quran); font-size: 2rem; direction: rtl; color: var(--gold-light); }
.sheet-hint { color: var(--text-dim); font-size: .9rem; }

@media (min-width: 768px) {
  #q-player { padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); }
  .qp-progress { width: 30%; }
}

/* active ayah while playing */
.ayah.active { border-color: var(--gold); background: var(--gold-soft); }
.ayah.active .ayah-num { border-color: var(--gold); color: var(--gold-light); }
