/* e-quran.com — Quran scanned pages V15
   Scoped to body.qpages-page / body.qpages-index.
   Theme policy: follow the site's theme and always provide an explicit light reset.
*/

:root {
  --qpr-radius: 20px;
}

/* =========================
   LIGHT THEME — DEFAULT
   ========================= */
body.qpages-page,
body.qpages-index {
  --qpr-bg: var(--background-color, #f7f6f1);
  --qpr-surface: #fffdf8;
  --qpr-surface-2: #f7f2e7;
  --qpr-surface-3: #efe8d7;
  --qpr-text: var(--text-color, #25312f);
  --qpr-muted: var(--text-muted, #687471);
  --qpr-heading: #173f39;
  --qpr-primary: #1d514a;
  --qpr-primary-hover: #17453f;
  --qpr-primary-soft: #e7f1ee;
  --qpr-gold: #b7892b;
  --qpr-gold-strong: #946b18;
  --qpr-gold-soft: #fff5d8;
  --qpr-info: #315f85;
  --qpr-info-soft: #edf5fb;
  --qpr-success: #2d6d55;
  --qpr-danger: #9b443c;
  --qpr-line: rgba(77, 67, 42, .16);
  --qpr-line-strong: rgba(77, 67, 42, .25);
  --qpr-field: #fffefb;
  --qpr-control: #fffdf8;
  --qpr-control-hover: #f8f2e4;
  --qpr-shadow: 0 16px 42px rgba(36, 31, 18, .09);
  --qpr-shadow-soft: 0 8px 24px rgba(36, 31, 18, .07);
  --qpr-focus-ring: rgba(183, 137, 43, .28);
  --qpr-gold-border: rgba(183, 137, 43, .46);
  --qpr-info-border: rgba(49, 95, 133, .28);
  --qpr-primary-border: rgba(29, 81, 74, .28);
  --qpr-success-shadow: rgba(45, 109, 85, .22);
  --qpr-success-hover: #245b47;
  --qpr-surface-overlay: rgba(255, 253, 248, .96);
  --qpr-surface-overlay-soft: rgba(255, 253, 248, .94);
  background: var(--qpr-bg);
  color: var(--qpr-text);
  color-scheme: light;
}

/* Explicit light reset. This intentionally comes after any stale/temporary dark class. */
html[data-theme="light"] body.qpages-page,
html[data-theme="light"] body.qpages-index,
html[data-color-mode="light"] body.qpages-page,
html[data-color-mode="light"] body.qpages-index,
html.light body.qpages-page,
html.light body.qpages-index,
body.qpages-page.light,
body.qpages-index.light,
body.qpages-page.light-mode,
body.qpages-index.light-mode {
  --qpr-bg: var(--background-color, #f7f6f1);
  --qpr-surface: #fffdf8;
  --qpr-surface-2: #f7f2e7;
  --qpr-surface-3: #efe8d7;
  --qpr-text: var(--text-color, #25312f);
  --qpr-muted: var(--text-muted, #687471);
  --qpr-heading: #173f39;
  --qpr-primary: #1d514a;
  --qpr-primary-hover: #17453f;
  --qpr-primary-soft: #e7f1ee;
  --qpr-gold: #b7892b;
  --qpr-gold-strong: #946b18;
  --qpr-gold-soft: #fff5d8;
  --qpr-info: #315f85;
  --qpr-info-soft: #edf5fb;
  --qpr-success: #2d6d55;
  --qpr-danger: #9b443c;
  --qpr-line: rgba(77, 67, 42, .16);
  --qpr-line-strong: rgba(77, 67, 42, .25);
  --qpr-field: #fffefb;
  --qpr-control: #fffdf8;
  --qpr-control-hover: #f8f2e4;
  --qpr-shadow: 0 16px 42px rgba(36, 31, 18, .09);
  --qpr-shadow-soft: 0 8px 24px rgba(36, 31, 18, .07);
  --qpr-focus-ring: rgba(183, 137, 43, .28);
  background: var(--qpr-bg);
  color: var(--qpr-text);
  color-scheme: light;
}

/* =========================
   DARK THEME
   ========================= */
html[data-theme="dark"] body.qpages-page,
html[data-theme="dark"] body.qpages-index,
html[data-color-mode="dark"] body.qpages-page,
html[data-color-mode="dark"] body.qpages-index,
html.dark body.qpages-page,
html.dark body.qpages-index,
html.dark-mode body.qpages-page,
html.dark-mode body.qpages-index,
body.qpages-page.dark,
body.qpages-index.dark,
body.qpages-page.dark-mode,
body.qpages-index.dark-mode,
body.qpages-page.qpages-dark,
body.qpages-index.qpages-dark {
  --qpr-bg: #101615;
  --qpr-surface: #17201f;
  --qpr-surface-2: #1f2b29;
  --qpr-surface-3: #263431;
  --qpr-text: #edf2ef;
  --qpr-muted: #aebbb7;
  --qpr-heading: #ead79e;
  --qpr-primary: #2c6b61;
  --qpr-primary-hover: #35796e;
  --qpr-primary-soft: #203b36;
  --qpr-gold: #d7b45f;
  --qpr-gold-strong: #efd48b;
  --qpr-gold-soft: #302b1d;
  --qpr-info: #83b7dc;
  --qpr-info-soft: #1c2d39;
  --qpr-success: #4f9578;
  --qpr-danger: #d27a71;
  --qpr-line: rgba(236, 218, 169, .14);
  --qpr-line-strong: rgba(236, 218, 169, .24);
  --qpr-field: #111918;
  --qpr-control: #1a2523;
  --qpr-control-hover: #25322f;
  --qpr-shadow: 0 18px 45px rgba(0, 0, 0, .24);
  --qpr-shadow-soft: 0 9px 26px rgba(0, 0, 0, .18);
  --qpr-focus-ring: rgba(215, 180, 95, .30);
  --qpr-gold-border: rgba(215, 180, 95, .38);
  --qpr-info-border: rgba(131, 183, 220, .30);
  --qpr-primary-border: rgba(53, 121, 110, .34);
  --qpr-success-shadow: rgba(79, 149, 120, .20);
  --qpr-success-hover: #407d65;
  --qpr-surface-overlay: rgba(23, 32, 31, .96);
  --qpr-surface-overlay-soft: rgba(23, 32, 31, .94);
  background: var(--qpr-bg);
  color: var(--qpr-text);
  color-scheme: dark;
}

/* Explicit light state wins even if qpages-dark remains briefly during site theme transitions. */
html[data-theme="light"] body.qpages-page.qpages-dark,
html[data-theme="light"] body.qpages-index.qpages-dark,
html[data-color-mode="light"] body.qpages-page.qpages-dark,
html[data-color-mode="light"] body.qpages-index.qpages-dark {
  --qpr-bg: var(--background-color, #f7f6f1);
  --qpr-surface: #fffdf8;
  --qpr-surface-2: #f7f2e7;
  --qpr-surface-3: #efe8d7;
  --qpr-text: var(--text-color, #25312f);
  --qpr-muted: var(--text-muted, #687471);
  --qpr-heading: #173f39;
  --qpr-primary: #1d514a;
  --qpr-primary-hover: #17453f;
  --qpr-primary-soft: #e7f1ee;
  --qpr-gold: #b7892b;
  --qpr-gold-strong: #946b18;
  --qpr-gold-soft: #fff5d8;
  --qpr-info: #315f85;
  --qpr-info-soft: #edf5fb;
  --qpr-success: #2d6d55;
  --qpr-danger: #9b443c;
  --qpr-line: rgba(77, 67, 42, .16);
  --qpr-line-strong: rgba(77, 67, 42, .25);
  --qpr-field: #fffefb;
  --qpr-control: #fffdf8;
  --qpr-control-hover: #f8f2e4;
  --qpr-shadow: 0 16px 42px rgba(36, 31, 18, .09);
  --qpr-shadow-soft: 0 8px 24px rgba(36, 31, 18, .07);
  --qpr-focus-ring: rgba(183, 137, 43, .28);
  background: var(--qpr-bg);
  color: var(--qpr-text);
  color-scheme: light;
}

/* Final explicit-light guard: the site’s declared light state always wins over stale dark classes. */
html[data-theme="light"] body.qpages-page,
html[data-theme="light"] body.qpages-index,
html[data-color-mode="light"] body.qpages-page,
html[data-color-mode="light"] body.qpages-index,
html.light body.qpages-page,
html.light body.qpages-index,
html.light-mode body.qpages-page,
html.light-mode body.qpages-index {
  --qpr-bg: var(--background-color, #f7f6f1);
  --qpr-surface: #fffdf8;
  --qpr-surface-2: #f7f2e7;
  --qpr-surface-3: #efe8d7;
  --qpr-text: var(--text-color, #25312f);
  --qpr-muted: var(--text-muted, #687471);
  --qpr-heading: #173f39;
  --qpr-primary: #1d514a;
  --qpr-primary-hover: #17453f;
  --qpr-primary-soft: #e7f1ee;
  --qpr-gold: #b7892b;
  --qpr-gold-strong: #946b18;
  --qpr-gold-soft: #fff5d8;
  --qpr-info: #315f85;
  --qpr-info-soft: #edf5fb;
  --qpr-success: #2d6d55;
  --qpr-danger: #9b443c;
  --qpr-line: rgba(77, 67, 42, .16);
  --qpr-line-strong: rgba(77, 67, 42, .25);
  --qpr-field: #fffefb;
  --qpr-control: #fffdf8;
  --qpr-control-hover: #f8f2e4;
  --qpr-shadow: 0 16px 42px rgba(36, 31, 18, .09);
  --qpr-shadow-soft: 0 8px 24px rgba(36, 31, 18, .07);
  --qpr-focus-ring: rgba(183, 137, 43, .28);
  --qpr-gold-border: rgba(183, 137, 43, .46);
  --qpr-info-border: rgba(49, 95, 133, .28);
  --qpr-primary-border: rgba(29, 81, 74, .28);
  --qpr-success-shadow: rgba(45, 109, 85, .22);
  --qpr-success-hover: #245b47;
  --qpr-surface-overlay: rgba(255, 253, 248, .96);
  --qpr-surface-overlay-soft: rgba(255, 253, 248, .94);
  background: var(--qpr-bg);
  color: var(--qpr-text);
  color-scheme: light;
}

/* =========================
   BASE LAYOUT
   ========================= */
.qpr-main {
  width: min(1180px, calc(100% - 28px));
  margin-inline: auto;
  padding: 18px 0 48px;
}

.qpr-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  color: var(--qpr-muted);
  font-size: .92rem;
}

.qpr-breadcrumb a {
  color: inherit;
  text-decoration: none;
}

.qpr-breadcrumb a:hover {
  color: var(--qpr-primary);
  text-decoration: underline;
}

.qpr-reader,
.qpr-wird,
.qpr-related,
.qpr-seo-copy,
.qpr-index-hero,
.qpr-index-panel {
  background: var(--qpr-surface);
  border: 1px solid var(--qpr-line);
  border-radius: var(--qpr-radius);
  box-shadow: var(--qpr-shadow);
}

.qpr-reader {
  overflow: hidden;
}

.qpr-reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 14px;
}

.qpr-kicker,
.qpr-section-head span,
.qpr-wird > div > span {
  color: var(--qpr-gold-strong);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.qpr-title-wrap h1,
.qpr-index-hero h1 {
  margin: 4px 0 5px;
  color: var(--qpr-heading);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.35;
}

.qpr-title-wrap p,
.qpr-index-hero p,
.qpr-wird p,
.qpr-related-card small,
.qpr-seo-copy p,
.qpr-last-note {
  margin: 0;
  color: var(--qpr-muted);
  line-height: 1.85;
}

.qpr-progress {
  position: relative;
  min-width: 106px;
  padding: 10px 12px 13px;
  overflow: hidden;
  border: 1px solid var(--qpr-line);
  border-radius: 14px;
  background: var(--qpr-surface-2);
  text-align: center;
}

.qpr-progress::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: var(--qpr-line);
}

.qpr-progress span {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  width: var(--progress);
  height: 4px;
  background: var(--qpr-gold);
}

.qpr-progress b {
  color: var(--qpr-heading);
  font-size: 1.1rem;
}

.qpr-progress small {
  margin-inline-start: 4px;
  color: var(--qpr-muted);
}

/* =========================
   TOOLBAR / FORM CONTROLS
   ========================= */
.qpr-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) minmax(150px, .8fr) minmax(260px, 2fr);
  gap: 10px;
  padding: 12px 20px;
  border-block: 1px solid var(--qpr-line);
  background: var(--qpr-surface-2);
}

.qpr-tools-close {
  display: none;
}

.qpr-jump-form,
.qpr-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--qpr-muted);
  font-size: .78rem;
  font-weight: 700;
}

.qpr-input-row {
  display: flex;
  gap: 6px;
}

.qpr-input-row input,
.qpr-select-wrap select,
.qpr-wird select,
.qpr-index-tools input,
.qpr-index-tools select {
  min-width: 0;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--qpr-line-strong);
  border-radius: 10px;
  outline: none;
  background: var(--qpr-field);
  color: var(--qpr-text);
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.qpr-input-row input:focus,
.qpr-select-wrap select:focus,
.qpr-wird select:focus,
.qpr-index-tools input:focus,
.qpr-index-tools select:focus {
  border-color: var(--qpr-gold);
  box-shadow: 0 0 0 3px var(--qpr-focus-ring);
}

.qpr-input-row button,
.qpr-tools button,
.qpr-wird button,
.qpr-wird a,
.qpr-done-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--qpr-line);
  border-radius: 10px;
  background: var(--qpr-control);
  color: var(--qpr-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 800;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.qpr-input-row button:hover,
.qpr-tools button:hover,
.qpr-wird button:hover,
.qpr-wird a:hover,
.qpr-done-btn:hover {
  background: var(--qpr-control-hover);
  border-color: var(--qpr-line-strong);
}

.qpr-input-row button:focus-visible,
.qpr-tools button:focus-visible,
.qpr-wird button:focus-visible,
.qpr-wird a:focus-visible,
.qpr-done-btn:focus-visible,
.qpr-nav-btn:focus-visible,
.qpr-index-btn:focus-visible,
.qpr-continue:focus-visible,
.qpr-page-card:focus-visible,
.qpr-juz-tabs button:focus-visible,
.qpr-mobile-nav a:focus-visible,
.qpr-mobile-nav button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--qpr-focus-ring);
}

.qpr-input-row button {
  min-width: 64px;
  border-color: transparent;
  background: var(--qpr-primary);
  color: #fff;
  box-shadow: 0 5px 14px rgba(29, 81, 74, .16);
}

.qpr-input-row button:hover {
  background: var(--qpr-primary-hover);
  border-color: transparent;
}

.qpr-tools {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.qpr-tools button[aria-pressed="true"] {
  border-color: var(--qpr-gold);
  background: var(--qpr-gold-soft);
  color: var(--qpr-gold-strong);
}

/* Important reader actions — visually distinct without becoming loud. */
.qpr-tools [data-qpr-fullscreen] {
  border-color: transparent;
  background: var(--qpr-primary);
  color: #fff;
}

.qpr-tools [data-qpr-fullscreen]:hover {
  background: var(--qpr-primary-hover);
  color: #fff;
}

.qpr-tools [data-qpr-focus] {
  border-color: var(--qpr-gold-border);
  background: var(--qpr-gold-soft);
  color: var(--qpr-gold-strong);
}

.qpr-tools [data-qpr-share] {
  border-color: var(--qpr-info-border);
  background: var(--qpr-info-soft);
  color: var(--qpr-info);
}

.qpr-tools [data-qpr-favorite][aria-pressed="true"] {
  border-color: var(--qpr-gold);
  background: var(--qpr-gold-soft);
  color: var(--qpr-gold-strong);
}

/* =========================
   PAGE NAVIGATION
   ========================= */
.qpr-page-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
}

.qpr-page-nav-top {
  border-bottom: 1px solid var(--qpr-line);
}

.qpr-nav-btn,
.qpr-index-btn {
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid var(--qpr-line-strong);
  border-radius: 12px;
  background: var(--qpr-control);
  color: var(--qpr-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.qpr-nav-btn:hover {
  border-color: var(--qpr-primary-border);
  background: var(--qpr-primary-soft);
  color: var(--qpr-primary);
}

.qpr-nav-btn:first-child {
  justify-self: start;
}

.qpr-nav-btn:last-child {
  justify-self: end;
}

.qpr-nav-num {
  color: var(--qpr-gold-strong);
}

.qpr-index-btn {
  border-color: transparent;
  background: var(--qpr-primary);
  color: #fff;
  box-shadow: 0 5px 16px rgba(29, 81, 74, .15);
}

.qpr-index-btn:hover {
  background: var(--qpr-primary-hover);
  color: #fff;
}

.qpr-nav-btn.is-disabled {
  opacity: .38;
  pointer-events: none;
}

/* =========================
   QURAN IMAGE
   ========================= */
.qpr-image-stage {
  margin: 0;
  padding: 18px 18px 8px;
  background: linear-gradient(180deg, var(--qpr-surface-2), transparent);
}

.qpr-image-scroll {
  overflow: auto;
  max-height: min(82vh, 1050px);
  border-radius: 14px;
  outline: none;
  text-align: center;
  /* Keep horizontal zoom/pan contained, but allow vertical scroll chaining
     to the document when the Quran image reaches its edge. */
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  touch-action: pan-x pan-y pinch-zoom;
  scrollbar-width: thin;
}

.qpr-page-image {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin-inline: auto;
  border: 1px solid rgba(98, 78, 38, .10);
  border-radius: 8px;
  background: #fbf7e8;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .15);
  transition: width .18s ease;
}

.qpr-image-scroll:focus-visible {
  box-shadow: 0 0 0 3px var(--qpr-focus-ring);
}

.qpr-image-stage figcaption {
  padding: 9px 8px 0;
  color: var(--qpr-muted);
  text-align: center;
  font-size: .78rem;
}

/* Keep the Quran page itself natural in dark mode; only its surroundings change. */
html[data-theme="dark"] body.qpages-page .qpr-page-image,
html.dark body.qpages-page .qpr-page-image,
body.qpages-page.dark .qpr-page-image,
body.qpages-page.dark-mode .qpr-page-image,
body.qpages-page.qpages-dark .qpr-page-image {
  border-color: rgba(236, 218, 169, .10);
  background: #eee8d6;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .32);
}

/* The page image also returns completely to the light presentation after a theme switch. */
html[data-theme="light"] body.qpages-page .qpr-page-image,
html[data-color-mode="light"] body.qpages-page .qpr-page-image,
html.light body.qpages-page .qpr-page-image,
html.light-mode body.qpages-page .qpr-page-image {
  border-color: rgba(98, 78, 38, .10);
  background: #fbf7e8;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .15);
}

/* =========================
   READING / WIRD
   ========================= */
.qpr-reading-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 20px 20px;
}

.qpr-done-btn {
  border-color: transparent;
  background: var(--qpr-success);
  color: #fff;
  box-shadow: 0 5px 16px var(--qpr-success-shadow);
}

.qpr-done-btn:hover,
.qpr-done-btn.is-done {
  border-color: transparent;
  background: var(--qpr-success-hover);
  color: #fff;
}

.qpr-wird,
.qpr-related,
.qpr-seo-copy {
  margin-top: 18px;
  padding: 20px 22px;
}

.qpr-wird {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.qpr-wird h2,
.qpr-section-head h2,
.qpr-seo-copy h2 {
  margin: 3px 0 6px;
  color: var(--qpr-heading);
  font-size: 1.15rem;
}

.qpr-wird-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.qpr-wird-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--qpr-muted);
  font-size: .78rem;
  font-weight: 700;
}

.qpr-wird-controls select {
  width: 100px;
}

.qpr-wird button,
.qpr-wird .qpr-continue {
  border-color: transparent;
  background: var(--qpr-gold);
  color: #fff;
}

.qpr-wird button:hover,
.qpr-wird .qpr-continue:hover {
  border-color: transparent;
  background: var(--qpr-gold-strong);
  color: #fff;
}

.qpr-wird-progress {
  position: relative;
  flex-basis: 100%;
  height: 9px;
  overflow: visible;
  border-radius: 99px;
  background: var(--qpr-line);
}

.qpr-wird-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--qpr-gold-strong), var(--qpr-gold));
}

.qpr-wird-progress b {
  position: absolute;
  inset: auto 0 12px;
  color: var(--qpr-muted);
  text-align: center;
  font-size: .78rem;
}

/* =========================
   RELATED CONTENT
   ========================= */
.qpr-related-surahs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.qpr-surah-chip {
  padding: 6px 10px;
  border: 1px solid var(--qpr-line);
  border-radius: 999px;
  background: var(--qpr-control);
  color: var(--qpr-text);
  text-decoration: none;
  font-size: .85rem;
}

.qpr-surah-chip:hover {
  border-color: var(--qpr-gold);
  background: var(--qpr-gold-soft);
  color: var(--qpr-gold-strong);
}

.qpr-related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.qpr-related-card {
  min-height: 105px;
  padding: 14px;
  border: 1px solid var(--qpr-line);
  border-radius: 15px;
  background: var(--qpr-surface-2);
  color: var(--qpr-text);
  text-decoration: none;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto 1fr;
  column-gap: 10px;
  align-items: center;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.qpr-related-card:hover {
  transform: translateY(-1px);
  border-color: var(--qpr-line-strong);
  background: var(--qpr-control-hover);
}

.qpr-related-card.is-primary {
  border-color: var(--qpr-gold-border);
  background: var(--qpr-gold-soft);
}

.qpr-related-icon {
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--qpr-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.qpr-related-card.is-primary .qpr-related-icon {
  background: var(--qpr-gold-strong);
}

.qpr-related-card strong {
  color: var(--qpr-heading);
  font-size: .95rem;
}

.qpr-related-card small {
  font-size: .79rem;
  line-height: 1.55;
}

.qpr-seo-copy {
  box-shadow: none;
}

.qpr-seo-copy p {
  font-size: .91rem;
}

.qpr-mobile-nav {
  display: none;
}

/* =========================
   INDEX
   ========================= */
.qpr-index-hero {
  padding: 24px;
  margin-bottom: 14px;
  border-color: rgba(255, 255, 255, .08);
  background: linear-gradient(135deg, #173f39, #245b52);
  color: #fff;
}

.qpr-index-hero h1 {
  color: #fff;
}

.qpr-index-hero p {
  max-width: 760px;
  color: rgba(255, 255, 255, .84);
}

.qpr-index-hero .qpr-kicker {
  color: #efd58d;
}

.qpr-index-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.qpr-index-stats span {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  font-size: .82rem;
}

.qpr-index-panel {
  padding: 18px;
}

.qpr-index-tools {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.qpr-index-tools label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--qpr-muted);
  font-size: .8rem;
  font-weight: 800;
}

.qpr-index-tools input,
.qpr-index-tools select {
  height: 42px;
  border-radius: 11px;
}

.qpr-continue {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--qpr-gold);
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: 0 5px 16px rgba(183, 137, 43, .16);
}

.qpr-continue:hover {
  background: var(--qpr-gold-strong);
  color: #fff;
}

.qpr-juz-tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding: 14px 0 8px;
  scrollbar-width: thin;
}

.qpr-juz-tabs button {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--qpr-line);
  border-radius: 999px;
  background: var(--qpr-control);
  color: var(--qpr-text);
  cursor: pointer;
  font: inherit;
}

.qpr-juz-tabs button:hover {
  border-color: var(--qpr-line-strong);
  background: var(--qpr-control-hover);
}

.qpr-juz-tabs button.is-active {
  border-color: transparent;
  background: var(--qpr-primary);
  color: #fff;
}

.qpr-pages-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.qpr-page-card {
  min-height: 76px;
  padding: 9px;
  border: 1px solid var(--qpr-line);
  border-radius: 13px;
  background: var(--qpr-control);
  color: var(--qpr-text);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.qpr-page-card b {
  color: var(--qpr-heading);
  font-size: 1.1rem;
}

.qpr-page-card small {
  margin-top: 4px;
  color: var(--qpr-muted);
  font-size: .69rem;
}

.qpr-page-card:hover {
  transform: translateY(-1px);
  border-color: var(--qpr-gold-border);
  background: var(--qpr-gold-soft);
  box-shadow: var(--qpr-shadow-soft);
}

.qpr-page-card[hidden] {
  display: none;
}

.qpr-index-empty {
  padding: 28px;
  color: var(--qpr-muted);
  text-align: center;
}

/* =========================
   FOCUS / FULLSCREEN
   ========================= */
body.qpages-focus #header,
body.qpages-focus #footer,
body.qpages-focus .qpr-breadcrumb,
body.qpages-focus .qpr-wird,
body.qpages-focus .qpr-related,
body.qpages-focus .qpr-seo-copy {
  display: none !important;
}

body.qpages-focus .qpr-main {
  width: min(1100px, calc(100% - 16px));
  padding-top: 8px;
}

body.qpages-focus .qpr-reader {
  border-radius: 12px;
}

#quran-page-reader:fullscreen {
  padding: 0;
  overflow: auto;
  background: var(--qpr-bg);
  color: var(--qpr-text);
}

#quran-page-reader:fullscreen .qpr-image-scroll {
  max-height: none;
}

#quran-page-reader:fullscreen .qpr-image-stage {
  min-height: calc(100vh - 170px);
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 980px) {
  .qpr-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .qpr-tools {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .qpr-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qpr-pages-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .qpr-main {
    width: min(100% - 16px, 700px);
    padding: 10px 0 88px;
  }

  .qpr-reader-head {
    padding: 16px;
    align-items: center;
  }

  .qpr-progress {
    min-width: 88px;
  }

  .qpr-toolbar {
    display: none;
    position: fixed;
    z-index: 95;
    inset: auto 8px calc(76px + env(safe-area-inset-bottom)) 8px;
    max-height: min(68vh, 570px);
    overflow: auto;
    grid-template-columns: 1fr 1fr;
    padding: 12px;
    border: 1px solid var(--qpr-line-strong);
    border-radius: 18px;
    background: var(--qpr-surface-overlay);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
    backdrop-filter: blur(18px);
  }

  .qpr-toolbar.is-open {
    display: grid;
  }

  .qpr-tools-close {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--qpr-line-strong);
    border-radius: 10px;
    background: var(--qpr-surface-3);
    color: var(--qpr-text);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
  }

  .qpr-tools {
    gap: 5px;
  }

  .qpr-tools button {
    flex: 1 1 calc(33.33% - 6px);
    padding-inline: 7px;
    font-size: .84rem;
  }

  .qpr-page-nav {
    padding: 10px;
    grid-template-columns: 1fr auto 1fr;
  }

  .qpr-nav-btn,
  .qpr-index-btn {
    min-height: 40px;
    padding: 6px 9px;
    font-size: .85rem;
  }

  .qpr-image-stage {
    padding: 10px 6px 6px;
  }

  .qpr-image-scroll {
    max-height: none;
    border-radius: 9px;
    /* Vertical finger movement belongs to the page. When the image ends,
       scrolling continues through the reader content instead of getting trapped. */
    overscroll-behavior-y: auto;
    touch-action: pan-x pan-y pinch-zoom;
  }

  .qpr-page-image {
    border-radius: 5px;
  }

  .qpr-wird {
    align-items: stretch;
    flex-direction: column;
  }

  .qpr-wird-controls > * {
    flex: 1 1 120px;
  }

  .qpr-related-grid {
    grid-template-columns: 1fr;
  }

  .qpr-related-card {
    min-height: 86px;
  }

  .qpr-mobile-nav {
    position: fixed;
    z-index: 80;
    inset: auto 8px max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--qpr-line-strong);
    border-radius: 16px;
    background: var(--qpr-surface-overlay-soft);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    backdrop-filter: blur(14px);
  }

  .qpr-mobile-nav a,
  .qpr-mobile-nav button,
  .qpr-mobile-nav > span {
    min-height: 45px;
    border: 0;
    background: transparent;
    color: var(--qpr-text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    font: inherit;
    font-weight: 800;
  }

  .qpr-mobile-nav button[data-qpr-mobile-tools] {
    border-radius: 11px;
    background: var(--qpr-primary);
    color: #fff;
  }

  .qpr-mobile-nav span {
    font-size: .68rem;
  }

  .qpr-mobile-nav .is-disabled {
    opacity: .3;
  }

  .qpr-index-tools {
    grid-template-columns: 1fr;
  }

  .qpr-pages-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .qpr-reader-head {
    gap: 8px;
  }

  .qpr-title-wrap h1 {
    font-size: 1.2rem;
  }

  .qpr-title-wrap p {
    font-size: .78rem;
  }

  .qpr-progress {
    min-width: 72px;
    padding-inline: 7px;
  }

  .qpr-toolbar {
    grid-template-columns: 1fr;
  }

  .qpr-tools {
    grid-column: auto;
  }

  .qpr-page-nav {
    gap: 5px;
  }

  .qpr-nav-btn,
  .qpr-index-btn {
    font-size: .78rem;
  }

  .qpr-related,
  .qpr-wird,
  .qpr-seo-copy {
    padding: 16px;
  }

  .qpr-pages-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .qpr-page-image,
  .qpr-page-card,
  .qpr-nav-btn,
  .qpr-index-btn,
  .qpr-tools button,
  .qpr-done-btn {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
