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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0e2f44;
  /* Gamified futuristic font */
  font-family: "Orbitron", "Segoe UI", Arial, sans-serif;
}

canvas {
  display: block;
  background: #1b4b63;
  width: 100vw;
  height: 100vh;
}

/* Quiz Popup Overlay */
#quizPopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.hidden {
  display: none !important;
}

.quiz-box {
  background: #ffffff;
  padding: 24px 20px;
  border-radius: 12px;
  width: min(90vw, 460px);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.2);
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  /* Use a normal/system font for quiz content (requirement) */
  font-family: "Segoe UI", Arial, sans-serif;
}

.quiz-title {
  margin-bottom: 10px;
  font-size: 22px;
  color: #0e2f44;
  letter-spacing: 0.2px;
}

.quiz-box p {
  font-size: 18px;
  margin-bottom: 14px;
  color: #1a1a1a;
  font-family: inherit;
}

.quiz-box #quizAnswers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.quiz-box button {
  display: block;
  margin: 0;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background-color: #0e8cd4;
  color: white;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.06s ease;
  font-family: inherit; /* ensure button also uses normal font */
}

.quiz-box button:hover {
  background-color: #0a6ca1;
}

.quiz-box button:active {
  transform: translateY(1px);
}

.quiz-box button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Feedback popup moved to top center */
#feedbackPopup {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 18px;
  z-index: 1000;
  text-align: center;
  pointer-events: none;
  max-width: 90vw;
}

/* Game Over Overlay */
#gameOverOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1500;
  font-family: inherit;
}

#gameOverOverlay .go-box {
  background: #0d3448;
  padding: 36px 44px 44px;
  /* Sharp corners per request */
  border-radius: 0;
  width: min(90vw, 480px);
  text-align: center;
  /* Sleeker, reduced shadow */
  box-shadow: 0 10px 28px -6px rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(0, 255, 213, 0.18);
  position: relative;
  overflow: hidden;
}

/* Subtle animated scan-line / sheen for extra game feel */
#gameOverOverlay .go-box:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 255, 213, 0.12) 0%,
    rgba(0, 0, 0, 0) 38%,
    rgba(0, 160, 255, 0.12) 72%,
    rgba(0, 0, 0, 0) 100%
  );
  mix-blend-mode: overlay;
  animation: panelGlow 7s linear infinite;
  pointer-events: none;
}

#gameOverOverlay h1 {
  font-size: 56px;
  margin: 0 0 16px;
  line-height: 1;
  /* New vibrant animated gradient */
  background: linear-gradient(
    90deg,
    #ff007a 0%,
    #ffbf00 25%,
    #00f5d4 50%,
    #5865f2 75%,
    #ff007a 100%
  );
  background-size: 300% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  letter-spacing: 1.5px;
  animation: titlePulse 5.5s linear infinite;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.28),
    0 0 18px rgba(255, 0, 122, 0.25);
}

#gameOverOverlay p {
  margin: 0 0 26px;
  font-size: 20px;
  color: #dffaff;
  letter-spacing: 0.75px;
  font-weight: 500;
}

#restartBtn {
  background: linear-gradient(
    100deg,
    #ff007a 0%,
    #ff5f11 30%,
    #ffbf00 60%,
    #00d4ff 100%
  );
  color: #fff;
  border: 0;
  padding: 14px 30px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.75px;
  border-radius: 4px;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.55);
  transition:
    transform 0.15s ease,
    filter 0.25s ease;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

#restartBtn:before {
  content: "";
  position: absolute;
  top: 0;
  left: -30%;
  width: 30%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0)
  );
  transform: skewX(-18deg);
  animation: sheen 3.4s ease-in-out infinite;
}

#restartBtn:hover {
  filter: brightness(1.12) contrast(1.05);
  transform: translateY(-2px);
}

#restartBtn:active {
  transform: translateY(1px) scale(0.98);
}

/* Keyframes */
@keyframes titlePulse {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes sheen {
  0% {
    left: -30%;
  }
  55%,
  100% {
    left: 130%;
  }
}

@keyframes panelGlow {
  0% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.85;
  }
  100% {
    opacity: 0.55;
  }
}
