/* ==========================
   Wrapper
========================== */
.wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  justify-content: center;
  background-color: #f3e8ff; /* soft lavender */
}

/* ==========================
   Container
========================== */
.container {
  text-align: center;
  max-width: 600px;
  width: 90%;
  padding: 20px;
  background-color: #f9f0ff;
  border-radius: 20px;
  box-shadow: 0 6px 25px rgba(102, 38, 255, 0.15);
  margin: 0 auto;
  animation: fadeIn 0.8s ease forwards;
}

/* ==========================
   Headings & Paragraphs
========================== */
h1, h2 {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 2.4rem;
  margin-bottom: 10px;
  color: #6a1b9a;
}

p {
  font-family: 'Nunito', sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: #4b0082;
  margin-top: 0.5rem;
}

/* ==========================
   Flashcards
========================== */
.flashcard {
  width: 100%;
  max-width: 400px;
  height: 140px;
  perspective: 1200px; /* depth for 3D flip */
  margin: 10px auto;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

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

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 15px;
  font-family: 'Nunito', sans-serif;
  font-size: 2rem;
  background-color: #d9b3ff;
  color: #4b0082;
  box-shadow: 0 4px 15px rgba(102, 38, 255, 0.2);
}

.card-back {
  transform: rotateY(180deg);
  background-color: #b266ff;
  color: #fff;
  pointer-events: none;
  visibility: hidden;
}

.flashcard.flipped .card-back {
  visibility: visible;
}

/* ==========================
   Buttons & Links
========================== */
button, .mode-btn, .back-link {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  margin: 10px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background-color: #b266ff;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

button:hover, .mode-btn:hover, .back-link:hover {
  background-color: #9c4dff;
  transform: scale(1.05);
}

.back-link {
  background-color: #d9b3ff;
  color: #4b0082;
}

/* ==========================
   Progress & Score
========================== */
#progress, #score {
  margin-top: 15px;
  font-size: 1.1rem;
  color: #4b0082;
}

/* ==========================
   Feedback Box
========================== */
.feedback-box {
  height: 35px; /* fixes container jump */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 5px 0;
}

#feedback {
  font-weight: 600;
  font-size: 1.1rem;
  color: #4b0082;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#feedback.show {
  opacity: 1;
}

/* ==========================
   Animations
========================== */
@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ==========================
   Responsive Styles
========================== */
@media (max-width: 480px) {
  h1, h2 {
    font-size: 1.8rem;
  }

  p {
    font-size: 1rem;
  }

  .container {
    padding: 15px;
  }

  input#answer {
    width: 95%;
    font-size: 0.95rem;
  }

  button, .mode-btn, .back-link {
    padding: 10px 16px;
    font-size: 0.95rem;
    margin: 5px 3px;
  }

  .flashcard {
    height: 120px;
  }

  .card-front, .card-back {
    font-size: 1.3rem;
  }

  .feedback-box {
    height: 30px;
  }
}