/* ── Flashcard area ── */
.flashcard-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  padding: 40px;
}

#flashcard-container {
  perspective: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* ── Flashcard ── */
.flashcard {
  width: 220px;
  max-width: 100%;
  height: 300px;
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  border-radius: var(--radius-lg);
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard:hover .front { border-color: var(--border-strong); box-shadow: 0 6px 20px rgba(26,26,26,0.08); }

.flashcard.flipped {
  transform: rotateY(180deg);
}

.front,
.back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.front {
  background: var(--surface-card);
  font-family: 'Amiri', serif;
  font-size: 96px;
  color: var(--ink);
}

.back {
  background: var(--accent-light);
  border-color: rgba(155, 34, 38, 0.2);
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: -0.01em;
  transform: rotateY(180deg);
  flex-direction: column;
  gap: 8px;
}

.back-form {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.8;
}

.nav-hint kbd {
  font-family: inherit;
  font-size: 0.72rem;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-card);
  color: var(--ink-muted);
}

/* ── Nav row ── */
.flashcard-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.nav-hint {
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  flex: 1;
  text-align: center;
}

/* ── Counter ── */
.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-counter {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem;
  color: var(--ink-muted);
}

/* ── Empty state ── */
.empty-msg {
  font-size: 0.9rem;
  color: var(--ink-faint);
  text-align: center;
}

/* ── Mobile ── */
@media (max-width: 680px) {
  .flashcard-area { min-height: 300px; padding: 24px; }
  .flashcard { width: 200px; height: 260px; }
  .front { font-size: 80px; }
  .flashcard-nav { gap: 12px; }
  .btn-icon { width: 44px; height: 44px; }
}

/* ── Animate in on card change ── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Animation goes on a wrapper — never on the preserve-3d element itself,
   since fill-mode 'both' leaves a computed transform that flattens the 3D context */
.flashcard-wrapper {
  animation: cardIn 0.25s var(--ease) both;
}