/* ==========================================================================
   AI FLASHCARDS STUDIO — styles.
   Loaded after style.css + ai-ui.css, so it inherits the site's colour
   tokens (--accent, --surface, --ink, --radius-*, --shadow-*, --font-*)
   and only adds the flashcard-specific pieces.
   ========================================================================== */

.fc-shell{
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.fc-hero{ text-align:center; margin-bottom: 24px; }
.fc-hero .eyebrow{
  display:inline-flex; align-items:center; gap:6px;
  font: 700 12px var(--font-body); letter-spacing:.08em; text-transform:uppercase;
  color: var(--accent);
}
.fc-hero h1{
  font: 800 clamp(26px,4vw,40px) var(--font-display);
  margin: 8px 0 6px; color: var(--ink);
}
.fc-hero p{ color: var(--ink-soft); max-width: 560px; margin: 0 auto; }

/* ---------- streak + stats strip ---------- */
.fc-stats{
  display:flex; flex-wrap:wrap; justify-content:center; gap:10px;
  margin: 18px 0 26px;
}
.fc-stat{
  display:flex; align-items:center; gap:6px;
  background: var(--surface-2); border:1px solid var(--border);
  border-radius: 999px; padding: 7px 14px;
  font: 600 13px var(--font-body); color: var(--ink-soft);
}
.fc-stat b{ color: var(--ink); }
.fc-stat.fire b{ color: var(--accent-2); }

/* ---------- generator panel ---------- */
.fc-generator{
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.fc-gen-row{ display:flex; gap:10px; flex-wrap:wrap; margin-top: 12px; }
.fc-gen-row input[type="text"]{
  flex: 1 1 220px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink);
  font: 500 14px var(--font-body);
}
.fc-gen-row select{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink);
  font: 500 14px var(--font-body);
}
.fc-gen-row input[type="text"]:focus, .fc-gen-row select:focus{ outline: 2px solid var(--accent); outline-offset: 1px; }

.fc-generate-btn{
  display:inline-flex; align-items:center; gap:8px;
  background: linear-gradient(120deg, var(--accent), var(--accent-3));
  color: var(--accent-ink);
  border: none; border-radius: var(--radius-sm);
  padding: 12px 20px;
  font: 700 14px var(--font-body);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.fc-generate-btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow-md); }
.fc-generate-btn:disabled{ opacity:.6; cursor:progress; transform:none; }

.fc-quick-chips{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.fc-chip{
  background: var(--surface-2); border:1px solid var(--border); color: var(--ink-soft);
  border-radius: 999px; padding: 6px 12px; font: 600 12px var(--font-body);
  cursor:pointer; transition: all .15s ease;
}
.fc-chip:hover{ border-color: var(--accent); color: var(--accent); }

.fc-status{ margin-top: 12px; font: 500 13px var(--font-body); color: var(--ink-soft); display:none; }
.fc-status.show{ display:block; }
.fc-status.error{ color: #E14B4B; }

/* ---------- empty state ---------- */
.fc-empty{
  text-align:center; padding: 50px 20px; color: var(--ink-faint);
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
}
.fc-empty svg{ width:46px; height:46px; stroke: var(--ink-faint); margin-bottom: 10px; }

/* ---------- deck toolbar ---------- */
.fc-deck{ display:none; }
.fc-deck.show{ display:block; }

.fc-deck-toolbar{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.fc-progress-wrap{ flex:1; min-width: 160px; }
.fc-progress-track{
  height: 8px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; border: 1px solid var(--border);
}
.fc-progress-fill{
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-3), var(--success));
  transition: width .35s ease;
}
.fc-progress-label{ font: 600 12px var(--font-body); color: var(--ink-soft); margin-top: 6px; }

.fc-toolbar-btns{ display:flex; gap:8px; flex-wrap: wrap; }
.fc-icon-btn{
  display:inline-flex; align-items:center; gap:6px;
  background: var(--surface-2); border:1px solid var(--border); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font: 600 12.5px var(--font-body); cursor:pointer;
}
.fc-icon-btn:hover{ border-color: var(--accent); }
.fc-icon-btn svg{ width:15px; height:15px; }

/* ---------- the card ---------- */
.fc-stage{
  perspective: 1600px;
  margin: 0 auto 20px;
  max-width: 560px;
}
.fc-card{
  position: relative;
  width: 100%;
  min-height: 300px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.fc-card.flipped{ transform: rotateY(180deg); }
.fc-face{
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items:center; justify-content:center;
  padding: 34px 28px;
  text-align: center;
  background: var(--surface);
}
.fc-face-front{
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(120% 140% at 100% 100%, color-mix(in srgb, var(--accent-3) 10%, transparent), transparent 60%),
    var(--surface);
}
.fc-face-back{
  transform: rotateY(180deg);
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 60%),
    var(--surface);
}
.fc-face-tag{
  position:absolute; top:16px; left:18px;
  font: 700 11px var(--font-body); letter-spacing:.06em; text-transform:uppercase;
  color: var(--ink-faint);
}
.fc-face-num{
  position:absolute; top:16px; right:18px;
  font: 700 12px var(--font-body); color: var(--ink-faint);
}
.fc-face-text{
  font: 700 clamp(18px,3vw,24px) var(--font-display);
  color: var(--ink);
  line-height: 1.4;
  max-height: 100%;
  overflow-y: auto;
}
.fc-face-hint{
  margin-top: 14px; font: 600 12px var(--font-body); color: var(--ink-faint);
}
.fc-speak-btn{
  position:absolute; bottom:14px; right:14px;
  width:34px; height:34px; border-radius:50%;
  background: var(--surface-2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  color: var(--ink-soft);
}
.fc-speak-btn:hover{ color: var(--accent); border-color: var(--accent); }
.fc-speak-btn svg{ width:16px; height:16px; }

/* ---------- rating buttons ---------- */
.fc-rate-row{
  display:flex; justify-content:center; gap:12px; margin: 6px 0 18px;
  flex-wrap: wrap;
}
.fc-rate-btn{
  display:inline-flex; align-items:center; gap:8px;
  border-radius: var(--radius-sm); padding: 12px 20px;
  font: 700 13.5px var(--font-body); cursor:pointer; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--ink);
  transition: transform .12s ease;
}
.fc-rate-btn:active{ transform: scale(.96); }
.fc-rate-btn.learning{ border-color: color-mix(in srgb, var(--accent-2) 55%, var(--border)); color: var(--accent-2); }
.fc-rate-btn.learning:hover{ background: color-mix(in srgb, var(--accent-2) 10%, var(--surface)); }
.fc-rate-btn.known{ border-color: color-mix(in srgb, var(--success) 55%, var(--border)); color: var(--success); }
.fc-rate-btn.known:hover{ background: color-mix(in srgb, var(--success) 10%, var(--surface)); }

.fc-nav-row{ display:flex; justify-content:center; align-items:center; gap:16px; }
.fc-nav-btn{
  width:40px; height:40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.fc-nav-btn:hover{ border-color: var(--accent); color: var(--accent); }
.fc-nav-btn:disabled{ opacity: .35; cursor: not-allowed; }
.fc-nav-btn svg{ width:18px; height:18px; }
.fc-kbd-hint{ font: 500 11.5px var(--font-body); color: var(--ink-faint); text-align:center; margin-top:10px; }

/* ---------- export row ---------- */
.fc-export-row{
  display:flex; justify-content:center; gap:10px; flex-wrap: wrap; margin-top: 22px;
}

/* ---------- completion celebration ---------- */
.fc-complete{
  display:none; text-align:center; padding: 34px 20px;
  border-radius: var(--radius-lg); border:1px solid var(--border);
  background: var(--surface);
}
.fc-complete.show{ display:block; }
.fc-complete .fc-trophy{ font-size: 48px; }
.fc-complete h3{ font: 800 22px var(--font-display); margin: 8px 0 4px; color: var(--ink); }
.fc-complete p{ color: var(--ink-soft); margin: 0 0 16px; }

.fc-confetti-canvas{
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
}

@media (max-width: 560px){
  .fc-rate-btn{ flex:1; justify-content:center; }
  .fc-face{ padding: 26px 18px; min-height: 260px; }
}

/* ---------- deck library ---------- */
.fc-library{ margin-bottom: 20px; }
.fc-library-head{
  font: 700 13px var(--font-body); color: var(--ink-soft); margin-bottom: 8px;
}
.fc-library-hint{ font-weight: 500; color: var(--ink-faint); }
.fc-library-row{
  display:flex; gap:8px; overflow-x:auto; padding-bottom: 4px;
}
.fc-deck-chip{
  display:flex; align-items:center; gap:8px; flex: none;
  background: var(--surface-2); border:1px solid var(--border);
  border-radius: 999px; padding: 7px 8px 7px 14px;
  font: 600 12.5px var(--font-body); color: var(--ink-soft);
  cursor: default;
}
.fc-deck-chip.active{ border-color: var(--accent); color: var(--accent); }
.fc-deck-chip-name{ cursor:pointer; color: var(--ink); max-width: 160px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-deck-chip.active .fc-deck-chip-name{ color: var(--accent); }
.fc-deck-chip-meta{ cursor:pointer; color: var(--ink-faint); font-weight:700; }
.fc-deck-chip-x{
  width:20px; height:20px; border-radius:50%; border:none;
  background: transparent; color: var(--ink-faint); cursor:pointer;
  display:flex; align-items:center; justify-content:center; font-size:15px; line-height:1;
}
.fc-deck-chip-x:hover{ background: color-mix(in srgb, #E14B4B 15%, transparent); color:#E14B4B; }

/* ---------- AI insight panel (explain more / memory trick) ---------- */
.fc-insight-row{
  display:flex; justify-content:center; gap:10px; margin: 4px 0 10px; flex-wrap:wrap;
}
.fc-insight-panel{
  display:none;
  max-width: 560px; margin: 0 auto 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.fc-insight-panel.show{ display:block; }
.fc-insight-label{ font: 700 12px var(--font-body); color: var(--accent); margin-bottom: 6px; }
.fc-insight-text{ font: 500 13.5px var(--font-body); color: var(--ink); line-height:1.55; white-space: pre-wrap; }
.fc-insight-text.error{ color:#E14B4B; }
.fc-insight-loading{ font: 500 13px var(--font-body); color: var(--ink-soft); }

/* ---------- achievement toast ---------- */
.fc-badge-toast{
  position: fixed; top: 18px; right: 18px; z-index: 10000;
  display:flex; flex-direction:column; gap:8px; align-items:flex-end;
}
.fc-badge-toast-item{
  background: linear-gradient(120deg, var(--accent), var(--accent-3));
  color: var(--accent-ink);
  font: 700 13px var(--font-body);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateX(30px);
  transition: opacity .35s ease, transform .35s ease;
}
.fc-badge-toast-item.show{ opacity: 1; transform: translateX(0); }

/* ---------- study mode (fullscreen focus) ---------- */
body.fc-study-mode .topbar,
body.fc-study-mode .fc-hero,
body.fc-study-mode .fc-stats,
body.fc-study-mode .fc-generator,
body.fc-study-mode .fc-library,
body.fc-study-mode .fc-empty,
body.fc-study-mode .site-note{
  display: none !important;
}
body.fc-study-mode .fc-shell{ padding-top: 40px; }
body.fc-study-mode .fc-stage{ max-width: 640px; }
body.fc-study-mode .fc-face{ min-height: 380px; }

/* ---------- voice quiz mode ---------- */
.fc-voice-overlay{
  position: fixed; inset: 0; z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(8, 10, 18, .72);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.fc-voice-overlay.show{ display: flex; }
.fc-voice-panel{
  position: relative;
  width: 100%; max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 26px 26px;
  text-align: center;
}
.fc-voice-close{
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--ink-soft); cursor: pointer; font-size: 14px;
}
.fc-voice-score{
  font: 700 13px var(--font-body); color: var(--ink-faint);
  letter-spacing: .02em; margin-bottom: 14px;
}
.fc-voice-mic{
  width: 76px; height: 76px; line-height: 76px;
  border-radius: 50%; margin: 0 auto 18px;
  background: linear-gradient(120deg, var(--accent), var(--accent-3));
  font-size: 32px;
}
.fc-voice-mic.listening{ animation: fcMicPulse 1.1s ease-in-out infinite; }
@keyframes fcMicPulse{
  0%, 100%{ box-shadow: 0 0 0 0 rgba(120,120,255,.35); }
  50%{ box-shadow: 0 0 0 16px rgba(120,120,255,0); }
}
.fc-voice-question{
  font: 700 18px var(--font-display); color: var(--ink);
  margin-bottom: 8px; min-height: 48px;
}
.fc-voice-state{ font: 500 13.5px var(--font-body); color: var(--ink-faint); margin-bottom: 10px; }
.fc-voice-heard{
  font: 500 14px var(--font-body); color: var(--ink-soft);
  min-height: 20px; margin-bottom: 6px; font-style: italic;
}
.fc-voice-feedback{
  font: 600 14.5px var(--font-body); min-height: 22px; margin-bottom: 18px;
}
.fc-voice-feedback.correct{ color: #2fae66; }
.fc-voice-feedback.partial{ color: #c99a2e; }
.fc-voice-feedback.wrong{ color: #d3554a; }
.fc-voice-btns{ display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fc-voice-btn{
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
  border-radius: var(--radius-sm); padding: 10px 18px;
  font: 700 13.5px var(--font-body); cursor: pointer;
}
.fc-voice-btn.primary{
  background: linear-gradient(120deg, var(--accent), var(--accent-3));
  color: var(--accent-ink); border: none;
}
.fc-voice-btn:disabled{ opacity: .55; cursor: progress; }
