/* Liero26 - Game Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a0a;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  width: 100%;
  min-height: 100vh;
}

.screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== MENU SCREEN ===== */
.menu-container {
  text-align: center;
  max-width: 600px;
  padding: 20px;
}

.game-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.game-logo h1 {
  font-size: 72px;
  font-weight: bold;
  color: #00ff00;
  text-shadow:
    0 0 10px #00ff00,
    0 0 20px #00ff00,
    0 0 40px #008800,
    2px 2px 0 #004400;
  letter-spacing: 8px;
  animation: glow 2s ease-in-out infinite alternate;
}

.logo-accent {
  color: #ff4444;
  text-shadow:
    0 0 10px #ff4444,
    0 0 20px #ff4444,
    0 0 40px #880000;
}

@keyframes glow {
  from { text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, 2px 2px 0 #004400; }
  to { text-shadow: 0 0 15px #00ff00, 0 0 30px #00ff00, 0 0 50px #008800, 2px 2px 0 #004400; }
}

.logo-worm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  animation: wormBounce 1s ease-in-out infinite alternate;
}

.logo-worm-1 {
  background: radial-gradient(circle, #00ff00, #008800);
  box-shadow: 0 0 10px #00ff00;
}

.logo-worm-2 {
  background: radial-gradient(circle, #ff4444, #880000);
  box-shadow: 0 0 10px #ff4444;
  animation-delay: 0.5s;
}

@keyframes wormBounce {
  from { transform: translateY(-5px); }
  to { transform: translateY(5px); }
}

.subtitle {
  font-size: 14px;
  color: #888;
  margin-bottom: 30px;
  letter-spacing: 2px;
}

.menu-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.menu-form label {
  font-size: 12px;
  color: #aaa;
  text-align: left;
}

.menu-form input {
  background: #1a1a2e;
  border: 2px solid #333;
  color: #00ff00;
  padding: 12px 16px;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  outline: none;
  transition: border-color 0.3s;
}

.menu-form input:focus {
  border-color: #00ff00;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

/* Buttons */
.btn {
  padding: 10px 20px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: #004400;
  border-color: #00ff00;
  color: #00ff00;
}

.btn-primary:hover {
  background: #006600;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.btn-secondary {
  background: #1a1a2e;
  border-color: #555;
  color: #aaa;
}

.btn-secondary:hover {
  background: #2a2a3e;
  border-color: #888;
  color: #fff;
}

.btn-large {
  padding: 14px 28px;
  font-size: 18px;
}

.btn-join {
  background: #442200;
  border-color: #ff8800;
  color: #ff8800;
  padding: 6px 16px;
  font-size: 12px;
}

.btn-join:hover {
  background: #663300;
  box-shadow: 0 0 10px rgba(255, 136, 0, 0.3);
}

/* Controls info */
.controls-info {
  text-align: left;
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #222;
}

.controls-info h3 {
  color: #FFD700;
  font-size: 12px;
  margin-bottom: 10px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 11px;
}

.control-item {
  color: #999;
}

kbd {
  background: #1a1a2e;
  border: 1px solid #444;
  padding: 1px 5px;
  font-size: 10px;
  color: #00ff00;
  border-radius: 2px;
}

.footer-info {
  font-size: 10px;
  color: #444;
  line-height: 1.6;
}

/* ===== LOBBY SCREEN ===== */
.lobby-container {
  max-width: 700px;
  width: 100%;
  padding: 20px;
}

.lobby-container h2 {
  color: #FFD700;
  margin-bottom: 20px;
  text-align: center;
}

.create-room-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.create-room-bar input,
.create-room-bar select {
  background: #1a1a2e;
  border: 2px solid #333;
  color: #e0e0e0;
  padding: 8px 12px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  outline: none;
  flex: 1;
}

.create-room-bar select {
  flex: 0.8;
}

.room-list {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #111;
  border: 1px solid #222;
  margin-bottom: 4px;
  transition: background 0.2s;
}

.room-item:hover {
  background: #1a1a1a;
  border-color: #333;
}

.room-item.loading {
  justify-content: center;
  color: #666;
}

.room-name {
  font-size: 16px;
  color: #00ff00;
  font-weight: bold;
}

.room-info {
  font-size: 12px;
  color: #888;
  flex: 1;
  text-align: center;
}

/* ===== WEAPON SELECT ===== */
.weapon-container {
  max-width: 900px;
  width: 100%;
  padding: 20px;
  max-height: 100vh;
  overflow-y: auto;
}

.weapon-container h2 {
  color: #FFD700;
  text-align: center;
  margin-bottom: 10px;
}

.weapon-instructions {
  text-align: center;
  color: #888;
  font-size: 12px;
  margin-bottom: 15px;
}

.selected-weapons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
  padding: 10px;
  background: #111;
  border: 2px solid #333;
}

.selected-weapons h3 {
  width: 100%;
  color: #FFD700;
  font-size: 12px;
  margin-bottom: 5px;
}

.selected-weapon-item {
  background: #1a1a2e;
  border: 1px solid #444;
  padding: 6px 12px;
  font-size: 12px;
  color: #00ff00;
  cursor: pointer;
  transition: all 0.2s;
}

.selected-weapon-item:hover {
  border-color: #00ff00;
}

.selected-weapon-item.active-slot {
  border-color: #FFD700;
  background: #2a2a00;
  color: #FFD700;
}

.slot-num {
  color: #888;
}

.weapon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin-bottom: 15px;
  max-height: 350px;
  overflow-y: auto;
  padding: 4px;
}

.weapon-item {
  background: #111;
  border: 1px solid #222;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.weapon-item:hover {
  background: #1a1a2e;
  border-color: #555;
}

.weapon-item.weapon-selected {
  border-color: #00ff00;
  background: #001a00;
}

.weapon-name {
  font-size: 11px;
  color: #e0e0e0;
  font-weight: bold;
  margin-bottom: 4px;
}

.weapon-stats {
  display: flex;
  gap: 6px;
  font-size: 9px;
  color: #666;
}

.weapon-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ===== GAME SCREEN ===== */
#game-screen {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: none;
  display: block;
}

/* Chat overlay */
.chat-container {
  position: absolute;
  bottom: 40px;
  left: 10px;
  max-width: 350px;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px;
  font-size: 12px;
  pointer-events: none;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
}

.chat-system {
  color: #888;
  font-style: italic;
  margin: 2px 0;
}

.chat-player {
  color: #e0e0e0;
  margin: 2px 0;
}

.chat-name {
  color: #FFD700;
  font-weight: bold;
}

.chat-input-line {
  color: #00ff00;
  margin-top: 4px;
  border-top: 1px solid #333;
  padding-top: 4px;
}

.cursor {
  animation: blink 0.5s infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ===== TOUCH CONTROLS ===== */
.touch-controls {
  /* Fixed to viewport so overflow:hidden on #game-screen can't clip it */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Respect iPhone home-indicator safe area */
  padding: 8px 16px max(12px, env(safe-area-inset-bottom)) 16px;
  display: none; /* shown via JS on touch devices */
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 100;
}

.touch-dpad,
.touch-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: all;
}

.dpad-row {
  display: flex;
  gap: 3px;
  align-items: center;
}

.dpad-gap {
  width: 40px;
  height: 40px;
}

.touch-row {
  display: flex;
  gap: 6px;
}

.touch-btn {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s;
}

.touch-btn:active {
  background: rgba(0, 200, 0, 0.45);
  border-color: #00ff00;
}

.btn-fire   { border-color: rgba(255, 80,  80,  0.6); color: #ff5050; }
.btn-jump   { border-color: rgba(80,  200, 255, 0.6); color: #50c8ff; }
.btn-change { border-color: rgba(255, 215, 0,   0.6); color: #ffd700; }
.btn-dig    { border-color: rgba(180, 120, 60,  0.6); color: #b4783c; }

/* Smaller buttons on very small screens (< 360px wide) */
@media (max-width: 359px) {
  .touch-btn { width: 40px; height: 40px; font-size: 11px; }
  .dpad-gap  { width: 34px; height: 34px; }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 600px) {
  .screen {
    align-items: flex-start;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }

  .menu-container {
    padding: 20px 16px;
  }

  .game-logo h1 {
    font-size: 48px;
    letter-spacing: 4px;
  }

  .logo-worm {
    width: 22px;
    height: 22px;
  }

  .subtitle {
    font-size: 11px;
    margin-bottom: 20px;
  }

  .btn-large {
    padding: 14px 20px;
    font-size: 16px;
  }

  .controls-info {
    display: none;
  }

  /* Lobby */
  .create-room-bar {
    flex-direction: column;
  }

  .create-room-bar select {
    flex: 1;
  }

  /* Weapon screen */
  .weapon-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    max-height: none;
  }

  .weapon-actions {
    flex-direction: column;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #111;
}

::-webkit-scrollbar-thumb {
  background: #333;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Ping display */
.ping-display {
  position: fixed;
  bottom: 32px;
  right: 8px;
  font-family: monospace;
  font-size: 11px;
  color: #44ff44;
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 100;
  pointer-events: none;
}

/* Character select */
.character-container {
  max-width: 700px;
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
  overflow-y: auto;
  max-height: 340px;
}

.character-item {
  background: #1a1a2e;
  border: 2px solid #333;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}

.character-item:hover {
  border-color: #4CAF50;
  background: #1f2f1f;
}

.character-selected {
  border-color: #FFD700;
  background: #2a2a10;
}

.character-thumb {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  object-fit: contain;
}

.character-name {
  font-family: monospace;
  font-size: 11px;
  color: #ccc;
  text-align: center;
}

/* Room password input */
#room-password-input {
  padding: 8px 12px;
  background: #1a1a2e;
  border: 1px solid #333;
  color: #fff;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}
