body {
  margin: 0;
  background: black;
  font-family: Arial, sans-serif;
}
 
canvas {
  border: 2px solid #444;
  display: block;
  margin: 0 auto;
}
 
/* ── Chat ─────────────────────────────────────────────────────────────────── */
#chatContainer {
  position: fixed;
  bottom: 10px;
  right: 10px;
  width: 300px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #444;
  padding: 5px;
  color: white;
  font-family: monospace;
  font-size: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
 
#chat {
  max-height: 150px;
  overflow-y: auto;
}
 
/* Input row: all three controls on one line */
#chat-input-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  width: 100%;
}
 
#chatInput {
  flex: 1 1 0;
  min-width: 0;
  padding: 4px;
  box-sizing: border-box;
}
 
#sendBtn {
  flex-shrink: 0;
  padding: 4px 8px;
  cursor: pointer;
}
 
/* The emoji label injected by chat.js sits in the same row */
#chatContainer label[for="chatImageInput"] {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
}
 
/* ── Menu ─────────────────────────────────────────────────────────────────── */
.menu {
  position: absolute;
  top: 80px;
  background-image: linear-gradient(to right, black, lightslategray);
  border: 1px solid #ccc;
  padding: 10px;
  z-index: 500;
}
 
.menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
 
.menu li {
  margin: 10px 0;
}
 
.menu a {
  text-decoration: none;
  color: white;
  font-weight: bold;
  font-size: 28px;
}
 
.hidden {
  display: none;
}
 
.menu li a:hover {
  color:lightslategray;
  background-color: white;
}
 
.menu li a:hover::before {
  content: "<> ";
}
 
.menu li a:hover::after {
  content: " <>";
}
 
.bars {
  height: 5px;
  width: 40px;
  background: black;
  transition: 2s;
}
 
#menu-button {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, 20px);
  grid-template-rows: repeat(4, 4px);
  gap: 10px 10px;
  margin: 20px;
}
 
.title {
  background-color: lightslategray;
  padding: 5px;
  margin: 0;
  font-family: Verdana;
  font-weight: bold;
}
 
.title h1 {
  text-align: center;
  font-size: 45px;
  margin: 10px 0;
}
 
/* ── Sprite menu ──────────────────────────────────────────────────────────── */
.sprite-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #ccc;
  padding: 20px;
  z-index: 2000;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  color: white;
  border-radius: 10px;
}
 
.sprite-menu h2 {
  text-align: center;
  color: lightslategray;
  margin-top: 0;
}
 
#spriteGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
  margin: 15px 0;
}
 
.sprite-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
 
.sprite-name {
  font-size: 11px;
  text-align: center;
  margin: 4px 0 0;
  color: #ccc;
}
 
.sprite-option {
  width: 80px;
  height: 80px;
  border: 2px solid gray;
  padding: 5px;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 5px;
  object-fit: contain;
}
 
.sprite-option:hover {
  border-color: lightslategray;
  transform: scale(1.1);
}
 
.sprite-option.selected {
  border-color: lightslategray;
  box-shadow: 0 0 10px lightslategray;
  background-color: rgba(119, 136, 153, 0.3);
}
 
.sprite-menu label {
  display: block;
  margin: 10px 0 5px 0;
  color: lightslategray;
}
 
#customSprite {
  margin-bottom: 15px;
}
 
#confirmSprite {
  width: 100%;
  padding: 10px;
  background-color: lightslategray;
  color: black;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
}
 
#confirmSprite:hover {
  background-color: #8ca3b0;
}
 
/* ── Overlays (shared) ────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.overlay.hidden {
  display: none;
}
 
.overlay-window {
  width: min(560px, 90vw);
  background: rgba(28, 28, 28, 0.95);
  border: 1px solid #888;
  border-radius: 10px;
  color: #fff;
  padding: 18px 20px;
  position: relative;
}
 
.overlay-window h2 {
  margin-top: 0;
  color: lightslategray;
}
 
.overlay-subtitle {
  font-size: 13px;
  color: #aaa;
  margin: -8px 0 16px;
}
 
.overlay-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}
 
.field-group {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
 
.confirm-button {
  margin-top: 16px;
  border: 1px solid #bfbfbf;
  background: #2e2e2e;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
.leaderboard-window {
  max-width: 400px;
}

.leaderboard-content {
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-entry.rank-1 {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.3);
}

.leaderboard-entry.rank-2 {
  background: rgba(192, 192, 192, 0.1);
  border-color: rgba(192, 192, 192, 0.3);
}

.leaderboard-entry.rank-3 {
  background: rgba(205, 127, 50, 0.1);
  border-color: rgba(205, 127, 50, 0.3);
}

.leaderboard-name {
  font-weight: bold;
  flex: 1;
}

.leaderboard-stats {
  display: flex;
  gap: 12px;
  font-size: 14px;
}

.leaderboard-kills {
  color: #ff6b6b;
}

.leaderboard-deaths {
  color: #74b9ff;
}
 
.confirm-button:hover {
  background: #444;
}

/* -- Keybinds toggle styling ------------------------------------------------ */

/* Keybind rows — mirrors toggle-row styling */
.kb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.kb-row:last-child {
  border-bottom: none;
}
.kb-label {
  font-size: 15px;
  color: #ddd;
}

/* Keybind button */
.kb-bind-btn {
  font-size: 12px;
  font-weight: 500;
  color: #ddd;
  background: #333;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 12px;
  min-width: 88px;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
  color:lightslategray;
  font-weight:bold;
  transition: background 0.15s, border-color 0.15s;
}
.kb-bind-btn:hover {
  background: #444;
  border-color: rgba(255, 255, 255, 0.22);
}
.kb-bind-btn.listening {
  background: rgba(119, 136, 153, 0.18);
  border-color: lightslategray;
  color: lightslategray;
  animation: kb-pulse 0.8s infinite alternate;
}
@keyframes kb-pulse {
  from { opacity: 1; }
  to   { opacity: 0.5; }
}

/* Reset button */
.kb-reset-btn {
  margin-top: 1.1rem;
  width: 100%;
  padding: 9px;
  font-size: 14px;
  color: #999;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.kb-reset-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
  border-color: rgba(255, 255, 255, 0.15);
}

.kb-save-btn {
  margin-top: 1.1rem;
  width: 100%;
  padding: 9px;
  font-size: 14px;
  color: white;
  font-weight:bold;
  background-color: lightslategray;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.kb-save-btn:hover {
  background: white;
  color: lightslategray;
  border-color: lightslategray;
}

/* ── Gun menu ─────────────────────────────────────────────────────────────── */
.gun-menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin: 4px 0 6px;
}

.gun-label {
  font-size: 20px;
  color: #ddd;
}

.gun-btn {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #2a2a2a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ddd;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  padding: 8px;
  text-align: center;
  word-break: break-word;
}

.gun-btn:hover {
  background: #383838;
  border-color: rgba(255, 255, 255, 0.25);
}

.gun-btn.selected {
  background: rgba(119, 136, 153, 0.2);
  border-color: lightslategray;
  color: lightslategray;
}

.gun-btn img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  pointer-events: none;
}

.reset-gun-button {
  margin-top: 1.1rem;
  width: 100%;
  padding: 9px;
  font-size: 14px;
  color: #999;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.reset-gun-button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
  border-color: rgba(255, 255, 255, 0.15);
}

.confirm-gun-button {
  margin-top: 0.5rem;
  width: 100%;
  padding: 9px;
  font-size: 14px;
  color: white;
  font-weight: bold;
  background-color: lightslategray;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.confirm-gun-button:hover {
  background: white;
  color: lightslategray;
  border-color: lightslategray;
}
 
/* ── Settings toggle rows ─────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
 
.toggle-row:last-child {
  border-bottom: none;
}
 
.toggle-label {
  font-size: 15px;
  color: #ddd;
}
 
/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
 
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
 
.toggle-thumb {
  position: absolute;
  inset: 0;
  background: #555;
  border-radius: 24px;
  transition: background 0.2s;
}
 
.toggle-thumb::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
 
.toggle-switch input:checked + .toggle-thumb {
  background: lightslategray;
}
 
.toggle-switch input:checked + .toggle-thumb::after {
  transform: translateX(20px);
}
