* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at top, #4a5f8a, #1a2740);
  font-family: 'Comic Sans MS', Arial, sans-serif;
  overflow: hidden;
}

#gameWrap {
  position: relative;
  width: min(900px, 96vw);
  border: 5px solid #111827;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  color: white;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 2px 2px 3px #000;
  z-index: 5;
}

#answerButtons {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 15px;
  z-index: 10;
}

#answerButtons.active {
  display: flex;
}

.answerBtn {
  border: none;
  background: linear-gradient(#66d9ff, #2eb8e8);
  color: white;
  font-size: 28px;
  font-weight: bold;
  padding: 18px 35px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 0 #1a7a9e;
  transition: all 0.1s;
  min-width: 80px;
}

.answerBtn:hover {
  background: linear-gradient(#4dc4f0, #1a9fd4);
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #1a7a9e;
}

.answerBtn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1a7a9e;
}

.answerBtn.correct {
  background: linear-gradient(#66ff8a, #2ecc71);
  box-shadow: 0 6px 0 #229954;
}

.answerBtn.wrong {
  background: linear-gradient(#ff6b6b, #e74c3c);
  box-shadow: 0 6px 0 #c0392b;
  animation: shake 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

#message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(10,15,30,.85);
  color: white;
  text-align: center;
  z-index: 20;
}

#message h1 {
  margin: 0 0 10px;
  color: #ffd23f;
  font-size: 48px;
  text-shadow: 3px 3px 0 #7a5200;
}

#message p {
  margin: 8px 0;
  font-size: 18px;
}

#message p.instructions {
  font-size: 16px;
  color: #aaa;
  margin-top: 5px;
}

#startButton {
  border: none;
  padding: 16px 40px;
  border-radius: 12px;
  background: linear-gradient(#ffe066, #ffb703);
  color: #5a3b00;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 0 #a86a00;
  margin-top: 15px;
}

#startButton:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #a86a00;
}

#levelMessage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 25, 0.85);
  z-index: 9999;
}

.levelCard {
  width: 450px;
  max-width: 90vw;
  padding: 40px;
  background: white;
  border-radius: 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  border: 5px solid #ffd23f;
}

.levelCard h1 {
  margin: 0 0 15px;
  font-size: 36px;
  color: #233047;
}

.levelCard p {
  margin: 10px 0 25px;
  font-size: 18px;
  color: #555;
}

#continueButton,
#restartButton {
  border: none;
  padding: 14px 35px;
  border-radius: 12px;
  background: linear-gradient(#ffe066, #ffb703);
  color: #5a3b00;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 0 #a86a00;
}

#continueButton:active,
#restartButton:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #a86a00;
}
