/* ========================
   Flashcards
   ======================== */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f7f7f7;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
}

/* Container centers wrapper */
.flashcard-container {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

/* Wrapper defines max width */
.flashcard-wrapper {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ====================
   Card
   ==================== */
.flashcard {
  width: 100%;
  height: 450px;
  perspective: 1200px;
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}

/* flip only inner */
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

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

/* both faces identical box model */
.flashcard-front,
.flashcard-back {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  padding: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-radius: 6px;
  line-height: 1.5;
  font-size: 1.5rem;
  overflow-y: auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flashcard-front { background: #f29595; }
.flashcard-back  { background: #84e187; transform: rotateY(180deg); }

.flashcard-front:hover, .flashcard-back:hover{
  cursor: pointer;
}

.card-label {
  position: absolute;
  top: 6px; left: 10px;
  font-size: 1rem;
  font-weight: bold;
  opacity: 0.7;
  pointer-events: none;
  display: block;
  margin-bottom: 12px;
  color: #333;
}

.card-tip {
  position: absolute;
  top: 6px; right: 10px;
  font-size: 1rem;
  font-weight: bold;
  display: block;
  opacity: 0.7;
  margin-bottom: 12px;
  color: #333;
}

/* ====================
   Slide/Fade Transitions
   ==================== */
.flashcard.enter-next {
  animation: slideInFromRight 0.4s ease both;
}
.flashcard.enter-prev {
  animation: slideInFromLeft 0.4s ease both;
}

@keyframes slideInFromRight {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInFromLeft {
  from { opacity: 0; transform: translateX(-50px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ====================
   Navigation
   ==================== */
.flashcard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
.flashcard-nav button {
  min-width: 120px;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: none;
  background: #0b74ff;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}
.flashcard-nav button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.flashcard-nav button:hover:not(:disabled) {
  background: #095ac7;
}

.back-link {
  margin-bottom: 1rem;
  display: inline-block;
  text-decoration: none;
  color: #0b74ff;
}
.back-link:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .flashcard { height: 360px; }
  .flashcard-front, .flashcard-back { font-size: 1.1rem; padding: 18px; }
  .flashcard-nav button { min-width: 90px; font-size: 1rem; }
}
