* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
}
#game-container {
  position: relative;
  display: inline-block;
}
canvas {
  display: block;
  border: 2px solid #444;
  border-radius: 4px;
}

/* HUD */
#hud {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 44px;
  background: linear-gradient(180deg, rgba(20,20,40,0.95), rgba(30,30,50,0.9));
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid #555;
  z-index: 10;
  display: none;
}
.hud-item { display: flex; align-items: center; gap: 6px; }
.hud-label { color: #aaa; font-weight: 400; font-size: 13px; }

/* Chicken Panel */
#chicken-panel {
  position: absolute;
  top: 0; right: 0;
  width: 220px;
  height: 100%;
  background: linear-gradient(180deg, #1e1e3a, #16162e);
  border-left: 1px solid #555;
  padding: 12px;
  color: #fff;
  overflow-y: auto;
  z-index: 10;
  display: none;
}
#chicken-panel h3 {
  text-align: center;
  margin-bottom: 10px;
  font-size: 14px;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.chicken-btn {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 2px solid #444;
  border-radius: 8px;
  background: #2a2a4a;
  color: #fff;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  transition: all 0.15s;
}
.chicken-btn:hover { border-color: #4CAF50; background: #333360; }
.chicken-btn.selected { border-color: #FFD700; background: #3a3a5a; box-shadow: 0 0 8px rgba(255,215,0,0.3); }
.chicken-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.chicken-btn .cb-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.chicken-btn .cb-emoji { font-size: 20px; }
.chicken-btn .cb-name { font-weight: 700; }
.chicken-btn .cb-cost { color: #FFD700; font-size: 12px; }
.chicken-btn .cb-desc { font-size: 11px; color: #999; line-height: 1.3; }
.chicken-btn .cb-stats { font-size: 11px; color: #7a7; margin-top: 3px; }
.hotkey-badge {
  display: inline-block;
  background: #555;
  color: #ddd;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: auto;
}

/* Speed Controls */
#speed-controls {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.speed-btn {
  padding: 4px 10px;
  background: #333;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.speed-btn.active { background: #4CAF50; color: #fff; border-color: #4CAF50; }

/* Start Wave Button */
#start-wave-btn {
  position: absolute;
  bottom: 24px;
  left: 380px;
  transform: translateX(-50%);
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(76,175,80,0.4);
  animation: pulse 1.8s ease-in-out infinite;
  display: none;
}
#start-wave-btn:hover { background: linear-gradient(135deg, #5CBF60, #50b050); }
@keyframes pulse {
  0%,100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

/* Auto-start Skip Button */
#auto-start-btn {
  position: absolute;
  bottom: 24px;
  left: 570px;
  width: 56px;
  height: 56px;
  font-size: 26px;
  background: #2a2a4a;
  color: #aaa;
  border: 2px solid #555;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: none;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
#auto-start-btn:hover { border-color: #4CAF50; color: #fff; }
#auto-start-btn.active {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  border-color: #4CAF50;
  color: #fff;
  box-shadow: 0 0 16px rgba(76,175,80,0.6);
}

/* Overlays */
.overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.85);
  color: #fff;
  z-index: 20;
  display: none;
}

#menu-overlay {
  background: linear-gradient(135deg, rgba(10,10,30,0.95), rgba(30,15,15,0.95));
}
#menu-overlay h1 {
  font-size: 42px;
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(255,200,50,0.5);
  line-height: 1.2;
}
#menu-overlay .subtitle {
  font-size: 14px;
  color: #888;
  text-align: center;
  max-width: 500px;
  line-height: 1.6;
  margin-bottom: 30px;
}
.menu-btn {
  padding: 14px 48px;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin: 6px;
  box-shadow: 0 4px 16px rgba(231,76,60,0.4);
  transition: transform 0.15s;
}
.menu-btn:hover { transform: scale(1.05); }
.menu-btn.green { background: linear-gradient(135deg, #4CAF50, #388E3C); box-shadow: 0 4px 16px rgba(76,175,80,0.4); }

/* Chicken Upgrade/Sell Popup */
#chicken-popup {
  position: absolute;
  background: rgba(20,20,45,0.95);
  border: 2px solid #FFD700;
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  z-index: 15;
  min-width: 180px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  pointer-events: auto;
}
.popup-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 15px;
}
#popup-level {
  color: #FFD700;
  font-size: 12px;
  margin-left: auto;
}
#popup-stats {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 10px;
  line-height: 1.5;
}
.popup-buttons {
  display: flex;
  gap: 8px;
}
.popup-buttons button {
  flex: 1;
  padding: 6px 0;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s;
}
.popup-buttons button:hover { transform: scale(1.05); }
#popup-upgrade-btn {
  background: linear-gradient(135deg, #4CAF50, #388E3C);
  color: #fff;
}
#popup-upgrade-btn.disabled {
  background: #555;
  cursor: not-allowed;
  opacity: 0.5;
}
#popup-sell-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
}

#victory-overlay h1 { font-size: 38px; margin-bottom: 10px; color: #FFD700; }
#victory-overlay p { font-size: 16px; color: #ccc; margin-bottom: 20px; }
#gameover-overlay h1 { font-size: 38px; margin-bottom: 10px; color: #e74c3c; }
#gameover-overlay p { font-size: 16px; color: #ccc; margin-bottom: 20px; }
#gameover-overlay .round-info { font-size: 22px; color: #FFD700; margin-bottom: 20px; }
