/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background: #f8f8f8;
  color: #333;
  text-align: center;
  padding: 60px 20px 20px;
}

header h1 {
  color: #b387d7;
  margin-bottom: 40px;
}

/* Mode toggle button */
.mode-toggle {
  margin-bottom: 20px;
  border: 2px solid #b387d7;
  padding: 8px 16px;
  background: #fff;
  cursor: pointer;
  border-radius: 5px;
}
.mode-toggle:hover {
  background: #b387d7;
  color: #fff;
}

/* Flashcard Layout with Proportional Scaling */
.flashcard {
  width: 90%;
  max-width: 600px;
  aspect-ratio: 5 / 2;
  margin: 20px auto;
  display: flex;
  border: 2px solid #b387d7;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  font-size: clamp(1rem, 4vw, 2rem);
}

.card-left,
.card-right {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

#kanji-display {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.card-left {
  background-color: #f0f0f0;
  font-size: 2em;
}

.card-right {
  background-color: #fff;
  border-left: 2px solid #333;
  flex-direction: column;
  font-size: 1em;
  position: relative;
}

.overlay {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  background-color: #b387d7;
  z-index: 10;
  transition: opacity 0.3s;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Counters & Success */
.counters {
  margin: 20px auto;
  font-size: 1.2rem;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.success-line {
  text-align: center;
  font-weight: bold;
  font-size: 1.3rem;
  margin-bottom: 10px;
}

/* Main flashcard buttons (purple) */
.controls button {
  padding: 10px 20px;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid #b387d7;
  border-radius: 5px;
  background-color: #b387d7;
  color: #fff;
  transition: background-color 0.2s;
}

.controls button:hover {
  background-color: #9b5fcf;
}

.hidden {
  display: none !important;
}

/* Review Wrong button (white) */
#review {
  padding: 10px 20px;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid #b387d7;
  border-radius: 5px;
  background-color: #fff;
  color: #333;
  transition: background-color 0.2s, color 0.2s;
}

#review:hover {
  background-color: #b387d7;
  color: #fff;
}

/* Multiple Choice Layout */
#choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 20px auto;
  max-width: 400px;
}

#choices button {
  padding: 10px;
  font-size: 1rem;
  border: 2px solid #b387d7;
  border-radius: 5px;
  background-color: #b387d7;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s;
}

#choices button:hover:not(:disabled) {
  background-color: #9b5fcf;
}

#choices button:disabled {
  cursor: default;
  opacity: 0.8;
}

/* Next button spans both columns */
#choices button.next-btn {
  grid-column: 1 / -1;
}

@media (min-width: 500px) {
  #choices {
    grid-template-columns: 1fr 1fr;
  }
}

/* Wrong Section */
#wrong-section {
  width: 90%;
  max-width: 800px;
  margin: 40px auto;
}

#wrong-section h2 {
  text-align: center;
  margin-bottom: 15px;
}

#review {
  display: block;
  margin: 0 auto 25px auto;
}

#wrong-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 700px) {
  #wrong-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.wrong-card {
  display: flex;
  align-items: center;
  padding: 15px 10px;
  border: 2px solid #b387d7;
  border-radius: 12px;
  background-color: #fff;
  box-sizing: border-box;
}

.wrong-kanji {
  font-size: 1.5em;
  flex: 1;
  text-align: center;
}

.wrong-details {
  flex: 2;
  padding-left: 20px;
  font-size: 0.8em;
}

/* Status message */
.status-message {
  font-size: 1.2em;
  color: #999;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}
