/* ==============================================
   Flashcard Engagement (F-080)
   UX parity with Quiz engagement layer
   ============================================== */

/* ---- Variables ---- */
:root {
  --fc-accent: var(--accent, #2563EB);
  --fc-accent-glow: rgba(59, 130, 246, 0.35);
  --fc-green: #22c55e;
  --fc-green-glow: rgba(34, 197, 94, 0.35);
  --fc-amber: #eab308;
  --fc-amber-bg: rgba(234, 179, 8, 0.15);
  --fc-gray: #6b7280;
  --fc-gray-bg: rgba(107, 114, 128, 0.10);
  --fc-gold: #f59e0b;
  --fc-gold-bg: rgba(245, 158, 11, 0.15);
  --fc-celebration-ms: 600ms;
}

/* ================================================
   SF-080.1: Compact Stats Bar (right-aligned)
   ================================================ */
.fc-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 20px;
  min-height: 40px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.fc-stats-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fc-stat-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  min-height: 36px;
  font-size: 13px;
  font-weight: 600;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.fc-stat-badge:hover {
  transform: scale(1.05);
}

/* XP Badge (amber) — matches quiz .quiz-nav-stat--xp */
.fc-stat-badge--xp {
  background: var(--fc-amber-bg);
  color: var(--fc-amber);
  font-weight: 700;
}

.fc-stat-badge--xp .fc-stat-icon {
  width: 20px;
  height: 20px;
}

/* Mastery Badge (blue) — matches quiz .quiz-nav-stat--mastery */
.fc-stat-badge--mastery {
  background: rgba(59, 130, 246, 0.15);
  color: #2563EB;
  font-weight: 700;
  position: relative;
}

.fc-stat-badge--mastery svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.fc-mastery-num {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: inherit;
  pointer-events: none;
}

/* Nav Badge (Learn/Quiz links) — 36×36px circles matching quiz-compact-nav-link */
.fc-stat-badge--nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-secondary, #64748b);
  padding: 0;
  border-radius: 50%;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  transition: background 150ms ease;
}
.fc-stat-badge--nav:hover {
  background: var(--bg-hover, rgba(0,0,0,0.06));
}

/* Homepage-matching icon colors */
.fc-stat-badge--nav-learn { color: #2563eb; }
.fc-stat-badge--nav-quiz { color: #eab308; }
.fc-stat-badge--nav svg {
  width: 22px;
  height: 22px;
}

/* Menu Badge (topic browser button) — 36×36px circle matching quiz reset/menu buttons */
.fc-stat-badge--menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--text-secondary, #64748b);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.fc-stat-badge--menu:hover {
  background: var(--bg-hover, rgba(0,0,0,0.06));
  color: var(--text-primary);
  transform: scale(1.05);
}
.fc-stat-badge--menu:active {
  transform: scale(0.93);
}
.fc-stat-badge--menu svg {
  width: 16px;
  height: 16px;
}

/* Streak Badge (gray → amber → gold) */
.fc-stat-badge--streak {
  background: var(--fc-gray-bg);
  color: var(--fc-gray);
}

.fc-stat-badge--streak[data-streak-tier="1"] {
  background: var(--fc-amber-bg);
  color: var(--fc-amber);
}

.fc-stat-badge--streak[data-streak-tier="2"] {
  background: var(--fc-gold-bg);
  color: var(--fc-gold);
}

.fc-stat-badge--streak.fc-hidden {
  display: none;
}

/* Badge pulse animation on XP gain */
.fc-stat-badge.fc-pulse {
  animation: fc-badge-pulse 400ms ease;
}

@keyframes fc-badge-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ================================================
   SF-080.2: Instagram-Style Progress Bar
   ================================================ */
.fc-progress-bar {
  display: flex;
  gap: 2px;
  padding: 0 2px;
  margin: 4px 20px 6px;
  height: 8px;
  align-items: stretch;
  border-radius: 4px;
}

.fc-progress-seg {
  flex: 1;
  min-height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: background 300ms ease, box-shadow 300ms ease, transform 150ms ease;
  position: relative;
  cursor: pointer;
}

.fc-progress-seg:hover {
  transform: scaleY(1.8);
  filter: brightness(1.3);
}

/* Segment states — Got It = green, Still Learning = red/amber */
.fc-progress-seg.seg-got-it {
  background: #22c55e;
}

.fc-progress-seg.seg-still-learning {
  background: #f59e0b;
}

/* Legacy: treat seg-engaged as got-it for backward compat */
.fc-progress-seg.seg-engaged {
  background: #22c55e;
}

.fc-progress-seg.seg-improved {
  background: #22c55e;
  box-shadow: 0 0 6px var(--fc-green-glow);
}

.fc-progress-seg.seg-current {
  background: var(--fc-accent);
  box-shadow: 0 0 4px var(--fc-accent-glow);
}

/* Previous run outlines */
.fc-progress-seg.prev-correct {
  outline: 1.5px solid rgba(34, 197, 94, 0.5);
  outline-offset: -1px;
}

.fc-progress-seg.prev-incorrect {
  outline: 1.5px solid rgba(234, 179, 8, 0.5);
  outline-offset: -1px;
}

/* Current segment pulse */
@media (prefers-reduced-motion: no-preference) {
  .fc-progress-seg.seg-current {
    animation: fc-seg-pulse 2s ease-in-out infinite;
  }
}

@keyframes fc-seg-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Mobile: thinner bar */
@media (max-width: 480px) {
  .fc-progress-bar {
    margin: 2px 16px 4px;
    height: 6px;
  }
}

/* ================================================
   SF-080.3: Rating Celebration Animations
   ================================================ */

/* Blue glow on any rating (same for both) */
.fc-card.fc-celebration-blue {
  animation: fc-glow-blue var(--fc-celebration-ms) ease-out;
}

@keyframes fc-glow-blue {
  0% { box-shadow: none; }
  15% { box-shadow: 0 0 20px var(--fc-accent-glow), 0 10px 40px rgba(0, 0, 0, 0.3); }
  60% { box-shadow: 0 0 12px var(--fc-accent-glow), 0 10px 40px rgba(0, 0, 0, 0.3); }
  100% { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
}

/* Green glow on improvement card */
.fc-card.fc-celebration-green {
  animation: fc-glow-green var(--fc-celebration-ms) ease-out;
}

@keyframes fc-glow-green {
  0% { box-shadow: none; }
  15% { box-shadow: 0 0 24px var(--fc-green-glow), 0 10px 40px rgba(0, 0, 0, 0.3); }
  60% { box-shadow: 0 0 16px var(--fc-green-glow), 0 10px 40px rgba(0, 0, 0, 0.3); }
  100% { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
}

/* ================================================
   SF-080.4: XP Float Animation
   ================================================ */
.fc-xp-float {
  position: absolute;
  font-size: 14px;
  font-weight: 700;
  color: var(--fc-amber);
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .fc-xp-float {
    animation: fc-float-up 1.5s ease-out forwards;
  }
}

@keyframes fc-float-up {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* Bonus float (green) */
.fc-xp-float--bonus {
  color: var(--fc-green);
}

/* ================================================
   SF-080.7: Streak Badge Tiers
   ================================================ */

/* Gold glow at 15+ cards */
@media (prefers-reduced-motion: no-preference) {
  .fc-card.fc-streak-glow {
    animation: fc-streak-border 2s ease-in-out infinite;
  }
}

@keyframes fc-streak-border {
  0%, 100% { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 16px var(--fc-gold-bg), 0 10px 40px rgba(0, 0, 0, 0.3); }
}

/* ================================================
   SF-080.8: Card Slide Animations (Rate = Advance)
   ================================================ */
@media (prefers-reduced-motion: no-preference) {
  .fc-card.fc-slide-out-right {
    animation: fc-slide-right 200ms ease-in forwards;
  }

  .fc-card.fc-slide-in-right {
    animation: fc-enter-right 200ms ease-out forwards;
  }

  .fc-card.fc-slide-out-left {
    animation: fc-slide-left 200ms ease-in forwards;
  }

  .fc-card.fc-slide-in-left {
    animation: fc-enter-left 200ms ease-out forwards;
  }
}

@keyframes fc-slide-right {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

@keyframes fc-enter-right {
  0% { transform: translateX(60%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes fc-slide-left {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-100%); opacity: 0; }
}

@keyframes fc-enter-left {
  0% { transform: translateX(-60%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ================================================
   SF-080.9: Coaching Messages (Floating Caption)
   ================================================ */
.fc-coaching {
  max-width: 360px;
  margin: 12px auto 0;
  padding: 10px 16px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary, #e2e8f0);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 5;
}

.fc-coaching.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.fc-coaching.is-fading {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 300ms ease, transform 300ms ease;
}

/* Light mode coaching banner */
body.light-mode .fc-coaching {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1e293b;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ================================================
   SF-080.5: Rich Completion Overlay
   ================================================ */
.fc-completion-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.fc-completion-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.fc-completion-card-inner {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 32px 28px;
  max-width: 420px;
  width: calc(100% - 32px);
  text-align: center;
  color: var(--text-primary, #e2e8f0);
}

/* Light mode completion card */
body.light-mode .fc-completion-card-inner {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1e293b;
}

.fc-completion-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.fc-completion-topic {
  font-size: 14px;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 24px;
}

/* 4-stat grid */
.fc-completion-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.fc-completion-stat {
  text-align: center;
}

.fc-completion-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--fc-accent);
}

.fc-completion-stat-label {
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Learning progress comparison */
.fc-completion-progress {
  margin-bottom: 20px;
  text-align: left;
}

.fc-completion-progress-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.fc-completion-compare {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 6px;
}

.fc-completion-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.fc-completion-bar-fill {
  height: 100%;
  background: var(--fc-accent);
  border-radius: 4px;
  transition: width 800ms ease;
}

.fc-completion-delta {
  font-size: 13px;
  font-weight: 600;
  color: var(--fc-green);
}

.fc-completion-delta.negative {
  color: var(--fc-amber);
}

.fc-completion-insight {
  font-size: 14px;
  margin-bottom: 20px;
  padding: 10px 14px;
  background: rgba(34, 197, 94, 0.08);
  border-radius: 10px;
  color: var(--fc-green);
}

/* Action buttons */
.fc-completion-actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.fc-completion-action-btn {
  flex: 1;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid var(--border, #334155);
  background: transparent;
  color: var(--text-primary, #e2e8f0);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.fc-completion-action-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--fc-accent);
}

.fc-completion-action-btn.primary {
  background: var(--fc-accent);
  border-color: var(--fc-accent);
  color: white;
}

.fc-completion-action-btn.primary:hover {
  background: var(--accent-hover, #2563eb);
}

/* Mobile completion */
@media (max-width: 480px) {
  .fc-completion-card-inner {
    padding: 24px 20px;
  }

  .fc-completion-stats {
    gap: 8px;
  }

  .fc-completion-stat-value {
    font-size: 20px;
  }

  .fc-completion-actions-row {
    flex-direction: column;
    gap: 8px;
  }
}

/* ================================================
   SF-080.11: Card Entrance Animation
   ================================================ */
@media (prefers-reduced-motion: no-preference) {
  .fc-card.fc-entrance {
    animation: fc-bounce-in 400ms ease-out forwards;
  }
}

@keyframes fc-bounce-in {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}

/* ================================================
   SF-080.12: Progress Bar Shimmer
   ================================================ */
@media (prefers-reduced-motion: no-preference) {
  .fc-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    animation: fc-shimmer 3s ease-in-out infinite;
    pointer-events: none;
  }
}

@keyframes fc-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ================================================
   SF-080.13: Thumb Rating Buttons (on card back)
   ================================================ */

.fc-card-actions {
  display: none;
  justify-content: center;
  gap: 32px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

body.light-mode .fc-card-actions {
  border-top-color: rgba(0, 0, 0, 0.06);
}

.fc-thumb {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 200ms ease;
  padding: 6px 12px;
}

.fc-thumb svg {
  width: 24px;
  height: 24px;
}

.fc-thumb-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.fc-thumb--down {
  color: #ef4444;
}

.fc-thumb--down:hover:not(:disabled):not(.rated) {
  transform: scale(1.1);
}

.fc-thumb--up {
  color: #22c55e;
}

.fc-thumb--up:hover:not(:disabled):not(.rated) {
  transform: scale(1.1);
}

/* Solid fill on click */
.fc-thumb--down.rated {
  color: #ef4444;
  transform: scale(1.1);
}
.fc-thumb--down.rated svg {
  fill: #ef4444;
  stroke: #ef4444;
}

.fc-thumb--up.rated {
  color: #22c55e;
  transform: scale(1.1);
}
.fc-thumb--up.rated svg {
  fill: #22c55e;
  stroke: #22c55e;
}

.fc-thumb:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Mobile: slightly smaller thumbs */
@media (max-width: 480px) {
  .fc-thumb svg {
    width: 22px;
    height: 22px;
  }
  .fc-thumb-label {
    font-size: 11px;
  }
  .fc-card-actions {
    gap: 28px;
    margin-top: 10px;
    padding-top: 8px;
  }
}

/* SF-080.14: Chevron arrows removed — navigation via rate-to-advance + clickable progress bar */

/* ================================================
   SF-080.15: Card Counter Badge
   ================================================ */
.fc-stat-badge--counter {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary, #94a3b8);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

body.light-mode .fc-stat-badge--counter {
  background: rgba(0, 0, 0, 0.04);
}

/* Light mode: progress segments */
body.light-mode .fc-progress-seg {
  background: rgba(0, 0, 0, 0.12);
}
body.light-mode .fc-progress-seg.seg-got-it,
body.light-mode .fc-progress-seg.seg-engaged {
  background: #22c55e;
}
body.light-mode .fc-progress-seg.seg-still-learning {
  background: #f59e0b;
}
body.light-mode .fc-progress-seg.seg-improved {
  background: #22c55e;
}
body.light-mode .fc-progress-seg.seg-current {
  background: var(--fc-accent, #2563EB);
}

/* ================================================
   Accessibility: Reduced Motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  .fc-card.fc-celebration-blue,
  .fc-card.fc-celebration-green,
  .fc-card.fc-streak-glow,
  .fc-card.fc-entrance,
  .fc-card.fc-slide-out-right,
  .fc-card.fc-slide-in-right,
  .fc-card.fc-slide-out-left,
  .fc-card.fc-slide-in-left,
  .fc-xp-float,
  .fc-stat-badge.fc-pulse {
    animation: none !important;
  }

  .fc-progress-seg.seg-current {
    animation: none !important;
    opacity: 1;
  }

  .fc-progress-bar::after {
    animation: none !important;
    display: none;
  }
}

/* ================================================
   ARIA live regions (screen readers)
   ================================================ */
.fc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ================================================
   Full-Page Completion (redesign — mirrors learn-mode)
   ================================================ */

/* --- Keyframes --- */
@keyframes fcc-icon-bounce {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.2); opacity: 1; }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes fcc-spark-burst {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--spark-dx), var(--spark-dy)) scale(0); opacity: 0; }
}

@keyframes fcc-fade-up {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes fcc-tile-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes fcc-xp-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(234, 179, 8, 0); }
  50%      { box-shadow: 0 0 14px rgba(234, 179, 8, 0.35); }
}

@keyframes fcc-btn-glow-gold {
  0%, 100% { box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15); }
  50%      { box-shadow: 0 2px 16px rgba(234, 179, 8, 0.45); }
}

@keyframes fcc-btn-glow-blue {
  0%, 100% { box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15); }
  50%      { box-shadow: 0 2px 16px rgba(37, 99, 235, 0.45); }
}

@keyframes fcc-btn-glow-green {
  0%, 100% { box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15); }
  50%      { box-shadow: 0 2px 16px rgba(34, 197, 94, 0.45); }
}

@keyframes fcc-action-slide {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* --- Container --- */
.fc-completion-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 24px 32px;
  min-height: 100%;
}

/* --- Hero icon with sparkles --- */
.fcc-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.fcc-hero__icon {
  color: var(--color-success, #22c55e);
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.45));
  animation: fcc-icon-bounce 500ms ease-out both;
}

.fcc-hero__icon svg {
  width: 64px;
  height: 64px;
}

.fcc-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  margin: -3px 0 0 -3px;
  animation: fcc-spark-burst 600ms ease-out 300ms both;
  pointer-events: none;
}

.fcc-spark:nth-child(1) { --spark-dx: -28px; --spark-dy: -22px; background: #2563EB; }
.fcc-spark:nth-child(2) { --spark-dx: 26px;  --spark-dy: -24px; background: #a855f7; }
.fcc-spark:nth-child(3) { --spark-dx: 32px;  --spark-dy: 8px;   background: #22c55e; }
.fcc-spark:nth-child(4) { --spark-dx: -30px; --spark-dy: 10px;  background: #eab308; }
.fcc-spark:nth-child(5) { --spark-dx: 10px;  --spark-dy: 30px;  background: #ef4444; }
.fcc-spark:nth-child(6) { --spark-dx: -12px; --spark-dy: 28px;  background: #ec4899; }

/* --- Title & topic --- */
.fcc-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
  animation: fcc-fade-up 400ms ease-out 150ms both;
}

.fcc-topic {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 12px;
  animation: fcc-fade-up 400ms ease-out 200ms both;
}

/* --- Nudge --- */
.fcc-nudge {
  font-size: 13px;
  color: var(--text-secondary, #64748b);
  line-height: 1.5;
  margin: 0 0 16px;
  max-width: 360px;
  animation: fcc-fade-up 400ms ease-out 250ms both;
}

/* --- CTA cards --- */
.fcc-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  margin-bottom: 20px;
  animation: fcc-action-slide 400ms ease-out 350ms both;
}

.fcc-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 8px);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  cursor: pointer;
  transition: all 200ms ease;
  min-height: 44px;
}

.fcc-card__icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fcc-card__icon svg {
  width: 30px;
  height: 30px;
}

.fcc-card__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}

.fcc-card__label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.fcc-card__sub {
  font-size: var(--font-xs, 11px);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Quiz card — gold (primary) */
.fcc-card--quiz {
  border-color: rgba(234, 179, 8, 0.55);
  background: rgba(234, 179, 8, 0.12);
  box-shadow: 0 4px 14px rgba(234, 179, 8, 0.15);
  animation: fcc-btn-glow-gold 2.5s ease-in-out infinite;
}

.fcc-card--quiz .fcc-card__icon { color: #eab308; }

.fcc-card--quiz:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.25);
}

/* Learn card — blue */
.fcc-card--learn {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(37, 99, 235, 0.12);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
  animation: fcc-btn-glow-blue 2.5s ease-in-out 0.5s infinite;
}

.fcc-card--learn .fcc-card__icon { color: #2563eb; }

.fcc-card--learn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
}

/* Next topic card — green */
.fcc-card--next {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.15);
  animation: fcc-btn-glow-green 2.5s ease-in-out 1s infinite;
}

.fcc-card--next .fcc-card__icon { color: #22c55e; }

.fcc-card--next:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25);
}

/* Study Again card — amber outline */
.fcc-card--retake {
  border-color: rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.06);
}

.fcc-card--retake .fcc-card__icon { color: var(--color-warning, #eab308); }
.fcc-card--retake .fcc-card__label { color: var(--color-warning, #eab308); }

.fcc-card--retake:hover {
  background: rgba(234, 179, 8, 0.12);
}

/* --- Stats grid (2x2) --- */
.fcc-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  margin-bottom: 16px;
  animation: fcc-fade-up 400ms ease-out 500ms both;
}

.fcc-stat-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: fcc-tile-in 400ms ease-out both;
}

.fcc-stat-tile:nth-child(1) { animation-delay: 550ms; }
.fcc-stat-tile:nth-child(2) { animation-delay: 600ms; }
.fcc-stat-tile:nth-child(3) { animation-delay: 650ms; }
.fcc-stat-tile:nth-child(4) { animation-delay: 700ms; }

body.light-mode .fcc-stat-tile,
[data-theme="light"] .fcc-stat-tile {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}

.fcc-stat-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted, #64748b);
}

.fcc-stat-tile__icon svg {
  width: 22px;
  height: 22px;
}

.fcc-stat-tile__text {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fcc-stat-tile__value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.fcc-stat-tile__label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

/* Stat tile color modifiers */
.fcc-stat-tile--cards .fcc-stat-tile__icon { color: #a855f7; }

.fcc-stat-tile--gotit .fcc-stat-tile__icon { color: var(--color-success, #22c55e); }
.fcc-stat-tile--gotit .fcc-stat-tile__value { color: var(--color-success, #22c55e); }

.fcc-stat-tile--hard .fcc-stat-tile__icon { color: #ef4444; }
.fcc-stat-tile--hard .fcc-stat-tile__value { color: #ef4444; }

.fcc-stat-tile--xp .fcc-stat-tile__icon { color: #eab308; }
.fcc-stat-tile--xp .fcc-stat-tile__value { color: #eab308; }
.fcc-stat-tile--xp.has-xp {
  animation: fcc-tile-in 400ms ease-out 600ms both, fcc-xp-pulse 1.5s ease-in-out 1.2s 2;
}

.fcc-stat-tile--muted .fcc-stat-tile__icon { color: var(--text-muted, #64748b); opacity: 0.5; }
.fcc-stat-tile--muted .fcc-stat-tile__value { color: var(--text-muted, #64748b); }

/* --- Dashboard link --- */
.fcc-dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
  text-decoration: none;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 200ms ease;
  animation: fcc-fade-up 400ms ease-out 800ms both;
}

.fcc-dashboard-link svg {
  width: 16px;
  height: 16px;
}

.fcc-dashboard-link:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .fc-completion-full,
  .fc-completion-full * {
    animation: none !important;
    transition: none !important;
  }
  .fcc-hero__icon { filter: none; }
  .fcc-spark { display: none; }

  .fcc-title, .fcc-topic, .fcc-nudge, .fcc-actions,
  .fcc-stats-grid, .fcc-stat-tile, .fcc-dashboard-link {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --- Mobile --- */
@media (max-width: 480px) {
  .fc-completion-full {
    padding: 4px 16px 28px;
  }

  .fcc-hero__icon svg {
    width: 52px;
    height: 52px;
  }

  .fcc-title { font-size: 20px; }

  .fcc-stats-grid,
  .fcc-actions {
    max-width: 100%;
  }

  .fcc-stat-tile {
    padding: 8px 10px;
  }

  .fcc-stat-tile__value {
    font-size: 16px;
  }
}
