html, body {
  margin: 0;
  height: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

#scene {
  position: fixed;
  inset: 0 0 0 0;
  z-index: 0;
  overflow: hidden;
}

#scene canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#ui {
  position: relative;
  z-index: 10;
  padding: 12px;
}

#topbar {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Project ID */
.project-id {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, rgba(100, 100, 255, 0.3), rgba(80, 80, 200, 0.3));
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
}

/* Fancy Score and Gold UI */
.stat-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.95), rgba(10, 10, 20, 0.95));
  padding: 12px 20px;
  border-radius: 15px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5),
              0 0 30px rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.15);
  min-width: 140px;
  transition: all 0.3s ease;
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6),
              0 0 40px rgba(255, 255, 255, 0.15);
}

.stat-icon {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5),
               0 0 20px rgba(255, 255, 255, 0.3);
  letter-spacing: 1px;
}

#restart {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b6b, #ff3333);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  box-shadow: 0 4px 15px rgba(255, 51, 51, 0.4);
  margin-left: auto;
}

#restart:hover {
  background: linear-gradient(135deg, #ff8888, #ff5555);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 80, 80, 0.6);
}

/* On-screen Flap Button */
#flap-button {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: 100px;
  height: 100px;
  font-size: 48px;
  background: linear-gradient(135deg, #00d4ff, #0099ff);
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 150, 255, 0.6),
              0 0 50px rgba(0, 212, 255, 0.4);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#flap-button:hover {
  background: linear-gradient(135deg, #00ffff, #00aaff);
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 10px 40px rgba(0, 180, 255, 0.8),
              0 0 60px rgba(0, 255, 255, 0.5);
}

#flap-button:active {
  transform: translateX(-50%) scale(0.95);
  box-shadow: 0 4px 20px rgba(0, 150, 255, 0.6),
              0 0 30px rgba(0, 212, 255, 0.4);
}

#message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 40px 60px;
  border-radius: 20px;
  font-size: 48px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 2px;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5),
               0 0 20px rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6),
              0 0 60px rgba(255, 50, 50, 0.4);
  border: 3px solid rgba(255, 255, 255, 0.2);
  animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

#message.hidden {
  display: none;
}

.game-over-text {
  margin-bottom: 25px;
}

.game-over-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.respawn-btn {
  padding: 15px 40px;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.respawn-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #5CBF60, #55b059);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(76, 175, 80, 0.6);
}

.respawn-btn:disabled {
  background: linear-gradient(135deg, #666, #555);
  cursor: not-allowed;
  opacity: 0.6;
}

.restart-btn {
  padding: 15px 40px;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b6b, #ff3333);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.restart-btn:hover {
  background: linear-gradient(135deg, #ff8888, #ff5555);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(255, 80, 80, 0.6);
}

#powerups {
  position: fixed;
  top: 60px;
  left: 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.powerup-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.75);
  padding: 12px 20px;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
  animation: powerUpPulse 0.8s ease-in-out infinite;
}

#breaker-status {
  border-color: #00aaff;
  box-shadow: 0 4px 12px rgba(0, 170, 255, 0.5);
}

#fever-status {
  border-color: #ff3333;
  box-shadow: 0 4px 12px rgba(255, 51, 51, 0.5);
}

#clicker-status {
  border-color: #00ff44;
  box-shadow: 0 4px 12px rgba(0, 255, 68, 0.6);
  animation: clickerPulse 0.3s ease-in-out infinite;
}

#immunity-status {
  border-color: #ffdd00;
  box-shadow: 0 4px 12px rgba(255, 221, 0, 0.6);
  animation: immunityPulse 1s ease-in-out infinite;
}

@keyframes clickerPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(0, 255, 68, 0.6);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 255, 68, 0.9);
  }
}

@keyframes immunityPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(255, 221, 0, 0.6);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 221, 0, 0.9);
  }
}

.powerup-icon {
  font-size: 24px;
}

.powerup-label {
  flex: 1;
}

.powerup-timer {
  font-size: 18px;
  font-weight: 700;
  min-width: 35px;
  text-align: right;
}

.powerup-status.hidden {
  display: none;
}

@keyframes powerUpPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Settings Page */
#settings {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

#settings.hidden {
  display: none;
}

/* Countdown overlay */
#countdown {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  pointer-events: none;
}

#countdown.hidden {
  display: none;
}

.countdown-number {
  font-size: 120px;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 30px rgba(0, 200, 255, 0.8),
               0 0 60px rgba(0, 200, 255, 0.6),
               0 4px 8px rgba(0, 0, 0, 0.9);
  animation: countdownPulse 1s ease-out;
}

@keyframes countdownPulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.settings-panel {
  background: linear-gradient(145deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 30, 0.95));
  padding: 50px 60px;
  border-radius: 25px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8),
              0 0 80px rgba(100, 150, 255, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  min-width: 400px;
}

.settings-title {
  color: #fff;
  font-size: 42px;
  font-weight: 800;
  margin: 0 0 40px 0;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5),
               0 0 20px rgba(100, 150, 255, 0.5);
  letter-spacing: 3px;
}

.settings-section {
  margin-bottom: 35px;
  padding-bottom: 30px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.settings-label {
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.mode-toggle {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}

.mode-btn {
  flex: 1;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

.mode-btn.active {
  background: linear-gradient(135deg, #00d4ff, #0099ff);
  color: white;
  border-color: #00d4ff;
  box-shadow: 0 4px 15px rgba(0, 180, 255, 0.5);
}

.mode-description {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  font-style: italic;
  margin-top: 8px;
}

.settings-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

.settings-btn {
  padding: 18px 40px;
  font-size: 22px;
  font-weight: 700;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#resume {
  background: linear-gradient(135deg, #00d4ff, #0099ff);
  color: white;
}

#resume:hover {
  background: linear-gradient(135deg, #00ffff, #00aaff);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 180, 255, 0.5);
}

#restart-settings {
  background: linear-gradient(135deg, #ff6b6b, #ff3333);
  color: white;
}

#restart-settings:hover {
  background: linear-gradient(135deg, #ff8888, #ff5555);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(255, 80, 80, 0.5);
}

.settings-hint {
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  font-style: italic;
  margin-top: 10px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Start Screen */
#start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 300;
  background: linear-gradient(135deg, rgba(0, 40, 80, 0.95), rgba(0, 20, 40, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

#start-screen.hidden {
  display: none;
}

.start-panel {
  text-align: center;
  padding: 60px 80px;
  background: rgba(20, 20, 30, 0.9);
  border-radius: 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8),
              0 0 100px rgba(0, 150, 255, 0.4);
  border: 4px solid rgba(255, 255, 255, 0.2);
}

.game-title {
  font-size: 80px;
  font-weight: 900;
  color: #00d4ff;
  margin: 0 0 10px 0;
  text-shadow: 0 6px 20px rgba(0, 212, 255, 0.8),
               0 0 40px rgba(0, 150, 255, 0.6);
  letter-spacing: 8px;
  text-transform: uppercase;
  animation: titleFloat 2s ease-in-out infinite;
}

.game-subtitle {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 50px 0;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  letter-spacing: 4px;
  opacity: 0.9;
}

.start-btn {
  padding: 20px 50px;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #00ff88, #00cc66);
  color: white;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 3px;
  box-shadow: 0 8px 25px rgba(0, 200, 100, 0.5);
  margin-bottom: 20px;
}

.start-btn:hover {
  background: linear-gradient(135deg, #00ffaa, #00dd77);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 35px rgba(0, 255, 136, 0.6);
}

.start-hint {
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  font-style: italic;
  margin-top: 15px;
}

@keyframes titleFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Height Bar UI */
#height-bar {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 50;
  height: 300px;
  width: 30px;
}

.height-bar-track {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 100%;
  background: linear-gradient(to top, 
    rgba(255, 255, 255, 0.2), 
    rgba(100, 200, 255, 0.4));
  border-radius: 3px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.height-indicator {
  position: absolute;
  bottom: 0%;
  left: 50%;
  transform: translate(-50%, 50%);
  transition: bottom 0.2s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.height-ball {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 30% 30%, #ffdd44, #ff8800);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(255, 136, 0, 0.6),
              0 0 20px rgba(255, 200, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.height-value {
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8),
               0 0 10px rgba(255, 136, 0, 0.5);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 8px;
  border-radius: 6px;
}
