:root {
  --paper: #f5efe3;
  --paper-deep: #ece4d3;
  --ink: #1d3a30;
  --ink-soft: #5e6f66;
  --ghost: #b7ae9c;
  --gold: #a9823a;
  --miss: #c0574a;
  --miss-bg: #f3d9d2;
  --line: #ddd3bf;
  --sheet: #fbf7ef;
  --band: #ede3cc;
  --leaf: #7f9a6c;
  --shadow: 0 24px 60px -24px rgb(60 45 20 / 0.35);

  --arabic: "Amiri Quran", "Amiri", "Scheherazade New", serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121816;
    --paper-deep: #1a2220;
    --ink: #e8e1d1;
    --ink-soft: #9aa69f;
    --ghost: #5d6863;
    --gold: #cda85e;
    --miss: #e48a7c;
    --miss-bg: #3d2421;
    --line: #2a3431;
    --band: #1c2522;
    --leaf: #6c8a60;
    --sheet: #18201e;
    --shadow: 0 24px 60px -24px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #121816;
  --paper-deep: #1a2220;
  --ink: #e8e1d1;
  --ink-soft: #9aa69f;
  --ghost: #5d6863;
  --gold: #cda85e;
  --miss: #e48a7c;
  --miss-bg: #3d2421;
  --line: #2a3431;
  --band: #1c2522;
  --leaf: #6c8a60;
  --sheet: #18201e;
  --shadow: 0 24px 60px -24px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease;
}

button, select, input { font: inherit; color: inherit; }

/* Top bar */

/* The header stays at the top while the finished ayat scroll beneath it */
.bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: var(--paper);
}

.wordmark {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.bar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

/* Progress through the current surah, under its name */
.surah-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: min(220px, 50vw);
}
.surah-progress-track {
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.surah-progress-fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.6s ease;
}
.surah-progress-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.surah-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  max-width: 60vw;
}
.surah-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.surah-button:hover { background: var(--paper-deep); }
.surah-button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; flex: none; }

.bar-actions { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }

.foot { transition: opacity 0.6s ease; }
/* Focus mode: while typing, only the surah name and its progress stay */
.wordmark, .bar-actions { transition: opacity 0.6s ease; }
body.focus .wordmark, body.focus .bar-actions { opacity: 0; }
body.focus .foot { opacity: 0; pointer-events: none; }

.timer-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.timer-button:hover { background: var(--paper-deep); color: var(--ink); }
.timer-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-button:hover { background: var(--paper-deep); color: var(--ink); }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
#play-button svg { fill: currentColor; stroke: none; }
#play-button .icon-pause, #play-button.playing .icon-play { display: none; }
#play-button.playing .icon-pause { display: block; }
#play-button.playing { color: var(--gold); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Ayah */

.current {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.current.leaving { opacity: 0; transform: translateY(-10px); }
.current.moved { visibility: hidden; }

/* Illuminated frame around the ayah being typed and the score page,
   drawn by js/frame.js to fit whatever size the ayah needs */
.stage {
  --band-width: clamp(18px, 3.4vw, 30px);
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--band-width) + clamp(20px, 3.5vw, 36px)) calc(var(--band-width) + clamp(14px, 3.5vw, 36px));
  padding-top: calc(var(--band-width) + var(--frame-top, 0px) + clamp(20px, 3.5vw, 36px));
  /* room for crowns and finials that reach outside the frame */
  margin-block: max(0px, calc(var(--frame-out, 0px) - 18px));
}
.stage[data-frame="none"] { padding-inline: 0; }
.illumination {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.illumination .band { fill: var(--band); }
.illumination .pattern { fill: none; stroke: var(--gold); stroke-width: 0.8; opacity: 0.35; }
.illumination .rule { fill: none; stroke: var(--gold); stroke-width: 1.2; }
.illumination .rule-thin { fill: none; stroke: var(--gold); stroke-width: 0.6; opacity: 0.7; }
.illumination .window { fill: var(--paper); stroke: var(--gold); stroke-width: 1.4; }
.illumination .leaf { fill: var(--leaf); stroke: var(--gold); stroke-width: 1; }
.illumination .leaf-vein { fill: none; stroke: var(--band); stroke-width: 0.9; opacity: 0.9; }
.illumination .rosette { fill: var(--gold); opacity: 0.75; }
.illumination .rosette-eye { fill: var(--band); }
/* Tulip border */
.illumination .t-band { fill: #1f5c9e; }
.illumination .t-blush { fill: #f2b8c1; }
.illumination .t-red { fill: #d8262f; }
.illumination .t-braid-band { fill: #3b2a14; }
.illumination .t-braid { fill: none; stroke: #d6a64a; stroke-width: 1.6; }
.illumination .t-petal { fill: #f6b6c3; stroke: #c71f3a; stroke-width: 1; }
.illumination .t-heart { fill: #d8262f; }
.illumination .t-leaf { fill: #2f8a4d; stroke: #1a4a2a; stroke-width: 0.5; }
.illumination .t-palm { fill: #c9973d; stroke: #6d4b16; stroke-width: 0.6; }
.illumination .t-dot { fill: #5bb4ea; }
.illumination .t-stem { stroke: #2f8a4d; stroke-width: 1.4; }
.illumination .t-tip { fill: #d8262f; }
.illumination .t-corner { fill: #c9973d; }
.illumination .t-outline { fill: none; stroke: #173f6e; stroke-width: 1; }
.illumination .t-window { fill: var(--paper); stroke: #3b2a14; stroke-width: 1; }
/* Pearl arch */
.illumination .a-band { fill: #1c2648; }
.illumination .a-vine { fill: none; stroke: #c99a45; stroke-width: 1.2; stroke-linecap: round; }
.illumination .a-gem { fill: #3d6fbf; stroke: #c99a45; stroke-width: 0.8; }
.illumination .a-panel { fill: #f3e8cc; }
.illumination .a-pearl { fill: url(#pearl); stroke: #d9c79c; stroke-width: 0.6; }
.illumination .a-ring { fill: none; stroke: url(#gilt); stroke-width: 3; }
.illumination .a-rule { fill: none; stroke: #c99a45; stroke-width: 1.5; }
.illumination .a-window { fill: var(--paper); stroke: url(#gilt); stroke-width: 5; }
/* Jewel bloom and jewel octagon */
.illumination .j-ink { stroke: #1d1a1a; stroke-width: 1.1; stroke-linejoin: round; }
.illumination .j-vine { fill: none; stroke: #f6c343; stroke-width: 1.1; }
.illumination .j-window { fill: var(--paper); stroke: #1d1a1a; stroke-width: 2.5; }
.illumination .j-window-edge { fill: none; stroke: #f2a71b; stroke-width: 7; }
/* The bright frames are softened a little in dark mode */
:root[data-theme="dark"] .stage:not([data-frame="cartouche"]) .illumination { opacity: 0.88; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stage:not([data-frame="cartouche"]) .illumination { opacity: 0.88; }
}
.stage > .current, .stage > .score { position: relative; }

/* The copy of a finished ayah that glides down into the trail */
.ghost {
  position: fixed;
  z-index: 5;
  margin: 0;
  pointer-events: none;
  transform-origin: top center;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 72px) 16px 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: text;
}

.basmalah {
  margin: 0 0 1.4rem;
  font-family: var(--arabic);
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  color: var(--gold);
}

.arabic {
  margin: 0 0 clamp(28px, 5vh, 48px);
  font-family: var(--arabic);
  font-size: clamp(1.75rem, 5.2vw, 2.5rem);
  line-height: 2.1;
  color: var(--ink);
  overflow-wrap: anywhere;
  transition: opacity 0.35s ease;
}

.ayah-mark {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  height: 1.5em;
  margin-inline-start: 0.25em;
  padding: 0 0.2em;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  font-family: var(--serif);
  font-size: 0.55em;
  line-height: 1;
  color: var(--gold);
  vertical-align: 0.35em;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Finishing an ayah fills its number with gold */
.current.finished .ayah-mark {
  background: var(--gold);
  color: var(--paper);
  animation: seal 0.6s ease;
}
@keyframes seal {
  40% { transform: scale(1.25); }
}

/* Typing */

.typing { position: relative; width: 100%; }

.translation {
  margin: 0;
  font-size: clamp(1.15rem, 3.2vw, 1.4rem);
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  text-align: center;
  transition: opacity 0.35s ease;
}

/* Letters ink in softly as they are typed */
.translation .c { color: var(--ghost); transition: color 0.35s ease; }
.translation .c.done { color: var(--ink); }
.translation .c.auto.done { color: var(--ink-soft); }
.translation .c.miss { color: var(--miss); background: var(--miss-bg); border-radius: 3px; transition: none; }

.caret {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  pointer-events: none;
  transition: transform 0.14s ease-out, width 0.14s ease-out, background-color 0.2s ease;
}
.caret.miss { background: var(--miss); }
.typing.blurred .caret { opacity: 0.35; }

/* The ↵ key at the end of a typed ayah */
.enter-key {
  position: relative;
  z-index: 1; /* above the invisible input so it can be tapped */
  display: inline-flex;
  gap: 0.3em;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.85em;
  line-height: 1;
  vertical-align: 0.1em;
  cursor: pointer;
  animation: rise 0.4s ease;
}
.keycap {
  display: inline-grid;
  place-items: center;
  min-width: 1.9em;
  height: 1.5em;
  padding: 0 0.35em;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 7px;
  background: var(--sheet);
  color: var(--gold);
}
.keycap-space { min-width: 3.4em; }
/* The space bar mark blinks gently, like the caret */
.space-mark {
  width: 1.7em;
  height: 0.38em;
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
  transform: translateY(0.12em);
  animation: blink-space 1.1s ease-in-out infinite;
}
@keyframes blink-space { 0%, 100% { opacity: 1; } 50% { opacity: 0.15; } }
.enter-key:hover .keycap { border-color: var(--gold); }
.enter-key.nudge { animation: nudge 0.35s ease; }
.enter-key.nudge .keycap { border-color: var(--gold); }
@media (prefers-reduced-motion: reduce) {
  .space-mark { animation: none; }
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes nudge { 30% { transform: translateY(-3px); } 60% { transform: translateY(1px); } }

/* Score page after finishing a surah */
.score {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.score.arriving { opacity: 0; transform: translateY(-12px); }
.score-arabic {
  margin: 0;
  font-family: var(--arabic);
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.6;
  color: var(--gold);
}
.score-title { margin: 0; font-size: 1.3rem; font-weight: 500; text-wrap: balance; }
.score-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 10px 0 6px;
  border-block: 1px solid var(--line);
}
.score-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 8px;
}
.score-stat + .score-stat { border-inline-start: 1px solid var(--line); }
.score-value { font-size: clamp(1.4rem, 4.5vw, 2rem); font-variant-numeric: tabular-nums; color: var(--ink); }
.score-label { font-size: 0.75rem; letter-spacing: 0.04em; color: var(--ink-soft); }
.score-note { margin: 0; color: var(--ink); }
.score-next { display: inline-flex; align-items: center; gap: 10px; }
.score-next kbd {
  font: inherit;
  font-size: 0.8rem;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  opacity: 0.7;
}
@media (max-width: 520px) {
  .score-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-stat:nth-child(3) { border-inline-start: 0; }
  .score-stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

/* Invisible input that catches typing, so phone keyboards open too. */
.catcher {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  font-size: 16px; /* stops iOS zooming in */
  caret-color: transparent;
  cursor: text;
}

.hint {
  margin: 28px 0 0;
  max-width: 32em;
  font-size: 0.9rem;
  color: var(--ink-soft);
  transition: opacity 0.4s ease;
}
.hint.gone { opacity: 0; }

.status {
  margin: 24px 0 0;
  color: var(--ink-soft);
}
.status button { margin-inline-start: 8px; }

/* Finished ayat, newest first */

.trail {
  list-style: none;
  margin: clamp(32px, 6vh, 56px) 0 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
  cursor: default;
}
.trail:empty { display: none; }

.trail-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  opacity: 0.75;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.trail-item:nth-child(n + 4) { opacity: 0.45; }
.trail-item.landing { opacity: 0; transition: none; }

.trail-ref {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.trail-arabic {
  margin: 0;
  font-family: var(--arabic);
  font-size: clamp(1.2rem, 3.4vw, 1.5rem);
  line-height: 2;
  color: var(--ink);
}

.trail-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
}

/* Footer */

/* The footer sits on the bottom edge of the screen rather than below the
   finished ayat, and only shows when the mouse moves */
.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 14px max(16px, calc((100vw - 760px) / 2)) calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  box-shadow: 0 -16px 24px -8px var(--paper);
}

.progress {
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.6s ease;
}

.progress-label {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.credits {
  margin: 14px 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-align: center;
  opacity: 0.8;
}
.credits a { color: inherit; }

/* My progress */

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: 12px;
  background: var(--paper);
}
.stat-value { font-size: 1.35rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-label { font-size: 0.75rem; letter-spacing: 0.04em; color: var(--ink-soft); }
.stat-note { margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--ink-soft); }

.surah-times { display: flex; flex-direction: column; max-height: 40vh; overflow-y: auto; }
.surah-times:empty { display: none; }
.surah-time {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
.surah-time-value { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.surah-done { font-size: 0.75rem; color: var(--gold); }

.sheet-actions-split { justify-content: space-between; flex-wrap: wrap; }

/* Surah index */
.sheet-tall { width: min(520px, calc(100vw - 32px)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.khatam-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-align: start;
}
.khatam-button strong { font-weight: 500; }
.khatam-button span { font-size: 0.85rem; opacity: 0.8; }
.khatam-button:disabled { opacity: 0.6; cursor: default; }

.surah-index {
  display: flex;
  flex-direction: column;
  max-height: 46vh;
  overflow-y: auto;
  margin-inline: -8px;
}
.surah-row {
  position: relative;
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 8px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: start;
}
.surah-row:hover { background: var(--paper); }
.surah-row.here { background: var(--paper-deep); }
.surah-row-num { font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.surah-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.surah-row-meta { font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.surah-row.done .surah-row-meta { color: var(--gold); }
.surah-row.done .surah-row-num::after { content: " \2713"; color: var(--gold); }
.surah-row-bar {
  position: absolute;
  left: calc(2.2em + 18px);
  right: 8px;
  bottom: 5px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--gold) var(--done), transparent var(--done));
  opacity: 0.8;
}

.exact summary { cursor: pointer; font-size: 0.9rem; color: var(--ink-soft); }
.exact-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.exact-row .field { flex: 1 1 180px; }
.exact-row .field-narrow { flex: 0 1 90px; }

/* Dialogs */

.sheet {
  width: min(440px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sheet);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgb(20 25 22 / 0.35); backdrop-filter: blur(2px); }
.sheet form { display: flex; flex-direction: column; gap: 16px; }

.sheet-title { margin: 0; font-size: 1.35rem; font-weight: 500; }
.sheet-lede { margin: 0; color: var(--ink-soft); line-height: 1.6; }
.sheet-label { margin: 8px 0 0; font-size: 0.85rem; letter-spacing: 0.04em; color: var(--ink-soft); }

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  text-align: start;
}
.choice:hover { border-color: var(--gold); }
.choice strong { font-weight: 500; }
.choice span { font-size: 0.85rem; color: var(--ink-soft); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--ink-soft); }
.field select, .field input[type="number"] {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
}
.field-check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); }
.field-check input { width: 18px; height: 18px; accent-color: var(--gold); }

.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.button {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.button-quiet { background: transparent; color: var(--ink-soft); }
.button-quiet:hover { color: var(--ink); }

@media (max-width: 520px) {
  .bar { grid-template-columns: 1fr auto; }
  .wordmark { display: none; }
  .bar-center { justify-self: start; align-items: flex-start; }
  .surah-progress { align-items: flex-start; padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Debug: autotype toggle, pinned to the left edge */
.debug-button {
  position: fixed;
  left: 12px;
  top: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transform: translateY(-50%);
}
.debug-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ghost); }
.debug-button.on { border-style: solid; border-color: var(--gold); color: var(--ink); }
.debug-button.on .debug-dot { background: var(--miss); animation: blink-space 1s ease-in-out infinite; }
@media (max-width: 520px) { .debug-button { top: auto; bottom: 12px; transform: none; } }

[hidden] { display: none !important; }

/* Flying copies must never widen the page */
body { overflow-x: clip; }
