/* ── Reset & Base ─────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #e0e0e0;
  padding: 20px;
}

.container {
  width: 100%;
  max-width: 680px;
  position: relative;
}

/* ── Header ──────────────────────────────────────── */
header h1 {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 24px;
  background: linear-gradient(90deg, #f7971e, #ffd200);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Card ────────────────────────────────────────── */
.card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s, opacity 0.3s;
}

.question-number {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.question-text {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ── Options ─────────────────────────────────────── */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #e0e0e0;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  user-select: none;
}

.option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateX(4px);
}

.option-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.option-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ── Correct / Wrong states ──────────────────────── */
.option-btn.correct {
  border-color: #2ecc71;
  background: rgba(46, 204, 113, 0.18);
}

.option-btn.correct .option-key {
  background: #2ecc71;
  color: #fff;
}

.option-btn.wrong {
  border-color: #e74c3c;
  background: rgba(231, 76, 60, 0.18);
  animation: shake 0.45s ease;
}

.option-btn.wrong .option-key {
  background: #e74c3c;
  color: #fff;
}

.option-btn.dimmed {
  opacity: 0.4;
}

/* ── Shake animation ─────────────────────────────── */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-10px);
  }
  40% {
    transform: translateX(10px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

/* ── Correct bounce animation ────────────────────── */
@keyframes correctPop {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

.option-btn.bounce {
  animation: correctPop 0.45s ease;
}

/* ── Result area ─────────────────────────────────── */
.result {
  margin-top: 24px;
  padding: 20px;
  border-radius: 14px;
  text-align: center;
  animation: fadeSlideIn 0.4s ease;
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.result-message {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.result.correct-bg {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.result.wrong-bg {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.explanation {
  margin-top: 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  text-align: left;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.explanation strong {
  color: #f0f0f0;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.next-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}

.next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.35);
}

.hidden {
  display: none !important;
}

/* ── Loading ─────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 60px 0;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Error ───────────────────────────────────────── */
.error {
  text-align: center;
  padding: 40px;
  background: rgba(231, 76, 60, 0.12);
  border-radius: 14px;
  font-size: 1.1rem;
}

/* ── Footer ──────────────────────────────────────── */
footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.25);
}

/* ── Confetti canvas (fullscreen overlay) ────────── */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}
