:root {
  color-scheme: dark;
  --bg: #101414;
  --surface: #111716;
  --panel: #18201f;
  --panel-2: #202a28;
  --ink: #f4f1e8;
  --muted: #aeb9b2;
  --line: #34413d;
  --accent: #38b67c;
  --accent-strong: #2f8f68;
  --gold: #d6ad5f;
  --danger: #e05d5d;
  --ok: #38b67c;
  --paper: #fffdf6;
  --paper-ink: #10110f;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    linear-gradient(135deg, rgba(56, 182, 124, .08), transparent 32%),
    radial-gradient(circle at top right, rgba(214, 173, 95, .14), transparent 36%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

button {
  min-height: 42px;
  padding: 9px 13px;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .55;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 14px;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(52, 65, 61, .82);
  border-radius: 8px;
  background: rgba(24, 32, 31, .88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brandMark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #07100d;
  font: 700 25px "Amiri", "Scheherazade New", serif;
}

h1 {
  margin: 0;
  overflow: hidden;
  font-size: 20px;
  font-weight: 760;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#status {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iconBtn {
  flex: 0 0 auto;
  border-color: rgba(56, 182, 124, .38);
  color: var(--accent);
  font-weight: 700;
}

.focusStopBtn {
  display: none;
}

.shell {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr) minmax(220px, 320px);
  min-height: 0;
  gap: 14px;
}

.controlPanel,
.reciterPanel,
.ayahList {
  min-height: 0;
  border: 1px solid rgba(52, 65, 61, .82);
  border-radius: 8px;
  background: rgba(24, 32, 31, .91);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.controlPanel {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 12px;
}

.panelBlock,
.meterPanel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 42, 40, .78);
}

.autoStartMode .controlPanel .panelBlock {
  display: none;
}

.autoStartMode .controlPanel {
  align-content: center;
}

.blockLabel {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121817;
}

.segmented button {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 720;
}

.segmented button.active {
  background: var(--accent);
  color: #07100d;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #07100d;
  font-weight: 760;
}

.primary:hover,
.segmented button.active:hover {
  background: var(--accent-strong);
}

.meter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  color: var(--muted);
}

.micOption,
.logOption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.micOption input,
.logOption input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.logNotice {
  color: rgba(232, 238, 235, .68);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

#recordDot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #65736e;
}

#recordDot.live {
  background: var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

#recordDot.processing {
  background: var(--gold);
}

#listenState {
  overflow: hidden;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#listenState.live {
  color: var(--accent);
}

#listenState.processing {
  color: var(--gold);
}

#listenState.correction {
  color: var(--danger);
}

#timer {
  font-variant-numeric: tabular-nums;
}

.actions {
  display: grid;
  gap: 8px;
}

.reciterPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
  padding: 18px;
}

.verseHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.verseMeta {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.verseText {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(52, 65, 61, .9);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .74), rgba(255, 250, 238, .78)),
    var(--surface);
  color: #111812;
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.9;
  text-align: center;
}

.verseText.hiddenText {
  color: transparent;
  user-select: none;
}

.verseText.hiddenText::before {
  content: "Memorization mode";
  color: var(--muted);
  font: 700 22px Inter, ui-sans-serif, system-ui, sans-serif;
}

.result {
  min-height: 100px;
  max-height: 25vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(32, 42, 40, .72);
}

.result.ok {
  border-color: rgba(56, 182, 124, .38);
  background: rgba(56, 182, 124, .10);
}

.result.bad {
  border-color: rgba(224, 93, 93, .38);
  background: rgba(224, 93, 93, .10);
}

.resultState {
  font-weight: 800;
}

.resultText {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.resultText [dir="rtl"] {
  color: var(--ink);
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: 1.18em;
}

.timing {
  margin-top: 7px;
  color: var(--gold);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.ayahList {
  display: grid;
  align-content: start;
  overflow: auto;
  padding: 8px;
}

.ayahItem {
  width: 100%;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  text-align: left;
}

.ayahItem:hover {
  background: rgba(56, 182, 124, .08);
}

.ayahItem.active {
  border-color: rgba(56, 182, 124, .38);
  background: rgba(56, 182, 124, .11);
}

.ayahItem.correct {
  background: rgba(56, 182, 124, .13);
}

.ayahItem.revealed {
  border-color: rgba(56, 182, 124, .28);
}

.ayahItem.wrong {
  background: rgba(224, 93, 93, .12);
}

.ayahNo {
  color: var(--accent);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.ayahItem.correct .ayahNo {
  color: var(--ok);
}

.ayahItem.wrong .ayahNo {
  color: var(--danger);
}

.ayahPreview {
  direction: rtl;
  overflow: hidden;
  color: var(--ink);
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: 18px;
  line-height: 1.55;
  text-align: right;
}

.ayahWord {
  transition: color .18s ease, filter .18s ease, opacity .18s ease, background-color .18s ease;
}

.ayahList.hiddenText {
  gap: 5px;
  background:
    linear-gradient(180deg, rgba(24, 32, 31, .9), rgba(17, 23, 22, .94)),
    var(--surface);
}

.ayahList.hiddenText .ayahItem {
  grid-template-columns: 58px minmax(0, 1fr);
  min-height: 48px;
  align-items: center;
}

.ayahList.hiddenText .ayahPreview {
  display: block;
  min-height: 1.55em;
  border-bottom: 1px dashed rgba(56, 182, 124, .24);
  color: transparent;
  text-shadow: none;
  user-select: none;
}

.ayahList.hiddenText .ayahItem.revealed .ayahPreview {
  border-bottom-color: transparent;
  color: #262a25;
  user-select: text;
}

.ayahList.hiddenText .ayahItem.active:not(.revealed) .ayahPreview::before {
  content: "";
  display: block;
  height: 1.55em;
  border-radius: 6px;
  background: rgba(56, 182, 124, .10);
}

.memorizeMode .shell {
  grid-template-columns: minmax(230px, 320px) minmax(0, 1fr);
}

.memorizeMode .reciterPanel {
  display: none;
}

.memorizeMode .ayahList {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: min(760px, 100%);
  width: 100%;
  justify-self: center;
  max-height: calc(100vh - 118px);
  aspect-ratio: 742 / 916;
  overflow: hidden;
  padding: clamp(26px, 3.8vw, 50px) clamp(22px, 3.4vw, 44px);
  border: 2px solid #1c1c1a;
  border-radius: 4px;
  background:
    linear-gradient(rgba(255, 253, 246, .98), rgba(255, 253, 246, .98)),
    var(--paper);
  box-shadow:
    0 0 0 5px var(--paper),
    0 0 0 7px #1c1c1a,
    var(--shadow);
  color: var(--paper-ink);
  direction: rtl;
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: clamp(22px, 2.95vw, 38px);
  line-height: 1.96;
  text-align: justify;
  text-align-last: right;
}

.memorizeMode .ayahList.mushafPage {
  gap: 0;
  justify-content: flex-start;
}

.memorizeMode .ayahList.locatingPage {
  display: grid;
  place-items: center;
  text-align: center;
  text-align-last: center;
}

.memorizeMode .ayahList.introPage {
  display: grid;
  place-items: center;
  text-align: center;
  text-align-last: center;
}

.introShell {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 30ch;
  direction: ltr;
  color: #17211c;
}

.introMark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 2px solid rgba(214, 173, 95, .58);
  border-radius: 50%;
  background: rgba(56, 182, 124, .10);
  color: var(--accent-strong);
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.introArabic {
  color: #111812;
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: clamp(24px, 4.4vw, 38px);
  font-weight: 800;
  line-height: 1.35;
}

.introText {
  color: rgba(23, 33, 28, .76);
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.5;
}

.introPrivacy {
  color: rgba(23, 33, 28, .62);
  font-size: clamp(12px, 1.7vw, 14px);
  font-weight: 700;
  line-height: 1.45;
}

.introHint {
  color: var(--accent-strong);
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 800;
}

.introCredit {
  margin-top: 4px;
  color: rgba(23, 33, 28, .52);
  font-size: clamp(11px, 1.5vw, 13px);
  font-weight: 700;
  letter-spacing: .02em;
}

.locatingShell {
  display: grid;
  justify-items: center;
  gap: 12px;
  direction: ltr;
  color: #17211c;
  width: min(100%, 520px);
}

.locatingOrb {
  position: relative;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
}

.locatingOrb::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 22px rgba(56, 182, 124, .45);
}

.locatingOrb span {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(56, 182, 124, .38);
  border-radius: 50%;
  animation: locatingPulse 1.8s ease-out infinite;
}

.locatingOrb span:nth-child(2) {
  animation-delay: .45s;
}

.locatingOrb span:nth-child(3) {
  animation-delay: .9s;
}

.locatingArabic {
  color: #111812;
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: clamp(24px, 4.2vw, 38px);
  font-weight: 800;
  line-height: 1.4;
}

.locatingText {
  color: var(--accent-strong);
  font-size: clamp(15px, 2.2vw, 20px);
  font-weight: 800;
}

.locatingDetail {
  max-width: 32ch;
  color: rgba(23, 33, 28, .64);
  font-size: clamp(12px, 1.8vw, 15px);
  line-height: 1.45;
}

.locatingHeard {
  min-height: 1.8em;
  max-width: min(100%, 30ch);
  color: #111812;
  font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 800;
  line-height: 1.55;
  text-align: center;
  text-align-last: center;
}

.locatingWindow {
  width: min(100%, 420px);
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(36, 111, 78, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .58);
  box-shadow: 0 10px 28px rgba(23, 33, 28, .08);
}

.locatingWindowTitle {
  color: rgba(23, 33, 28, .68);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.locatingCandidates {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.locatingCandidate {
  display: grid;
  grid-template-columns: 28px minmax(58px, auto) 1fr;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid rgba(23, 33, 28, .10);
  border-radius: 7px;
  background: rgba(250, 248, 240, .72);
  color: #17211c;
  text-align: left;
}

.locatingCandidate.topCandidate {
  border-color: rgba(36, 111, 78, .36);
  background: rgba(56, 182, 124, .12);
}

.candidateRank {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(36, 111, 78, .12);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.candidateRef {
  color: #111812;
  font-size: 15px;
  font-weight: 900;
}

.candidateMeta {
  min-width: 0;
  color: rgba(23, 33, 28, .66);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

@keyframes locatingPulse {
  0% {
    opacity: .75;
    transform: scale(.42);
  }
  70% {
    opacity: .08;
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

.mushafLine {
  height: calc(100% / var(--visible-lines, 16));
  min-height: 0;
  display: block;
  align-content: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(16, 17, 15, .12);
  font-size: calc(1em * var(--page-scale, 1) * var(--line-scale, 1));
  line-height: 1.18;
  white-space: nowrap;
}

.mushafLine.centered,
.mushafLine.surah_name,
.mushafLine.basmallah {
  text-align: center;
  text-align-last: center;
}

.mushafLine.surah_name,
.mushafLine.basmallah {
  color: #111812;
  font-size: .8em;
  font-weight: 800;
}

.mushafLine.basmallah {
  font-size: .92em;
}

.mushafWord {
  cursor: pointer;
  transition: filter .18s ease, opacity .18s ease, background-color .18s ease, color .18s ease;
}

.mushafWord.ayahEnd {
  display: inline-grid;
  place-items: center;
  min-width: 1.55em;
  min-height: 1.55em;
  margin-inline: .12em;
  color: #121311;
  font-size: .48em;
  vertical-align: .18em;
}

.memorizeMode .mushafWord:not(.wordRevealed):not(.ayahEnd) {
  filter: blur(5px);
  opacity: .38;
  user-select: none;
}

.memorizeMode .mushafWord.wordRevealed,
.memorizeMode .mushafWord.ayahEnd {
  filter: blur(0);
  opacity: 1;
}

.memorizeMode .mushafWord.currentWord {
  border-radius: 6px;
  background: rgba(184, 131, 47, .18);
  box-shadow: 0 0 0 3px rgba(184, 131, 47, .11);
}

.memorizeMode .mushafWord.activeAyah.ayahEnd {
  color: var(--gold);
}

.memorizeMode .mushafWord.correct {
  color: var(--ok);
}

.memorizeMode .mushafWord.correct.latestResult {
  border-radius: 5px;
  background: rgba(22, 116, 73, .16);
  box-shadow: 0 0 0 2px rgba(22, 116, 73, .10);
}

.memorizeMode .mushafWord.wrong {
  color: var(--danger);
}

.memorizeMode .mushafWord.wrong.latestResult {
  border-radius: 5px;
  background: rgba(180, 35, 24, .14);
  box-shadow: 0 0 0 2px rgba(180, 35, 24, .10);
}

.memorizeMode .ayahList.hiddenText .ayahItem {
  display: inline;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: inherit;
}

.memorizeMode .ayahList.hiddenText .ayahItem:hover,
.memorizeMode .ayahList.hiddenText .ayahItem.active,
.memorizeMode .ayahList.hiddenText .ayahItem.correct,
.memorizeMode .ayahList.hiddenText .ayahItem.wrong {
  background: transparent;
}

.memorizeMode .ayahList.hiddenText .ayahPreview {
  display: inline;
  min-height: 0;
  border-bottom: 0;
  color: #10110f;
  filter: none;
  opacity: 1;
}

.memorizeMode .ayahList.hiddenText .ayahItem.revealed .ayahPreview {
  color: #10110f;
  opacity: 1;
}

.memorizeMode .ayahList.hiddenText .ayahWord {
  color: #10110f;
  filter: blur(5px);
  opacity: .38;
  user-select: none;
}

.memorizeMode .ayahList.hiddenText .ayahWord.wordRevealed,
.memorizeMode .ayahList.hiddenText .ayahItem.revealed .ayahWord {
  filter: blur(0);
  opacity: 1;
  user-select: text;
}

.memorizeMode .ayahList.hiddenText .ayahWord.correct {
  color: var(--ok);
}

.memorizeMode .ayahList.hiddenText .ayahWord.correct.latestResult {
  border-radius: 5px;
  background: rgba(22, 116, 73, .16);
  box-shadow: 0 0 0 2px rgba(22, 116, 73, .10);
}

.memorizeMode .ayahList.hiddenText .ayahWord.wrong {
  color: var(--danger);
}

.memorizeMode .ayahList.hiddenText .ayahWord.wrong.latestResult {
  border-radius: 5px;
  background: rgba(180, 35, 24, .14);
  box-shadow: 0 0 0 2px rgba(180, 35, 24, .10);
}

.memorizeMode .ayahList.hiddenText .ayahWord.currentWord {
  border-radius: 6px;
  background: rgba(184, 131, 47, .16);
  box-shadow: 0 0 0 3px rgba(184, 131, 47, .10);
}

.memorizeMode .ayahList.hiddenText .ayahItem.active:not(.revealed) .ayahPreview::before {
  content: none;
}

.memorizeMode .ayahList.hiddenText .ayahNo {
  display: inline-grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  margin: 0 .18em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  color: #121311;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .42em;
  font-weight: 850;
  line-height: 1;
  vertical-align: .18em;
}

.memorizeMode .ayahList.hiddenText .surahPart {
  display: none;
}

.memorizeMode .ayahList.hiddenText .ayahItem.active .ayahNo {
  color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 131, 47, .16);
}

.memorizeMode .ayahList.hiddenText .ayahItem.revealed .ayahNo {
  color: var(--ok);
}

.memorizeMode .ayahList.hiddenText .ayahItem.wrong .ayahNo {
  color: var(--danger);
}

.focusListening .app {
  grid-template-rows: minmax(0, 1fr);
  padding: 8px;
  gap: 0;
}

.focusListening .topbar,
.focusListening .controlPanel,
.focusListening .reciterPanel {
  display: none;
}

.focusListening .shell,
.focusListening.memorizeMode .shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  gap: 0;
}

.focusListening.memorizeMode .ayahList {
  width: auto;
  max-width: min(calc(100vw - 34px), calc((100vh - 34px) * .81));
  max-height: calc(100vh - 28px);
  align-self: center;
  justify-self: center;
}

.focusListening .ayahList {
  pointer-events: none;
}

.focusStopBtn {
  position: fixed;
  z-index: 50;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  display: none;
  min-width: 48px;
  min-height: 38px;
  padding: 7px 10px;
  border-color: rgba(224, 93, 93, .7);
  background: rgba(16, 20, 20, .88);
  color: #ffd9d9;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 850;
}

.focusListening .focusStopBtn {
  display: inline-grid;
  place-items: center;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .56;
    transform: scale(1.38);
  }
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto;
  }

  .app {
    min-height: 100vh;
    height: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 55vh) auto;
  }

  .memorizeMode .shell {
    grid-template-columns: 1fr;
  }

  .controlPanel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }

  .ayahList {
    display: flex;
    min-height: 104px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .ayahItem {
    width: 170px;
    min-width: 170px;
  }

  .memorizeMode .shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

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

  .memorizeMode .meterPanel {
    grid-column: 1 / -1;
  }

  .memorizeMode .actions {
    grid-template-columns: 1fr;
  }

  .memorizeMode .ayahList {
    display: flex;
    overflow: hidden;
    width: min(100%, 620px);
    min-height: 0;
    max-height: none;
    aspect-ratio: 1000 / 1160;
    padding: clamp(18px, 5vw, 34px) clamp(14px, 4.5vw, 30px);
    font-size: clamp(17px, 4.2vw, 28px);
    line-height: 1.82;
  }

  .memorizeMode .mushafLine {
    min-height: 0;
    height: calc(100% / 16);
    overflow: hidden;
  }

  .memorizeMode .mushafWord.currentWord {
    box-shadow: 0 0 0 2px rgba(184, 131, 47, .11);
  }

  .focusListening .app {
    min-height: 100vh;
    height: 100vh;
    padding: 7px;
  }

  .focusListening.memorizeMode .ayahList {
    width: auto;
    max-width: min(calc(100vw - 28px), calc((100vh - 28px) * .81));
    max-height: calc(100vh - 20px);
    aspect-ratio: 742 / 916;
  }
}

@media (max-width: 700px) {
  .app {
    padding: 8px;
    gap: 8px;
  }

  .topbar {
    padding: 10px;
  }

  .brandMark {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  h1 {
    font-size: 17px;
  }

  #status {
    max-width: 58vw;
    font-size: 13px;
  }

  .shell {
    gap: 8px;
    grid-template-rows: auto minmax(360px, 58vh) auto;
  }

  .controlPanel {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .panelBlock,
  .meterPanel {
    padding: 9px;
  }

  .reciterPanel {
    padding: 10px;
  }

  .verseText {
    padding: 12px;
    font-size: clamp(28px, 10vw, 48px);
  }

  .result {
    max-height: 30vh;
  }

  .memorizeMode .app {
    padding: 6px;
    gap: 6px;
  }

  .memorizeMode .topbar {
    padding: 7px 8px;
  }

  .memorizeMode .brandMark {
    width: 32px;
    height: 32px;
    font-size: 19px;
  }

  .memorizeMode h1 {
    font-size: 15px;
  }

  .memorizeMode #status {
    max-width: 52vw;
    font-size: 12px;
  }

  .memorizeMode .controlPanel {
    gap: 6px;
    padding: 6px;
  }

  .memorizeMode .panelBlock,
  .memorizeMode .meterPanel {
    gap: 6px;
    padding: 7px;
  }

  .memorizeMode .blockLabel,
  .memorizeMode .field span {
    display: none;
  }

  .memorizeMode select,
  .memorizeMode button,
  .memorizeMode .segmented button {
    min-height: 34px;
    padding: 6px 7px;
    font-size: 12px;
  }

  .memorizeMode .meter {
    grid-template-columns: auto 1fr auto;
    min-height: 24px;
    font-size: 12px;
  }

  .memorizeMode .actions {
    gap: 6px;
  }

  .memorizeMode .ayahList {
    width: min(100%, calc(100vh * .63));
    padding: clamp(12px, 4.4vw, 20px) clamp(10px, 3.7vw, 18px);
    border-width: 1px;
    box-shadow:
      0 0 0 3px #fffdf6,
      0 0 0 4px #1c1c1a,
      0 8px 22px rgba(44, 38, 25, .14);
    font-size: clamp(14px, 3.55vw, 20px);
    line-height: 1.68;
  }

  .memorizeMode .mushafLine {
    border-bottom-color: rgba(16, 17, 15, .08);
  }

  .memorizeMode .mushafWord.ayahEnd {
    min-width: 1.35em;
    min-height: 1.35em;
    margin-inline: .06em;
    font-size: .42em;
  }

  .memorizeMode .mushafWord:not(.wordRevealed):not(.ayahEnd) {
    filter: blur(3px);
  }

  .focusListening .app {
    padding: 5px;
  }

  .focusListening.memorizeMode .ayahList {
    width: auto;
    max-width: min(calc(100vw - 22px), calc((100vh - 22px) * .81));
    max-height: calc(100vh - 16px);
    padding: clamp(12px, 3.8vw, 20px) clamp(10px, 3.4vw, 18px);
  }

  .focusListening .focusStopBtn {
    min-width: 44px;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 12px;
  }
}
