:root {
  --bg: #eef3f8;
  --panel: rgba(255, 255, 255, 0.82);
  --ink: #172033;
  --muted: #667085;
  --brand: #ae1c3f;
  --brand-2: #e04b6f;
  --good: #0f9f6e;
  --bad: #dc3545;
  --warn: #f2a51a;
  --line: rgba(23, 32, 51, 0.12);
  --shadow: 0 22px 60px rgba(34, 46, 80, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Be Vietnam Pro", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(174, 28, 63, 0.18), transparent 30%),
    radial-gradient(circle at 78% 10%, rgba(15, 159, 110, 0.16), transparent 28%),
    linear-gradient(135deg, #f8fafc 0%, var(--bg) 55%, #dfe7f1 100%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.hero > div:first-child,
.score-card,
.stats-panel,
.quiz-card,
.result-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero > div:first-child {
  flex: 1;
  border-radius: 8px;
  padding: 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1;
}

.subtitle {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.score-card {
  width: 190px;
  border-radius: 8px;
  padding: 24px;
  display: grid;
  place-items: center;
  text-align: center;
}

.score-card span,
.stats-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.score-card strong {
  display: block;
  margin-top: 8px;
  color: var(--brand);
  font-size: 54px;
  line-height: 1;
}

.score-pop {
  animation: scorePop 0.45s ease;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 22px;
}

.stats-panel div {
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.58);
}

.stats-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.quiz-card,
.result-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  padding: 28px;
}

.progress-track {
  height: 10px;
  background: rgba(23, 32, 51, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--warn), var(--good));
  border-radius: inherit;
  transition: width 0.35s ease;
}

.question-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.category,
.points {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

.category {
  color: var(--brand);
  background: rgba(174, 28, 63, 0.1);
}

.points {
  color: #6b4a00;
  background: rgba(242, 165, 26, 0.22);
}

#questionText {
  min-height: 92px;
  margin-bottom: 22px;
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.25;
}

.answers {
  display: grid;
  gap: 14px;
}

.answer {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.answer:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(174, 28, 63, 0.35);
  box-shadow: 0 12px 26px rgba(34, 46, 80, 0.12);
}

.answer:disabled {
  cursor: default;
}

.answer-key {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #364152;
  font-weight: 800;
}

.answer.correct {
  border-color: rgba(15, 159, 110, 0.8);
  background: rgba(15, 159, 110, 0.12);
  animation: correctPulse 0.7s ease;
}

.answer.correct .answer-key {
  background: var(--good);
}

.answer.wrong {
  border-color: rgba(220, 53, 69, 0.8);
  background: rgba(220, 53, 69, 0.1);
  animation: wrongShake 0.45s ease;
}

.answer.wrong .answer-key {
  background: var(--bad);
}

.feedback {
  min-height: 56px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.feedback.good {
  color: var(--good);
}

.feedback.bad {
  color: var(--bad);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.primary,
.secondary {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 28px rgba(174, 28, 63, 0.24);
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary {
  color: var(--ink);
  background: rgba(23, 32, 51, 0.08);
}

.result-card {
  text-align: center;
}

.result-card h2 {
  font-size: clamp(30px, 5vw, 48px);
  margin-bottom: 10px;
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  min-width: 240px;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 120px);
  border-radius: 8px;
  padding: 14px 18px;
  color: white;
  background: #172033;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 1.2s ease-out forwards;
}

.quiz-card.correct-flash {
  animation: cardGood 0.55s ease;
}

.quiz-card.wrong-flash {
  animation: cardBad 0.5s ease;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

@keyframes scorePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes cardGood {
  0%, 100% { box-shadow: var(--shadow); }
  45% { box-shadow: 0 22px 70px rgba(15, 159, 110, 0.34); }
}

@keyframes cardBad {
  0%, 100% { box-shadow: var(--shadow); }
  45% { box-shadow: 0 22px 70px rgba(220, 53, 69, 0.3); }
}

@keyframes confettiFall {
  to {
    transform: translateY(100vh) rotate(520deg);
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1080px);
    padding: 24px 0;
  }

  .hero {
    display: block;
  }

  .score-card {
    width: 100%;
    margin-top: 14px;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }

  .question-topline,
  .actions {
    flex-direction: column;
  }

  .primary,
  .secondary {
    width: 100%;
  }

  .answer {
    grid-template-columns: 36px 1fr;
    padding: 12px;
  }

  .answer-key {
    width: 34px;
    height: 34px;
  }
}
