.flashcard {
  position: relative;
  cursor: pointer;
  perspective: 1200px;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.1s ease;
}

@media (hover: hover) and (pointer: fine) {
  .flashcard:hover {
    transform: translateY(-2px);
  }
}

.flashcard-inner {
  position: relative;
  width: 100%;
  flex: 1; /* fill .flashcard */
  transform-style: preserve-3d;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped .flashcard-inner {
  transform: rotateX(180deg);
}

.flashcard-front {
  position: relative;
  width: 100%;
  height: 100%;
  padding: var(--space-lg);
  border-radius: var(--border-radius-xl);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateX(0deg);
  overflow-y: auto;
}

@media (hover: hover) and (pointer: fine) {
  .flashcard:hover .flashcard-front {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-md);
  }
}

.flashcard-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: var(--space-lg);
  border-radius: var(--border-radius-xl);
  border: 1px solid var(--border-color);
  background: var(--bg-card-back);
  box-shadow: var(--shadow-sm);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateX(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.card-content {
  text-align: left;
  width: 100%;
}

.flashcard-back .card-content {
  text-align: center;
}

.question-number {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--primary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.question-text {
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  margin-bottom: var(--space-md);
  color: var(--text-main);
}

.choices {
  list-style: none;
  padding: 0;
  margin: 0;
}

.choices li {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  padding: 3px 0;
}

.answer {
  font-size: var(--font-size-xl);
  color: var(--text-main);
  font-weight: var(--font-weight-bold);
  text-align: center;
}

/* Dark mode override for choice text – full contrast on dark cards */
[data-theme="dark"] .choices li {
  color: var(--text-main);
}