/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100vh;
  overflow: hidden;
  font-family: "Arial", sans-serif;
  background: linear-gradient(135deg, #0d1421 0%, #1a1f3a 25%, #2d3561 50%, #1a1f3a 75%, #0d1421 100%);
  color: white;
}

/* Main Game Wrapper */
.game-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Top HUD Bar - Only Mute Button */
.hud-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(64, 196, 255, 0.1);
  z-index: 100;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* HUD Elements - Using Morka Brand Colors */
.score-display {
  display: flex;
  align-items: center;
}

.score-number {
  font-size: 22px;
  font-weight: bold;
  color: #40c4ff;
  text-shadow: 0 0 8px rgba(64, 196, 255, 0.3);
}

.trophy-icon {
  font-size: 18px;
  color: #ffd54f;
  filter: drop-shadow(0 0 4px rgba(255, 213, 79, 0.4));
}

.lives-display {
  display: flex;
  gap: 4px;
}

.heart {
  font-size: 16px;
  color: #ff5252;
  text-shadow: 0 0 6px rgba(255, 82, 82, 0.3);
}

.heart.lost {
  opacity: 0.3;
}

.ammo-display {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(64, 196, 255, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(64, 196, 255, 0.3);
  box-shadow: 0 0 8px rgba(64, 196, 255, 0.1);
}

.ammo-icon {
  font-size: 14px;
  color: #40c4ff;
}

.ammo-count {
  font-size: 14px;
  font-weight: bold;
  color: #40c4ff;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(64, 196, 255, 0.2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: rgba(64, 196, 255, 0.1);
  border-color: rgba(64, 196, 255, 0.4);
  box-shadow: 0 0 8px rgba(64, 196, 255, 0.2);
}

/* Canvas Section - Contains top bar and canvas */
.canvas-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 800px;
}

/* Top Controls Bar - Above Canvas */
.top-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  border: 1px solid rgba(64, 196, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 6px;
}

/* Game Stats - Left Side */
.game-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: bold;
}

.stat-item .icon {
  font-size: 18px;
  filter: drop-shadow(0 0 4px currentColor);
}

.stat-item .label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: normal;
  letter-spacing: 0.3px;
}

.stat-item .value {
  color: #40c4ff;
  text-shadow: 0 0 8px rgba(64, 196, 255, 0.4);
  font-weight: bold;
  min-width: 30px;
  text-align: left;
}

/* Lives stat specific styling */
.lives-stat .icon {
  color: #ff5252;
  text-shadow: 0 0 8px rgba(255, 82, 82, 0.4);
  font-size: 25px;
}

.lives-stat .value {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.ammo-stat .icon {
  color: #ffd54f;
  text-shadow: 0 0 8px rgba(255, 213, 79, 0.4);
}

.ammo-stat .value {
  color: #ffd54f;
  text-shadow: 0 0 8px rgba(255, 213, 79, 0.4);
}

/* Game Control Buttons - Right Side */
.game-controls {
  display: flex;
  gap: 20px;
  align-items: center;
}

.control-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.game-control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 70px;
  height: 32px;
  letter-spacing: 0.3px;
}

.pause-btn {
  background: linear-gradient(135deg, #d4a574, #c49660);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.pause-btn:hover {
  background: linear-gradient(135deg, #ddb485, #d4a574);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(212, 165, 116, 0.3);
}

.pause-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(212, 165, 116, 0.3);
}

.restart-btn {
  background: linear-gradient(135deg, #7a9b7a, #6b8b6b);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.restart-btn:hover {
  background: linear-gradient(135deg, #8aab8a, #7a9b7a);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(122, 155, 122, 0.3);
}

.restart-btn:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(168, 200, 168, 0.3);
}

.control-label {
  display: none;
}

/* Game Canvas Container - Now connects to top bar */
.game-container {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  max-width: 800px;
  max-height: 600px;
  border-radius: 8px;
  border: 1px solid rgba(64, 196, 255, 0.3);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 20px rgba(64, 196, 255, 0.1), inset 0 0 0 1px rgba(64, 196, 255, 0.05);
}

/* Main Game Area */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  gap: 15px;
  position: relative;
}

.game-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  width: 100%;
}

/* Left Side - SHOOT Button */
.left-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 140px;
}

/* Right Side - Movement Controls */
.right-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 140px;
}

/* Canvas Elements */
canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

#objects {
  z-index: 1;
}

#gui {
  z-index: 2;
}

.movement-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.control-row {
  display: flex;
  gap: 8px;
}

.action-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* MOBILE OVERLAY CONTROLS - Hidden by default */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  z-index: 10;
  pointer-events: none;
}

.mobile-movement {
  position: absolute;
  bottom: 0;
  right: 0;
  pointer-events: all;
}

.mobile-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  pointer-events: all;
}

/* Control Button Styles */
.control-btn {
  background: rgba(96, 125, 139, 0.9);
  border: 1px solid rgba(255, 213, 79, 0.3);
  border-radius: 10px;
  padding: 12px;
  color: white;
  font-size: 18px;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.control-btn:hover {
  background: rgba(120, 144, 156, 0.95);
  border-color: rgba(255, 213, 79, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.4), 0 0 8px rgba(255, 213, 79, 0.2);
}

.control-btn:active,
.control-btn.pressed {
  background: rgba(69, 90, 100, 0.95);
  border-color: rgba(255, 213, 79, 0.7);
  transform: scale(0.95);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 213, 79, 0.3);
}

.shoot-btn {
  background: linear-gradient(135deg, #6b9bd1, #5a8bc4);
  border: none;
  border-radius: 10px;
  padding: 14px 22px;
  color: white;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(64, 196, 255, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 130px;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.shoot-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(64, 196, 255, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  background: linear-gradient(135deg, #7ba5db, #6b9bd1);
}

.shoot-btn:active,
.shoot-btn.pressed {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(64, 196, 255, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
}

.shoot-icon {
  font-size: 16px;
}

.shoot-text {
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* Controls Below Canvas Layout */
.controls-below {
  display: none;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 80px;
  width: 100%;
}

.controls-below .action-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls-below .movement-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

/* Add pressed state for controls-below buttons */
.controls-below .control-btn:active,
.controls-below .control-btn.pressed {
  background: rgba(69, 90, 100, 0.95);
  border-color: rgba(255, 213, 79, 0.7);
  transform: scale(0.95);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 213, 79, 0.3);
}

.controls-below .shoot-btn:active,
.controls-below .shoot-btn.pressed {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(64, 196, 255, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
}

/* LARGE DESKTOP (1000px+) - Three column layout */
@media (min-width: 1000px) {
  .game-area {
    flex-direction: column;
    gap: 40px;
    padding: 20px;
  }

  .game-content {
    flex-direction: row;
    gap: 40px;
  }

  .left-controls,
  .right-controls {
    display: flex;
    min-width: 140px;
  }

  .controls-below {
    display: none;
  }
}

/* MEDIUM SCREENS (768px - 999px) - Controls below canvas */
@media (max-width: 999px) and (min-width: 768px) {
  .game-area {
    flex-direction: column;
    gap: 30px;
    padding: 20px;
    align-items: center;
  }

  .game-content {
    flex-direction: column;
    gap: 30px;
    align-items: center;
  }

  /* Hide side controls */
  .left-controls,
  .right-controls {
    display: none;
  }

  /* Show controls below canvas */
  .controls-below {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 80px;
    width: 100%;
    align-items: center;
  }

  .controls-below .action-controls {
    order: 1; /* SHOOT on left */
  }

  .controls-below .movement-controls {
    order: 2; /* Movement on right */
  }

  .control-btn {
    width: 64px;
    height: 64px;
    font-size: 20px;
  }

  .shoot-btn {
    padding: 16px 28px;
    font-size: 15px;
    min-width: 150px;
  }
}

/* MOBILE LAYOUT (<768px) - Switch to overlay controls */
@media (max-width: 767px) {
  .top-controls-bar {
    padding: 6px 12px;
    border-radius: 8px 8px 0 0;
  }

  .game-area {
    padding: 10px;
    gap: 0;
    flex-direction: column;
  }

  .game-content {
    flex-direction: column;
    gap: 0;
  }

  .canvas-section {
    max-width: 100vw;
  }

  .game-container {
    max-height: calc(100vh - 200px);
  }

  /* Hide desktop controls */
  .left-controls,
  .right-controls,
  .controls-below {
    display: none;
  }

  /* Show mobile overlay controls */
  .mobile-controls {
    display: block;
  }

  /* Adjust top controls bar for mobile */
  .game-stats {
    gap: 10px;
  }

  .stat-item {
    font-size: 12px;
  }

  .stat-item .icon {
    font-size: 14px;
  }

  .stat-item .label {
    font-size: 10px;
  }

  .game-controls {
    gap: 12px;
  }

  .game-control-btn {
    padding: 6px 12px;
    font-size: 11px;
    min-width: 60px;
    height: 28px;
  }

  .control-label {
    font-size: 8px;
  }

  .game-control-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .control-icon {
    font-size: 14px;
  }

  .control-label {
    font-size: 9px;
  }

  .game-container {
    border-radius: 0 0 8px 8px;
  }

  /* Mobile movement controls (bottom-right) */
  .mobile-movement .movement-controls {
    gap: 8px;
  }

  .mobile-movement .control-row {
    gap: 6px;
  }

  .mobile-movement .control-btn {
    width: 64px;
    height: 64px;
    font-size: 16px;
    background: rgba(96, 125, 139, 0.95);
  }

  /* Mobile action controls (bottom-left) */
  .mobile-actions .shoot-btn {
    padding: 12px 18px;
    font-size: 13px;
    min-width: 110px;
    background: linear-gradient(135deg, #6b9bd1, #5a8bc4);
  }

  .hud-bar {
    padding: 8px 12px;
  }

  .hud-left {
    gap: 10px;
  }

  .score-number {
    font-size: 18px;
  }
}

/* SMALL MOBILE (<480px) */
@media (max-width: 479px) {
  .top-controls-bar {
    padding: 4px 8px;
  }

  .game-stats {
    gap: 2px;
  }

  .stat-item {
    font-size: 11px;
  }

  .stat-item .label {
    font-size: 9px;
  }

  .game-controls {
    gap: 8px;
  }

  .game-control-btn {
    padding: 4px 10px;
    font-size: 10px;
    min-width: 55px;
    height: 26px;
  }

  .control-label {
    font-size: 7px;
  }

  .game-control-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .control-icon {
    font-size: 12px;
  }

  .control-label {
    font-size: 8px;
  }

  .mobile-movement .control-btn {
    width: 48px;
    height: 48px;
    font-size: 15px;
  }

  .mobile-actions .shoot-btn {
    padding: 10px 16px;
    font-size: 12px;
    min-width: 100px;
  }

  .mobile-controls {
    bottom: 15px;
    left: 15px;
    right: 15px;
  }
}

/* Hide original controls */
#controls {
  display: none;
}

/* Prevent text selection on controls */
.left-controls,
.right-controls,
.mobile-controls {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
