/* ============================================================
   📖 القرآن الكريم — the look of the Quran subject
   A calmer cousin of the app's bright style: sage paper, deep green ink,
   Mushaf gold. The same chunky buttons, softer colour, no confetti.
   ============================================================ */
:root {
  --q-ink: #0e4d3c;
  --q-ink-soft: #e3efe8;
  --q-gold: #b8892b;
  --q-gold-soft: #f1e6c8;
  --q-paper: #f4f6ef;
  --q-page: #fbfcf8;
  --q-line: #d6ddcb;
  --q-text: #1b2621;
  --q-muted: #5b6b62;
  --q-font: 'Amiri Quran', 'Amiri', 'Scheherazade New', 'Noto Naskh Arabic', 'Traditional Arabic', serif;
}
:root[data-theme="dark"] {
  --q-ink: #7fd1b4;
  --q-ink-soft: #173229;
  --q-gold: #e2b85a;
  --q-gold-soft: #3a3220;
  --q-paper: #0f1d19;
  --q-page: #14251f;
  --q-line: #24372f;
  --q-text: #e4ebe5;
  --q-muted: #9baea4;
}

.quran-text { font-family: var(--q-font); font-weight: 400; }

/* ---------- tajweed colours (AlQuran.cloud's palette; the two deep blues are lifted in dark mode) ---------- */
.tj-h, .tj-s, .tj-l { color: #9a9a9a; }
.tj-n { color: #537fff; }
.tj-p { color: #4050ff; }
.tj-m { color: #000ebc; }
.tj-o { color: #2144c1; }
.tj-q { color: #dd0008; }
.tj-c { color: #d500b7; }
.tj-f { color: #9400a8; }
.tj-w { color: #58b800; }
.tj-i { color: #26bffd; }
.tj-a { color: #169777; }
.tj-u { color: #169200; }
.tj-d, .tj-b { color: #a1a1a1; }
.tj-g { color: #ff7e1e; }
:root[data-theme="dark"] .tj-m { color: #7d8cff; }
:root[data-theme="dark"] .tj-o { color: #6f8cff; }
:root[data-theme="dark"] .tj-p { color: #8591ff; }
:root[data-theme="dark"] .tj-f { color: #cc66dd; }

/* ---------- the subject screen ---------- */
.screen-quran { background: var(--q-paper); color: var(--q-text); }
.screen-quran .topbar { background: var(--q-page); border-bottom: 2px solid var(--q-gold); }
.screen-quran .lesson-title { color: var(--q-ink); font-weight: 800; }
.quran-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 16px 90px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 760px) { .quran-body { max-width: 760px; width: 100%; margin: 0 auto; } }
@media (min-width: 900px) { .quran-body:has(.qm-book.spread) { max-width: 1040px; } }

.qh-note { text-align: center; color: var(--q-muted); padding: 14px 8px; line-height: 1.8; }
.qh-foot { text-align: center; color: var(--q-muted); font-size: .8rem; line-height: 1.8; padding: 8px 12px; }
.qh-section { font-weight: 800; color: var(--q-ink); margin-top: 6px; }
.qh-btn { font: inherit; font-weight: 800; border: 0; border-radius: 14px; padding: 12px 18px; cursor: pointer; background: var(--q-ink); color: var(--q-paper); box-shadow: 0 4px 0 rgba(0,0,0,.22); }
.qh-btn.alt { background: var(--q-ink-soft); color: var(--q-ink); box-shadow: 0 4px 0 var(--q-line); }
.qh-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.22); }
.qh-chip { font: inherit; font-size: .85rem; font-weight: 700; border: 1.5px solid var(--q-line); background: var(--q-page); color: var(--q-ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.qh-chip:hover { border-color: var(--q-gold); }
.qh-btn:focus-visible, .qh-chip:focus-visible, .qh-card:focus-visible, .qi-row:focus-visible, .qs-hit:focus-visible, .ql-ayah:focus-visible, .qh-nav:focus-visible { outline: 3px solid var(--q-gold); outline-offset: 2px; }

/* ---------- hub ---------- */
.qh-hero {
  position: relative; text-align: center; padding: 26px 16px 18px; border-radius: 6px;
  background: var(--q-page); border: 2px solid var(--q-gold); outline: 1px solid var(--q-gold); outline-offset: 4px; margin: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23b8892b' stroke-opacity='.16' stroke-width='1.4'%3E%3Crect x='14' y='14' width='28' height='28'/%3E%3Crect x='14' y='14' width='28' height='28' transform='rotate(45 28 28)'/%3E%3C/g%3E%3C/svg%3E");
}
.qh-hero-ar { font-family: var(--q-font); font-size: 1.9rem; color: var(--q-ink); line-height: 1.6; }
.qh-hero-sub { color: var(--q-muted); font-size: .9rem; margin: 4px 0 10px; }
.qh-bar { height: 10px; border-radius: 99px; background: var(--q-line); overflow: hidden; max-width: 320px; margin: 0 auto; }
.qh-bar span { display: block; height: 100%; background: var(--q-gold); border-radius: 99px; }
.qh-continue { display: flex; align-items: center; gap: 12px; width: 100%; font: inherit; text-align: start; cursor: pointer; border: 2px solid var(--q-ink); border-radius: 16px; padding: 12px 14px; background: var(--q-ink-soft); color: var(--q-text); box-shadow: 0 4px 0 var(--q-ink); }
.qh-continue small { display: block; color: var(--q-muted); }
.qh-continue b { color: var(--q-ink); }
.qh-continue-ico { font-size: 1.8rem; }
.qh-go { margin-inline-start: auto; color: var(--q-ink); font-weight: 900; }
.qh-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .qh-grid { grid-template-columns: repeat(3, 1fr); } }
.qh-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font: inherit; text-align: start; cursor: pointer; padding: 14px; border-radius: 14px; background: var(--q-page); color: var(--q-text); border: 1.5px solid var(--q-line); border-bottom: 4px solid var(--q-gold); }
.qh-card:hover { border-color: var(--q-gold); }
.qh-card b { color: var(--q-ink); }
.qh-card small { color: var(--q-muted); line-height: 1.5; }
.qh-card-ico { font-size: 1.7rem; }
.qh-card.soon { opacity: .65; border-bottom-color: var(--q-line); }

/* ---------- the Mushaf book ---------- */
.qm { display: flex; flex-direction: column; gap: 10px; }
.qm-bar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.qm-book { display: flex; flex-direction: row; justify-content: center; gap: 0; perspective: 1400px; transform-origin: right center; }
.qm-page {
  position: relative; display: flex; flex-direction: column; flex: 0 1 460px; width: 100%; max-width: 460px; aspect-ratio: 5 / 7.2;
  padding: 12px 18px 8px; background: var(--q-page); color: var(--q-text);
  border: 2px solid var(--q-gold); outline: 1px solid var(--q-gold); outline-offset: -8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.qm-book.spread .qm-page { flex-basis: 480px; }
.qm-book.spread .qm-page.odd { border-inline-end-width: 1px; box-shadow: inset -14px 0 18px -14px rgba(0,0,0,.25); }
.qm-book.spread .qm-page.even { border-inline-start-width: 1px; box-shadow: inset 14px 0 18px -14px rgba(0,0,0,.25); }
.qm-page header, .qm-page footer { display: flex; justify-content: space-between; font-size: .72rem; color: var(--q-muted); padding: 2px 6px; }
.qm-page footer { justify-content: center; color: var(--q-gold); font-weight: 800; }
.qm-text {
  flex: 1; min-height: 0; overflow: hidden; padding: 6px 4px; line-height: 2.15;
  text-align: justify; text-align-last: center; text-justify: inter-word; font-size: 22px;
  display: block;
}
.qm-page.short .qm-text { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.qm-surah-head { text-align: center; margin: 4px 0; padding: 2px 0; border: 1.5px solid var(--q-gold); border-radius: 4px; background: var(--q-gold-soft); color: var(--q-ink); font-size: .95em; text-align-last: center; }
.qm-basmala { text-align: center; text-align-last: center; color: var(--q-ink); }
.qm-ayah { cursor: pointer; border-radius: 6px; transition: background .2s; }
.qm-ayah:hover { background: var(--q-ink-soft); }
.qm-ayah.playing { background: var(--q-gold-soft); }
.qm-ayah.flash { animation: qFlash 2.4s ease; }
@keyframes qFlash { 0%, 60% { background: var(--q-gold-soft); outline: 2px solid var(--q-gold); } 100% { background: transparent; outline: 2px solid transparent; } }
.qm-no { color: var(--q-gold); font-size: .8em; white-space: nowrap; }
.qm-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qh-nav { font: inherit; font-weight: 800; border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; background: var(--q-ink); color: var(--q-paper); }
.qh-nav:disabled { opacity: .35; cursor: default; }
.qm-go { color: var(--q-muted); font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.qm-go input { width: 4.2em; font: inherit; text-align: center; padding: 6px; border-radius: 8px; border: 1.5px solid var(--q-line); background: var(--q-page); color: var(--q-text); }
/* the page turn: the leaf folds around the spine on the right */
.qm-book.turn-next .qm-page { animation: qTurnNext .42s ease; transform-origin: right center; }
.qm-book.turn-prev .qm-page { animation: qTurnPrev .42s ease; transform-origin: right center; }
@keyframes qTurnNext { from { transform: rotateY(55deg); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes qTurnPrev { from { transform: rotateY(-55deg); opacity: .3; } to { transform: none; opacity: 1; } }

/* ---------- bottom sheets ---------- */
.qm-sheet-wrap { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.qm-sheet { width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto; background: var(--q-page); color: var(--q-text); border-top: 3px solid var(--q-gold); border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; animation: qSheet .25s ease; }
@keyframes qSheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.qs-title { font-weight: 800; color: var(--q-ink); }
.qs-ayah { font-size: 1.6rem; line-height: 2.1; text-align: center; padding: 8px; border-radius: 12px; background: var(--q-paper); }
.qs-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.qs-rules { display: flex; flex-direction: column; gap: 8px; }
.qs-rule { display: grid; grid-template-columns: 22px auto 1fr; align-items: baseline; gap: 8px; }
.qs-rule small { color: var(--q-muted); }
.qs-sw { font-size: 1.1rem; }

/* ---------- index / search / listen ---------- */
.qi-juz { display: flex; flex-wrap: wrap; gap: 6px; }
.qi-list { display: flex; flex-direction: column; gap: 6px; }
.qi-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; font: inherit; text-align: start; cursor: pointer; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--q-line); background: var(--q-page); color: var(--q-text); }
.qi-row:hover { border-color: var(--q-gold); }
.qi-n { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--q-gold); color: var(--q-gold); font-weight: 800; font-size: .85rem; }
.qi-name { font-size: 1.15rem; color: var(--q-ink); }
.qi-meta { color: var(--q-muted); font-size: .78rem; text-align: end; }
.qs-box input { width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--q-line); background: var(--q-page); color: var(--q-text); }
.qs-box input:focus { outline: none; border-color: var(--q-gold); }
.qs-out { display: flex; flex-direction: column; gap: 8px; }
.qs-hit { display: flex; flex-direction: column; gap: 4px; text-align: start; font: inherit; cursor: pointer; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--q-line); background: var(--q-page); color: var(--q-text); }
.qs-hit:hover { border-color: var(--q-gold); }
.qs-hit.jump { border-color: var(--q-ink); background: var(--q-ink-soft); }
.qs-hit .quran-text { font-size: 1.25rem; line-height: 2; }
.qs-ref { color: var(--q-gold); font-weight: 800; font-size: .8rem; }
.ql { display: flex; flex-direction: column; gap: 10px; }
.ql-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ql label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--q-muted); flex: 1 1 140px; min-width: 0; }
.ql select, .qt-rec { font: inherit; padding: 8px; border-radius: 10px; border: 1.5px solid var(--q-line); background: var(--q-page); color: var(--q-text); max-width: 100%; }
.ql-list { display: flex; flex-direction: column; gap: 6px; }
.ql-ayah { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; font: inherit; text-align: start; cursor: pointer; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--q-line); background: var(--q-page); color: var(--q-text); }
.ql-ayah .quran-text { font-size: 1.3rem; line-height: 2; }
.ql-ayah.playing { background: var(--q-gold-soft); border-color: var(--q-gold); }
.ql-no { color: var(--q-gold); font-weight: 800; text-align: center; }

/* ---------- inside lessons ---------- */
.qz-inline { display: inline-block; font-size: 1.35em; line-height: 2; padding: 0 6px; border-radius: 8px; background: var(--q-ink-soft); color: var(--q-text); }
.qz-word { font-size: 1.35em; line-height: 1.8; padding: 0 4px; border-bottom: 2px solid var(--q-gold); }
.qt-box { display: flex; flex-direction: column; gap: 10px; }
.qt-ayahs { font-size: 1.55rem; line-height: 2.2; text-align: center; padding: 10px; border-radius: 14px; background: var(--q-page); border: 1.5px solid var(--q-line); }
.qt-a { border-radius: 8px; transition: background .2s; }
.qt-a.playing { background: var(--q-gold-soft); }
.qt-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.qt-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; font-size: .8rem; color: var(--q-muted); }
.qt-lg i { font-style: normal; margin-inline-end: 4px; }
.qz-box { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 12px; border-radius: 14px; background: var(--q-page); border: 1.5px solid var(--q-gold); }
.qz-ayah { font-size: 1.6rem; line-height: 2.2; text-align: center; color: var(--q-text); }
.qz-hidden { color: var(--q-muted); padding: 10px; }
.qz-blank { color: var(--q-gold); letter-spacing: .1em; }
.qz-mark { background: var(--q-gold-soft); border-radius: 6px; padding: 0 3px; color: inherit; }
.qz-play { font: inherit; font-weight: 800; border: 0; border-radius: 12px; padding: 8px 16px; cursor: pointer; background: var(--q-ink); color: var(--q-paper); }
.quran-text-option, #choices .quran-text { font-size: 1.35rem; line-height: 2; }

/* ---------- recite & parent ---------- */
.qr { display: flex; flex-direction: column; gap: 12px; }
.qr-p { color: var(--q-muted); line-height: 1.9; margin: 0; }
.qr-note { color: var(--q-muted); font-size: .85rem; line-height: 1.8; margin: 0; }
.qr-err { color: #c0392b; font-weight: 700; line-height: 1.7; margin: 0; }
:root[data-theme="dark"] .qr-err { color: #ff8a80; }
.qr-input { font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--q-line); background: var(--q-page); color: var(--q-text); width: 100%; box-sizing: border-box; }
.qr-input:focus { outline: none; border-color: var(--q-gold); }
.qr-gate { display: flex; align-items: baseline; gap: 10px; font-size: 1.15rem; }
.qr-gate b { color: var(--q-ink); font-size: 1.35rem; }
.qr-list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.8; }
.qr-check { display: flex; gap: 10px; align-items: flex-start; line-height: 1.7; cursor: pointer; }
.qr-check input { margin-top: 6px; width: 18px; height: 18px; accent-color: var(--q-ink); flex: none; }
.qr-center { justify-content: center; }
.qr-stage { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-height: 90px; }
.qr-rec { background: #c0392b; color: #fff; box-shadow: 0 4px 0 #8e281d; }
.qr-stop { background: #c0392b; color: #fff; box-shadow: 0 4px 0 #8e281d; }
.qr-live { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 14px; border-radius: 14px; background: var(--q-page); border: 1.5px solid #c0392b; }
.qr-meter-box { width: 100%; max-width: 360px; height: 12px; border-radius: 99px; background: var(--q-line); overflow: hidden; direction: ltr; }
.qr-meter-box i { display: block; height: 100%; background: #c0392b; transform-origin: left; transform: scaleX(.04); transition: transform .08s linear; }
.qr-time { color: var(--q-muted); font-variant-numeric: tabular-nums; }
.qr-res { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; background: var(--q-page); border: 2px solid var(--q-gold); }
.qr-score { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.qr-score b { font-size: 2.2rem; color: var(--q-ink); }
.qr-score span { color: var(--q-muted); }
.qr-words { font-size: 1.7rem; line-height: 2.3; text-align: center; }
.qr-w.ok { color: #2e7d4f; }
.qr-w.close { color: #b7791f; border-bottom: 2px dotted #b7791f; }
.qr-w.wrong { color: #c0392b; text-decoration: underline wavy #c0392b; }
.qr-w.missing { color: var(--q-muted); opacity: .75; text-decoration: line-through; }
:root[data-theme="dark"] .qr-w.ok { color: #6fcf97; }
:root[data-theme="dark"] .qr-w.close { color: #e8b04a; border-bottom-color: #e8b04a; }
:root[data-theme="dark"] .qr-w.wrong { color: #ff8a80; text-decoration-color: #ff8a80; }
.qr-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .8rem; color: var(--q-muted); }
.qr-legend i { font-style: normal; margin-inline-end: 4px; text-decoration: none; border: 0; }
.qr-fb { display: flex; gap: 12px; align-items: flex-start; background: var(--q-paper); border-radius: 12px; padding: 12px 14px; line-height: 1.8; }
.qr-fb .owl { font-size: 1.6rem; line-height: 1; }
.qr-status { padding: 14px; border-radius: 14px; font-weight: 800; text-align: center; border: 2px solid var(--q-line); }
.qr-status.on { background: var(--q-ink-soft); color: var(--q-ink); border-color: var(--q-ink); }
.qr-status.off { background: var(--q-page); color: var(--q-muted); }
.qr-sheet { z-index: 500; }
