/* ============================================================
   Quiz engine + flashcards UI
   ============================================================ */

/* ---- Quiz ---- */
.quiz-launcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.quiz-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  cursor: pointer;
  transition: all 0.15s;
}

.quiz-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.quiz-card .title {
  font-weight: 600;
  margin-bottom: 4px;
}

.quiz-card .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

.quiz-arena {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  margin: 20px 0;
  display: none;
}

.quiz-arena.open { display: block; }

.quiz-progress-bar {
  height: 3px;
  background: var(--bg-3);
  margin-bottom: 28px;
  border-radius: 2px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.quiz-q {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.4;
  margin-bottom: 24px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.quiz-opt {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 14px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14.5px;
  transition: all 0.15s;
  color: var(--text);
  text-align: left;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-opt:hover:not(.locked) { border-color: var(--accent-2); }
.quiz-opt.selected { border-color: var(--accent); background: var(--bg-3); }
.quiz-opt.correct  { border-color: var(--success); background: rgba(86, 211, 100, 0.08); }
.quiz-opt.wrong    { border-color: var(--danger);  background: rgba(248, 81, 73, 0.08); }
.quiz-opt.locked   { cursor: default; }

.quiz-opt-key {
  font-family: var(--mono);
  background: var(--bg-3);
  border: 1px solid var(--border);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 12px;
  flex-shrink: 0;
}

.quiz-explanation {
  background: var(--bg);
  border-left: 3px solid var(--accent-2);
  padding: 14px 18px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
  display: none;
}

.quiz-explanation.show { display: block; }

.quiz-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
  transition: filter 0.15s;
}

.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  filter: none;
}

.quiz-result {
  text-align: center;
  padding: 20px 0;
}

.quiz-result .score {
  font-family: var(--mono);
  font-size: 56px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ---- Flashcards ---- */
.flashcard {
  perspective: 1200px;
  margin: 20px 0;
  min-height: 280px;
}

.flashcard-inner {
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  min-height: 280px;
  cursor: pointer;
}

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.flashcard-back {
  transform: rotateY(180deg);
  border-color: var(--accent);
}

.flashcard-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.flashcard-q {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.4;
  color: var(--text);
  max-width: 600px;
}

.flashcard-a {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  max-width: 600px;
  text-align: left;
}

.flashcard-hint {
  position: absolute;
  bottom: 16px;
  right: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.flashcard-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.flashcard-counter {
  font-family: var(--mono);
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
}
