@font-face {
  font-family: "QCF2000";
  src: url("/public/fonts/qcf4/QCF4_QBSML.woff2") format("woff2");
  font-display: block;
}

@font-face { font-family: "QCF2001"; src: url("/public/fonts/qcf4/QCF4_Hafs_01_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2002"; src: url("/public/fonts/qcf4/QCF4_Hafs_02_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2003"; src: url("/public/fonts/qcf4/QCF4_Hafs_03_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2004"; src: url("/public/fonts/qcf4/QCF4_Hafs_04_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2005"; src: url("/public/fonts/qcf4/QCF4_Hafs_05_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2006"; src: url("/public/fonts/qcf4/QCF4_Hafs_06_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2007"; src: url("/public/fonts/qcf4/QCF4_Hafs_07_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2008"; src: url("/public/fonts/qcf4/QCF4_Hafs_08_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2009"; src: url("/public/fonts/qcf4/QCF4_Hafs_09_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2010"; src: url("/public/fonts/qcf4/QCF4_Hafs_10_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2011"; src: url("/public/fonts/qcf4/QCF4_Hafs_11_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2012"; src: url("/public/fonts/qcf4/QCF4_Hafs_12_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2013"; src: url("/public/fonts/qcf4/QCF4_Hafs_13_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2014"; src: url("/public/fonts/qcf4/QCF4_Hafs_14_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2015"; src: url("/public/fonts/qcf4/QCF4_Hafs_15_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2016"; src: url("/public/fonts/qcf4/QCF4_Hafs_16_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2017"; src: url("/public/fonts/qcf4/QCF4_Hafs_17_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2018"; src: url("/public/fonts/qcf4/QCF4_Hafs_18_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2019"; src: url("/public/fonts/qcf4/QCF4_Hafs_19_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2020"; src: url("/public/fonts/qcf4/QCF4_Hafs_20_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2021"; src: url("/public/fonts/qcf4/QCF4_Hafs_21_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2022"; src: url("/public/fonts/qcf4/QCF4_Hafs_22_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2023"; src: url("/public/fonts/qcf4/QCF4_Hafs_23_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2024"; src: url("/public/fonts/qcf4/QCF4_Hafs_24_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2025"; src: url("/public/fonts/qcf4/QCF4_Hafs_25_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2026"; src: url("/public/fonts/qcf4/QCF4_Hafs_26_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2027"; src: url("/public/fonts/qcf4/QCF4_Hafs_27_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2028"; src: url("/public/fonts/qcf4/QCF4_Hafs_28_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2029"; src: url("/public/fonts/qcf4/QCF4_Hafs_29_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2030"; src: url("/public/fonts/qcf4/QCF4_Hafs_30_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2031"; src: url("/public/fonts/qcf4/QCF4_Hafs_31_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2032"; src: url("/public/fonts/qcf4/QCF4_Hafs_32_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2033"; src: url("/public/fonts/qcf4/QCF4_Hafs_33_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2034"; src: url("/public/fonts/qcf4/QCF4_Hafs_34_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2035"; src: url("/public/fonts/qcf4/QCF4_Hafs_35_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2036"; src: url("/public/fonts/qcf4/QCF4_Hafs_36_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2037"; src: url("/public/fonts/qcf4/QCF4_Hafs_37_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2038"; src: url("/public/fonts/qcf4/QCF4_Hafs_38_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2039"; src: url("/public/fonts/qcf4/QCF4_Hafs_39_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2040"; src: url("/public/fonts/qcf4/QCF4_Hafs_40_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2041"; src: url("/public/fonts/qcf4/QCF4_Hafs_41_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2042"; src: url("/public/fonts/qcf4/QCF4_Hafs_42_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2043"; src: url("/public/fonts/qcf4/QCF4_Hafs_43_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2044"; src: url("/public/fonts/qcf4/QCF4_Hafs_44_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2045"; src: url("/public/fonts/qcf4/QCF4_Hafs_45_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2046"; src: url("/public/fonts/qcf4/QCF4_Hafs_46_W.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "QCF2047"; src: url("/public/fonts/qcf4/QCF4_Hafs_47_W.woff2") format("woff2"); font-display: block; }

:root {
  color-scheme: dark;
  --bg: #16161d;
  --panel: #1b1b23;
  --phone: #202029;
  --surface: #252531;
  --surface-2: #2b2b37;
  --line: #363644;
  --line-soft: rgba(255, 255, 255, .07);
  --text: #f7f7ef;
  --muted: #aaaeb8;
  --quiet: #7d8290;
  --empty: #e6e6de;
  --weak: #465829;
  --building: #647e24;
  --strong: #92b81f;
  --mastered: #abda1a;
  --danger: #ff9a8c;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f0;
  --panel: #ffffff;
  --phone: #ffffff;
  --surface: #eef0e8;
  --surface-2: #e3e7d9;
  --line: #cfd5c3;
  --line-soft: rgba(22, 22, 29, .08);
  --text: #18191f;
  --muted: #5d6658;
  --quiet: #72796d;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at top left, rgba(171, 218, 26, .08), transparent 46%),
    radial-gradient(ellipse at bottom right, rgba(127, 168, 13, .06), transparent 48%),
    var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button {
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

h1, h2, h3, p { margin: 0; }

h1 {
  font-size: 1.35rem;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: min(100vw - 16px, 460px);
  height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
  margin: 12px auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--phone);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar,
.reading-top,
.modal-head,
.section-head,
.selected-head,
.detail-title,
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  min-height: 48px;
}

.topbar p,
.section-head p,
small {
  color: var(--muted);
}

.topbar p {
  margin-top: 4px;
  font-size: .82rem;
  line-height: 1.35;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
}

.icon-btn:hover,
.icon-btn.active {
  border-color: rgba(171, 218, 26, .35);
  background: rgba(171, 218, 26, .13);
  color: var(--strong);
}

.icon-btn.small {
  width: 34px;
  height: 34px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  margin: 8px 0 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-results {
  --search-result-row-height: 56px;
  display: grid;
  gap: 8px;
  height: calc((var(--search-result-row-height) * 5) + (8px * 4));
  max-height: calc((var(--search-result-row-height) * 5) + (8px * 4));
  margin-top: 0;
  padding: 0 0 8px;
  overflow-y: auto;
}

.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--search-result-row-height);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.search-result-copy {
  min-width: 0;
}

.search-result-copy strong,
.search-result-copy small {
  display: block;
}

.search-result-copy strong {
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-copy small {
  margin-top: 4px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: .74rem;
  font-weight: 900;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-height: 44px;
  padding: 4px;
  border-radius: var(--radius);
  background: rgba(10, 22, 40, .45);
}

.tabs button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .64rem;
  font-weight: 900;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs .active {
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

.home-panel {
  min-height: 0;
  overflow: auto;
  padding-top: 14px;
}

.section-head {
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.section-head > div {
  flex: 1 1 180px;
}

.section-head .primary-btn {
  flex: 1 1 100%;
  align-self: stretch;
  width: 100%;
}

.section-head p {
  margin-top: 5px;
  font-size: .82rem;
  line-height: 1.34;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 950;
}

.primary-btn {
  border: 1px solid var(--strong);
  background: var(--strong);
  color: #263500;
}

.primary-btn.quiet,
.secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.danger-btn {
  border: 1px solid #6b3b35;
  background: #2b1714;
  color: var(--danger);
}

.full {
  width: 100%;
  margin-top: 10px;
}

.progress-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.mushaf-strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 0;
  height: 2px;
  margin-bottom: 6px;
  overflow: visible;
  border-radius: 0;
  background: var(--line-soft);
}

.mushaf-strip::before,
.mushaf-strip::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  pointer-events: none;
}

.mushaf-strip::before {
  right: 100%;
  background: linear-gradient(to right, transparent, var(--line-soft));
}

.mushaf-strip::after {
  left: 100%;
  background: linear-gradient(to right, var(--line-soft), transparent);
}

.mushaf-strip-segment {
  height: 100%;
}

.section-caption {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
}

.mushaf-strip-label {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  font-size: .88rem;
  letter-spacing: .08em;
  text-align: left;
}

.juz-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.juz-cell,
.page-cell,
.page-chip {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 25px;
  font-weight: 950;
}

.juz-cell {
  min-height: 30px;
  font-size: 13px;
}

.juz-cell.selected {
  outline: 2px solid var(--strong);
  outline-offset: 2px;
}

.selected-head {
  margin: 11px 0 8px;
  justify-content: space-between;
  gap: 8px;
  font-size: .86rem;
  text-align: left;
}

.selected-head .section-caption {
  font-size: .88rem;
  letter-spacing: .08em;
  text-align: left;
}

.summary-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.small-pill,
.type-pill {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 950;
}

.type-pill {
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.page-cell {
  min-height: 34px;
  font-size: 13px;
}

.empty { background: var(--empty); color: #263500; }
.juz-cell.empty,
.page-cell.empty {
  background: var(--surface-2);
  color: #f7f7f7;
}
.juz-cell.progress-cell,
.page-cell.progress-cell {
  background: color-mix(in srgb, var(--weak), var(--mastered) var(--cell-progress, 0%));
  color: var(--cell-ink, #f7f7ef);
}
.weak { background: var(--weak); color: #f7f7ef; }
.building { background: var(--building); color: #fef3c7; }
.strong { background: var(--strong); color: #263500; }
.mastered { background: var(--mastered); color: #263500; }

.small-pill.empty,
.ayah-mark.empty {
  background: var(--count-color, var(--empty));
  color: var(--count-ink, #263500);
}

.small-pill.weak,
.ayah-mark.weak {
  background: var(--count-color, var(--weak));
  color: var(--count-ink, #f7f7ef);
}

.small-pill.building,
.ayah-mark.building {
  background: var(--count-color, var(--building));
  color: var(--count-ink, #fef3c7);
}

.small-pill.strong,
.ayah-mark.strong {
  background: var(--count-color, var(--strong));
  color: var(--count-ink, #263500);
}

.small-pill.mastered,
.ayah-mark.mastered {
  background: var(--count-color, var(--mastered));
  color: var(--count-ink, #263500);
}

.label {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.queue-list {
  display: grid;
  gap: 8px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.queue-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.list-row-juz {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--line) 72%, var(--strong) 28%);
  min-height: 48px;
}

.list-row-surah {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  direction: ltr;
  align-items: center;
  column-gap: 22px;
  row-gap: 3px;
}

.surah-row-number {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  padding-inline: 20px;
  font-size: 1.64rem;
  font-weight: 800;
  text-align: right;
  color: var(--muted);
}

.surah-row-copy {
  grid-column: 2;
  min-width: 0;
  padding-left: 12px;
}

.surah-row-copy strong,
.surah-row-copy small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surah-row-copy small {
  margin-top: 2px;
}

.surah-row-page {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  min-width: 44px;
  padding: 4px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  font-size: .72rem;
  font-weight: 800;
  text-align: right;
  color: var(--muted);
}

.list-row strong,
.list-row small {
  display: block;
}

.list-row small {
  margin-top: 3px;
  font-size: .7rem;
  font-weight: 800;
}

.list-row.static > button:first-child {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.4;
}

.reader-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.reading-top {
  min-height: 44px;
  font-weight: 900;
}

.reading-meta {
  min-width: 0;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

.page-shell {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  margin-top: 8px;
  --mushaf-row-height: 2.13rem;
  --mushaf-page-content-height: min(660px, 126.3vw);
  flex: 1 1 auto;
  min-height: 0;
  height: min(
    max(clamp(430px, 62vh, 620px), calc(var(--mushaf-page-content-height) + 38px)),
    100%
  );
  padding: 18px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: grab;
  touch-action: pan-y;
}

.reader-shell .page-shell {
  width: calc(100% + 24px);
  margin-inline: -12px;
}

.page-shell.odd {
  padding-left: 0;
}

.page-shell.even {
  padding-right: 0;
}

.page-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 300%;
  height: 100%;
  min-height: 0;
  transform: translateX(calc(-33.333333% + var(--track-offset, 0px)));
  will-change: transform;
}

.page-track.dragging {
  transition: none;
}

.page-track:not(.dragging) {
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}

.page-slot {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: visible;
}

.page-slot.previous,
.page-slot.next {
  pointer-events: none;
  visibility: hidden;
}

.page-track.dragging .page-slot.previous,
.page-track.dragging .page-slot.next,
.page-track[data-track-direction="previous"] .page-slot.previous,
.page-track[data-track-direction="next"] .page-slot.next {
  visibility: visible;
}

.page-slot.current {
  pointer-events: auto;
  visibility: visible;
}

.page-slot.empty {
  visibility: hidden;
}

.qcf4-slot {
  place-items: center;
  overflow: visible;
}

.page-shell.dragging {
  cursor: grabbing;
  user-select: none;
}

.page-slot.current .ayah-marker[data-ayah],
.page-slot.current button.ayah-mark[data-ayah] {
  cursor: pointer;
}

.page-shell.dragging .ayah-marker[data-ayah],
.page-shell.dragging button.ayah-mark[data-ayah] {
  cursor: grabbing;
}

.page-shell.swipe-armed .mushaf-line,
.page-shell.swipe-armed .line {
  user-select: none;
}

.ayah-mark.inert {
  pointer-events: none;
}

.page-slot.odd::after,
.page-slot.even::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -18px;
  bottom: -18px;
  width: 18px;
  pointer-events: none;
  opacity: .58;
  background:
    linear-gradient(90deg, rgba(171, 218, 26, .12), rgba(171, 218, 26, 0)),
    linear-gradient(90deg, transparent 3px, rgba(171, 218, 26, .24) 3px 4px, transparent 4px 8px, rgba(171, 218, 26, .18) 8px 9px, transparent 9px 13px, rgba(171, 218, 26, .12) 13px 14px, transparent 14px);
}

.page-slot.odd::after { right: -15px; }
.page-slot.even::before {
  left: -15px;
  transform: scaleX(-1);
}

.mushaf {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  align-content: start;
  gap: 3px;
  padding-inline: 20px;
  color: #f6f1df;
  font-family: "Traditional Arabic", "Amiri", "Scheherazade New", serif;
  font-size: clamp(1.02rem, 4.4vw, 1.24rem);
  line-height: var(--mushaf-row-height);
}

mushaf-page {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: #f6f1df;
  text-align: justify;
  text-align-last: justify;
  user-select: none;
}

mushaf-page-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  -webkit-font-smoothing: antialiased;
}

.qcf4-slot .page-content {
  display: flex;
  width: 98%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.ayah-chars {
  display: flex;
  flex-direction: column;
  width: 100%;
  direction: rtl;
  unicode-bidi: bidi-override;
  font-size: min(29px, 5.55cqw);
  line-height: min(44px, 8.42cqw);
  letter-spacing: -2.1px;
  white-space: nowrap;
  text-align-last: justify;
}

.ayah-chars .line {
  display: block;
  height: min(44px, 8.42cqw);
  width: 100%;
  unicode-bidi: bidi-override;
}

.ayah-chars .centered-line {
  display: inline-flex;
  width: 100% !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-inline: auto;
  letter-spacing: 1.64px;
  text-align: center;
}

.ayah-chars .ayah-group {
  unicode-bidi: bidi-override;
}

.ayah-chars .space {
  font-size: 2px;
}

.ayah-chars .ayah-marker.ayah-mark {
  min-width: auto;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: var(--count-color, inherit);
}

.ayah-chars .ayah-marker.ayah-mark::before,
.ayah-chars .ayah-marker.ayah-mark::after {
  inset-inline: -.16em;
  bottom: var(--transition-underline-gap);
  height: 2px;
  border-radius: 999px;
}

.page-slot.opening-page .mushaf {
  align-content: center;
}

.mushaf-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .38em;
  max-width: 100%;
  min-width: 0;
  min-height: var(--mushaf-row-height);
  white-space: nowrap;
  user-select: text;
}

.mushaf-line.unjustified {
  justify-content: center;
}

.mushaf-line.short,
.surah-header,
.basmala {
  justify-content: center;
  text-align: center;
}

.surah-header,
.basmala,
.basmala-line {
  color: var(--strong);
  font-weight: 800;
}

.surah-header {
  position: relative;
  min-height: var(--mushaf-row-height);
  padding: 0;
  font-size: 1.12em;
  line-height: var(--mushaf-row-height);
}

.surah-header::before {
  content: "";
  position: absolute;
  inset: 0;
  border-block: 1px solid var(--line-soft);
  pointer-events: none;
}

.basmala {
  min-height: var(--mushaf-row-height);
}

.fit-93 { font-size: .93em; }
.fit-89 { font-size: .89em; }
.fit-84 { font-size: .84em; }
.fit-78 { font-size: .78em; }
.fit-72 { font-size: .72em; }
.fit-68 { font-size: .68em; }
.fit-64 { font-size: .64em; }
.fit-58 { font-size: .58em; }
.fit-52 { font-size: .52em; }

.qword {
  min-width: max-content;
}

.ayah-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  --transition-progress: 0%;
  --transition-clip: 50%;
  --transition-color: var(--empty);
  --transition-underline-gap: -.03em;
  min-width: 1.78rem;
  width: 1.78rem;
  height: 1.78rem;
  border: 1px solid color-mix(in srgb, var(--count-color, #abda1a) 78%, #f7f7ef 22%);
  border-radius: 999px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .68rem;
  font-weight: 950;
  line-height: 1;
  user-select: none;
  isolation: isolate;
}

.ayah-mark::before,
.ayah-mark::after {
  content: "";
  position: absolute;
  inset-inline: -.16em;
  bottom: var(--transition-underline-gap);
  height: 2px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
}

.ayah-mark::before {
  z-index: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 34%, transparent) 18%, color-mix(in srgb, var(--text) 34%, transparent) 82%, transparent);
}

.ayah-mark::after {
  z-index: 1;
  background: linear-gradient(90deg, transparent, var(--transition-color) 18%, var(--transition-color) 82%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--transition-color) 36%, transparent);
  clip-path: inset(0 var(--transition-clip));
  transform-origin: center;
}

.ayah-mark.transition-count-empty::before,
.ayah-mark.transition-count-weak::before,
.ayah-mark.transition-count-building::before,
.ayah-mark.transition-count-strong::before,
.ayah-mark.transition-count-mastered::before,
.ayah-mark.transition-count-empty::after,
.ayah-mark.transition-count-weak::after,
.ayah-mark.transition-count-building::after,
.ayah-mark.transition-count-strong::after,
.ayah-mark.transition-count-mastered::after {
  opacity: 1;
}

.ayah-mark.transition-shine::before {
  animation: transition-track-shine .82s cubic-bezier(.16, 1, .3, 1);
}

.ayah-mark.transition-shine::after {
  animation: transition-shine .82s cubic-bezier(.16, 1, .3, 1);
}

.ayah-mark.target,
.ayah-mark.transition-target {
  outline: 3px solid #f7f7ef;
  outline-offset: 2px;
}

.pulse {
  animation: pulse .42s ease-out;
}

@keyframes pulse {
  0% { transform: scale(1.22); }
  72% { transform: scale(.98); }
  100% { transform: scale(1); }
}

@keyframes transition-shine {
  0% {
    clip-path: inset(0 50%);
    filter: brightness(3.2) saturate(1.65);
    transform: scaleY(3);
    box-shadow: 0 0 18px color-mix(in srgb, #abda1a 86%, transparent), 0 0 34px color-mix(in srgb, #abda1a 54%, transparent);
  }
  34% {
    clip-path: inset(0 max(var(--transition-clip), 18%));
    filter: brightness(2.55) saturate(1.5);
    transform: scaleY(3.4);
    box-shadow: 0 0 22px color-mix(in srgb, #abda1a 92%, transparent), 0 0 42px color-mix(in srgb, #abda1a 62%, transparent);
  }
  68% {
    clip-path: inset(0 var(--transition-clip));
    filter: brightness(1.65) saturate(1.18);
    transform: scaleY(1.8);
    box-shadow: 0 0 16px color-mix(in srgb, var(--transition-color) 62%, transparent), 0 0 28px color-mix(in srgb, var(--transition-color) 38%, transparent);
  }
  100% {
    clip-path: inset(0 var(--transition-clip));
    filter: brightness(1);
    transform: scaleY(1);
    box-shadow: 0 0 10px color-mix(in srgb, var(--transition-color) 36%, transparent);
  }
}

@keyframes transition-track-shine {
  0% {
    clip-path: inset(0 50%);
    opacity: 1;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, #abda1a 88%, transparent) 18%, color-mix(in srgb, #abda1a 88%, transparent) 82%, transparent);
    box-shadow: 0 0 0 color-mix(in srgb, #abda1a 0%, transparent);
  }
  42% {
    clip-path: inset(0 0);
    opacity: 1;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, #abda1a 74%, transparent) 18%, color-mix(in srgb, #abda1a 74%, transparent) 82%, transparent);
    box-shadow: 0 0 26px color-mix(in srgb, #abda1a 58%, transparent);
  }
  100% {
    clip-path: inset(0 0);
    opacity: 1;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 34%, transparent) 18%, color-mix(in srgb, var(--text) 34%, transparent) 82%, transparent);
    box-shadow: 0 0 0 color-mix(in srgb, #abda1a 0%, transparent);
  }
}

.repetition-count-pop {
  position: fixed;
  z-index: 20;
  display: inline-grid;
  place-items: center;
  min-width: 1.22rem;
  height: 1.22rem;
  padding-inline: 4px;
  border: 1px solid rgba(171, 218, 26, .8);
  border-radius: 999px;
  background: var(--strong);
  color: #263500;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .62rem;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -70%);
  animation: repetition-count-pop .68s cubic-bezier(.16, 1, .3, 1) forwards;
}

@keyframes repetition-count-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -45%) scale(.82);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -78%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(.94);
  }
}

.reader-bottom-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.reader-bottom-btn {
  min-height: 42px;
  border: 1px solid rgba(171, 218, 26, .36);
  border-radius: 12px;
  background: rgba(171, 218, 26, .08);
  color: var(--text);
  font-weight: 800;
}

.reader-bottom-btn:not(:disabled):hover,
.reader-bottom-btn:not(:disabled):focus-visible {
  border-color: rgba(171, 218, 26, .74);
  background: rgba(171, 218, 26, .16);
}

.reader-bottom-btn:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.floating-undo {
  position: fixed;
  right: max(22px, calc((100vw - 460px) / 2 + 22px));
  bottom: 24px;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--strong);
  color: #263500;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .34);
}

.review-bar {
  position: sticky;
  bottom: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 39, .96);
  box-shadow: 0 16px 32px rgba(0, 0, 0, .3);
  font-size: .78rem;
  font-weight: 950;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: end center;
  padding: 12px;
  background: rgba(0, 0, 0, .48);
}

.modal {
  width: min(100%, 460px);
  max-height: min(760px, calc(100vh - 24px));
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--phone);
  box-shadow: var(--shadow);
}

.modal-head {
  min-height: 42px;
}

.modal-backdrop:has(.settings-modal) {
  padding: 0;
}

.settings-modal {
  width: min(100%, 460px);
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-modal .modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -14px -14px 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--phone) 96%, transparent);
  backdrop-filter: blur(10px);
}

.detail-modal {
  display: grid;
  gap: 14px;
}

.detail-head-actions,
.detail-metric-value-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-head-actions {
  flex: 0 0 auto;
}

.detail-panel {
  display: grid;
  gap: 10px;
}

.detail-panel > .full {
  margin-top: 0;
}

.detail-block,
.detail-transition-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 100%),
    var(--surface);
}

.detail-block {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
}

.detail-mini-action {
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  padding-inline: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.detail-transition-row {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: start;
}

.detail-transition-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-block-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.detail-count-row > .detail-metric-value-line {
  flex: 1 1 auto;
  min-width: 0;
}

.detail-count-row > .detail-mini-action {
  margin-left: auto;
}

.detail-block-head,
.detail-transition-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-block-head > :first-child,
.detail-transition-head > :first-child {
  min-width: 0;
}

.detail-block-head .small-pill,
.detail-transition-head .small-pill {
  position: static;
}

.detail-transition-path {
  color: var(--text);
  font-size: .98rem;
  font-weight: 800;
  line-height: 1.1;
}

.detail-metric-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.detail-metric-value-line {
  align-items: baseline;
  justify-content: flex-start;
  gap: 6px;
}

.detail-metric-value {
  font-size: 2.85rem;
  font-weight: 950;
  line-height: .95;
  letter-spacing: -.04em;
}

.detail-metric-target {
  color: var(--quiet);
  font-size: 1rem;
  font-weight: 900;
}

.detail-empty-copy {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.detail-transition-row-empty {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .02), transparent 100%),
    color-mix(in srgb, var(--surface) 82%, var(--empty) 18%);
}

.detail-transition-row-empty .detail-transition-copy {
  gap: 6px;
}

.detail-card {
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.detail-title {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.fatal-error {
  margin: 12px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--danger);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  line-height: 1.45;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.setting-row {
  min-height: 58px;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .84rem;
  font-weight: 900;
}

.setting-row small {
  display: block;
  margin-top: 3px;
  font-size: .7rem;
}

.setting-row input[type="number"] {
  width: 78px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  text-align: center;
  font-weight: 900;
}

.settings-error {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--danger), transparent 35%);
  border-radius: var(--radius);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger), transparent 88%);
  font-size: .76rem;
  font-weight: 900;
  line-height: 1.35;
}

.threshold-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.threshold-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 950;
}

.threshold-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
}

.threshold-field input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  text-align: center;
  font-weight: 900;
}

.toggle {
  width: 44px;
  height: 26px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: #3b3b47;
}

.toggle::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dce7cc;
}

.toggle.on {
  background: var(--strong);
}

.toggle.on::after {
  margin-left: 18px;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (min-width: 900px) {
  .home-panel {
    display: block;
  }

  .queue-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  .app-shell {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border-inline: 0;
  }

  .mushaf {
    padding-inline: 8px;
    font-size: 1.14rem;
  }

  .section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .section-head .primary-btn {
    width: 100%;
  }
}

@container (max-width: 340px) {
  .mushaf {
    padding-inline: 5px;
    font-size: 1.06rem;
  }

  .mushaf-line {
    gap: .28em;
  }
}

@container (max-width: 320px) {
  .mushaf {
    padding-inline: 3px;
    font-size: 1.01rem;
  }

  .mushaf-line {
    gap: .22em;
  }
}

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

  .pulse {
    animation-duration: .42s !important;
  }

  .repetition-count-pop {
    animation-duration: .68s !important;
  }
}
