:root {
  --bg: #0d0d0d;
  --primary: #7c3aed;
  --accent: #a78bfa;
  --secondary: #ffffff;
  --text-muted: #888888;
  --border: #2d2d2d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100vh;
}

body {
  font-family: 'Space Mono', 'IBM Plex Mono', monospace;
  background: var(--bg);
  color: var(--secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  letter-spacing: 0.5px;
}

#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.progress-bar {
  position: fixed;
  border-radius: 100px;
  top: 0;
  left: 10px;
  right: 10px;
  width: calc(100% - 20px);
  height: 10px;
  margin-top: 10px;
  display: flex;
  gap: 0;
  z-index: 50;
  background: rgba(13, 13, 13, 0.9);
  overflow: hidden;
}

.progress-segment {
  flex: 1;
  height: 100%;
  background: rgba(141, 141, 141, 0.3);
  border-right: 1px solid rgba(141, 141, 141, 0.2);
  transition: background 0.3s ease;
}

.progress-segment:last-child {
  border-right: none;
}

.progress-segment.active {
  background: var(--secondary);
}

.container {
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 0;
  transition: transform 0.6s ease, filter 0.6s ease, opacity 0.6s ease;
}

.quiz-container {
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  transition: transform 0.6s ease, filter 0.6s ease, opacity 0.6s ease;
}

.question-section {
  text-align: center;
}

.question {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  letter-spacing: 1px;
  color: var(--secondary);
}

.answers-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.answer-btn {
  width: 100%;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--secondary);
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  position: relative;
  overflow: hidden;
}

.answer-btn span {
  position: relative;
  z-index: 2;
  display: block;
}

.answer-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 1;
}

.answer-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.1);
}

.answer-btn:hover::before {
  opacity: 0.08;
}

.answer-btn.active {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.1);
  box-shadow:
    0 0 24px rgba(124, 58, 237, 0.15),
    inset 0 0 12px rgba(124, 58, 237, 0.05);
}

.answer-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.answer-btn.loading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
  animation: loadingBar 1.2s ease-in-out forwards;
}

@keyframes loadingBar {
  0% { width: 0; }
  100% { width: 100%; }
}

.status-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(13, 13, 13, 0.95);
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  padding: 32px 48px;
  text-align: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 12px 60px rgba(124, 58, 237, 0.3);
}

.status-message.show {
  opacity: 1;
  pointer-events: auto;
  animation: statusPulse 2.2s ease-in-out;
}

@keyframes statusPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
  }
  15% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  85% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
  }
}

.status-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--secondary);
  margin: 0 0 8px 0;
}

.status-connecting {
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin: 0;
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.4; }
}
.footer {
  position: fixed;
  bottom: 16px;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 2;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.explosion-container {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
}

body.exploding {
  animation: screenShake 0.55s ease-out;
}

body.flash-out::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 140;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,0.24) 0%, rgba(124,58,237,0.12) 28%, rgba(0,0,0,0) 70%);
  animation: globalFlash 0.55s ease-out forwards;
}

.container.parallax-blast {
  animation: blastZoom 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-origin: center center;
}

.quiz-container.explode-hit {
  animation: contentFadeBlast 0.8s ease forwards;
}

.explosion-flash {
  position: fixed;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle,
      rgba(255,255,255,0.95) 0%,
      rgba(167,139,250,0.9) 25%,
      rgba(124,58,237,0.5) 55%,
      rgba(124,58,237,0) 75%);
  filter: blur(6px);
  animation: flashBurst 0.7s ease-out forwards;
}

.shockwave {
  position: fixed;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(167, 139, 250, 0.75);
  box-shadow:
    0 0 30px rgba(167, 139, 250, 0.35),
    inset 0 0 20px rgba(167, 139, 250, 0.18);
  animation: shockwaveExpand 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.explosion-particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #c4b5fd 20%, #7c3aed 65%, #4c1d95 100%);
  box-shadow:
    0 0 10px rgba(167, 139, 250, 0.7),
    0 0 28px rgba(124, 58, 237, 0.35);
  animation: explodeParticle var(--dur) cubic-bezier(0.12, 0.8, 0.32, 1) forwards;
  will-change: transform, opacity, filter;
}

.explosion-particle.back {
  filter: blur(2px);
  opacity: 0.75;
}

.explosion-particle.mid {
  filter: blur(0.8px);
  opacity: 0.95;
}

.explosion-particle.front {
  filter: blur(0px);
  opacity: 1;
  box-shadow:
    0 0 14px rgba(255, 255, 255, 0.45),
    0 0 26px rgba(167, 139, 250, 0.8),
    0 0 50px rgba(124, 58, 237, 0.4);
}

.explosion-streak {
  position: fixed;
  width: 80px;
  height: 2px;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) rotate(var(--angle));
  transform-origin: left center;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,1) 0%,
    rgba(167,139,250,0.9) 40%,
    rgba(124,58,237,0.35) 100%
  );
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.65);
  animation: streakBlast var(--dur) ease-out forwards;
}

.page-transition {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at center,
      rgba(255,255,255,0.18) 0%,
      rgba(124,58,237,0.18) 22%,
      rgba(13,13,13,0.86) 58%,
      rgba(0,0,0,1) 100%);
  transition: opacity 0.55s ease;
}

.page-transition.show {
  opacity: 1;
}

@keyframes explodeParticle {
  0% {
    transform: translate(-50%, -50%) translate3d(0, 0, 0) scale(0.4) rotate(0deg);
    opacity: 1;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform:
      translate(-50%, -50%)
      translate3d(var(--dx), var(--dy), 0)
      scale(0.1)
      rotate(var(--rot));
    opacity: 0;
  }
}

@keyframes streakBlast {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--angle)) scaleX(0.2);
  }
  100% {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      translate(var(--dx), var(--dy))
      rotate(var(--angle))
      scaleX(1.35);
  }
}

@keyframes flashBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.8);
  }
}

@keyframes shockwaveExpand {
  0% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(18);
  }
}

@keyframes blastZoom {
  0% {
    transform: scale(1) translateY(0);
    filter: blur(0px);
    opacity: 1;
  }
  35% {
    transform: scale(1.05) translateY(-6px);
    filter: blur(0px);
    opacity: 1;
  }
  100% {
    transform: scale(1.18) translateY(-18px);
    filter: blur(10px);
    opacity: 0;
  }
}

@keyframes contentFadeBlast {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0px);
  }
  100% {
    opacity: 0;
    transform: scale(0.92);
    filter: blur(12px);
  }
}

@keyframes screenShake {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-4px, 2px); }
  40%  { transform: translate(4px, -3px); }
  60%  { transform: translate(-3px, 3px); }
  80%  { transform: translate(2px, -2px); }
  100% { transform: translate(0, 0); }
}

@keyframes globalFlash {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@media (max-width: 640px) {
  .container {
    padding: 30px 16px 16px;
    padding-top: 16px;
  }

  .question {
    font-size: 20px;
  }

  .answer-btn {
    padding: 16px 20px;
    font-size: 12px;
  }

  .status-message {
    width: calc(100% - 32px);
    max-width: 360px;
    padding: 24px 32px;
  }

  .progress-bar {
    height: 10px;
    border-radius: 100px;
  }

  .footer {
    font-size: 11px;
    bottom: 12px;
  }
}