/* ==========================================================================
   QuranicWords — components: word cards, verse context, table, flashcards,
   quiz, learn path, roots, progress, dialog, toasts, celebrations, about.
   ========================================================================== */

/* ---------------- Word cards ---------------- */
.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 18px;
}
.word-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  min-width: 0;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.word-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.word-card:hover, .word-card:focus-within { border-color: var(--primary-border); box-shadow: var(--shadow-md); }
.word-card:hover::before, .word-card:focus-within::before { opacity: 1; }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-arabic-wrap { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.card-arabic {
  font-family: var(--font-arabic);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-arabic);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}
.card-arabic:hover { color: var(--primary-text); }
.card-meta-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.card-pos-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}
.cat-verb { color: var(--light-green); border-color: rgba(126, 217, 87, 0.4); }
[data-theme="light"] .cat-verb { color: #2d6b12; }
.cat-particle { color: var(--gold-text); border-color: var(--gold-border); }
.card-occ-pill {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--gold-text);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.card-tags-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-tags-row.centered { justify-content: center; }
.tag-root {
  font-family: var(--font-arabic);
  font-size: 1.05rem;
  background: var(--primary-soft);
  color: var(--primary-text);
  border: 1px solid var(--primary-border);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 30px;
}
.tag-root:hover { background: var(--primary); color: var(--on-primary); }
.tag-root.static { cursor: default; }
.tag-root.static:hover { background: var(--primary-soft); color: var(--primary-text); }
.tag-chapter, .tag-learned {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-inset);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.tag-learned { color: var(--primary-text); border: 1px solid var(--primary-border); }
.card-meaning-box { display: flex; flex-direction: column; gap: 4px; }
.card-primary-meaning { font-size: 1.06rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.card-pos-detail { font-size: 0.78rem; color: var(--text-dim); }
.verb-forms { font-size: 0.84rem; color: var(--text-muted); }
.vf-ar { font-size: 1.15rem; color: var(--text-arabic); }
.card-poly-indicator {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--gold-text);
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  min-height: 30px;
}
.card-poly-indicator:hover { border-color: var(--gold); }

/* ---------------- Verse context ---------------- */
.card-verse-box {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: auto;
}
.verse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  text-align: start;
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 600;
  min-height: 44px;
}
.verse-toggle:hover { background: var(--primary-soft); }
.verse-toggle-label { flex: 1; }
.verse-ref-badge { font-size: 0.74rem; font-weight: 700; color: var(--gold-text); }
.card-verse-content { padding: 0 12px 12px; }
.card-verse-arabic {
  font-family: var(--font-verse);
  font-size: 1.35rem;
  line-height: 2.1;
  color: var(--text-main);
  text-align: right;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
/* The taught word and its meaning: bold green (light theme) / gold (dark theme) on a tint. No padding or border
   on the Arabic mark - either would break the joining of a connected letter (لِ in لِرَبِّهِۦ). */
.card-verse-arabic mark {
  background: var(--hl-bg);
  color: var(--hl-text);
  font-weight: 700;
  text-decoration: underline 2px var(--hl-text);
  text-underline-offset: 6px;
}
.card-verse-trans { font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; }
.verse-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin-top: 8px; }
.card-verse-trans mark, .mark-tr {
  background: var(--hl-bg);
  color: var(--hl-text);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 700;
}
.verse-ref { font-size: 0.76rem; font-weight: 700; color: var(--gold-text); margin-top: 6px; }

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
a.card-action-btn { text-decoration: none; }
.card-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  min-height: 36px;
  border-radius: var(--radius-sm);
}
.card-action-btn:hover { color: var(--text-main); background: var(--primary-soft); }
.card-action-btn.active { color: var(--gold-text); }

.load-more-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 0; }
.empty-state { text-align: center; padding: 50px 16px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state-icon { font-size: 2.6rem; opacity: 0.6; }

/* ---------------- Table ---------------- */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}
.dict-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.dict-table th {
  background: var(--bg-surface-elevated);
  padding: 12px 14px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: start;
  white-space: nowrap;
}
.dict-table td { padding: 10px 14px; border-top: 1px solid var(--border-subtle); vertical-align: middle; }
.dict-table tr:hover td { background: var(--primary-soft); }
.dict-table .num { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.table-arabic-cell { text-align: right; white-space: nowrap; }
.linklike {
  font-family: var(--font-arabic);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-arabic);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
}
.linklike:hover { color: var(--primary-text); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px 0; flex-wrap: wrap; }
.pager-info { font-size: 0.88rem; color: var(--text-muted); }

/* ---------------- Flashcards & review ---------------- */
.flashcard-controls-top, .flashcard-wrap, .flashcard-nav-bar, .kbd-hint { max-width: 640px; margin-left: auto; margin-right: auto; }
.flashcard-controls-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.flashcard-progress-text { font-size: 0.9rem; font-weight: 700; color: var(--text-muted); }
.flashcard-streak-badge {
  background: var(--gold-soft);
  color: var(--gold-text);
  border: 1px solid var(--gold-border);
  padding: 2px 12px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.8rem;
}
.flashcard-perspective-box {
  display: block;
  width: 100%;
  min-height: 320px;
  perspective: 1000px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  border-radius: var(--radius-lg);
  color: inherit;
}
.flashcard-flipper {
  display: block;
  position: relative;
  width: 100%;
  min-height: 320px;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.flashcard-flipper.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: center;
}
.flashcard-back { transform: rotateY(180deg); border-color: var(--primary-border); }
.fc-arabic { font-family: var(--font-arabic); font-size: clamp(2.6rem, 9vw, 4rem); font-weight: 700; line-height: 1.4; color: var(--text-arabic); }
.fc-root-tag { font-family: var(--font-arabic); font-size: 1.1rem; color: var(--primary-text); }
.fc-hint-tap { font-size: 0.8rem; color: var(--text-dim); margin-top: 8px; }
.fc-meaning { font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 800; line-height: 1.35; }
.fc-occ { font-size: 0.88rem; color: var(--text-muted); }
.grade-row { text-align: center; margin: 16px 0 0; }
.grade-prompt { font-weight: 700; margin-bottom: 8px; }
.grade-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.grade-buttons .btn { min-width: 96px; }
.grade-buttons kbd { font-family: var(--font-mono); font-size: 0.72rem; opacity: 0.75; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.grade-again { border-color: var(--danger); color: var(--danger); }
.grade-again:hover { background: var(--danger-fill); color: #fff; }
.grade-good { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.grade-good:hover { background: var(--primary-hover); }
.grade-easy { background: var(--gold); color: var(--on-gold); border-color: transparent; }
.fc-extras { margin-top: 14px; }
.flashcard-nav-bar { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.kbd-hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 12px; text-align: center; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}
.panel-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 8px; }
.done-panel { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 18px; }
.done-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 2rem;
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}

/* ---------------- Learn path ---------------- */
.continue-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: var(--primary-border); }
.continue-name { font-weight: 800; font-size: 1.05rem; }
.continue-words { font-size: 1.4rem; color: var(--text-arabic); }
.chapter-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-item { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.chapter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  cursor: pointer;
  border-radius: var(--radius-lg);
  list-style: none;
}
.chapter-summary::-webkit-details-marker { display: none; }
.chapter-summary::before { content: '▸'; color: var(--primary-text); transition: transform var(--transition-fast); }
[dir="rtl"] .chapter-summary::before { content: '◂'; }
.chapter-item[open] > .chapter-summary::before { transform: rotate(90deg); }
[dir="rtl"] .chapter-item[open] > .chapter-summary::before { transform: rotate(-90deg); }
.chapter-name { flex: 1; display: flex; flex-direction: column; font-weight: 700; min-width: 180px; }
.chapter-num { font-size: 0.74rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.04em; }
.chapter-progress { display: flex; flex-direction: column; gap: 4px; min-width: 140px; font-size: 0.8rem; }
.chapter-body { padding: 0 16px 16px; }
.section-block { margin-top: 12px; }
.section-title { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 8px; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 8px; }
.lesson-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: start;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  cursor: pointer;
}
.lesson-btn:hover { border-color: var(--primary-border); }
.lesson-btn.is-done { border-color: var(--primary-border); background: var(--primary-soft); }
.lesson-btn.is-next { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.lesson-btn-title { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.86rem; }
.lesson-check { color: var(--primary-text); font-weight: 900; }
.lesson-btn-words { font-size: 1.05rem; color: var(--text-arabic); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 10px; flex-wrap: wrap; }
.lesson-name { font-size: 0.82rem; }
.lesson-step { font-weight: 800; font-size: 1.1rem; }
.step-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.step-dots li { width: 28px; height: 6px; border-radius: var(--radius-full); background: var(--bg-surface-elevated); }
.step-dots li.done { background: var(--primary); }
.step-dots li.current { background: var(--gold); }
.teach-card { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 26px 18px; }
.teach-card .card-verse-box { width: 100%; text-align: start; }
.teach-arabic { font-family: var(--font-arabic); font-size: clamp(2.8rem, 10vw, 4.2rem); font-weight: 700; line-height: 1.4; color: var(--text-arabic); background: none; border: none; cursor: pointer; border-radius: var(--radius-md); padding: 0 10px; }
.teach-meaning { font-size: 1.4rem; font-weight: 800; }
.xp-gain { font-size: 1.4rem; font-weight: 900; color: var(--gold-text); }
.done-words { display: flex; flex-direction: column; gap: 4px; }
.done-words .ar { font-size: 1.3rem; color: var(--text-arabic); }

/* ---------------- Quiz ---------------- */
.quiz-box {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.quiz-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-stats { display: flex; gap: 10px; align-items: center; }
.quiz-score { font-weight: 800; color: var(--gold-text); }
.quiz-combo { font-weight: 800; color: var(--on-primary); background: var(--primary); padding: 2px 10px; border-radius: var(--radius-full); font-size: 0.82rem; }
.quiz-settings { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.quiz-settings .field { flex: 1 1 200px; }
.quiz-prompt { text-align: center; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.quiz-stimulus { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 16px; text-align: center; }
.quiz-question-arabic { font-family: var(--font-arabic); font-size: clamp(2.6rem, 9vw, 3.6rem); font-weight: 700; line-height: 1.4; color: var(--text-arabic); }
.quiz-question-meaning { font-size: 1.5rem; font-weight: 800; }
.quiz-verse { text-align: center; }
.blank { display: inline-block; min-width: 3em; border-bottom: 3px solid var(--gold); color: transparent; }
.quiz-options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quiz-option-btn {
  min-height: 56px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.quiz-option-btn:hover:not([aria-disabled="true"]) { border-color: var(--primary); }
.quiz-option-btn[aria-disabled="true"] { cursor: default; }
.quiz-option-btn .opt-ar { font-size: 1.6rem; color: var(--text-arabic); }
.quiz-option-btn.correct { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.quiz-option-btn.correct .opt-ar { color: var(--on-primary); }
.quiz-option-btn.wrong { border-color: var(--danger); color: var(--danger); background: transparent; }
.quiz-option-btn.correct::after { content: ' ✓'; }
.quiz-option-btn.wrong::after { content: ' ✗'; }
.quiz-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; min-height: 44px; flex-wrap: wrap; }
.quiz-feedback { font-weight: 700; }
.quiz-feedback.ok { color: var(--primary-text); }
.quiz-feedback.bad { color: var(--danger); }

/* ---------------- Roots ---------------- */
.roots-tools { margin-bottom: 14px; max-width: 420px; }
.roots-search { padding-inline: 16px; }
.roots-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.root-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 12px;
  cursor: pointer;
  min-height: 44px;
}
.root-pill:hover { border-color: var(--primary); background: var(--primary-soft); }
.root-pill-arabic { font-size: 1.3rem; color: var(--text-arabic); }
.root-pill-count { font-size: 0.74rem; font-weight: 800; color: var(--primary-text); }

/* ---------------- Progress view ---------------- */
.progress-stats { margin: 0 0 16px; max-width: none; }
.xp-progress { height: 12px; margin: 6px 0; }
.goal-options { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.goal-option {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}
.goal-option.active { border-color: var(--primary); background: var(--primary-soft); }
.goal-option input { accent-color: var(--primary); }
.history-chart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 120px; }
.history-chart li { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.history-bar { width: 100%; height: var(--h, 0%); min-height: 2px; background: var(--primary-border); border-radius: 4px 4px 0 0; }
.history-bar.met { background: var(--primary); }
.history-day { font-size: 0.66rem; color: var(--text-dim); }
.box-chart { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.box-chart li { display: grid; grid-template-columns: 80px 1fr 48px; align-items: center; gap: 10px; font-size: 0.86rem; }
.box-bar { height: 12px; width: var(--w, 0%); min-width: 2px; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--primary), var(--light-green)); }
.box-bar.box-5 { background: var(--gold); }
.box-count { text-align: end; font-variant-numeric: tabular-nums; }
.mistake-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.mistake-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.mistake-ar { font-size: 1.4rem; color: var(--text-arabic); }
.mistake-meaning { flex: 1; min-width: 120px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---------------- Dialog ---------------- */
.modal {
  margin: auto;
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text-main);
  max-width: min(720px, calc(100vw - 24px));
  width: 100%;
  max-height: calc(100vh - 32px);
}
.modal::backdrop { background: rgba(0, 10, 6, 0.72); }
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-title { font-size: 1.2rem; font-weight: 800; }
body.modal-open { overflow: hidden; }
.senses-head { text-align: center; margin-bottom: 6px; }
.senses-ar { font-size: 2.6rem; color: var(--text-arabic); }
.senses-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.sense-item { background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 14px; }
.sense-title { font-size: 0.95rem; color: var(--hl-text); margin-bottom: 4px; }
.confirm-body p { margin-bottom: 16px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---------------- Toasts ---------------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--primary-border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}
.toast.show { opacity: 1; transform: none; }
.toast-error { border-color: var(--danger); }
.toast-success { border-color: var(--gold); }

/* ---------------- Celebrations ---------------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1500; overflow: hidden; }
.confetti {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: 8px;
  height: 12px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0.9;
  animation: confetti-fall var(--d) ease-in var(--delay) forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--dx), 105vh) rotate(var(--r)); opacity: 0.2; }
}
.pulse { animation: pulse 0.9s ease-out 2; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(235, 201, 113, 0.6); }
  100% { box-shadow: 0 0 0 16px rgba(235, 201, 113, 0); }
}
.pulse-static { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------------- About / SEO section ---------------- */
.seo-guide-section {
  margin-top: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
}
.seo-guide-header { text-align: center; margin-bottom: 22px; }
.seo-guide-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 10px; }
.seo-guide-lead { max-width: 780px; margin: 0 auto; color: var(--text-muted); }
.seo-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; margin-bottom: 20px; }
.seo-feature-card { background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 16px; }
.seo-card-title { font-size: 1rem; font-weight: 800; margin-bottom: 6px; }
.seo-card-desc { color: var(--text-muted); font-size: 0.9rem; }
.seo-showcase-box { margin-bottom: 20px; }
.seo-showcase-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 10px; }
.seo-table-responsive { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.seo-preview-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.seo-preview-table th, .seo-preview-table td { padding: 8px 12px; text-align: start; border-top: 1px solid var(--border-subtle); white-space: nowrap; }
.seo-preview-table th { background: var(--bg-surface-elevated); color: var(--text-muted); font-size: 0.74rem; text-transform: uppercase; border-top: none; }
.seo-ar-word { font-size: 1.4rem; color: var(--text-arabic); }
.seo-faq-list { display: flex; flex-direction: column; gap: 8px; }
.seo-faq-item { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-inset); }
.seo-faq-summary { padding: 12px 14px; cursor: pointer; font-weight: 700; border-radius: var(--radius-md); }
.seo-faq-answer { padding: 0 14px 14px; color: var(--text-muted); font-size: 0.92rem; }

@media (max-width: 720px) {
  .word-card { padding: 14px; }
  .card-arabic { font-size: 1.9rem; }
  .quiz-box { padding: 14px; }
  .quiz-options-grid { grid-template-columns: 1fr; }
  .flashcard-perspective-box, .flashcard-flipper { min-height: 260px; }
  .box-chart li { grid-template-columns: 64px 1fr 40px; }
  .card-actions .card-action-btn span:not(.ico) { font-size: 0.8rem; }
}

/* Reduced motion: no 3D flip — swap faces instantly. */
@media (prefers-reduced-motion: reduce) {
  .flashcard-flipper { transition: none; transform: none !important; }
  .flashcard-face { backface-visibility: visible; transform: none; }
  .flashcard-flipper .flashcard-back { display: none; }
  .flashcard-flipper.flipped .flashcard-front { display: none; }
  .flashcard-flipper.flipped .flashcard-back { display: flex; }
  .confetti-layer { display: none; }
}
