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

body {
  background: #0a1a0a;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #e8f5e0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

body.mobile {
  overscroll-behavior: none;
}

#game-container {
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

#hud-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

#hud-overlay .interactive {
  pointer-events: auto;
}

.hud-panel {
  position: absolute;
  background: rgba(10, 30, 10, 0.85);
  border: 2px solid #4a7c3f;
  border-radius: 8px;
  padding: 12px 16px;
  backdrop-filter: blur(4px);
}

.hud-top {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  min-width: 280px;
  position: relative;
}

.mute-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.minimap-panel {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid #4a7c3f;
  border-radius: 4px;
  overflow: hidden;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.minimap-panel canvas {
  display: block;
}

.hud-timer {
  font-size: 2rem;
  font-weight: bold;
  color: #ffd700;
}

.hud-phase {
  font-size: 0.85rem;
  color: #8fbc8f;
  margin-top: 4px;
}

.hud-bottom-left {
  bottom: 12px;
  left: 12px;
  min-width: 200px;
}

.hud-bottom-right {
  bottom: 12px;
  right: 12px;
  min-width: 220px;
}

.hud-coins {
  font-size: 1.2rem;
  color: #ffd700;
}

.hud-role {
  font-size: 0.9rem;
  color: #a8d8a8;
  margin-top: 4px;
}

.hud-shop {
  top: 12px;
  right: 12px;
  display: none;
}

.hud-shop.visible {
  display: block;
}

.hud-shop h3 {
  margin-bottom: 8px;
  color: #ffd700;
}

.hud-shop button {
  display: block;
  width: 100%;
  margin: 4px 0;
  padding: 8px 12px;
  background: #2d5a27;
  color: #e8f5e0;
  border: 1px solid #4a7c3f;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.hud-shop button:hover {
  background: #3d7a37;
}

.hud-shop button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hud-transform {
  bottom: 80px;
  left: 12px;
  display: none;
}

.hud-transform.visible {
  display: block;
}

.hud-transform button {
  padding: 10px 16px;
  background: #8b4513;
  color: #fff;
  border: 2px solid #cd853f;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.hud-transform button:hover {
  background: #a0522d;
}

.hud-transform button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lobby-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 5, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: auto;
}

.lobby-card {
  background: #1a3a1a;
  border: 3px solid #4a7c3f;
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  text-align: center;
}

.lobby-card h1 {
  color: #7cfc00;
  margin-bottom: 8px;
  font-size: 1.8rem;
}

.lobby-card p {
  color: #8fbc8f;
  margin-bottom: 24px;
}

.lobby-section {
  margin: 16px 0;
  text-align: left;
}

.lobby-section label {
  display: block;
  margin-bottom: 8px;
  color: #a8d8a8;
}

.role-buttons,
.size-buttons,
.duration-buttons,
.species-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.role-buttons button,
.size-buttons button,
.duration-buttons button,
.species-buttons button {
  flex: 1;
  min-width: 100px;
  padding: 12px;
  background: #2d5a27;
  color: #e8f5e0;
  border: 2px solid #4a7c3f;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.role-buttons button.selected,
.size-buttons button.selected,
.duration-buttons button.selected,
.species-buttons button.selected {
  background: #4a7c3f;
  border-color: #7cfc00;
}

.role-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lobby-card .ready-btn {
  margin-top: 24px;
  padding: 14px 32px;
  background: #ffd700;
  color: #1a1a00;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
}

.lobby-card .ready-btn:hover {
  background: #ffec8b;
}

.lobby-card .ready-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.player-list {
  list-style: none;
  margin-top: 16px;
  text-align: left;
}

.player-list li {
  padding: 6px 0;
  border-bottom: 1px solid #2d5a27;
  color: #c8e6c8;
  font-size: 0.9rem;
}

.results-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 5, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  pointer-events: auto;
}

.results-card {
  background: #1a3a1a;
  border: 3px solid #ffd700;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  max-width: 400px;
}

.results-card h2 {
  color: #ffd700;
  font-size: 2rem;
  margin-bottom: 16px;
}

.results-card .scores {
  text-align: left;
  margin: 16px 0;
}

.results-card .scores div {
  padding: 4px 0;
  color: #c8e6c8;
}

.results-card .results-countdown {
  margin-top: 12px;
  color: #8fbc8f;
  font-size: 0.9rem;
}

.results-card button {
  margin-top: 16px;
  padding: 12px 24px;
  background: #4a7c3f;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.hud-controls {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: #6a9a6a;
  text-align: center;
}

.hud-controls.mobile-hint {
  bottom: 140px;
  max-width: 90%;
  line-height: 1.4;
}

@media (pointer: coarse) {
  .hud-controls.desktop-hint {
    display: none;
  }
}

.touch-controls {
  display: none;
  pointer-events: auto;
  touch-action: none;
}

.touch-controls.visible {
  display: block;
}

.joystick-zone {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(30, 60, 30, 0.45);
  border: 2px solid rgba(74, 124, 63, 0.7);
  touch-action: none;
}

.joystick-zone.move-stick {
  bottom: 24px;
  left: 24px;
}

.joystick-zone.aim-stick {
  bottom: 24px;
  right: 100px;
}

.joystick-stick {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(127, 252, 0, 0.5);
  border: 2px solid rgba(127, 252, 0, 0.9);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.joystick-zone.aim-stick .joystick-stick {
  background: rgba(255, 215, 0, 0.5);
  border-color: rgba(255, 215, 0, 0.9);
}

.mobile-btn {
  position: absolute;
  padding: 12px 16px;
  background: rgba(45, 90, 39, 0.9);
  color: #e8f5e0;
  border: 2px solid #4a7c3f;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  touch-action: manipulation;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active {
  background: rgba(74, 124, 63, 0.95);
}

.mobile-btn.selected {
  background: #4a7c3f;
  border-color: #7cfc00;
}

.mobile-btn.shoot-btn {
  bottom: 40px;
  right: 24px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  padding: 0;
  font-size: 0.75rem;
  background: rgba(200, 50, 50, 0.9);
  border-color: #ff6666;
}

.mobile-btn.shoot-btn:active {
  background: rgba(255, 80, 80, 0.95);
}

.mobile-actions-top {
  position: absolute;
  top: 70px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-actions-top .mobile-btn {
  position: relative;
  min-width: 100px;
}

.mobile-transform-btn {
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 20px;
}
