/* =====================================================================
   English Master — Flashcards  (تصميم البطاقات + المراجعة)
   ---------------------------------------------------------------------
   بطاقة بوجهين بأنيميشن قلب ثلاثي الأبعاد. تعتمد على tokens shared.css.
   ===================================================================== */

.fc-wrap { max-width: 560px; margin: 0 auto; }

/* ---------- رأس الجلسة ---------- */
.fc-head { text-align: center; margin-bottom: 16px; }
.fc-head h1 { font-family: var(--font-heading); font-size: clamp(1.3rem, 4.5vw, 1.8rem); color: var(--ink-blue); font-weight: 700; }
.fc-head .fc-en { font-family: var(--font-english); color: var(--ink-pink); font-weight: 600; direction: ltr; display: block; margin-top: 2px; font-size: 0.95rem; }

/* شريط تقدّم الجلسة */
.fc-progress { display: flex; align-items: center; gap: 10px; margin: 14px 0 22px; }
.fc-progress .fcp-track { flex: 1; height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; }
.fc-progress .fcp-fill { height: 100%; width: 0%; border-radius: 5px; background: linear-gradient(90deg, var(--ink-teal), var(--ink-green)); transition: width 0.4s ease; }
.fc-progress .fcp-counter { font-family: var(--font-english); font-weight: 700; color: var(--ink-blue); font-size: 0.9rem; white-space: nowrap; }

/* ---------- مسرح البطاقة ---------- */
.card-stage { perspective: 1400px; margin-bottom: 22px; }

.flashcard {
  position: relative;
  width: 100%;
  min-height: 340px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.flashcard.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.05);
  overflow: hidden;
}

/* الوش — ورق كشكول */
.card-front {
  background: var(--paper);
  background-image: linear-gradient(var(--paper-line) 1px, transparent 1px);
  background-size: 100% 34px;
  background-position: 0 70px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.card-front::before {
  content: '';
  position: absolute; top: 0; bottom: 0; right: 34px;
  width: 2px; background: var(--paper-margin); opacity: 0.55;
}

.card-status {
  position: absolute; top: 16px; left: 16px;
  font-size: 0.72rem; font-weight: 700;
  padding: 2px 12px; border-radius: 12px;
}
.card-status.is-new { color: var(--ink-red); background: #fee2e2; }
.card-status.is-learning { color: var(--ink-orange); background: #fff7ed; }
.card-status.is-mastered { color: var(--ink-green); background: #f0fdf4; }

.card-word {
  font-family: var(--font-english);
  font-size: clamp(2.2rem, 9vw, 3rem);
  font-weight: 700;
  color: var(--ink-blue);
  direction: ltr;
  line-height: 1.15;
}
.card-phonetic { font-family: var(--font-english); color: var(--text-muted); direction: ltr; font-size: 1.1rem; margin-top: 6px; }

/* زر النطق على البطاقة */
.card-stage .speak-btn {
  width: 46px; height: 46px;
  margin: 18px 0 0;
  border: 2px solid var(--ink-blue);
}
.card-stage .speak-btn .em-icon { width: 1.1em; height: 1.1em; }

.card-hint {
  position: absolute; bottom: 18px; left: 0; right: 0;
  font-family: var(--font-hand);
  color: var(--ink-purple);
  font-size: 1.15rem;
}

/* الضهر — أبيض */
.card-back {
  background: white;
  transform: rotateY(180deg);
  text-align: right;
  overflow-y: auto;
}
.card-meaning-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; border-bottom: 2px dashed var(--ink-blue); padding-bottom: 12px; margin-bottom: 14px; }
.card-meaning { font-family: var(--font-heading); font-size: 1.7rem; font-weight: 700; color: var(--ink-blue); }
.card-type { font-size: 0.85rem; color: var(--ink-purple); font-weight: 600; }

.card-block { margin-bottom: 14px; }
.card-block .cb-label { font-family: var(--font-hand); color: var(--ink-red); font-size: 1.15rem; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }

.example-en { font-family: var(--font-english); color: var(--ink-blue); font-weight: 600; direction: ltr; text-align: left; font-size: 1.05rem; }
.example-ar { font-size: 0.92rem; color: var(--text); margin-top: 3px; }
.example-ar::before { content: '⟵ '; color: var(--text-muted); }

.colo-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.colo-chip {
  background: rgba(13,148,136,0.08);
  border: 1.5px solid var(--ink-teal);
  color: var(--ink-teal);
  padding: 4px 12px; border-radius: 16px;
  font-family: var(--font-english); direction: ltr;
  font-size: 0.85rem; font-weight: 600;
}

/* ---------- أزرار التقييم ---------- */
.card-actions { display: flex; gap: 12px; }
.rate-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px; border: none; border-radius: 14px;
  font-family: var(--font-body); font-weight: 700; font-size: 1.05rem;
  cursor: pointer; color: white;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.rate-btn:hover { transform: translateY(-2px); }
.rate-btn.knew { background: var(--ink-green); box-shadow: 0 6px 16px rgba(21,128,61,0.28); }
.rate-btn.knew:hover { filter: brightness(1.06); }
.rate-btn.didnt { background: var(--ink-red); box-shadow: 0 6px 16px rgba(220,38,38,0.25); }
.rate-btn.didnt:hover { filter: brightness(1.06); }

.fc-keyhint {
  text-align: center; margin-top: 14px;
  font-size: 0.82rem; color: var(--text-muted);
}
.fc-keyhint kbd {
  font-family: var(--font-english);
  background: white; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 7px; font-size: 0.8rem; margin: 0 2px;
}

/* ---------- شاشة الملخّص ---------- */
.session-summary {
  display: none;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.05);
  padding: 36px 26px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.session-summary::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--ink-teal), var(--ink-green), var(--ink-blue));
}
.session-summary.show { display: block; animation: fcPop 0.45s cubic-bezier(0.22,1,0.36,1); }
@keyframes fcPop { from { opacity: 0; transform: scale(0.88) translateY(14px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.session-summary .sum-emoji { font-size: 3.6rem; display: block; margin-bottom: 4px; animation: emojiBounce 0.6s 0.3s both; }
@keyframes emojiBounce { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.session-summary .sum-score { font-family: var(--font-english); font-size: 3.8rem; font-weight: 900; color: var(--ink-teal); line-height: 1; margin: 4px 0 2px; }
.session-summary .sum-label { font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink-purple); margin-bottom: 6px; }
.session-summary .sum-message { font-size: 1.05rem; font-weight: 700; margin-bottom: 20px; color: var(--ink-blue); background: #f0fdf4; border-radius: 10px; padding: 10px 14px; }
.session-summary .sum-grid { display: flex; gap: 12px; justify-content: center; margin-bottom: 22px; }
.session-summary .sum-cell { background: #f8fafc; border-radius: 14px; padding: 14px 26px; flex: 1; max-width: 140px; }
.session-summary .sum-cell .sc-num { font-family: var(--font-english); font-size: 2rem; font-weight: 800; line-height: 1; }
.session-summary .sum-cell.knew .sc-num { color: var(--ink-green); }
.session-summary .sum-cell.didnt .sc-num { color: var(--ink-red); }
.session-summary .sum-cell .sc-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 5px; font-weight: 600; }

.sum-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.sum-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.95rem;
  text-decoration: none; cursor: pointer; border: 2px solid var(--ink-blue);
}
.sum-btn.primary { background: var(--ink-blue); color: white; }
.sum-btn.primary:hover { background: var(--ink-blue-light); }
.sum-btn.ghost { background: white; color: var(--ink-blue); }
.sum-btn.ghost:hover { background: #eff6ff; }
.sum-btn.retry {
  background: linear-gradient(135deg, var(--ink-orange), #f97316);
  color: white; border-color: transparent;
  box-shadow: 0 4px 14px rgba(234,88,12,0.32);
  width: 100%;
}
.sum-btn.retry:hover { filter: brightness(1.07); transform: translateY(-1px); }

/* ---------- حالة المراجعة الفاضية ---------- */
.empty-state {
  display: none;
  text-align: center;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 40px 26px;
}
.empty-state .es-emoji { font-size: 3.4rem; }
.empty-state h2 { font-family: var(--font-heading); color: var(--ink-green); font-size: 1.5rem; margin: 10px 0 6px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }

@media (max-width: 560px) {
  .card-face { padding: 22px 18px; }
  .flashcard { min-height: 320px; }
}
