* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Arial', sans-serif;
  background: #1a1a2e;
  color: #fff;
  overflow: hidden;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

#game-canvas {
  display: block;
  background: #0f1419;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  touch-action: none;
  cursor: crosshair;
}

#game-canvas:active {
  cursor: grabbing;
}

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

#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: all;
}

#level-info {
  font-size: 18px;
  font-weight: bold;
  color: #ffd700;
}

#health-bar {
  flex: 1;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  margin: 0 15px;
  overflow: hidden;
  border: 2px solid #fff;
}

#health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4444 0%, #ff6b6b 100%);
  transition: width 0.3s ease;
}

#coins {
  font-size: 18px;
  font-weight: bold;
  color: #ffd700;
}

#weapon-info {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  padding: 15px;
  border-radius: 10px;
  pointer-events: all;
}

#melee-weapon, #ranged-weapon {
  font-size: 18px;
  font-weight: bold;
  margin: 5px 0;
  color: #fff;
}

#melee-damage {
  color: #4ade80;
}

#weapon-icon {
  margin-right: 5px;
}

#ammo-count {
  color: #fbbf24;
}

#game-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#game-message.show {
  opacity: 1;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

.screen h1 {
  font-size: 48px;
  margin-bottom: 40px;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
  color: #ffd700;
}

.screen h2 {
  font-size: 36px;
  margin-bottom: 30px;
  color: #ffd700;
}

.menu-btn {
  padding: 15px 40px;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.menu-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.menu-btn:active {
  transform: translateY(0);
}

#instructions {
  margin-top: 40px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 10px;
  max-width: 400px;
}

#instructions h3 {
  margin-bottom: 15px;
  color: #ffd700;
}

#instructions p {
  margin: 10px 0;
  font-size: 16px;
}

#character-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  max-width: 600px;
  width: 100%;
  margin-bottom: 30px;
}

.character-card {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.character-card:hover {
  transform: translateY(-5px);
  border-color: #667eea;
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.character-card.selected {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.2);
}

.character-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.character-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.character-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.character-stats {
  font-size: 14px;
  color: #aaa;
}

.character-cost {
  color: #ffd700;
  font-weight: bold;
  margin-top: 10px;
}

#inventory-stats {
  font-size: 20px;
  margin-bottom: 30px;
  text-align: center;
}

#inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  max-width: 800px;
  width: 100%;
  margin-bottom: 30px;
  max-height: 400px;
  overflow-y: auto;
}

.inventory-item {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
}

.inventory-item-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.inventory-item-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
}

.inventory-item-value {
  color: #ffd700;
  font-size: 14px;
  margin-bottom: 10px;
}

.sell-btn {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.sell-btn:hover {
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .screen h1 {
    font-size: 36px;
  }
  
  .screen h2 {
    font-size: 28px;
  }
  
  .menu-btn {
    padding: 12px 30px;
    font-size: 18px;
  }
  
  #character-list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  #inventory-list {
    grid-template-columns: 1fr;
  }
}
