:root {
  --primary-color: #4682b4;
  --secondary-color: #6a5acd;
  --background-dark: #0a0a1e;
  --background-light: #1a1a2e;
  --accent-color: #9370db;
  --text-color: #e0e0ff;
  --border-color: #d2b48c;
  --enemy-color: #ff5555;
  --turret-color: #55ff55;
  --warning-color: #ffcc00;
  --success-color: #00cc99;
  --enemy-zone-color: #ff0000;
}

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

body {
  background: var(--background-dark);
  font-family: 'Arial', sans-serif;
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: none; /* Prevent default touch behaviors */
}

#mobile-game-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  padding: 5px;
  background: linear-gradient(145deg, var(--background-light), var(--background-dark));
  border-radius: 0;
  box-shadow: none;
  border: none;
}

#mobile-game-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 30, 0.3);
  border-radius: 8px;
  border: 2px solid var(--border-color);
  overflow: hidden;
  margin: 5px 0;
}

#mobile-game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#mobile-stats {
  display: flex;
  justify-content: space-around;
  background: rgba(10, 10, 30, 0.5);
  border-radius: 8px;
  padding: 5px;
  margin-bottom: 5px;
  border: 1px solid var(--primary-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
}

.stat-label {
  font-weight: bold;
  color: var(--primary-color);
}

.stat-value {
  font-family: monospace;
  font-size: 0.9rem;
}

#mobile-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding: 5px;
  background: rgba(26, 26, 46, 0.7);
  border-radius: 8px;
  border: 2px solid var(--border-color);
}

.mobile-button {
  background: var(--secondary-color);
  color: var(--text-color);
  border: none;
  border-radius: 5px;
  padding: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  touch-action: manipulation; /* Ensure buttons are clickable */
}

.mobile-button:hover {
  background: var(--accent-color);
  transform: scale(1.05);
}

.mobile-button:disabled {
  background: #444;
  cursor: not-allowed;
  transform: none;
}

.mobile-button.active {
  background: var(--warning-color);
  transform: scale(0.95);
}

.mobile-button.locked {
  background: #444;
  cursor: not-allowed;
  transform: none;
}

.mobile-button::after {
  content: attr(data-condition);
  display: block;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  color: var(--warning-color);
  font-size: 0.6rem;
  margin-top: 2px;
  white-space: nowrap;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-content {
  background: var(--background-light);
  padding: 20px;
  border-radius: 10px;
  min-width: 200px;
  max-width: 80%;
  text-align: center;
  border: 3px solid var(--accent-color);
  animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal h2 {
  margin-bottom: 15px;
  color: var(--accent-color);
  font-size: 1.2rem;
}

.modal p {
  margin-bottom: 20px;
  font-size: 0.9rem;
}