@font-face {
  font-family: "Hafs";
  src: url("/fonts/UthmanicHafs_V22.ttf") format("truetype");
  font-display: swap;
}

.recite-demo {
  --rd-band: #d9c8aa;
  --rd-band-line: #bfa97f;
  --rd-orn: #c9b48c;
  --rd-cart: #faebd0;
  --rd-heard: rgb(10 122 108 / 0.2);
  --rd-circle: #a9a090;
  container-type: inline-size;
  display: block;
  position: relative;
  width: 100%;
  font-family: var(--font-ui);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  .recite-demo:not([data-theme="light"] *) {
    --rd-band: #3a3322;
    --rd-band-line: #5a4e33;
    --rd-orn: #4d4229;
    --rd-cart: #2c2616;
    --rd-heard: rgb(74 207 188 / 0.24);
    --rd-circle: #7d7566;
  }
}

.recite-demo[data-variant="phone"] {
  height: 100%;
  aspect-ratio: 1206 / 2622;
  overflow: hidden;
}

.rd {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  user-select: none;
  -webkit-user-select: none;
}

.rd--phone {
  position: absolute;
  inset: 0;
}

.rd__page {
  position: relative;
}

.rd__banner {
  position: relative;
  display: grid;
  place-items: center;
}

.rd__banner svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rd__band {
  fill: var(--rd-band);
  stroke: var(--rd-band-line);
  stroke-width: 1;
}

.rd__orn {
  fill: var(--rd-orn);
}

.rd__cart {
  fill: var(--rd-cart);
  stroke: var(--rd-band-line);
  stroke-width: 0.8;
}

.rd__num {
  position: absolute;
  font-family: "Iowan Old Style", "Palatino", Georgia, serif;
  color: var(--ink);
  line-height: 1;
}

.rd__basmala,
.rd__text {
  margin: 0;
  font-family: var(--font-quran);
  color: var(--ink);
  direction: rtl;
  text-align: justify;
  text-align-last: center;
  font-kerning: none;
}

.rd__basmala {
  text-align: center;
}

.rd__text {
  text-align-last: start;
  text-align-last: right;
  transition: opacity 0.7s var(--ease-in-out);
}

.rd__text.is-clearing {
  opacity: 0;
}

.rd__w,
.rd__m {
  display: inline-block;
}

.rd__w {
  border-radius: 0.2em;
  padding-inline: 0.06em;
  margin-inline: -0.06em;
  opacity: 0;
  transform: translateY(0.28em);
  transition: opacity 0.5s var(--ease-out), transform 0.6s var(--ease-out), background-color 1.4s var(--ease-out), box-shadow 1.4s var(--ease-out);
}

.rd__w.is-on {
  opacity: 1;
  transform: none;
}

.rd__w.is-heard {
  background-color: var(--rd-heard);
  box-shadow: inset 0 -0.07em 0 var(--accent);
}

.rd__w.is-wrong {
  background-color: var(--danger-soft);
  color: var(--danger);
  outline: 0.07em dashed var(--danger);
  outline-offset: -0.02em;
  box-shadow: none;
}

.rd__m {
  opacity: 0;
  color: var(--rd-circle);
  font-size: 0.82em;
  transition: opacity 0.6s var(--ease-out);
}

.rd__m.is-on {
  opacity: 1;
}

.rd__meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.18em;
  height: 1em;
  color: var(--accent);
}

.rd__meter i {
  display: block;
  width: 0.2em;
  height: 100%;
  border-radius: 0.1em;
  background: currentColor;
  transform-origin: bottom;
  transform: scaleY(0.2);
}

.rd__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.rd__pill.is-on {
  opacity: 1;
}

.rd--phone {
  font-size: 3.6cqw;
}

.rd--phone .rd__status {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 14.4cqw;
  padding: 3cqw 9.4cqw 0;
  direction: ltr;
}

.rd--phone .rd__time {
  font-size: 4.5cqw;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.rd--phone .rd__sys {
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  fill: currentColor;
}

.rd--phone .rd__sys svg:nth-child(1) {
  width: 3.9cqw;
}

.rd--phone .rd__sys svg:nth-child(2) {
  width: 3.7cqw;
}

.rd--phone .rd__sys svg:nth-child(3) {
  width: 6cqw;
}

.rd--phone .rd__head {
  flex: none;
  position: relative;
  height: 14cqw;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 4cqw;
}

.rd--phone .rd__back,
.rd--phone .rd__more {
  width: 7cqw;
  height: 7cqw;
  margin-top: 3.6cqw;
  display: grid;
  place-items: center;
}

.rd--phone .rd__back svg,
.rd--phone .rd__more svg {
  width: 5.4cqw;
  height: 5.4cqw;
}

.rd[dir="rtl"] .rd__back svg {
  transform: scaleX(-1);
}

.rd--phone .rd__titles {
  position: absolute;
  inset-inline: 0;
  top: 1.3cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6cqw;
  pointer-events: none;
}

.rd--phone .rd__title {
  font-size: 4.6cqw;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rd--phone .rd__sub {
  font-size: 3.1cqw;
  color: var(--ink-soft);
}

.rd--phone .rd__tasmee {
  position: absolute;
  inset-inline-end: 12.5cqw;
  top: 1.6cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6cqw;
}

.rd--phone .rd__eye {
  width: 6.8cqw;
  height: 6.8cqw;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  display: grid;
  place-items: center;
}

.rd--phone .rd__eye svg {
  width: 3.8cqw;
  height: 3.8cqw;
}

.rd--phone .rd__tasmee-l {
  font-size: 2.7cqw;
  font-weight: 500;
  color: var(--accent);
}

.rd--phone .rd__page {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 3.3cqw;
  --rd-fs: 5.5cqw;
}

.rd--phone .rd__banner {
  height: 8.7cqw;
  margin-top: 1cqw;
}

.rd--phone .rd__num {
  font-size: 5.2cqw;
}

.rd--phone .rd__basmala {
  font-size: 5.6cqw;
  line-height: 1;
  padding-top: 3.2cqw;
  margin-bottom: 0.4cqw;
  opacity: 0.94;
}

.rd--phone .rd__text {
  font-size: var(--rd-fs);
  line-height: 1.82;
  padding: 0 1.6cqw;
}

.rd--phone .rd__dock {
  flex: none;
  position: relative;
  margin: 0 3.3cqw 2.6cqw;
  height: 18.4cqw;
  border-radius: 4.2cqw;
  background: var(--raised);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 4cqw;
}

.rd--phone .rd__dock-l {
  display: flex;
  flex-direction: column;
  gap: 1.1cqw;
  flex: 1 1 0;
  min-width: 0;
}

.rd--phone .rd__dock-t {
  font-size: 4.3cqw;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rd--phone .rd__dock-s {
  display: flex;
  align-items: center;
  gap: 1.4cqw;
  font-size: 3.5cqw;
  color: var(--ink-soft);
}

.rd--phone .rd__meter {
  font-size: 2.9cqw;
}

.rd--phone .rd__stop {
  position: relative;
  flex: none;
  width: 14.6cqw;
  height: 14.6cqw;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1.1cqw var(--accent-soft);
}

.rd--phone .rd__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 0.4cqw solid var(--accent);
  opacity: 0;
}

.rd--phone .rd__stop-i {
  width: 4.2cqw;
  height: 4.2cqw;
  border-radius: 0.9cqw;
  background: var(--surface);
}

.rd--phone .rd__pill {
  justify-self: end;
  height: 8.4cqw;
  border-radius: 4.2cqw;
  font-size: 3.6cqw;
  transform-origin: center;
}

.rd--phone .rd__dock > .rd__pill {
  padding: 0 3.2cqw;
}

.rd--phone .rd__bar {
  flex: none;
  margin: 0 3.3cqw;
  height: 13.6cqw;
  border-radius: 7cqw;
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: stretch;
  padding: 0.6cqw;
  gap: 0.4cqw;
}

.rd--phone .rd__tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7cqw;
  border-radius: 6cqw;
  color: var(--ink-soft);
  min-width: 0;
}

.rd--phone .rd__tab:nth-child(3) {
  opacity: 0.55;
}

.rd--phone .rd__tab.is-on {
  background: var(--accent);
  color: var(--surface);
}

.rd--phone .rd__tab svg {
  width: 4.8cqw;
  height: 4.8cqw;
}

.rd--phone .rd__tab-l {
  font-size: 2.9cqw;
  white-space: nowrap;
}

.rd--phone .rd__home {
  flex: none;
  align-self: center;
  width: 32cqw;
  height: 1.3cqw;
  border-radius: 1cqw;
  background: var(--ink);
  opacity: 0.85;
  margin: 3.4cqw 0 2.4cqw;
}

.rd--phone.is-live .rd__ring {
  animation: rd-breathe 2.6s var(--ease-in-out) infinite;
}

.rd--phone.is-live .rd__stop {
  animation: rd-pulse 2.6s var(--ease-in-out) infinite;
}

@keyframes rd-breathe {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.38);
    opacity: 0;
  }
}

@keyframes rd-pulse {
  50% {
    transform: scale(1.03);
  }
}

.rd--stage {
  --rd-fs: clamp(1.45rem, 3.2cqi, 3.6rem);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.rd--stage .rd__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: clamp(0.75rem, 2cqi, 1.25rem) clamp(1rem, 3cqi, 2rem);
  border-bottom: 1px solid var(--hairline);
  font-size: 1rem;
}

.rd--stage .rd__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hairline);
  background: var(--raised);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}

.rd--stage .rd__btn:active {
  transform: scale(0.97);
}

.rd--stage .rd__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rd--stage .rd__btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
  min-width: 7.5rem;
  justify-content: center;
}

.rd--stage .rd__btn-i {
  display: grid;
  width: 1.1rem;
  height: 1.1rem;
}

.rd--stage .rd__btn-i svg {
  width: 100%;
  height: 100%;
}

.rd--stage .rd__switch {
  position: relative;
  width: 2.3rem;
  height: 1.4rem;
  border-radius: var(--radius-pill);
  background: var(--hairline);
  transition: background-color var(--dur-2) var(--ease-out);
}

.rd--stage .rd__switch::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  inset-inline-start: 0.15rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--raised);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform var(--dur-2) var(--ease-out);
}

.rd--stage .rd__toggle[aria-pressed="true"] .rd__switch {
  background: var(--accent);
}

.rd--stage .rd__toggle[aria-pressed="true"] .rd__switch::after {
  transform: translateX(0.9rem);
}

.rd--stage[dir="rtl"] .rd__toggle[aria-pressed="true"] .rd__switch::after {
  transform: translateX(-0.9rem);
}

.rd--stage .rd__live {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-inline-start: auto;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.rd--stage .rd__meter {
  font-size: 1.1rem;
}

.rd--stage[data-state="playing"] .rd__live {
  color: var(--accent);
}

.rd--stage .rd__pill {
  height: 2rem;
  padding: 0 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
}

.rd--stage .rd__page {
  padding: clamp(1rem, 3cqi, 2.25rem) clamp(1rem, 4cqi, 3.5rem) clamp(1.25rem, 4cqi, 3rem);
}

.rd--stage .rd__banner {
  height: clamp(2rem, 5cqi, 3.4rem);
}

.rd--stage .rd__num {
  font-size: clamp(1.1rem, 2.6cqi, 1.9rem);
}

.rd--stage .rd__basmala {
  font-size: var(--rd-fs);
  line-height: 1.5;
  padding: 1.1em 0 0.15em;
}

.rd--stage .rd__text {
  font-size: var(--rd-fs);
  line-height: 2.05;
}

.rd--stage .rd__text:not(.is-tasmee) .rd__w {
  opacity: 0.5;
  transform: none;
}

.rd--stage .rd__text:not(.is-tasmee) .rd__w.is-on {
  opacity: 1;
}

.rd--stage .rd__text:not(.is-tasmee) .rd__m {
  opacity: 1;
}

.rd--stage .rd__meter {
  color: var(--ink-faint);
}

.rd--stage.is-live .rd__meter {
  color: var(--accent);
}

.rd__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .rd__w,
  .rd__m,
  .rd__text,
  .rd__pill {
    transition: none;
  }

  .rd--phone.is-live .rd__ring,
  .rd--phone.is-live .rd__stop {
    animation: none;
  }
}

.rd__body {
  position: relative;
}

.rd__idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9em;
  color: var(--ink-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease-out);
}

.rd.is-idle .rd__idle {
  opacity: 1;
}

.rd__text:not(.is-tasmee) ~ .rd__idle {
  display: none;
}

.rd__idle-l {
  font-family: var(--font-ui);
  font-size: 1em;
}

.rd--phone .rd__idle {
  font-size: 3.8cqw;
}

.rd--stage .rd__idle {
  font-size: clamp(0.95rem, 1.6cqi, 1.15rem);
}

.rd__idle-m {
  display: inline-flex;
  align-items: center;
  gap: 0.28em;
  height: 1.8em;
  color: var(--accent);
}

.rd__idle-m i {
  display: block;
  width: 0.26em;
  height: 100%;
  border-radius: 0.13em;
  background: currentColor;
  opacity: 0.7;
  transform: scaleY(0.28);
  animation: rd-idle 2.4s var(--ease-in-out) infinite;
}

.rd__idle-m i:nth-child(2) { animation-delay: -0.4s; }
.rd__idle-m i:nth-child(3) { animation-delay: -0.8s; }
.rd__idle-m i:nth-child(4) { animation-delay: -1.2s; }
.rd__idle-m i:nth-child(5) { animation-delay: -1.6s; }

@keyframes rd-idle {
  50% {
    transform: scaleY(0.62);
  }
}

.rd--stage .rd__btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .rd__idle,
  .rd__idle-m i {
    transition: none;
    animation: none;
  }
}
