* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: sans-serif;
  color: #fff;
}
h1 { color: #f5a623; margin-bottom: 4px; font-size: 1.6rem; }
p.hint { color: #aaa; margin-bottom: 10px; font-size: 0.9rem; }
canvas {
  border: 3px solid #f5a623;
  border-radius: 6px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Player info bar */
#player-bar {
  color: #f5a623;
  font-size: 1rem;
  margin-bottom: 6px;
  min-height: 1.2em;
  display: flex;
  align-items: center;
  gap: 16px;
}
#switch-player-btn {
  background: rgba(245,166,35,0.15);
  border: 2px solid #f5a623;
  border-radius: 12px;
  padding: 2px 12px;
  font-size: 0.85rem;
  color: #f5a623;
  cursor: pointer;
  font-family: inherit;
}
#switch-player-btn:hover {
  background: rgba(245,166,35,0.35);
}
#points-display {
  background: rgba(245,166,35,0.15);
  border: 2px solid #f5a623;
  border-radius: 12px;
  padding: 2px 12px;
  font-weight: bold;
  font-size: 1rem;
  color: #FFD700;
  display: none;
}

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #16213e;
  border: 3px solid #f5a623;
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  max-width: 420px;
  width: 90%;
}
.modal h2 { color: #f5a623; margin-bottom: 16px; font-size: 1.5rem; }
.modal input {
  font-size: 1.1rem;
  padding: 10px 16px;
  border: 2px solid #f5a623;
  border-radius: 10px;
  background: #1a1a2e;
  color: #fff;
  width: 100%;
  margin-bottom: 14px;
  outline: none;
}
.modal input:focus { border-color: #fff; }
.avatar-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-bottom: 16px;
}
.avatar-grid span {
  font-size: 2rem; cursor: pointer;
  padding: 4px 6px; border-radius: 8px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.avatar-grid span.selected { border-color: #f5a623; }
.avatar-grid span:hover { border-color: #fff; }
.modal button {
  font-size: 1.1rem; padding: 10px 30px;
  background: #f5a623; color: #1a1a2e;
  border: none; border-radius: 10px;
  cursor: pointer; font-weight: bold;
}
.modal button:hover { background: #f7c56a; }
.modal .error { color: #e74c3c; font-size: 0.9rem; min-height: 1.3em; margin-bottom: 8px; }
.modal .player-list { margin-bottom: 14px; max-height: 120px; overflow-y: auto; }
.modal .player-list div {
  padding: 6px 12px; cursor: pointer; border-radius: 8px;
  transition: background 0.15s;
}
.modal .player-list div:hover { background: rgba(245,166,35,0.2); }
.modal hr { border: none; border-top: 1px solid #333; margin: 14px 0; }

/* Shortcuts bar */
#shortcuts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  max-width: 960px;
}
.shortcut-key {
  background: rgba(245,166,35,0.1);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.85rem;
  color: #ccc;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  user-select: none;
}
.shortcut-key:hover {
  background: rgba(245,166,35,0.25);
  border-color: #f5a623;
  color: #fff;
  transform: scale(1.05);
}
.shortcut-key:active, .shortcut-key.pressed {
  background: #f5a623;
  color: #1a1a2e;
  transform: scale(0.95);
}
.shortcut-key kbd {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: bold;
  color: #f5a623;
  margin-right: 4px;
}
.shortcut-key:active kbd, .shortcut-key.pressed kbd {
  color: #1a1a2e;
  background: rgba(0,0,0,0.15);
}

/* Shop overlay */
#shop-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
#shop-overlay.hidden { display: none; }
.shop-panel {
  background: #16213e;
  border: 3px solid #f5a623;
  border-radius: 16px;
  padding: 24px;
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}
.shop-panel h2 { color: #f5a623; margin-bottom: 8px; text-align: center; }
.shop-points {
  text-align: center;
  font-size: 1.1rem;
  color: #FFD700;
  font-weight: bold;
  margin-bottom: 12px;
}
.shop-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.shop-tabs button {
  padding: 6px 16px; border: 2px solid #f5a623; background: transparent;
  color: #f5a623; border-radius: 8px; cursor: pointer; font-size: 0.95rem;
}
.shop-tabs button.active { background: #f5a623; color: #1a1a2e; }
.shop-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.shop-item {
  background: rgba(255,255,255,0.05);
  border: 2px solid #333;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.shop-item.owned { border-color: #2ecc71; }
.shop-item-swatch {
  width: 36px; height: 36px;
  border-radius: 6px;
  margin: 0 auto 8px;
  border: 2px solid rgba(255,255,255,0.2);
}
.shop-item-name { font-size: 0.9rem; color: #fff; margin-bottom: 4px; }
.shop-item-price { font-size: 0.85rem; color: #FFD700; margin-bottom: 8px; }
.shop-item button {
  padding: 4px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: bold;
}
.shop-item button.buy-btn {
  background: #f5a623; color: #1a1a2e;
}
.shop-item button.buy-btn:disabled {
  background: #555; color: #888; cursor: not-allowed;
}
.shop-item button.equip-btn {
  background: #2ecc71; color: #fff;
}
.shop-item button.unequip-btn {
  background: #e74c3c; color: #fff;
}
.shop-equipped { margin-bottom: 12px; }
.shop-equipped h3 { color: #f5a623; font-size: 0.95rem; margin-bottom: 8px; text-align: center; }
#shop-equipped-list {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.equipped-tag {
  background: rgba(46,204,113,0.2);
  border: 1px solid #2ecc71;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: #2ecc71;
}
.shop-close {
  display: block; margin: 0 auto; padding: 8px 24px;
  background: #f5a623; color: #1a1a2e; border: none;
  border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 1rem;
}

/* Leaderboard overlay */
#leaderboard-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
#leaderboard-overlay.hidden { display: none; }
.lb-panel {
  background: #16213e;
  border: 3px solid #f5a623;
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.lb-panel h2 { color: #f5a623; margin-bottom: 12px; text-align: center; }
.lb-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.lb-tabs button {
  padding: 6px 16px; border: 2px solid #f5a623; background: transparent;
  color: #f5a623; border-radius: 8px; cursor: pointer; font-size: 0.95rem;
}
.lb-tabs button.active { background: #f5a623; color: #1a1a2e; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { color: #f5a623; padding: 6px 8px; text-align: left; border-bottom: 1px solid #333; }
.lb-table td { padding: 6px 8px; border-bottom: 1px solid #222; }
.lb-table tr:first-child td { color: #FFD700; }
.lb-close {
  display: block; margin: 16px auto 0; padding: 8px 24px;
  background: #f5a623; color: #1a1a2e; border: none;
  border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 1rem;
}
