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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0d0d14;
  color: #eee;
  min-height: 100vh;
  overflow: hidden;
}

.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
}

.screen.hidden { display: none; }

.panel {
  background: #16162a;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 420px;
  width: 90%;
}

h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, #4af, #f4a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle { color: #888; margin: 8px 0 24px; }

input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  background: #0d0d14;
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 16px;
  outline: none;
}

input[type="text"]:focus { border-color: #4af; }

.skins {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.skin-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.skin-btn:hover { transform: scale(1.1); }
.skin-btn.selected { border-color: #fff; }

.btn {
  padding: 12px 32px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin: 6px;
  background: #2a2a4a;
  color: #eee;
  transition: background 0.2s;
}

.btn:hover { background: #3a3a5a; }
.btn.primary { background: linear-gradient(135deg, #48f, #a4f); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }

.error { color: #f55; margin-top: 10px; min-height: 20px; }

.leaderboard-preview {
  margin-top: 28px;
  text-align: left;
}

.leaderboard-preview h3 { font-size: 0.9rem; color: #888; margin-bottom: 8px; }

.leaderboard-preview ul { list-style: none; }

.leaderboard-preview li {
  padding: 6px 0;
  border-bottom: 1px solid #1a1a2e;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
}

/* Game screen */
#game-screen {
  flex-direction: column;
  padding: 16px;
  position: relative;
}

#game-canvas {
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  background: #1a1a2e;
  cursor: crosshair;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  width: 900px;
  max-width: 100%;
  margin-bottom: 8px;
}

.hud-timer {
  font-size: 1.8rem;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  color: #fa0;
}

.hud-weapon {
  font-size: 1rem;
  padding: 6px 14px;
  background: #16162a;
  border-radius: 8px;
  border: 1px solid #2a2a4a;
  min-width: 180px;
  text-align: right;
}

.hud-bottom {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 900px;
  max-width: 100%;
  margin-top: 8px;
}

.weapon-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  padding: 8px 14px;
  background: #16162a;
  border: 2px solid #2a2a4a;
  border-radius: 10px;
}

.weapon-icon {
  width: 40px;
  height: 40px;
  background: #0d0d14;
  border-radius: 8px;
  border: 1px solid #2a2a4a;
  image-rendering: pixelated;
}

.score-weapon-icon {
  display: inline-block;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  image-rendering: pixelated;
}

.weapon-label {
  font-size: 0.65rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.weapon-name {
  font-size: 0.95rem;
  font-weight: bold;
  white-space: nowrap;
}

.hud-bottom {
  flex: 1;
  height: 24px;
  background: #1a1a2e;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid #2a2a4a;
}

.hp-bar {
  height: 100%;
  background: linear-gradient(90deg, #4c4, #8f8);
  width: 100%;
  transition: width 0.2s;
}

#hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  text-shadow: 0 0 4px #000;
}

.hud-kills { font-size: 1.1rem; white-space: nowrap; }

.leaderboard-panel {
  position: absolute;
  top: 60px;
  right: 16px;
  width: 260px;
  background: rgba(13, 13, 20, 0.85);
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 12px;
  backdrop-filter: blur(4px);
}

.leaderboard-panel h3 {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.leaderboard-panel ol {
  list-style: none;
  counter-reset: rank;
}

.leaderboard-panel li {
  counter-increment: rank;
  padding: 4px 0;
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #1a1a2e;
}

.score-player {
  flex-shrink: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-right {
  text-align: right;
  font-size: 0.68rem;
  line-height: 1.2;
}

.score-weapon-name {
  display: block;
  opacity: 0.85;
}

.score-right b {
  font-size: 0.82rem;
}

.leaderboard-panel li::before {
  content: counter(rank) ".";
  color: #666;
  margin-right: 6px;
}

.leaderboard-panel li.me {
  color: #4af;
  font-weight: bold;
}

.leaderboard-panel li.dead { opacity: 0.4; }

#controls-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: #555;
}

#result-screen .panel { max-width: 500px; }
#result-screen h2 { margin-bottom: 12px; }
#result-winner { font-size: 1.2rem; color: #fa0; margin-bottom: 20px; }

#result-list {
  list-style: none;
  text-align: left;
  margin-bottom: 20px;
}

#result-list li {
  padding: 8px 0;
  border-bottom: 1px solid #2a2a4a;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 940px) {
  #game-canvas { width: 100%; height: auto; }
  .hud-top, .hud-bottom { width: 100%; }
  .leaderboard-panel {
    position: static;
    width: 100%;
    margin-top: 8px;
  }
}
