:root {
  --paper: #ffffff;
  --card: #f6f6f4;
  --ink: #171717;
  --muted: #626262;
  --line: #dedede;
  --accent: #171717;
  --accent-ink: #ffffff;
  --skip: #171717;
  --sub: #171717;
  --repeat: #171717;
  --vowel: #171717;
  --tajweed: #171717;
  --none: #171717;
  --radius: 14px;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
main { max-width: 640px; margin: 0 auto; padding: 32px 24px 48px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 0; }
.lang { font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', sans-serif; font-size: 14px; padding: 6px 14px; border-radius: 8px; border-color: transparent; color: var(--accent); background: transparent; flex-shrink: 0; }
[dir='rtl'] .lang { font-family: 'IBM Plex Sans', sans-serif; }
[dir='rtl'] body { font-family: 'IBM Plex Sans Arabic', sans-serif; }
[dir='rtl'] .eyebrow { letter-spacing: 0; }
[dir='rtl'] h1 { letter-spacing: 0; line-height: 1.35; }
h1 { font-size: clamp(30px, 7vw, 42px); line-height: 1.15; letter-spacing: -0.045em; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 20px; margin: 0 0 12px; font-weight: 600; }
.lede { font-size: 17px; line-height: 1.55; color: var(--muted); margin: 0 0 28px; }
.lede em { color: var(--ink); font-style: normal; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }

.fields { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 16px 0 8px; }
.fields label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.opt { color: var(--muted); font-weight: 400; }
select { font: inherit; font-size: 15px; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }

.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--muted); margin-bottom: 20px; }
.consent input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; }
.consent a { color: var(--accent); }

button { font: inherit; font-size: 15px; font-weight: 500; padding: 12px 18px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.link { background: none; border: none; padding: 6px 0; color: var(--muted); text-decoration: underline; }
#start { width: 100%; padding: 15px; font-size: 16px; }

.task-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.badge { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; color: #fff; background: var(--k, var(--none)); }
.ref { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.instruction { font-size: 18px; line-height: 1.5; font-weight: 500; margin: 0 0 18px; }

.quran { font-family: 'Amiri Quran', 'Amiri', serif; font-size: 30px; line-height: 2.3; padding: 16px 18px; background: var(--paper); border-radius: 12px; margin-bottom: 20px; }
.ayah + .ayah { margin-top: 6px; }
.ayah-no { font-family: 'IBM Plex Sans', sans-serif; font-size: 12px; color: var(--muted); margin-inline-start: 6px; }
.ayah.skip_ayah { color: var(--skip); text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.8; }
.w { padding: 0 2px; border-radius: 6px; white-space: nowrap; }
.w.mark { background: color-mix(in srgb, var(--k) 16%, transparent); box-shadow: inset 0 -3px 0 var(--k); color: var(--k); }
.w.skip_word { text-decoration: line-through; text-decoration-thickness: 2px; }
body.recording .lede, body.recording h1 { display: none; }
body.recording main { padding-top: 18px; }

[data-kind='none'] { --k: var(--none); }
[data-kind='skip_word'], [data-kind='skip_ayah'] { --k: var(--skip); }
[data-kind='substitution'] { --k: var(--sub); }
[data-kind='repeat'] { --k: var(--repeat); }
[data-kind='vowel'] { --k: var(--vowel); }
[data-kind='tajweed'] { --k: var(--tajweed); }

.recorder { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.rec { width: 68px; height: 68px; border-radius: 50%; padding: 0; display: grid; place-items: center; border: 2px solid var(--skip); background: #fff; flex-shrink: 0; }
.rec.on { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--skip) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) { .rec.on { animation: none; } }
.rec-meta { display: grid; gap: 2px; }
#rec-status { font-weight: 500; }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }

#review audio { width: 100%; margin-bottom: 12px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions button { flex: 1; }
.footer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.count { font-size: 14px; color: var(--accent); font-weight: 600; }
.error { color: #a32121; font-size: 14px; min-height: 1em; margin: 8px 0 0; }

footer { margin-top: 28px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.finish { width: 100%; margin-top: 14px; background: transparent; border-color: var(--accent); color: var(--accent); }
.done-body { color: var(--muted); line-height: 1.55; margin: 0 0 20px; }
.subscribe { display: grid; gap: 8px; margin-bottom: 16px; }
.subscribe label { font-weight: 500; font-size: 15px; }
.subscribe-row { display: flex; gap: 8px; flex-wrap: wrap; }
.subscribe input { flex: 1 1 200px; font: inherit; font-size: 16px; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.fine { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }
.subscribed { color: var(--accent); font-weight: 500; line-height: 1.5; }


/* One short invitation, then the ayah takes centre stage. */
.icon { width: 22px; height: 22px; display: inline-block; flex-shrink: 0; }
button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; touch-action: manipulation; }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
input { accent-color: var(--accent); }
.lang { min-height: 44px; }
button.link { min-height: 48px; }
.lede { max-width: 52ch; }
.how-it-works { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.how-it-works > div { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; font-size: 14px; font-weight: 500; line-height: 1.4; }
.how-it-works .icon { box-sizing: content-box; width: 26px; height: 26px; padding: 14px; border-radius: 12px; background: #ecede8; color: var(--accent); }
.quiet-tip { color: var(--muted); font-size: 14px; text-align: center; line-height: 1.5; margin: 0 0 24px; }
.profile { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); margin-bottom: 24px; padding: 4px 12px; }
.profile summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--ink); list-style: none; }
.profile summary::-webkit-details-marker { display: none; }
.profile summary::after { content: '+'; margin-inline-start: auto; font-size: 22px; }
.profile[open] summary::after { content: '−'; }
.profile[open] { padding-bottom: 16px; }
select { width: 100%; min-width: 0; min-height: 48px; font-size: 16px; }
.consent { font-size: 14px; line-height: 1.6; cursor: pointer; }
.consent input, .check input { width: 22px; height: 22px; flex-shrink: 0; }
.privacy-tip { display: flex; justify-content: center; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; margin: 16px 0 0; }
.privacy-tip .icon { width: 18px; height: 18px; }
.error:empty { display: none; }
.task-head { flex-wrap: wrap; gap: 8px 12px; }
.badge { white-space: nowrap; }
.quran { overflow-wrap: anywhere; }
.w { white-space: normal; }
.rec { color: var(--skip); width: 64px; height: 64px; }
.rec .icon { width: 28px; height: 28px; }
.rec .stop-icon, .rec.on .mic-icon { display: none; }
.rec.on .stop-icon { display: block; }
.rec.on { background: var(--skip); color: white; }
.rec-meta { min-width: 0; }
.timer { direction: ltr; text-align: start; }
.check { min-height: 48px; cursor: pointer; line-height: 1.5; margin: 0; padding-block: 8px; }
.check:has(input:checked) { color: var(--accent); }
#review audio { display: block; }
#task.reviewing .recorder { display: none; }
#task.reviewing .dock { position: static; }
.footer-actions { gap: 16px; }
.count { text-align: end; }
.thank-you { width: 64px; height: 64px; display: grid; place-items: center; background: #ecede8; color: var(--accent); border-radius: 50%; margin-bottom: 24px; }
.thank-you .icon { width: 32px; height: 32px; }
.subscribe input { min-width: 0; }
[dir='rtl'] .directional { transform: scaleX(-1); }
.ayah-no { display: inline-block; text-decoration: none; }
@media (max-width: 600px) {
  main { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .topbar { margin-bottom: 24px; }
  .eyebrow { font-size: 12px; letter-spacing: 0.02em; }
  h1 { margin-bottom: 12px; }
  .lede { font-size: 16px; line-height: 1.5; margin-bottom: 24px; }
  .card { padding: 20px; border-radius: 16px; }
  .how-it-works { gap: 8px; }
  .how-it-works > div { font-size: 13px; }
  .how-it-works .icon { padding: 12px; }
  .fields { grid-template-columns: 1fr; }
  .instruction { font-size: 17px; line-height: 1.6; margin-bottom: 16px; }
  .quran { font-size: 28px; line-height: 2.15; padding: 16px 12px; margin-inline: -8px; margin-bottom: 20px; }
  .dock { position: sticky; bottom: 0; z-index: 5; margin-inline: -20px; padding: 16px 20px max(16px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; }
  .recorder { margin-bottom: 0; gap: 16px; }
  .footer-actions { align-items: center; flex-wrap: wrap; margin-top: 8px; }
  .count { font-size: 13px; }
  .actions { gap: 8px; }
  .actions button { padding-inline: 12px; }
  footer { font-size: 12px; margin-top: 24px; }
  .subscribe-row button { width: 100%; }
}
@media (max-height: 500px) { .dock { position: static; } }

footer a { color: var(--accent); }
.sid { font-size: 12px; background: var(--line); padding: 1px 5px; border-radius: 4px; user-select: all; overflow-wrap: anywhere; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.wordmark > :first-child { font: 800 27px/34px system-ui, sans-serif; letter-spacing: -.06em; }
.wordmark [lang="ar"] { font: 400 24px/30px 'IBM Plex Sans Arabic', sans-serif; }
header > .eyebrow { font-size: 12px; letter-spacing: .12em; margin-bottom: 16px; }
body.recording header > .eyebrow { display: none; }
@media (hover: hover) { button.primary:not(:disabled):hover { background: #333; } .lang:hover { background: var(--card); } }

/* Native radios keep the tap choices accessible to keyboards and screen readers. */
.choice-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.choice-group legend { font-size: 14px; font-weight: 500; margin-bottom: 8px; padding: 0; }
.choices { display: grid; gap: 8px; }
.gender-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields .choice { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 15px; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice > .icon:last-child { width: 18px; height: 18px; margin-inline-start: auto; visibility: hidden; }
.choice:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.choice:has(input:checked) > .icon:last-child { visibility: visible; }
.choice:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; }
.learn-more { margin: -12px 0 28px; }
.learn-more summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; list-style: none; text-decoration: underline; text-underline-offset: 4px; }
.learn-more summary::-webkit-details-marker { display: none; }
.learn-more summary .icon { width: 18px; height: 18px; }
[dir='rtl'] .learn-more summary .icon { transform: scaleX(-1); }
.learn-more[open] summary .icon { transform: rotate(90deg); }
.mission { padding: 20px 0 8px; border-top: 1px solid var(--line); margin-top: 8px; }
.mission h2 { font-size: 22px; letter-spacing: -.02em; }
.mission p { font-size: 15px; line-height: 1.65; color: var(--muted); margin: 0 0 12px; }
.mission-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.mission-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 14px; text-underline-offset: 4px; }
body.recording .learn-more { display: none; }
@media (max-width: 360px) { .fields .choice { gap: 8px; padding: 10px; font-size: 14px; } .gender-choices .choice > .icon:last-child { display: none; } }

/* Keep the details visible without making them a long form. */
.fields { gap: 16px; margin-top: 8px; }
.profile { margin-bottom: 16px; }
.profile[open] { padding-bottom: 12px; }
.profile[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.fields .choice { min-height: 44px; padding: 10px 12px; }
.level-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .level-choices .choice { flex-direction: column; justify-content: center; gap: 6px; text-align: center; font-size: 13px; line-height: 1.4; min-height: 76px; padding: 10px 4px; }
.level-choices .choice > .icon:last-child { display: none; }
.fields .device-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.device-field select { width: auto; max-width: 65%; min-height: 44px; padding-block: 8px; }
.start-dock { background: var(--card); }
@media (max-width: 600px) {
  html { scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  body:not(.recording) main { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  body:has(.start-dock .error:not(:empty)):not(.recording) main { padding-bottom: calc(180px + env(safe-area-inset-bottom)); }
  .topbar { padding-bottom: 12px; margin-bottom: 16px; }
  header > .eyebrow { margin-bottom: 8px; }
  h1 { font-size: 28px; }
  .lede { margin-bottom: 12px; }
  .learn-more { margin: -8px 0 12px; }
  .card { padding: 16px; }
  .how-it-works { margin-bottom: 12px; }
  .how-it-works > div { gap: 6px; font-size: 12px; }
  .how-it-works .icon { width: 22px; height: 22px; padding: 4px; background: transparent; }
  .quiet-tip { margin-bottom: 12px; font-size: 13px; }
  .profile summary { min-height: 44px; }
  .consent { margin-bottom: 12px; }
  .privacy-tip { margin-top: 12px; }
  .start-dock { position: fixed; inset-inline: 0; bottom: 0; z-index: 10; border-top: 1px solid var(--line); background: var(--paper); padding: 12px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .start-dock > * { max-width: 560px; margin-inline: auto; }
  #start { display: flex; min-height: 52px; padding: 12px; }
  .start-dock .error { max-height: 4.5em; overflow-y: auto; }
  .dock { margin-inline: -16px; padding-inline: 16px; }
}
/* In a short landscape viewport, let feedback and the action scroll together. */
@media (max-width: 600px) and (max-height: 400px) {
  .start-dock { position: static; padding: 12px 0 0; background: var(--card); }
  body:not(.recording) main { padding-bottom: 24px; }
}

/* A short, quiet celebration when the thank-you screen opens. */
#done { position: relative; overflow: hidden; }
.celebration { display: flex; justify-content: space-around; color: #a47b32; font-size: 24px; margin-bottom: 12px; pointer-events: none; }
.celebration span { animation: celebrate 900ms ease-out both; }
.celebration span:nth-child(even) { color: #607c60; animation-delay: 100ms; }
@keyframes celebrate { from { opacity: 0; transform: translateY(18px) rotate(-35deg) scale(.4); } to { opacity: 1; transform: translateY(0) rotate(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .celebration span { animation: none; } }
.share-invitation { border-block: 1px solid var(--line); padding-block: 20px; margin-bottom: 24px; }
.share-invitation h3 { font-size: 18px; margin: 0 0 8px; }
.share-invitation > p { color: var(--muted); line-height: 1.55; margin: 0 0 16px; }
#share-message { display: block; width: 100%; resize: vertical; font: inherit; font-size: 14px; line-height: 1.6; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-block: 8px 12px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#share-whatsapp { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 18px; background: #255b3b; color: white; border-radius: 8px; text-decoration: none; font-size: 15px; font-weight: 500; }
.share-invitation #share-status { margin: 8px 0 0; }

.playback-note { font-size: 14px; color: var(--muted); background: var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
