/* ---------- Tokens (matching the-frontend-projects palette) ---------- */
:root {
  --bg-dark: 17 35 54;
  --bg-light: 63 79 101;
  --cyan: 0 243 255;
  --cyan-comp: 255 90 80;
  --lime: 126 211 33;
  --lime-comp: 150 90 230;

  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: radial-gradient(120% 120% at 20% 0%, rgb(var(--bg-light)) 0%, rgb(var(--bg-dark)) 60%);
  color: white;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Ambient background ---------- */
.stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1.5rem;
  isolation: isolate;
}

.aurora {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  mix-blend-mode: hard-light;
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.aurora--cyan {
  top: -20%;
  left: -10%;
  background: radial-gradient(circle, rgb(var(--cyan) / 0.8) 0%, rgb(var(--cyan) / 0) 60%);
  animation: drift-a 22s ease-in-out infinite;
}

.aurora--lime {
  bottom: -25%;
  right: -15%;
  background: radial-gradient(circle, rgb(var(--lime) / 0.8) 0%, rgb(var(--lime) / 0) 60%);
  animation: drift-b 28s ease-in-out infinite;
}

@keyframes drift-a {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(8%, 10%) scale(1.1);
  }
}

@keyframes drift-b {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-6%, -8%) scale(1.08);
  }
}

.noise {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.5;
  mix-blend-mode: soft-light;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  .aurora {
    animation: none;
  }
}

/* ---------- Card ---------- */
.card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  border-radius: 28px;
  padding: 2.5rem 2rem;
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.1);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.5);
  overflow: hidden;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  text-align: center;
  align-items: center;
}

.screen.is-active {
  display: flex;
}

/* ---------- Start screen ---------- */
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(var(--lime));
}

.title {
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
}

.grad-text {
  background: linear-gradient(90deg, rgb(var(--cyan)), rgb(var(--lime)));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.subtitle {
  color: rgb(255 255 255 / 0.65);
  font-size: 0.95rem;
  max-width: 32ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 150ms var(--ease-out-quad),
    box-shadow 200ms ease;
}

.btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: scale(1.02);
  }
  .btn:active:hover {
    transform: scale(0.97);
  }
}

.btn--primary {
  color: rgb(var(--bg-dark));
  background: linear-gradient(90deg, rgb(var(--cyan)), rgb(var(--lime)));
  box-shadow: 0 12px 30px -10px rgb(var(--cyan) / 0.5);
}

.btn--ghost {
  color: white;
  background: rgb(255 255 255 / 0.08);
  border: 1px solid rgb(255 255 255 / 0.16);
}

/* ---------- Quiz screen ---------- */
.quiz-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: rgb(255 255 255 / 0.6);
}

.score-pill {
  color: rgb(var(--lime));
}

.score-pill strong {
  display: inline-block;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(var(--cyan)), rgb(var(--lime)));
}

.question-text {
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  font-weight: 700;
  line-height: 1.4;
}

.answers {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.answer-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 0.95rem;
  color: white;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgb(255 255 255 / 0.12);
  background: rgb(255 255 255 / 0.04);
  cursor: pointer;
  transition:
    background-color 200ms ease,
    border-color 200ms ease,
    transform 150ms var(--ease-out-quad);
}

.answer-btn:focus-visible {
  outline: 2px solid rgb(var(--cyan));
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .answer-btn:not([disabled]):hover {
    background: rgb(255 255 255 / 0.09);
    border-color: rgb(var(--cyan) / 0.5);
  }
}

.answer-btn:not([disabled]):active {
  transform: scale(0.98);
}

.answer-btn[disabled] {
  cursor: default;
}

.answer-btn .answer-icon {
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 150ms ease,
    transform 150ms var(--ease-out-quad);
}

.answer-btn.is-correct {
  border-color: rgb(var(--lime) / 0.7);
  background: rgb(var(--lime) / 0.12);
  color: rgb(var(--lime));
}

.answer-btn.is-incorrect {
  border-color: rgb(var(--cyan-comp) / 0.7);
  background: rgb(var(--cyan-comp) / 0.12);
  color: rgb(var(--cyan-comp));
}

.answer-btn.is-correct .answer-icon,
.answer-btn.is-incorrect .answer-icon {
  opacity: 1;
  transform: scale(1);
}

.answer-btn.is-muted {
  opacity: 0.45;
}

.answer-btn.is-shaking {
  animation: shake 380ms var(--ease-out-quad);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .answer-btn.is-shaking {
    animation: none;
  }
}

/* ---------- Result screen ---------- */
.score-ring {
  position: relative;
  width: 140px;
  height: 140px;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring circle {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}

.score-ring__track {
  stroke: rgb(255 255 255 / 0.1);
}

.score-ring__fill {
  stroke: rgb(var(--lime));
  stroke-dasharray: 377;
  stroke-dashoffset: 377;
}

.score-ring__value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
}

.score-ring__max {
  font-size: 1rem;
  font-weight: 500;
  color: rgb(255 255 255 / 0.55);
}

.result-message {
  font-size: 1.4rem;
  font-weight: 700;
}

.result-sub {
  color: rgb(255 255 255 / 0.6);
  font-size: 0.9rem;
}

/* ---------- Confetti ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  will-change: transform, opacity;
}

@media (max-width: 480px) {
  .card {
    padding: 2rem 1.4rem;
    border-radius: 22px;
  }
}
