/* Noor design-v06. One accent, three reading themes, two typefaces.
   Plan and rationale: docs/design-v06.md. No decorative ornament. */

:root,
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f8f7;
  --surface-2: #edf1ef;
  --line: #e3e8e5;
  --text: #16201c;
  --text-2: #55615c;
  --text-3: #636e69;
  --quran: #0f1714;
  --accent: #0b5d4b;
  --accent-soft: #e7f2ee;
  --on-accent: #ffffff;
  --scrim: rgb(10 20 16 / 0.36);
  --shadow: 0 18px 48px rgb(16 32 26 / 0.14), 0 2px 6px rgb(16 32 26 / 0.06);
  color-scheme: light;
}
:root[data-theme="sepia"] {
  --bg: #f5eddc;
  --surface: #eee4cf;
  --surface-2: #e6d9bf;
  --line: #ddcdaf;
  --text: #3a2e21;
  --text-2: #6d5d48;
  --text-3: #735f45;
  --quran: #2c2116;
  --accent: #1d5e4a;
  --accent-soft: #e4e0c6;
  --on-accent: #ffffff;
  --scrim: rgb(40 28 12 / 0.34);
  --shadow: 0 18px 48px rgb(60 40 10 / 0.16), 0 2px 6px rgb(60 40 10 / 0.08);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111514;
  --surface: #181d1b;
  --surface-2: #212725;
  --line: #2a312e;
  --text: #e6ece9;
  --text-2: #a3aea9;
  --text-3: #8c9792;
  --quran: #eef2f0;
  --accent: #5dbe9c;
  --accent-soft: #1a2c26;
  --on-accent: #0d1512;
  --scrim: rgb(0 0 0 / 0.55);
  --shadow: 0 18px 48px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}
:root {
  --arabic-size: 40px;
  --ui: "Noor Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 8px;
  --r-md: 14px;
  --header-h: 64px;
  --bar-h: 56px;
  --player-h: 76px;
  --tabs-h: 0px;
  --measure: 860px;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  /* clip, not hidden: hidden would make body a scroll container and break
     the sticky reading toolbar. */
  overflow-x: clip;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}
:lang(ar) body,
html:lang(ar) body {
  font-size: 16.5px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: default;
  opacity: 0.4;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
[hidden] {
  display: none !important;
}
svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
[dir="rtl"] [data-icon="chevron"] svg,
[dir="rtl"] .flip-rtl svg {
  transform: none;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: var(--r-sm);
}
.skip:focus {
  top: 12px;
}

/* ---------- Header and navigation ---------- */
.app-header {
  position: relative;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex: none;
}
.brand-symbol {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-family: "Amiri Quran", serif;
  font-size: 24px;
  line-height: 1;
  padding-bottom: 6px;
}
.brand-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.main-nav {
  display: flex;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.nav-button {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
}
.nav-button svg {
  display: none;
}
.nav-button:hover {
  color: var(--text);
  background: var(--surface);
}
.nav-button.active {
  color: var(--text);
  background: var(--surface-2);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.language-field {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding-inline: 10px 4px;
  border-radius: var(--r-sm);
  color: var(--text-2);
}
.language-field:hover {
  background: var(--surface);
}
.language-field select {
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  padding: 0 4px;
  height: 40px;
  cursor: pointer;
  color: var(--text-2);
}
.language-field select option {
  background: var(--bg);
  color: var(--text);
}

/* ---------- Buttons ---------- */
.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text-3);
  flex: none;
}
.icon-button:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}
.icon-button[aria-pressed="true"],
.icon-button.saved {
  color: var(--accent);
}
.icon-button.saved svg {
  fill: currentColor;
}
.primary-button,
.outline-button,
.chip-button,
.picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}
.primary-button {
  background: var(--accent);
  color: var(--on-accent);
}
.primary-button svg {
  width: 16px;
  height: 16px;
}
.primary-button:hover:not(:disabled) {
  filter: brightness(1.08);
}
.outline-button,
.chip-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--bg);
}
.outline-button:hover:not(:disabled),
.chip-button:hover:not(:disabled) {
  background: var(--surface);
}
.chip-button {
  max-width: 100%;
  min-width: 0;
  color: var(--text-2);
}
.chip-button > span:not([data-icon]) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-button svg {
  width: 17px;
  height: 17px;
}
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
a.text-button {
  padding-block: 11px;
  min-height: 0;
}
.text-button:hover:not(:disabled) {
  text-decoration: underline;
}
.text-button svg {
  width: 18px;
  height: 18px;
}

/* ---------- Main column ---------- */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px calc(var(--player-h) + var(--tabs-h) + 48px);
  min-width: 0;
}
body.player-hidden main {
  padding-bottom: calc(var(--tabs-h) + 48px);
}
main > section,
#reader-view {
  min-width: 0;
}
h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0;
}
h1 {
  font-size: 28px;
}
h2 {
  font-size: 20px;
}
h3 {
  font-size: 16px;
}
p {
  margin: 0;
}
.eyebrow {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.section-intro {
  color: var(--text-2);
  margin: 8px 0 24px;
  max-width: 62ch;
}
.settings-note {
  color: var(--text-3);
  font-size: 13.5px;
  line-height: 1.6;
}
.empty-state {
  color: var(--text-2);
  padding: 32px 0;
  text-align: center;
}

/* ---------- Reader bar (sticky) ---------- */
/* The reading toolbar stays on screen while reading (owner request): the
   header scrolls away, this single compact row sticks to the top. */
.reader-bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: var(--bg);
  margin: 0 -24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
.reading-works {
  display: flex;
  gap: 20px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line);
  margin: 0 -24px;
  padding-inline: 24px;
}
.work-tab {
  min-height: 44px;
  padding: 0;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.work-tab.selected {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.reader-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--bar-h);
  min-width: 0;
}
.picker-button {
  padding: 0 12px;
  margin-inline-start: -12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  border-radius: var(--r-sm);
  min-width: 0;
}
.picker-button:hover {
  background: var(--surface);
}
.picker-button #picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-button svg {
  color: var(--text-3);
}
.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}
.segmented button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.segmented button.selected {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}

/* ---------- Surah heading ---------- */
.reader-shell {
  min-width: 0;
}
.surah-heading {
  text-align: center;
  padding: 48px 0 28px;
}
#surah-arabic {
  font-family: "Amiri Quran", serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 2;
  padding-bottom: 0.15em;
  color: var(--quran);
  letter-spacing: 0;
}
#surah-name {
  color: var(--text-2);
  font-size: 16px;
  margin-top: 10px;
}
.surah-meta {
  color: var(--text-3);
  font-size: 14px;
  margin-top: 8px;
}
.surah-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.basmala {
  font-family: "Amiri Quran", serif;
  font-size: calc(var(--arabic-size) * 0.92);
  line-height: 2;
  text-align: center;
  color: var(--quran);
  padding: 4px 0 20px;
  overflow-wrap: anywhere;
}

/* ---------- Ayahs, verse view ---------- */
.verses,
.riwaya-verses {
  min-width: 0;
}
.fade-in {
  animation: fade-in 0.18s ease both;
}
@keyframes fade-in {
  from {
    opacity: 0.25;
  }
  to {
    opacity: 1;
  }
}
.switching {
  opacity: 0.45;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.ayah,
.riwaya-ayah {
  position: relative;
  padding: 20px 20px 24px;
  margin: 0 -20px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  transition: background-color 0.35s ease;
  scroll-margin-top: calc(var(--bar-h) + 24px);
  scroll-margin-bottom: calc(var(--player-h) + var(--tabs-h) + 24px);
}
body:is(.is-playing, .view-practice) .ayah.active,
body.is-playing .riwaya-ayah.active {
  background: var(--accent-soft);
  border-radius: var(--r-md);
  border-top-color: transparent;
}
body:is(.is-playing, .view-practice) .ayah.active + .ayah {
  border-top-color: transparent;
}
body:is(.is-playing, .view-practice) .ayah.active::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.ayah-top {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: -8px 0 4px;
  min-height: 44px;
}
.ayah-id {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  min-width: 44px;
  font-variant-numeric: tabular-nums;
}
.ayah-top .icon-button {
  width: 44px;
  height: 44px;
}
.ayah-top .icon-button svg {
  width: 18px;
  height: 18px;
}
.ayah-top .tafsir-link {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
}
.ayah-top .tafsir-link:hover,
.ayah-top .tafsir-link[aria-expanded="true"] {
  color: var(--accent);
  background: var(--surface-2);
}
.ayah-more {
  position: relative;
  margin-inline-start: auto;
}
.ayah-more > summary {
  list-style: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text-3);
  cursor: pointer;
}
.ayah-more > summary::-webkit-details-marker {
  display: none;
}
.ayah-more > summary:hover,
.ayah-more[open] > summary {
  color: var(--text);
  background: var(--surface-2);
}
.ayah-menu {
  position: absolute;
  inset-inline-end: 0;
  top: 44px;
  z-index: 20;
  min-width: 250px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
}
.ayah-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  text-align: start;
  font-size: 14.5px;
  color: var(--text);
}
.ayah-menu button:hover:not(:disabled) {
  background: var(--surface);
}
.reading-count {
  padding: 4px 12px 6px;
  font-size: 13px;
  color: var(--text-3);
}
.arabic {
  font-family: "Amiri Quran", serif;
  font-size: var(--arabic-size);
  line-height: 2.1;
  color: var(--quran);
  text-align: right;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}
/* Amiri Quran is reserved for the Quran; other Arabic texts (hadith, adhkar,
   tafsir, names) use a naskh text face. */
.arabic.hadith-text,
.arabic.devotion-arabic,
.arabic.devotion-preview,
.dhikr-arabic,
.tafsir-body,
.ar-name,
.brand-symbol,
.tafsir-inline .tafsir-body {
  font-family: "Noor Naskh", "Amiri", serif;
}
.verse-number {
  font-size: 0.82em;
  color: var(--text-3);
  white-space: nowrap;
}
.translation {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.75;
  max-width: 68ch;
}
html[dir="rtl"] .translation {
  text-align: left;
  direction: ltr;
  margin-inline-start: auto;
}
.hidden-ayah {
  width: 100%;
  min-height: calc(var(--arabic-size) * 1.9);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-3);
  font-size: 14px;
}
.verse-actions,
.recall-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
}
.recall-actions {
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.text-button.reviewed {
  color: var(--text-2);
}
.tafsir-inline {
  margin-top: 14px;
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--line);
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.95;
}
.tafsir-inline .tafsir-body {
  font-size: 17px;
  color: var(--text-2);
}
.tafsir-inline.collapsed .tafsir-body {
  max-height: 8.2em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.tafsir-inline .tafsir-more {
  min-height: 40px;
}
.tafsir-inline [role="status"] {
  font-size: 14px;
  color: var(--text-3);
}
.tafsir-inline-note {
  text-align: center;
  padding-bottom: 8px;
}
.tafsir-inline-note .tafsir-credit {
  margin-top: 0;
}
.tafsir-panel {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--r-md);
  font-size: 16px;
  line-height: 1.9;
}
.tafsir-body {
  font-size: 17px;
  line-height: 2;
  color: var(--text);
}
.tafsir-body p + p {
  margin-top: 10px;
}
.tafsir-quote {
  font-family: "Amiri Quran", serif;
  color: var(--accent);
  font-size: 1.12em;
}
.tafsir-see {
  font-family: var(--ui);
  font-size: 14px;
  color: var(--text-2);
  border-inline-start: 2px solid var(--line);
  padding-inline-start: 8px;
}
.tafsir-credit {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-3);
}
.tafsir-panel .settings-note {
  margin-top: 8px;
}

/* ---------- Reading mode (continuous text) ---------- */
.verses.flow {
  font-family: "Amiri Quran", serif;
  font-size: var(--arabic-size);
  line-height: 2.35;
  color: var(--quran);
  text-align: justify;
  text-align-last: center;
  direction: rtl;
  padding: 8px 0 24px;
  overflow-wrap: anywhere;
}
.verses.flow .ayah {
  display: inline;
  padding: 0.08em 0.1em;
  margin: 0;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.verses.flow .ayah::before {
  display: none;
}
body.is-playing .verses.flow .ayah.active {
  background: var(--accent-soft);
}
.verses.flow .hidden-ayah {
  width: auto;
  display: inline-block;
  min-height: 0;
  padding: 0 16px;
  font-family: var(--ui);
  vertical-align: middle;
}

/* ---------- Alternate editions ---------- */
.regional-reader {
  min-width: 0;
}
.edition-header {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 0 0 20px;
}
.edition-header h2 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
}
.edition-notice {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 16px 20px;
  margin: 0 0 20px;
  background: var(--surface);
  border-radius: var(--r-md);
  color: var(--text-2);
}
.edition-notice .notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.listening-choice {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  color: var(--text-2);
  font-size: 14.5px;
  padding: 0 0 20px;
}
.sync-notice,
.edition-note {
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
  margin-bottom: 12px;
}
.riwaya-ayah .ayah-id {
  display: block;
  margin-bottom: 4px;
}
.edition-text {
  font-size: calc(var(--arabic-size) * 1.02);
}
.read-status:empty {
  display: none;
}
.read-status {
  text-align: center;
  color: var(--text-2);
  padding: 12px;
}

/* ---------- Footer of reader ---------- */
.chapter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 32px 0 8px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 14px;
}
.below-reader {
  text-align: center;
  padding-top: 8px;
}
.below-reader .text-button {
  color: var(--text-3);
  font-size: 13.5px;
}

/* ---------- Practice ---------- */
.panel,
.practice-panel,
.dashboard-card,
.resume-card,
.work-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 20px;
}
#study-practice {
  margin-top: 24px;
}
#study-practice h2 {
  margin-bottom: 6px;
}
#study-practice > p {
  color: var(--text-2);
  margin-bottom: 12px;
}
.practice-panel {
  margin-bottom: 20px;
}
.panel-title {
  font-weight: 500;
  margin-bottom: 12px;
}
.practice-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.practice-fields label,
.book-tools label,
.voice-fields label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  min-width: 0;
}
input[type="number"],
input[type="search"],
select,
.search {
  min-height: 44px;
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.practice-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 16px;
}
.study-guide,
.book-source,
.reward-note,
.devotion-source {
  margin-top: 16px;
  color: var(--text-2);
  font-size: 14.5px;
}
.study-guide summary,
.book-source summary,
.reward-note summary,
.devotion-source summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--text);
  font-weight: 500;
}
.study-guide h3 {
  margin: 12px 0 4px;
}
.study-guide p,
.book-source p,
.reward-note p,
.devotion-source p {
  margin: 6px 0;
}

/* ---------- Progress ---------- */
progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 8px 0 4px;
}
progress::-webkit-progress-bar {
  background: var(--surface-2);
}
progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 99px;
}
progress::-moz-progress-bar {
  background: var(--accent);
}
.completion-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--text-2);
}
.completion-label strong {
  color: var(--text);
}
.quran-completion {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
}

/* ---------- Views: Today, library, listen, reciters ---------- */
#today-view,
#library-view,
#devotions-view,
#listen-view,
#reciters-view,
#hadith-view {
  padding-top: 40px;
}
#today-view > h1,
#library-view > h1,
#listen-view > h1,
#reciters-view > h1,
#devotions-view h1 {
  margin-bottom: 4px;
}
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.work-card {
  display: grid;
  gap: 4px;
  align-content: start;
}
.work-card h2 {
  font-size: 18px;
}
.work-card button {
  margin-top: 12px;
  justify-self: start;
}
.recall-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 12px;
}
.recall-summary p {
  color: var(--text-2);
  font-size: 14px;
}
.due-today {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  margin-bottom: 12px;
}
.due-today h2 {
  font-size: 17px;
}
.due-today p {
  color: var(--text-2);
}
.due-count {
  font-size: 24px;
  color: var(--accent);
  font-weight: 600;
}
.plan-calendar {
  list-style: none;
  margin: 8px 0 4px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.plan-calendar li {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12px;
  color: var(--text-3);
  min-width: 0;
}
.plan-calendar li span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-calendar strong {
  font-size: 18px;
  color: var(--text-2);
}
.plan-calendar li.has-due strong {
  color: var(--accent);
}
.review-plan {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.review-plan h2 {
  font-size: 17px;
  margin-bottom: 8px;
}
.review-plan ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.review-plan .plan-list li {
  display: grid;
  grid-template-columns: 9em minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
}
.review-plan .plan-list li:first-child {
  border-top: 0;
}
.review-plan .plan-day {
  color: var(--text-2);
}
.review-plan .plan-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.review-plan .plan-refs button {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.resume-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 24px 0 12px;
}
.resume-card p {
  color: var(--text-2);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  display: grid;
  gap: 2px;
}
.stat strong {
  font-size: 24px;
  font-weight: 600;
}
.stat span {
  color: var(--text-2);
  font-size: 13.5px;
}
.dashboard-card {
  margin-bottom: 12px;
}
.dashboard-card h2 {
  margin-bottom: 4px;
}
.dashboard-card .section-intro {
  margin-bottom: 16px;
}
.dhikr-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.dhikr-card {
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 16px;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}
html[lang="ar"] .dhikr-card h3 {
  display: none;
}
.dhikr-arabic {
  font-size: 38px;
  line-height: 1.8;
  color: var(--quran);
}
.dhikr-number {
  font-size: 32px;
  font-weight: 600;
}
.dhikr-total {
  font-size: 13px;
  color: var(--text-3);
}
.dhikr-corrections {
  display: flex;
  gap: 8px;
}
.free-note {
  color: var(--text-3);
  font-size: 13.5px;
  margin-top: 24px;
  text-align: center;
}
.library-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.row-info {
  flex: 1;
  min-width: 0;
}
.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.file-label {
  cursor: pointer;
}

/* Listen */
.listen-now {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--r-md);
  margin: 24px 0 16px;
}
.listen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.listen-reciter {
  min-width: 0;
}
.listen-reciter strong {
  display: block;
  font-size: 18px;
}
.listen-reciter span {
  color: var(--text-2);
  font-size: 14px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text-2);
  font-size: 14.5px;
}
.surah-rows {
  display: grid;
}
.surah-row,
.surah-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  text-align: start;
}
.surah-row:hover:not(:disabled),
.surah-option:hover {
  background: var(--surface);
}
.surah-row.current {
  background: var(--accent-soft);
}
.surah-row > span:nth-child(2),
.surah-option > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.surah-option.unavailable strong,
.surah-option.unavailable .ar-name {
  opacity: 0.55;
}
.surah-row .num,
.surah-option .num {
  width: 32px;
  flex: none;
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.surah-row strong,
.surah-option strong {
  display: block;
  font-weight: 500;
}
.surah-row small,
.surah-option small {
  color: var(--text-3);
  font-size: 13px;
}
.surah-row .row-state {
  color: var(--text-3);
  font-size: 13px;
}
.ar-name {
  font-family: "Amiri Quran", serif;
  font-size: 20px;
  color: var(--quran);
}

/* Reciter gallery (by country) */
.country-toolbar {
  display: grid;
  gap: 6px;
  max-width: 360px;
  margin-bottom: 24px;
  color: var(--text-2);
  font-size: 14px;
}
.country-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--text-2);
}
.country-heading span {
  display: none;
}
.reciter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.reciter-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: start;
}
.reciter-monogram {
  display: none;
}
.reciter-tags span {
  font-size: 13px;
  color: var(--text-2);
}
.reciter-footnote {
  color: var(--text-3);
  font-size: 13px;
}
.catalog-note {
  margin-top: 24px;
  color: var(--text-3);
  font-size: 13.5px;
}

/* ---------- Hadith ---------- */
.book-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}
.book-tools form {
  display: flex;
  gap: 8px;
  align-items: end;
  min-width: 0;
}
.book-tools form label {
  flex: 1;
}
.hadith-page {
  padding: 8px 0 20px;
}
.hadith-page h2 {
  margin: 12px 0;
}
.hadith-text {
  font-size: calc(var(--arabic-size) * 0.72);
  line-height: 2.1;
}
.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.book-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  color: var(--text-3);
}

/* ---------- Devotions ---------- */
.devotion-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.devotion-filters button,
.chips button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}
.devotion-filters button[aria-pressed="true"],
.chips button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.devotion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.devotion-card {
  display: grid;
  gap: 6px;
  align-content: start;
  text-align: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-width: 0;
}
.devotion-card:hover {
  background: var(--surface);
}
.devotion-card h2 {
  font-size: 17px;
}
.devotion-preview {
  font-size: 22px;
  line-height: 1.9;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.devotion-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-3);
  font-size: 13px;
}
.devotion-focus {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  padding-top: 16px;
}
.devotion-arabic {
  text-align: center;
  font-size: calc(var(--arabic-size) * 0.9);
}
.devotion-steps {
  display: flex;
  gap: 6px;
}
.devotion-steps span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-3);
}
.devotion-steps .current {
  border-color: var(--accent);
  color: var(--accent);
}
.devotion-steps .done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.devotion-counter {
  display: grid;
  gap: 10px;
  justify-items: center;
}
.count-orb {
  width: 148px;
  height: 148px;
  border-radius: 999px;
  display: grid;
  place-content: center;
  gap: 2px;
  background:
    radial-gradient(circle, var(--bg) 62%, transparent 63%),
    conic-gradient(var(--accent) var(--progress, 0%), var(--surface-2) 0);
  color: var(--text);
}
.count-orb strong {
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
}
.count-orb span {
  color: var(--text-3);
  font-size: 13px;
}
.devotion-actions {
  display: flex;
  gap: 12px;
}
.devotion-source {
  text-align: start;
  width: 100%;
  max-width: 62ch;
}

/* ---------- Player ---------- */
.player {
  position: fixed;
  inset-inline: 0;
  bottom: var(--tabs-h);
  z-index: 35;
  height: var(--player-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.player-identity {
  display: grid;
  min-width: 0;
  justify-items: start;
}
.player-identity strong {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.player-identity .text-button {
  min-height: 44px;
  margin-block: -10px -8px;
  padding: 0;
  font-size: 13.5px;
  color: var(--text-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.playback {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-width: 0;
}
.playback-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.play-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
}
.play-button svg {
  width: 18px;
  height: 18px;
}
.timeline {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.timeline input {
  flex: 1;
  min-width: 0;
  height: 44px;
  margin: -12px 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.timeline input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 3px;
  background: var(--surface-2);
}
.timeline input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}
.timeline input::-moz-range-track {
  height: 4px;
  border-radius: 3px;
  background: var(--surface-2);
}
.timeline input::-moz-range-progress {
  height: 3px;
  background: var(--accent);
}
.timeline input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}
.player-extra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.player-extra select {
  width: auto;
  min-height: 36px;
  font-size: 13px;
  padding: 0 8px;
}
.follow-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.follow-button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}
.follow-button svg {
  width: 18px;
  height: 18px;
}
.audio-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Dialogs and sheets ---------- */
dialog {
  border: 0;
  padding: 0;
  color: var(--text);
  background: var(--bg);
}
dialog::backdrop {
  background: var(--scrim);
}
.sheet {
  width: min(560px, calc(100vw - 32px));
  max-height: min(84vh, 760px);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 20px 24px 24px;
  overflow: auto;
}
.sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.2s ease both;
}
@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sheet > * + * {
  margin-top: 12px;
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-inline-end: -10px;
}
.dialog-top h2 {
  font-size: 19px;
}
.sheet h3 {
  margin-top: 16px;
}
.sheet p {
  color: var(--text-2);
}
.sheet-scroll {
  overflow: auto;
  min-height: 0;
  flex: 1;
  margin-inline: -8px;
  padding-inline: 8px;
}
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3) !important;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sheet-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 8px;
}
.reciter-list {
  display: block;
  max-height: 46vh;
}
.reciter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  text-align: start;
}
.reciter-row:hover {
  background: var(--surface);
}
.reciter-row[aria-pressed="true"] {
  background: var(--accent-soft);
}
.reciter-row > span:first-child {
  flex: 1;
  min-width: 0;
}
.reciter-row strong {
  display: block;
  font-weight: 500;
}
.reciter-row small {
  display: block;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.5;
}
.reciter-row small .unavailable {
  color: var(--text-2);
}
#voice-status:not(:has(button)) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.dialog-top h2:focus {
  outline: none;
}
.reciter-row .row-check {
  color: var(--accent);
  visibility: hidden;
}
.reciter-row[aria-pressed="true"] .row-check {
  visibility: visible;
}
.explore-voices {
  align-self: flex-start;
}
.setting-block {
  display: grid;
  gap: 8px;
}
.theme-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.theme-choice {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 8px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2);
}
.theme-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-choice:has(input:checked) {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.theme-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.swatch {
  width: 100%;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid rgb(0 0 0 / 0.08);
}
[data-swatch="light"] .swatch {
  background: linear-gradient(90deg, #ffffff 60%, #0b5d4b 60% 68%, #ffffff 68%);
}
[data-swatch="sepia"] .swatch {
  background: linear-gradient(90deg, #f5eddc 60%, #1d5e4a 60% 68%, #f5eddc 68%);
}
[data-swatch="dark"] .swatch {
  background: linear-gradient(90deg, #111514 60%, #5dbe9c 60% 68%, #111514 68%);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.setting-row select {
  width: auto;
  max-width: 60%;
}
.setting-row input[type="range"] {
  width: 44%;
  accent-color: var(--accent);
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background-color 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 99px;
  background: var(--bg);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.2s ease;
}
[dir="rtl"] .switch::after {
  left: auto;
  right: 2px;
}
.switch:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.switch:checked::after {
  transform: translateX(18px);
}
[dir="rtl"] .switch:checked::after {
  transform: translateX(-18px);
}
.switch:disabled {
  opacity: 0.4;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + var(--tabs-h) + 16px);
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .main-nav .nav-button {
    padding: 0 9px;
  }
}
@media (max-width: 900px) {
  :root {
    --header-h: 56px;
    --tabs-h: 60px;
    --player-h: 64px;
  }
  .app-header {
    padding: 0 16px;
    padding-top: env(safe-area-inset-top);
  }
  .main-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 45;
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  .main-nav,
  .player {
    transition:
      transform 0.25s ease,
      bottom 0.25s ease;
  }
  body.nav-away .main-nav {
    transform: translateY(100%);
  }
  body.nav-away .player {
    bottom: 0;
  }
  .main-nav .nav-button {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 100%;
    padding: 0 2px;
    border-radius: 0;
    font-size: 11px;
    min-width: 0;
  }
  .main-nav .nav-button svg {
    display: block;
    width: 22px;
    height: 22px;
  }
  .main-nav .nav-button:hover,
  .main-nav .nav-button.active {
    background: none;
  }
  .main-nav .nav-button.active {
    color: var(--accent);
  }
  .nav-label {
    font-size: 12px;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-actions {
    margin-inline-start: auto;
  }
  main {
    padding-inline: 16px;
  }
  .reader-bar,
  .reading-works {
    margin: 0 -16px;
    padding-inline: 16px;
  }
  .player {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 4px;
    padding: 0 12px 0 16px;
  }
  .playback {
    display: contents;
  }
  .timeline {
    position: absolute;
    inset-inline: 0;
    top: -22px;
    max-width: none;
    height: 44px;
    padding: 0;
  }
  .timeline span {
    display: none;
  }
  .timeline input {
    height: 44px;
    margin: 0;
  }
  .player-extra {
    gap: 0;
  }
  .player-extra select {
    display: none;
  }
  .follow-label {
    display: none;
  }
  .follow-button {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
  .sheet {
    width: 100vw;
    max-width: 100vw;
    max-height: 88vh;
    margin: auto 0 0;
    border-radius: var(--r-md) var(--r-md) 0 0;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .sheet[open] {
    animation-name: sheet-up;
  }
  @keyframes sheet-up {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
  .work-grid,
  .stats-grid,
  .dhikr-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .practice-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .book-tools {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  :root {
    --arabic-size: 34px;
  }
  .brand-name {
    display: none;
  }
  .surah-heading {
    padding: 32px 0 20px;
  }
  #surah-arabic {
    font-size: 34px;
  }
  .ayah,
  .riwaya-ayah {
    padding: 16px 12px 20px;
    margin: 0 -12px;
  }
  .segmented button {
    padding: 0 10px;
    font-size: 13.5px;
  }
  .reader-toolbar .icon-button {
    width: 40px;
    height: 40px;
  }
  .picker-button {
    font-size: 15px;
    padding: 0 8px;
    margin-inline-start: -8px;
  }
  .sheet-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .surah-actions {
    flex-wrap: nowrap;
  }
  .surah-actions .chip-button {
    flex: 0 1 auto;
    padding: 0 12px;
  }
  .surah-actions .primary-button {
    padding: 0 16px;
  }
  .resume-card {
    flex-direction: column;
    align-items: stretch;
  }
  .review-plan .plan-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .ayah-menu {
    min-width: 220px;
  }
  .language-field span[data-icon] {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  .app-header,
  .main-nav,
  .player,
  .reader-bar,
  .ayah-top,
  .surah-actions {
    display: none !important;
  }
}

/* design-v06 audit additions */
.speed-pill {
  min-height: 44px;
  min-width: 56px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.speed-pill:hover {
  background: var(--surface);
}
.listening-choice.one-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  padding: 0 0 16px;
}
.listening-choice.one-line .text-button svg {
  width: 14px;
  height: 14px;
}
.surah-option.current {
  background: var(--accent-soft);
}
.surah-type {
  color: var(--text-3);
  font-size: 13px;
}
.stats-line {
  color: var(--text-2);
  font-size: 14.5px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
.due-list > summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
}
#free-dhikr {
  padding-top: 8px;
}
.riwaya-ayah .ayah-top {
  margin-bottom: 0;
}
@media (max-width: 900px) {
  .speed-pill {
    display: none;
  }
}

/* QA v0.7: in French at 390 px the two chapter buttons pushed the page 2 px
   wider than the screen (horizontal scroll). They may wrap instead. */
.chapter-footer .outline-button {
  white-space: normal;
  min-width: 0;
  flex: 0 1 auto;
  text-align: center;
}
.chapter-footer #chapter-position {
  flex: none;
}

/* QA v0.7: at 390 px the reading toolbar (layout, translation, tafsir, eye)
   left the surah picker 0 to 70 px: the surah name disappeared in French and
   was cut in Arabic. The picker keeps its full name; the toolbar moves to a
   second line only when both do not fit. */
@media (max-width: 480px) {
  .reader-bar-row {
    flex-wrap: wrap;
    row-gap: 0;
  }
  .picker-button {
    flex: 1 0 auto;
    max-width: 100%;
    justify-content: flex-start;
  }
  .reader-toolbar {
    flex: 1 1 auto;
    justify-content: space-between;
    min-width: 0;
  }
}

/* QA v0.7: the size slider shows which end is small and which is large (in
   Arabic the native range runs right to left: smaller on the right). */
.size-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.size-hint {
  font-family: "Amiri", serif;
  color: var(--text-2);
  line-height: 1;
}
.size-hint.small {
  font-size: 14px;
}
.size-hint.large {
  font-size: 26px;
}

/* QA v0.7 (report "cannot change reciter" on a phone, not reproduced in
   Chromium nor WebKit emulation): the sheet is sized on the visible viewport
   (dvh: Safari toolbars shown), its list never scrolls the page behind, and
   browsers without <dialog> get a fixed overlay (see dialogFallback). */
@media (max-width: 900px) {
  .sheet {
    max-height: 88dvh;
  }
}
.sheet,
.sheet-scroll {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
dialog.dialog-fallback:not([open]) {
  display: none;
}
dialog.dialog-fallback[open] {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1000;
  margin: 0 auto;
}
html.dialog-fallback-open body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--scrim);
}
