/* Flashcards (ENG-23): one big card at a time, with a quick flip. Works on a
   phone first; on a laptop the card stays a readable width. */

.deck-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toggle-label {
  font-weight: 700;
  color: var(--ink-muted);
  margin-right: 4px;
}

.toggle {
  min-height: var(--tap);
  padding: 6px 14px;
  border: 2px solid var(--ink-muted);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.toggle[aria-pressed='true'] {
  border-color: var(--tone-cards);
  background: var(--tone-cards);
  color: var(--accent-ink);
}

.toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.card-stage {
  display: grid;
  gap: 16px;
  max-width: 36rem;
}

.flashcard {
  display: grid;
  align-content: center;
  min-height: 300px;
  padding: 24px 20px;
  background: var(--panel);
  border: var(--line) solid var(--edge);
  border-top: 10px solid var(--tone-cards);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: center;
}

.flashcard:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.card-face {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.card-face p {
  margin: 0;
}

.flashcard[data-flipped='true'] .card-face {
  animation: card-flip 220ms ease-out;
}

@keyframes card-flip {
  from { transform: perspective(800px) rotateY(-90deg); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .flashcard[data-flipped='true'] .card-face {
    animation: none;
  }
}

.card-kind {
  color: var(--ink-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

.card-word {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 9vw, 3rem);
  letter-spacing: 0.03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.card-sentence {
  font-size: 1.15rem;
  line-height: 1.6;
  max-width: 30rem;
}

.card-blank {
  font-weight: 700;
  letter-spacing: 0.08em;
}

.card-answer {
  padding: 0 3px;
  border-radius: 3px;
  background: var(--highlight);
  color: var(--highlight-ink);
  font-weight: 700;
}

.card-definition {
  font-size: 1.2rem;
  font-weight: 700;
  max-width: 30rem;
}

.card-flip {
  justify-content: center;
}

/* Keep the choices small on a phone so the card fits on the screen. */
.toggle-group .toggle {
  font-size: 0.95rem;
}

@media (max-width: 599px) {
  .deck-controls {
    gap: 8px;
    margin-bottom: 14px;
  }

  .flashcard {
    min-height: 240px;
  }
}

/* Rating a story word (ENG-24): three buttons under the flipped card. */
.rating {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.rating-question {
  margin: 0;
  font-weight: 700;
}

.rating-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.rating-buttons .btn {
  padding: 8px 6px;
}

.rating-buttons [data-rating='completely'] { border-color: var(--tone-cards); }
.rating-buttons [data-rating='not-at-all'] { border-color: var(--accent); }

.rating-saved {
  margin: 0 0 12px;
  min-height: 1.5em;
  color: var(--ink-muted);
  font-weight: 700;
}
