/* ============================================================
   Sound section — صوت
   ============================================================ */

:root {
  --bg: #f3e9d2;
  --fg: #2a1810;
  --primary: #0d4f3c;
  --primary-2: #166548;
  --primary-dark: #0a3d2e;
  --gold: #b8860b;
  --gold-light: #d4af37;
  --gold-dark: #8b6914;
  --card: #fffaef;
  --border: #c9a961;
  --ink-soft: #6b5a45;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Tajawal', sans-serif;
  color: var(--fg);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 18% 8%, rgba(184, 134, 11, 0.14) 0%, transparent 42%),
    radial-gradient(circle at 90% 88%, rgba(13, 79, 60, 0.12) 0%, transparent 48%),
    radial-gradient(circle at 50% 50%, rgba(255, 250, 239, 0.35) 0%, transparent 70%);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

.font-display {
  font-family: 'Reem Kufi', sans-serif;
}

/* ---------- Header ---------- */
.sound-header {
  position: relative;
  background:
    linear-gradient(145deg, rgba(8, 46, 35, 0.97) 0%, rgba(13, 79, 60, 0.95) 50%, rgba(22, 101, 72, 0.92) 100%),
    radial-gradient(ellipse at 70% 20%, rgba(212, 175, 55, 0.18), transparent 55%);
  border-bottom: 4px solid var(--gold);
  color: #fffaef;
  text-align: center;
  padding: 1.5rem 1rem 1.75rem;
  overflow: hidden;
}

.sound-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(212, 175, 55, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 85% 30%, rgba(255, 250, 239, 0.06) 0%, transparent 30%);
  pointer-events: none;
}

.sound-header-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  min-height: 44px;
}

.sound-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.sound-settings-btn {
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  border-radius: 50%;
  background: rgba(255, 250, 239, 0.12);
  color: #fffaef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease, background 0.15s ease, border-color 0.15s ease;
}

.sound-settings-btn:hover {
  background: rgba(255, 250, 239, 0.22);
  border-color: var(--gold-light);
  transform: rotate(45deg);
}

.sound-settings-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sound-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 42px;
  padding: 0.4rem 0.85rem;
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  border-radius: 999px;
  background: rgba(255, 250, 239, 0.1);
  color: #fffaef;
  text-decoration: none;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sound-back-btn:hover {
  background: rgba(255, 250, 239, 0.2);
  border-color: var(--gold-light);
  transform: translateX(2px);
}

.sound-back-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sound-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: rgba(0, 0, 0, 0.15);
  color: var(--gold-light);
  font-size: 0.8rem;
  font-weight: 600;
}

.sound-header-body {
  position: relative;
  z-index: 2;
}

.sound-header .ornament {
  font-family: 'Amiri Quran', serif;
  font-size: 1.55rem;
  color: var(--gold-light);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.sound-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.25rem);
  color: #f5e6c8;
  letter-spacing: 0.02em;
}

.sound-header .subtitle {
  margin: 0.45rem auto 0;
  max-width: 28rem;
  color: rgba(245, 230, 200, 0.88);
  font-size: 0.95rem;
  line-height: 1.55;
}

.sound-wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 28px;
  margin: 1rem auto 0;
  opacity: 0.85;
}

.sound-wave span {
  display: block;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
  animation: wave 1.1s ease-in-out infinite;
}

.sound-wave span:nth-child(1) { height: 10px; animation-delay: 0s; }
.sound-wave span:nth-child(2) { height: 18px; animation-delay: 0.12s; }
.sound-wave span:nth-child(3) { height: 26px; animation-delay: 0.24s; }
.sound-wave span:nth-child(4) { height: 16px; animation-delay: 0.36s; }
.sound-wave span:nth-child(5) { height: 12px; animation-delay: 0.48s; }
.sound-wave span:nth-child(6) { height: 20px; animation-delay: 0.2s; }
.sound-wave span:nth-child(7) { height: 14px; animation-delay: 0.32s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.55); opacity: 0.7; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- Main ---------- */
.sound-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.35rem 1rem 3.5rem;
}

.sound-intro {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.05rem;
  background: linear-gradient(145deg, rgba(255, 250, 239, 0.95), rgba(247, 237, 212, 0.9));
  border: 1.5px solid rgba(201, 169, 97, 0.5);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(45, 24, 16, 0.06);
}

.sound-intro-icon {
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fffaef;
  font-size: 1.1rem;
  box-shadow: 0 3px 10px rgba(13, 79, 60, 0.25);
}

.sound-intro h2 {
  margin: 0;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.sound-intro p {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------- List toolbar ---------- */
.sound-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  padding: 0 0.15rem;
}

.sound-toolbar-label {
  font-family: 'Reem Kufi', sans-serif;
  color: var(--primary);
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sound-toolbar-label i {
  color: var(--gold-dark);
}

.sound-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(13, 79, 60, 0.1);
  border: 1px solid rgba(13, 79, 60, 0.2);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

/* ---------- Listing ---------- */
.sound-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sound-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1.5px solid rgba(13, 79, 60, 0.35);
  background:
    linear-gradient(135deg, rgba(243, 250, 246, 0.95) 0%, #fffaef 45%, #f7edd4 100%);
  box-shadow:
    0 4px 16px rgba(13, 79, 60, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: default;
  overflow: hidden;
}

.sound-item::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(180deg, var(--gold-light), var(--primary));
  border-radius: 0 18px 18px 0;
}

.sound-item.is-link {
  cursor: pointer;
}

.sound-item.is-link:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(13, 79, 60, 0.16);
}

.sound-item.is-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.sound-item-num {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Amiri Quran', serif;
  font-size: 1.15rem;
  color: #fffaef;
  background: radial-gradient(circle, #1f7a5a 0%, var(--primary) 70%, #082e23 100%);
  box-shadow: 0 3px 10px rgba(13, 79, 60, 0.3);
}

.sound-item-body {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.sound-item-name {
  margin: 0;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.sound-item-meta {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.sound-item-meta .dot {
  opacity: 0.45;
}

.sound-item-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.sound-play-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--gold-light), var(--gold-dark));
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 3px 12px rgba(139, 105, 20, 0.35);
}

.sound-item.is-link:hover .sound-play-icon {
  background: linear-gradient(145deg, #e0c15a, var(--gold));
}

.sound-item-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(13, 79, 60, 0.12);
  color: var(--primary);
  border: 1px solid rgba(13, 79, 60, 0.25);
}

/* ---------- Footer note ---------- */
.sound-note {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.sound-note strong {
  color: var(--primary-dark);
}

/* ---------- Responsive (listing) ---------- */
@media (max-width: 420px) {
  .sound-item {
    padding: 0.9rem 0.85rem;
    gap: 0.7rem;
  }

  .sound-item-num {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1rem;
  }

  .sound-item-name {
    font-size: 1.08rem;
  }

  .sound-play-icon {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 0.9rem;
  }
}

/* ============================================================
   Surah reader + voice practice
   ============================================================ */

body.sound-reader-page {
  background-image:
    radial-gradient(circle at 15% 5%, rgba(184, 134, 11, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 95%, rgba(13, 79, 60, 0.1) 0%, transparent 45%);
}

.sound-reader-main {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3.5rem;
}

/* ---------- Practice panel (compact, below ayat) ---------- */
.sound-practice-panel {
  margin: 0.85rem 0 0;
  max-width: none;
  width: 100%;
  padding: 0.65rem 0.75rem 0.6rem;
  background:
    linear-gradient(155deg, rgba(255, 250, 239, 0.98) 0%, rgba(243, 250, 246, 0.95) 100%);
  border: 1px solid rgba(13, 79, 60, 0.22);
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(13, 79, 60, 0.06);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.sound-practice-panel.is-recording {
  border-color: rgba(180, 40, 40, 0.4);
  box-shadow:
    0 0 0 2px rgba(180, 40, 40, 0.1),
    0 4px 14px rgba(13, 79, 60, 0.08);
}

.sound-practice-panel.is-listening {
  animation: sound-listen-glow 2.2s ease-in-out infinite;
}

@keyframes sound-listen-glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(180, 40, 40, 0.08), 0 4px 14px rgba(13, 79, 60, 0.08); }
  50% { box-shadow: 0 0 0 3px rgba(180, 40, 40, 0.14), 0 4px 16px rgba(180, 40, 40, 0.1); }
}

.sound-practice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
}

.sound-practice-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--primary-dark);
}

.sound-practice-title i {
  color: #b83232;
  font-size: 0.85rem;
}

.sound-practice-panel.is-recording .sound-practice-title i {
  animation: sound-mic-pulse 1s ease-in-out infinite;
}

@keyframes sound-mic-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.12); }
}

.sound-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 110px;
  flex: 1 1 120px;
  max-width: 180px;
}

.sound-progress-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  min-width: 2.8rem;
  text-align: center;
}

.sound-progress-bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(13, 79, 60, 0.12);
  border: 1px solid rgba(13, 79, 60, 0.15);
  overflow: hidden;
}

.sound-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary) 0%, var(--gold) 100%);
  transition: width 0.35s ease;
}

.sound-status {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink-soft);
  min-height: 1.4em;
}

.sound-coach {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 8px;
}

.sound-coach-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'Reem Kufi', sans-serif;
  border: 1px solid rgba(201, 169, 97, 0.45);
  background: rgba(13, 79, 60, 0.08);
  color: var(--primary);
}

.sound-coach-badge.is-listening { background: rgba(13, 79, 60, 0.1); color: var(--primary); }
.sound-coach-badge.is-good { background: #d4edda; color: #155724; border-color: #b7dfc1; }
.sound-coach-badge.is-slow { background: #fff3cd; color: #856404; border-color: #ffe08a; }
.sound-coach-badge.is-repeat,
.sound-coach-badge.is-hint { background: #e8f0fe; color: #1a4d8c; border-color: #b6d0f7; }
.sound-coach-badge.is-milestone {
  background: linear-gradient(135deg, #fff4d6, #f0e0a8);
  color: var(--gold-dark);
  border-color: var(--gold);
}

.sound-coach-msg {
  font-size: 0.76rem;
  color: var(--fg);
  flex: 1;
  min-width: 0;
}

.sound-practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
}

.sound-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border-radius: 9px;
  border: 1.5px solid transparent;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  -webkit-appearance: none;
  appearance: none;
}

.sound-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.sound-btn:active {
  transform: translateY(0);
}

.sound-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sound-btn-record {
  background: linear-gradient(145deg, #c23b3b 0%, #8f1f1f 100%);
  color: #fff;
  border-color: rgba(100, 20, 20, 0.35);
  box-shadow: 0 4px 14px rgba(160, 40, 40, 0.3);
}

.sound-btn-stop {
  background: linear-gradient(145deg, #4a4a4a 0%, #2a2a2a 100%);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sound-btn-secondary {
  background: linear-gradient(145deg, #fff8e7, #f0d896);
  color: var(--primary-dark);
  border-color: var(--gold);
}

.sound-btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary);
  border-color: rgba(13, 79, 60, 0.25);
}

.sound-hint {
  margin: 0.45rem 0 0;
  font-size: 0.7rem;
  color: var(--ink-soft);
  line-height: 1.35;
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  justify-content: center;
  text-align: center;
}

.sound-hint i {
  margin-top: 0.12rem;
  color: var(--gold-dark);
  font-size: 0.72rem;
}

.sound-hint.is-warn {
  color: #7a4a12;
  background: rgba(255, 243, 205, 0.55);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
}

/* ---------- Meta bar ---------- */
.sound-reader-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 250, 239, 0.9);
  border: 1px solid rgba(201, 169, 97, 0.5);
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(45, 24, 16, 0.05);
}

.sound-reader-meta-bar .meta-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.sound-reader-meta-bar .meta-num {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(13, 79, 60, 0.08);
  border: 1px solid rgba(13, 79, 60, 0.18);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}

/* ---------- Mushaf page ---------- */
.sound-mushaf {
  position: relative;
  margin-bottom: 0;
  background: linear-gradient(180deg, #fffef8 0%, #faf3e0 55%, #f5ebd0 100%);
  border: 2px solid var(--gold);
  border-radius: 18px;
  box-shadow:
    0 8px 28px rgba(45, 24, 16, 0.1),
    inset 0 0 0 6px rgba(201, 169, 97, 0.25),
    inset 0 0 0 8px rgba(13, 79, 60, 0.08);
  overflow: hidden;
}

body.voice-mode .sound-mushaf {
  border-color: var(--primary);
  box-shadow:
    0 8px 28px rgba(13, 79, 60, 0.14),
    inset 0 0 0 6px rgba(13, 79, 60, 0.12),
    inset 0 0 0 8px rgba(201, 169, 97, 0.2);
}

.sound-mushaf-inner {
  padding: 1.5rem 1.25rem 1.75rem;
}

.sound-mushaf-title {
  text-align: center;
  margin: 0 0 1.15rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(201, 169, 97, 0.45);
  font-family: 'Reem Kufi', sans-serif;
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  color: var(--primary-dark);
  position: relative;
}

.sound-mushaf-title::after {
  content: '۞';
  display: block;
  margin-top: 0.4rem;
  font-family: 'Amiri Quran', serif;
  font-size: 1.1rem;
  color: var(--gold);
  line-height: 1;
}

.sound-ayahs {
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: clamp(1.25rem, 3.8vw, 1.65rem);
  line-height: 2.75;
  color: #1a120c;
  text-align: justify;
  text-align-last: center;
  direction: rtl;
  unicode-bidi: embed;
  /* Natural spaces come from text nodes between spans — no extra word-spacing */
  word-spacing: normal;
  letter-spacing: normal;
  white-space: normal;
}

/*
 * Words stay inline in the flowing Quran line.
 * Spacing is real spaces between spans (not margin chips).
 */
.sound-word,
.sound-ayahs .q-word {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  vertical-align: baseline;
  white-space: nowrap; /* keep each Arabic word intact */
  transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

/* Ayah numbers — ALWAYS visible during recording */
.sound-ayah-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55em;
  height: 1.55em;
  margin: 0 0.15em;
  vertical-align: middle;
  font-family: 'Amiri Quran', serif;
  font-size: 0.7em;
  line-height: 1;
  color: var(--primary-dark);
  background: radial-gradient(circle, #fff8e7 0%, #f0d896 70%, var(--gold) 100%);
  border: 1.5px solid var(--gold-dark);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(139, 105, 20, 0.25);
  user-select: none;
  position: relative;
  z-index: 2;
  white-space: nowrap;
}

body.voice-active .sound-ayah-marker {
  opacity: 1 !important;
  visibility: visible !important;
  color: var(--primary-dark) !important;
  box-shadow: 0 0 0 2px rgba(13, 79, 60, 0.15), 0 2px 6px rgba(139, 105, 20, 0.3);
}

/*
 * Hidden words: keep the word's natural width (text stays in DOM),
 * only hide the ink. Do NOT use opacity:0 (that hides the blank underline too).
 * Override voice-recite's inline opacity:0.
 */
body.voice-active .sound-word.voice-hidden,
body.voice-active .q-word.voice-hidden {
  opacity: 1 !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  background: rgba(13, 79, 60, 0.07);
  border-bottom: 2px dashed rgba(184, 134, 11, 0.55);
  border-radius: 4px;
  padding: 0 0.06em;
  display: inline;
  user-select: none;
  pointer-events: none;
}

/* Next expected word slot — still in-flow, lightly highlighted blank */
body.voice-active .sound-word.voice-next,
body.voice-active .q-word.voice-next {
  opacity: 1 !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  background: rgba(184, 134, 11, 0.18);
  border-bottom: 2px solid var(--gold);
  border-radius: 4px;
  padding: 0 0.06em;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35);
  animation: sound-next-pulse 1.4s ease-in-out infinite;
  display: inline;
}

@keyframes sound-next-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35); }
  50% { box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18); }
}

/* Revealed words — soft highlight, still continuous mushaf text */
body.voice-active .sound-word.voice-revealed,
body.voice-active .sound-word.revealed,
body.voice-active .q-word.voice-revealed,
body.voice-active .q-word.revealed {
  opacity: 1 !important;
  color: var(--primary-dark) !important;
  -webkit-text-fill-color: var(--primary-dark);
  background: rgba(45, 122, 63, 0.14);
  border-bottom: 2px solid rgba(45, 122, 63, 0.55);
  border-radius: 3px;
  font-weight: inherit;
  padding: 0 0.04em;
  display: inline;
  animation: sound-word-reveal 0.3s ease;
}

@keyframes sound-word-reveal {
  from {
    color: transparent;
    background: rgba(45, 122, 63, 0.05);
  }
  to {
    color: var(--primary-dark);
    background: rgba(45, 122, 63, 0.14);
  }
}

.sound-reader-empty,
.sound-reader-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.6;
}

.sound-reader-error {
  color: #8b2e2e;
  background: rgba(180, 60, 60, 0.08);
  border: 1px solid rgba(180, 60, 60, 0.25);
  border-radius: 14px;
}

.sound-reader-footer {
  margin-top: 1.35rem;
  text-align: center;
}

.sound-reader-footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid rgba(13, 79, 60, 0.35);
  background: linear-gradient(145deg, #fffaef, #f0e4c4);
  color: var(--primary-dark);
  text-decoration: none;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sound-reader-footer a:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 79, 60, 0.12);
}

/* ---------- Settings modal ---------- */
.sound-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(8, 46, 35, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sound-settings-overlay.is-open {
  display: flex;
}

.sound-settings-overlay[hidden] {
  display: none !important;
}

.sound-settings-overlay.is-open[hidden] {
  display: flex !important;
}

.sound-settings-card {
  width: min(820px, 100%);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  background: linear-gradient(160deg, #fffaef 0%, #f5e6c8 100%);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 1.25rem 1.2rem 1.1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  color: var(--fg);
  text-align: right;
}

/* Three settings side by side */
.sound-settings-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  align-items: stretch;
}

.sound-settings-row-3 .sound-settings-block {
  margin-bottom: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sound-settings-tile {
  padding: 0.7rem 0.65rem 0.65rem;
}

.sound-settings-tile-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.sound-settings-tile-head .sound-settings-icon {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.75rem;
}

.sound-settings-tile-head strong {
  font-size: 0.88rem;
  color: var(--primary-dark);
  line-height: 1.3;
}

.sound-settings-tile-desc {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  color: #6b5a45;
  line-height: 1.35;
  min-height: 2em;
}

.sound-settings-tile-control {
  display: flex;
  justify-content: center;
  margin: 0.15rem 0 0.35rem;
}

.sound-settings-tile .sound-pace-toggle {
  margin-top: 0.15rem;
  flex-wrap: nowrap;
}

.sound-settings-tile .sound-pace-opt {
  min-height: 34px;
  font-size: 0.78rem;
  padding: 0.25rem 0.35rem;
}

.sound-settings-tile .sound-cache-status {
  margin: 0.25rem 0 0.35rem;
  font-size: 0.68rem;
  line-height: 1.3;
  min-height: 2.2em;
}

.sound-settings-secondary-sm {
  margin-top: auto;
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
}

.sound-settings-tile .sound-tajweed-legend {
  margin-top: auto;
  justify-content: center;
  gap: 0.3rem;
}

.sound-settings-tile .sound-tajweed-legend span {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
}

/* When tajweed tile is hidden, let other two share the row */
.sound-settings-row-3:has(#tajweedSettingsBlock[hidden]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .sound-settings-card {
    width: min(100%, 520px);
  }

  .sound-settings-row-3,
  .sound-settings-row-3:has(#tajweedSettingsBlock[hidden]) {
    grid-template-columns: 1fr;
  }
}

.sound-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sound-settings-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sound-settings-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sound-settings-block {
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.7rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 14px;
}

.sound-settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.sound-settings-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
}

.sound-settings-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fffaef;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.sound-settings-label strong {
  display: block;
  color: var(--primary-dark);
  font-size: 0.92rem;
}

.sound-settings-label p {
  margin: 0.15rem 0 0;
  font-size: 0.74rem;
  color: #6b5a45;
  line-height: 1.4;
}

.sound-pace-toggle {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.sound-pace-opt {
  flex: 1;
  min-height: 40px;
  border-radius: 10px;
  border: 1.5px solid rgba(13, 79, 60, 0.25);
  background: #fff;
  color: var(--primary-dark);
  font-family: 'Reem Kufi', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sound-pace-opt.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: var(--primary-dark);
  color: #fffaef;
}

.sound-pace-opt:hover:not(.is-active) {
  border-color: var(--gold);
  background: #fff8e7;
}

/* Recitation mode — options in one row */
.sound-recite-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.sound-recite-mode-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.sound-recite-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: right;
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1.5px solid rgba(13, 79, 60, 0.22);
  background: #fff;
  color: var(--primary-dark);
  font-family: 'Tajawal', sans-serif;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

@media (max-width: 700px) {
  .sound-recite-mode,
  .sound-recite-mode-3 {
    grid-template-columns: 1fr;
  }
}

/* Select-ayahs picker (inside settings popup) */
.sound-select-picker {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem 0.85rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid rgba(13, 79, 60, 0.28);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(13, 79, 60, 0.06);
}

.sound-select-picker-in-settings {
  margin-top: 0.85rem;
}

.sound-select-picker[hidden] {
  display: none !important;
}

.sound-select-picker-note {
  margin: 0.55rem 0 0;
  font-size: 0.74rem;
  color: var(--ink-soft);
  line-height: 1.4;
  text-align: center;
}

.sound-select-page-hint {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.85rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--primary-dark);
  background: rgba(13, 79, 60, 0.08);
  border: 1px solid rgba(13, 79, 60, 0.2);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.sound-select-page-hint[hidden] {
  display: none !important;
}

.sound-select-page-hint i {
  color: var(--primary);
}

.sound-select-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.sound-select-picker-title {
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sound-select-picker-title i {
  color: var(--primary);
}

.sound-select-summary {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fffaef;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.sound-select-picker-hint {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.sound-select-range-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
  justify-content: center;
}

.sound-select-range-field {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.sound-select-range-field select {
  min-width: 3.5rem;
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  border: 1.5px solid rgba(201, 169, 97, 0.55);
  background: #fff;
  font-family: 'Amiri Quran', serif;
  font-size: 1rem;
  color: var(--primary-dark);
}

.sound-select-apply {
  min-height: 34px;
  padding: 0.3rem 0.75rem;
  border-radius: 9px;
  border: 1.5px solid var(--gold);
  background: linear-gradient(145deg, #fff8e7, #f0d896);
  color: var(--primary-dark);
  font-family: 'Reem Kufi', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.sound-select-apply:hover {
  filter: brightness(1.03);
}

.sound-ayah-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.sound-ayah-chip {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.2rem 0.4rem;
  border-radius: 50%;
  border: 2px dashed rgba(139, 105, 20, 0.55);
  background: #fff;
  color: var(--primary-dark);
  font-family: 'Amiri Quran', serif;
  font-size: 1rem;
  cursor: pointer;
  opacity: 1;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, border-color 0.12s;
}

.sound-ayah-chip:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  background: #f3faf6;
}

/* Selected = solid green so choice is obvious */
.sound-ayah-chip.is-selected {
  border-style: solid;
  border-color: var(--primary-dark);
  background: radial-gradient(circle, #1f7a5a 0%, var(--primary) 70%, #082e23 100%);
  color: #fffaef;
  box-shadow: 0 0 0 3px rgba(13, 79, 60, 0.22), 0 3px 10px rgba(13, 79, 60, 0.25);
  transform: scale(1.06);
}

.sound-select-apply {
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.25);
}

.sound-select-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.sound-select-mini {
  min-height: 32px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(13, 79, 60, 0.25);
  background: #fff;
  color: var(--primary);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.sound-select-mini:hover {
  border-color: var(--gold);
  background: #fff8e7;
}

.sound-recite-opt > i {
  color: var(--gold-dark);
  margin-bottom: 0.1rem;
}

.sound-recite-opt-title {
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
}

.sound-recite-opt-desc {
  font-size: 0.74rem;
  color: #6b5a45;
  line-height: 1.4;
}

.sound-recite-opt.is-active {
  border-color: var(--primary);
  background: linear-gradient(145deg, rgba(243, 250, 246, 0.95), #fffaef);
  box-shadow: 0 0 0 2px rgba(13, 79, 60, 0.1);
}

.sound-recite-opt.is-active > i {
  color: var(--primary);
}

.sound-recite-opt:hover:not(.is-active) {
  border-color: var(--gold);
  background: #fff8e7;
}

/* Start-ayah picker (fromAny mode) */
.sound-start-picker {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.85rem 0.85rem;
  background: linear-gradient(155deg, rgba(255, 250, 239, 0.98), rgba(243, 250, 246, 0.92));
  border: 1.5px solid rgba(13, 79, 60, 0.28);
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(13, 79, 60, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sound-start-picker[hidden] {
  display: none !important;
}

.sound-start-picker.is-listening-detect {
  border-color: rgba(180, 40, 40, 0.45);
  animation: sound-detect-pulse 1.6s ease-in-out infinite;
}

.sound-start-picker.is-detected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(13, 79, 60, 0.12), 0 4px 14px rgba(13, 79, 60, 0.1);
}

@keyframes sound-detect-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(180, 40, 40, 0.1); }
  50% { box-shadow: 0 0 0 4px rgba(180, 40, 40, 0.18); }
}

.sound-start-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.sound-start-picker-title {
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sound-start-picker-title i {
  color: var(--primary);
  font-size: 0.85rem;
}

.sound-start-picker.is-listening-detect .sound-start-picker-title i {
  color: #b83232;
  animation: sound-mic-pulse 1s ease-in-out infinite;
}

.sound-start-picker-current {
  min-width: 2rem;
  text-align: center;
  font-family: 'Amiri Quran', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fffaef;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  box-shadow: 0 2px 8px rgba(13, 79, 60, 0.25);
}

.sound-start-picker.is-listening-detect .sound-start-picker-current {
  background: linear-gradient(135deg, #c23b3b, #8f1f1f);
}

.sound-start-picker-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.sound-practice-panel.is-detecting {
  border-color: rgba(180, 40, 40, 0.4);
}

.sound-ayah-marker.is-start-marker {
  box-shadow: 0 0 0 3px rgba(13, 79, 60, 0.35), 0 2px 8px rgba(139, 105, 20, 0.35);
  transform: scale(1.12);
  background: radial-gradient(circle, #1f7a5a 0%, var(--primary) 70%, #082e23 100%);
  color: #fffaef;
  border-color: var(--primary-dark);
}

/* Ayahs before the auto-detected start: fully removed from view */
.sound-word.sound-ayah-hidden-before,
.q-word.sound-ayah-hidden-before,
.sound-ayah-marker.sound-ayah-hidden-before {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
}

body.sound-detecting .sound-mushaf {
  border-color: rgba(180, 40, 40, 0.45);
}

/* Toggle switch (reuse landing pattern) */
.sound-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.sound-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.sound-switch-ui {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #c9b896;
  border: 1px solid rgba(139, 105, 20, 0.35);
  position: relative;
  transition: background 0.2s;
}

.sound-switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.sound-switch input:checked + .sound-switch-ui {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.sound-switch input:checked + .sound-switch-ui::after {
  transform: translateX(-18px);
}

.sound-switch-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 2.4rem;
}

.sound-cache-status {
  margin: 0.55rem 0 0.45rem;
  font-size: 0.74rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.sound-settings-secondary {
  width: 100%;
  border: 1px solid rgba(13, 79, 60, 0.25);
  background: rgba(255, 255, 255, 0.8);
  color: var(--primary-dark);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.sound-settings-secondary:hover {
  background: #fff;
  border-color: var(--gold);
}

.sound-settings-note {
  margin: 0.35rem 0 0;
  font-size: 0.74rem;
  color: #6b5a45;
  text-align: center;
}

.sound-tajweed-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.sound-tajweed-legend span {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.sound-tajweed-legend .leg-madd {
  color: #1a5f9e;
  background: rgba(26, 95, 158, 0.1);
  border-color: rgba(26, 95, 158, 0.25);
}

.sound-tajweed-legend .leg-shadda {
  color: #9a6b0a;
  background: rgba(184, 134, 11, 0.12);
  border-color: rgba(184, 134, 11, 0.3);
}

.sound-tajweed-legend .leg-sukun {
  color: #8b4513;
  background: rgba(139, 69, 19, 0.1);
  border-color: rgba(139, 69, 19, 0.25);
}

.sound-tajweed-legend .leg-waqf {
  color: #7a1f3d;
  background: rgba(122, 31, 61, 0.1);
  border-color: rgba(122, 31, 61, 0.25);
}

/* ---------- Tajweed light (Al-Fatiha) ---------- */
.tajweed-light .tj-madd,
.tajweed-light .tj-madd-base {
  color: #1a5f9e;
  -webkit-text-fill-color: #1a5f9e;
}

.tajweed-light .tj-dagger {
  color: #0d4f3c;
  -webkit-text-fill-color: #0d4f3c;
  font-weight: 700;
}

.tajweed-light .tj-shadda {
  color: #b8860b;
  -webkit-text-fill-color: #b8860b;
  font-weight: 700;
}

.tajweed-light .tj-sukun {
  color: #8b4513;
  -webkit-text-fill-color: #8b4513;
}

.tajweed-light .tj-waqf {
  color: #7a1f3d;
  -webkit-text-fill-color: #7a1f3d;
  font-weight: 700;
}

.tajweed-light .sound-word.has-tj-tip {
  border-bottom: 1.5px dotted rgba(26, 95, 158, 0.45);
  cursor: help;
}

/* Stronger colors after successful completion */
body.tajweed-review .tj-madd,
body.tajweed-review .tj-madd-base {
  color: #0b4a8a;
  -webkit-text-fill-color: #0b4a8a;
  text-decoration: underline;
  text-decoration-color: rgba(26, 95, 158, 0.35);
  text-underline-offset: 3px;
}

body.tajweed-review .tj-shadda {
  color: #8b6914;
  -webkit-text-fill-color: #8b6914;
}

body.tajweed-review .sound-word.has-tj-tip {
  background: rgba(26, 95, 158, 0.06);
  border-radius: 4px;
}

/* Hide tajweed ink while word is blank */
body.voice-active .sound-word.voice-hidden .tj-madd,
body.voice-active .sound-word.voice-hidden .tj-madd-base,
body.voice-active .sound-word.voice-hidden .tj-dagger,
body.voice-active .sound-word.voice-hidden .tj-shadda,
body.voice-active .sound-word.voice-hidden .tj-sukun,
body.voice-active .sound-word.voice-hidden .tj-waqf,
body.voice-active .sound-word.voice-next .tj-madd,
body.voice-active .sound-word.voice-next .tj-madd-base,
body.voice-active .sound-word.voice-next .tj-dagger,
body.voice-active .sound-word.voice-next .tj-shadda,
body.voice-active .sound-word.voice-next .tj-sukun,
body.voice-active .sound-word.voice-next .tj-waqf {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}

/* Revealed words keep tajweed colors */
body.voice-active .sound-word.voice-revealed,
body.voice-active .sound-word.revealed {
  -webkit-text-fill-color: unset;
}

body.voice-active .sound-word.voice-revealed .tj-madd-base,
body.voice-active .sound-word.revealed .tj-madd-base,
body.voice-active .sound-word.voice-revealed .tj-madd,
body.voice-active .sound-word.revealed .tj-madd {
  color: #1a5f9e !important;
  -webkit-text-fill-color: #1a5f9e !important;
}

body.voice-active .sound-word.voice-revealed .tj-shadda,
body.voice-active .sound-word.revealed .tj-shadda {
  color: #b8860b !important;
  -webkit-text-fill-color: #b8860b !important;
}

body.voice-active .sound-word.voice-revealed .tj-sukun,
body.voice-active .sound-word.revealed .tj-sukun {
  color: #8b4513 !important;
  -webkit-text-fill-color: #8b4513 !important;
}

body.voice-active .sound-word.voice-revealed .tj-dagger,
body.voice-active .sound-word.revealed .tj-dagger {
  color: #0d4f3c !important;
  -webkit-text-fill-color: #0d4f3c !important;
}

/* ---------- Complete overlay ---------- */
.sound-complete-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(8, 46, 35, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sound-complete-overlay[hidden] {
  display: none !important;
}

.sound-complete-card {
  width: min(400px, 100%);
  text-align: center;
  padding: 1.5rem 1.25rem 1.25rem;
  background: linear-gradient(160deg, #fffaef 0%, #f5e6c8 100%);
  border: 2px solid var(--gold);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  color: var(--fg);
}

.sound-complete-icon {
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  background: linear-gradient(145deg, var(--gold-light), var(--gold-dark));
  box-shadow: 0 4px 14px rgba(139, 105, 20, 0.35);
}

.sound-complete-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.45rem;
  color: var(--primary-dark);
}

.sound-complete-card p {
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.sound-complete-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sound-complete-actions .sound-btn {
  width: 100%;
}

@media (max-width: 480px) {
  .sound-mushaf-inner {
    padding: 1.15rem 0.9rem 1.4rem;
  }

  .sound-ayahs {
    line-height: 2.8;
  }

  .sound-practice-panel {
    padding: 0.55rem 0.6rem 0.5rem;
  }

  .sound-practice-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .sound-btn {
    flex: 1 1 auto;
    min-width: 7.5rem;
  }
}
