﻿/* ============================================================
   رتّب الآيات — Mushaf aesthetic + layout
   ============================================================ */

: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;
  --success: #2d7a3f;
  --danger: #a83232;
  --timer-circumference: 188.5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(184, 134, 11, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(13, 79, 60, 0.08) 0%, transparent 45%);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

.font-quran {
  font-family: 'Amiri Quran', serif;
}

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

/* ---------- Header ---------- */
.header-band {
  background: linear-gradient(135deg, #082e23 0%, var(--primary) 60%, var(--primary-2) 100%);
  position: relative;
  overflow: hidden;
  border-bottom: 4px solid var(--gold);
  padding: 1.5rem 1rem;
  text-align: center;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.header-band h1 {
  margin: 0;
  color: #f5e6c8;
  font-size: 1.75rem;
}

.header-band p {
  margin: 0.25rem 0 0;
  color: #d4af37;
  font-size: 0.9rem;
}

.settings-btn,
.home-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--gold-light);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
  text-decoration: none;
}

.settings-btn {
  left: 15px;
}

.home-btn {
  right: 15px;
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) rotate(45deg);
}

.home-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.05);
}

.settings-btn:focus-visible,
.home-btn:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.info-bar {
  border: 1px solid rgba(201, 169, 97, 0.35);
}

/* ---------- Word bank ---------- */
.word-bank {
  background: linear-gradient(135deg, #fffaef 0%, #fff4d6 100%);
  border: 2px solid var(--gold);
  border-radius: 16px;
  min-height: 100px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(184, 134, 11, 0.15);
  margin-top: 0;
  margin-bottom: 2rem;
  position: relative;
}

.word-bank h3 {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--primary);
  color: #fffaef;
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 0.85rem;
  border: 1px solid var(--gold);
  margin: 0;
}

.word-chip {
  background: linear-gradient(135deg, #0d4f3c 0%, #166548 100%);
  border: 1px solid var(--gold);
  color: #fffaef;
  padding: 0.6rem 1.1rem;
  border-radius: 12px;
  font-family: 'Amiri Quran', serif;
  font-size: 1.4rem;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 3px 8px rgba(45, 24, 16, 0.2);
  animation: popIn 0.4s ease backwards;
  z-index: 10;
}

.word-chip:active {
  cursor: grabbing;
}

.word-chip.placed {
  display: none;
}

.word-chip.dragging-source {
  opacity: 0.3;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Ghost chip during drag */
.ghost-chip {
  position: fixed !important;
  z-index: 9999 !important;
  pointer-events: none !important;
  opacity: 0.95 !important;
  transform: scale(1.15) rotate(3deg);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4) !important;
  background: linear-gradient(135deg, #b8860b 0%, #8b6914 100%) !important;
  color: #fffaef !important;
  border: 1px solid var(--gold-light) !important;
  margin: 0 !important;
  cursor: grabbing !important;
  animation: none !important;
}

/* ---------- Mushaf page ---------- */
.mushaf-page {
  background: radial-gradient(ellipse at center, #fffaef 0%, #f5e6c8 100%);
  border: 3px double var(--gold);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 20px rgba(184, 134, 11, 0.1),
    0 4px 14px rgba(0, 0, 0, 0.08);
  padding: 1.15rem 1.1rem 1rem;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.5s ease;
}

.mushaf-frame {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(184, 134, 11, 0.5);
  border-radius: 4px;
  pointer-events: none;
}

.mushaf-inner {
  text-align: center;
  position: relative;
  z-index: 2;
}

.surah-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 1.35rem;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fffaef;
  border-radius: 30px;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.28);
}

.quran-text {
  font-family: 'Amiri Quran', serif;
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  line-height: 2.15;
  color: var(--primary-dark);
  text-align: justify;
  text-align-last: center;
  direction: rtl;
  position: relative;
  z-index: 2;
}

.q-word {
  display: inline-block;
  padding: 0 0.2rem;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease, color 0.3s ease;
  position: relative;
  border-bottom: 2px solid transparent;
  border-radius: 6px;
}

/* Multi-word chunks need a bit more room as blanks */
.q-word.q-chunk {
  padding: 0 0.35rem;
}

.game-active .q-word.empty.q-chunk {
  min-width: 4.5rem;
}

/* Empty blanks */
.game-active .q-word.empty {
  color: transparent;
  background: rgba(13, 79, 60, 0.1);
  border: 1px dashed var(--gold);
  margin: 0 0.12rem;
  min-width: 2rem;
}

/* Filled blanks */
.q-word.filled {
  background: rgba(13, 79, 60, 0.15);
  border: 1px solid transparent;
  color: var(--primary-dark);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.q-word.filled:hover {
  background: rgba(13, 79, 60, 0.25);
}

/* Verification states */
.q-word.correct {
  background: #d4edda;
  color: var(--success) !important;
  border: 1px solid var(--success);
  font-weight: bold;
  cursor: default;
  touch-action: auto;
}

.q-word.incorrect {
  background: #f8d7da;
  color: var(--danger) !important;
  border: 1px solid var(--danger);
  cursor: default;
  touch-action: auto;
}

.q-word.unanswered {
  background: #fff3cd;
  border: 1px dashed var(--danger) !important;
  color: transparent !important;
  cursor: default;
}

/* Drop hover glow */
.drop-target-hover {
  background: rgba(184, 134, 11, 0.4) !important;
  border: 1px solid var(--gold) !important;
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
}

.ayah-end {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  margin: 0 0.2rem;
  background: radial-gradient(circle, var(--gold-light) 0%, var(--gold) 70%, var(--gold-dark) 100%);
  color: #fffaef;
  border-radius: 50%;
  font-family: 'Amiri Quran', serif;
  font-size: 0.7rem;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* ---------- Buttons ---------- */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  font-family: 'Reem Kufi', sans-serif;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fffaef;
  border-color: var(--gold);
  box-shadow: 0 4px 14px rgba(13, 79, 60, 0.35);
}

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

.hidden {
  display: none !important;
}

/* ---------- Feedback ---------- */
.feedback {
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.feedback.success {
  background: #d4edda;
  color: #155724;
}

.feedback.partial {
  background: #fff3cd;
  color: #856404;
}

/* ---------- Timer ---------- */
.timer-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.timer-ring {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-dark);
}

/* ---------- Overlays / modals ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 46, 35, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding: 1rem;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.popup-card {
  background: linear-gradient(135deg, #fffaef 0%, #f5e6c8 100%);
  border: 3px solid var(--gold);
  border-radius: 22px;
  padding: 2rem 1.75rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  transform: scale(0.85);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

/* Settings needs more room for verse picker + options */
#settingsOverlay .popup-card {
  max-width: min(820px, 96vw);
  padding: 1.75rem 2rem;
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.settings-field {
  min-width: 0;
}

.settings-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-header h2 {
  margin: 0;
}

.responses-icon-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fffaef;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.responses-icon-btn:hover {
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 4px 12px rgba(13, 79, 60, 0.3);
}

.responses-icon-btn:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

.responses-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'Tajawal', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fffaef;
}

#responsesOverlay .responses-card {
  max-width: min(720px, 96vw);
  text-align: right;
}

.responses-list {
  max-height: min(50vh, 380px);
  overflow-y: auto;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  text-align: right;
}

.responses-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #6b5a45;
  font-size: 0.95rem;
}

.response-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem 0.85rem;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(201, 169, 97, 0.35);
}

.response-item:last-child {
  border-bottom: none;
}

.response-item:nth-child(even) {
  background: rgba(13, 79, 60, 0.04);
}

.response-rank {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #fffaef;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.response-body {
  min-width: 0;
}

.response-name {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 1rem;
}

.response-meta {
  font-size: 0.78rem;
  color: #6b5a45;
  margin-top: 0.15rem;
  line-height: 1.45;
}

.response-score-wrap {
  text-align: center;
  flex-shrink: 0;
}

.response-score {
  font-family: 'Reem Kufi', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  line-height: 1;
}

.response-grade {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-dark);
  margin-top: 0.15rem;
}

.overlay.show .popup-card {
  transform: scale(1);
}

.input-box {
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 1rem;
  width: 100%;
  font-family: 'Tajawal', sans-serif;
  color: var(--fg);
}

.input-box:focus {
  outline: none;
  border-color: var(--primary);
}

.form-select {
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 1rem;
  width: 100%;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  color: var(--fg);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ---------- Verse picker (settings) ---------- */
.verse-range-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.verse-range-field {
  min-width: 0;
}

.verse-range-apply {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.verse-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-start;
}

.btn-chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-chip:hover {
  background: rgba(13, 79, 60, 0.08);
  border-color: var(--primary);
}

.verse-picker-list {
  max-height: 200px;
  overflow-y: auto;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  text-align: right;
  padding: 0.35rem;
}

.verse-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.verse-picker-item:hover {
  background: rgba(13, 79, 60, 0.06);
}

.verse-picker-item input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
}

.verse-picker-item .verse-picker-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.verse-picker-item .verse-picker-title {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.9rem;
}

.verse-picker-item .verse-picker-preview {
  font-family: 'Amiri Quran', serif;
  font-size: 0.95rem;
  color: #5c4a38;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verse-picker-summary {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  text-align: center;
}

.score-display {
  font-family: 'Reem Kufi', sans-serif;
  font-size: 4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.result-ornament {
  font-family: 'Amiri Quran', serif;
  font-size: 1.6rem;
  color: var(--gold-dark);
}

/* Phone / small-screen styles live in css/phone.css (loaded after this file) */

@media (min-width: 769px) {
  .container {
    padding: 2rem 1.25rem;
  }
}
/* Prevent text selection while dragging anywhere */
body.is-dragging {
  user-select: none;
  -webkit-user-select: none;
  cursor: grabbing;
}

body.is-dragging .word-chip,
body.is-dragging .q-word {
  cursor: grabbing;
}

/* ---------- Voice recite / memorization test ---------- */
.btn-voice {
  background: linear-gradient(135deg, #1a5c4a 0%, #0d4f3c 55%, #b8860b 160%);
  color: #fffaef;
  border-color: var(--gold-light);
  box-shadow: 0 4px 16px rgba(13, 79, 60, 0.4);
}

.btn-voice:hover {
  filter: brightness(1.06);
}

.voice-panel {
  text-align: center;
  padding: 0.5rem 0.25rem 0.75rem;
}

.voice-panel-icon {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--gold) 120%);
  box-shadow: 0 0 0 0 rgba(184, 134, 11, 0.55);
  animation: voice-pulse 1.6s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(184, 134, 11, 0.45);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(184, 134, 11, 0);
  }
}

.voice-panel h3 {
  margin: 0 0 0.5rem;
  color: var(--primary);
  font-family: 'Reem Kufi', sans-serif;
  font-size: 1.15rem;
}

.voice-status {
  margin: 0 0 0.85rem;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 1.4em;
}

.voice-progress-wrap {
  height: 10px;
  border-radius: 999px;
  background: rgba(13, 79, 60, 0.12);
  border: 1px solid rgba(184, 134, 11, 0.35);
  overflow: hidden;
  margin: 0 auto 0.4rem;
  max-width: 28rem;
}

.voice-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--gold-light) 100%);
  transition: width 0.25s ease;
  border-radius: 999px;
}

.voice-progress-label {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-dark);
}

.voice-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #5a4630;
  line-height: 1.55;
  max-width: 32rem;
  margin-inline: auto;
}

/* ---------- Encouragement modal after full recitation ---------- */
.voice-encourage-overlay {
  z-index: 1200;
}

.voice-encourage-card {
  text-align: center;
  max-width: 26rem;
  position: relative;
  padding-top: 1.75rem;
  background: linear-gradient(180deg, #fffcf3 0%, #eef6f1 55%, #fff8e7 100%);
  border: 2px solid var(--gold);
  box-shadow: 0 12px 40px rgba(13, 79, 60, 0.28);
  animation: voice-encourage-in 0.45s ease;
}

@keyframes voice-encourage-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.voice-encourage-ornament {
  position: absolute;
  top: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 1.1rem;
  letter-spacing: 0.35rem;
  opacity: 0.85;
}

.voice-encourage-icon {
  width: 4rem;
  height: 4rem;
  margin: 0.5rem auto 0.85rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--gold) 130%);
  box-shadow: 0 6px 18px rgba(184, 134, 11, 0.4);
  animation: voice-pulse 1.8s ease-in-out infinite;
}

.voice-encourage-title {
  margin: 0 0 0.35rem;
  color: var(--primary);
  font-size: 1.85rem;
  font-weight: 700;
}

.voice-encourage-name {
  margin: 0 0 0.85rem;
  color: var(--gold-dark);
  font-weight: 700;
  font-size: 1.05rem;
}

.voice-encourage-message {
  margin: 0 0 1rem;
  color: var(--primary-dark);
  font-size: 1.05rem;
  line-height: 1.85;
  font-weight: 500;
  padding: 0 0.35rem;
}

.voice-encourage-sub {
  margin: 0 0 1.15rem;
  font-size: 0.82rem;
  color: #6b5a40;
  opacity: 0.9;
}

/* Hidden words during voice mode */
.voice-active .q-word.voice-hidden {
  opacity: 0;
  color: transparent !important;
  background: rgba(13, 79, 60, 0.08);
  border-bottom: 2px dashed rgba(184, 134, 11, 0.55);
  border-radius: 6px;
  min-width: 1.6rem;
  margin: 0 0.1rem;
  user-select: none;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.voice-active .q-word.voice-next {
  opacity: 0; /* still hidden text, but slot is highlighted */
  background: rgba(184, 134, 11, 0.22);
  border-bottom-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35);
}

.voice-active .q-word.voice-revealed,
.voice-active .q-word.revealed {
  opacity: 1 !important;
  color: var(--primary-dark) !important;
  background: #d4edda;
  border-bottom: 2px solid var(--success);
  font-weight: 700;
  animation: voice-reveal 0.35s ease;
}

@keyframes voice-reveal {
  from {
    transform: scale(0.88);
    opacity: 0.35;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

body.voice-mode .word-bank {
  border-color: var(--primary);
  background: linear-gradient(180deg, #fffcf3 0%, #eef6f1 100%);
}

/* ---------- Voice coach UI ---------- */
.voice-coach-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.55rem;
  padding: 0.22rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  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);
}

.voice-coach-badge.is-listening {
  background: rgba(13, 79, 60, 0.1);
  color: var(--primary);
}

.voice-coach-badge.is-good {
  background: #d4edda;
  color: #155724;
  border-color: #b7dfc1;
}

.voice-coach-badge.is-slow {
  background: #fff3cd;
  color: #856404;
  border-color: #ffe08a;
}

.voice-coach-badge.is-repeat,
.voice-coach-badge.is-hint {
  background: #e8f0fe;
  color: #1a4d8c;
  border-color: #b6d0f7;
}

.voice-coach-badge.is-milestone {
  background: linear-gradient(135deg, #fff4d6, #f0e0a8);
  color: var(--gold-dark);
  border-color: var(--gold);
}

.voice-panel.coach-slow {
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.35);
}

.voice-panel.coach-good {
  box-shadow: 0 0 0 2px rgba(45, 122, 63, 0.28);
}

.voice-panel.coach-repeat,
.voice-panel.coach-hint {
  box-shadow: 0 0 0 2px rgba(26, 77, 140, 0.25);
}

.voice-panel.coach-milestone {
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.45);
}

.voice-active .q-word.voice-next {
  animation: voice-next-pulse 1.4s ease-in-out infinite;
}

@keyframes voice-next-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(212, 175, 55, 0.15);
  }
}
