/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base */
html, body {
  width: 100%;
  height: 100%;
  background: #1a1a1a;
  color: #fff;
  font-family: monospace;
  overflow: hidden;
  user-select: none;
}

/* App container */
#app {
  position: relative;
  width: 800px;
  height: 600px;
  margin: 0 auto;
  margin-top: calc((100vh - 600px) / 2);
}

/* Canvas */
#gameCanvas {
  display: block;
  width: 800px;
  height: 600px;
  background: #1a1a1a;
  cursor: crosshair;
}

/* UI overlay — sits on top of canvas */
#ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 800px;
  height: 600px;
  pointer-events: none;
}

#ui > * {
  pointer-events: auto;
}

/* Connection indicator */
.conn-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  z-index: 100;
  transition: background-color 0.3s;
}

.conn-indicator.connected {
  background: #44ff44;
  box-shadow: 0 0 6px #44ff44;
}

.conn-indicator.disconnected {
  background: #ff4444;
  box-shadow: 0 0 6px #ff4444;
}

/* ======== SCREENS ======== */

/* Lobby screen */
.screen-lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
  background: #1a1a1a;
}

.screen-lobby h1 {
  font-size: 48px;
  letter-spacing: 4px;
  color: #fff;
  text-transform: uppercase;
}

.screen-lobby .subtitle {
  font-size: 14px;
  color: #888;
}

.screen-lobby input[type="text"] {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #fff;
  font-family: monospace;
  font-size: 18px;
  padding: 10px 16px;
  outline: none;
  width: 260px;
  text-align: center;
}

.screen-lobby input[type="text"]:focus {
  border-color: #888;
}

.color-picker {
  display: flex;
  gap: 12px;
}

.color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.color-btn:hover {
  transform: scale(1.15);
}

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

.btn-enter {
  background: #fff;
  color: #1a1a1a;
  border: none;
  font-family: monospace;
  font-size: 18px;
  font-weight: bold;
  padding: 12px 40px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: opacity 0.2s;
}

.btn-enter:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-enter:not(:disabled):hover {
  background: #ddd;
}

.online-count {
  font-size: 13px;
  color: #666;
}

.error-msg {
  color: #ff4444;
  font-size: 14px;
  min-height: 20px;
}

/* Waiting room */
.screen-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
  background: #1a1a1a;
}

.screen-waiting h2 {
  font-size: 28px;
  letter-spacing: 3px;
  color: #fff;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
}

.player-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
}

.player-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  flex-shrink: 0;
}

.player-name {
  flex: 1;
}

.player-ready-mark {
  color: #44ff44;
  font-size: 18px;
}

.ready-count {
  font-size: 14px;
  color: #888;
}

.btn-ready {
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
  font-family: monospace;
  font-size: 18px;
  font-weight: bold;
  padding: 12px 40px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background 0.2s, color 0.2s;
}

.btn-ready:hover {
  background: #fff;
  color: #1a1a1a;
}

.btn-ready:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.countdown-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 30px rgba(255,255,255,0.5);
  pointer-events: none;
}

/* HUD (in-game) */
.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 14px;
  color: #fff;
  pointer-events: none;
}

/* Death overlay */
.overlay-death {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.overlay-death .death-title {
  font-size: 56px;
  color: #ff4444;
  letter-spacing: 4px;
  font-weight: bold;
}

.overlay-death .death-killer {
  font-size: 20px;
  color: #ccc;
}

.overlay-death .death-watching {
  font-size: 14px;
  color: #666;
  margin-top: 8px;
}

/* Victory overlay */
.overlay-victory {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.overlay-victory .victory-title {
  font-size: 56px;
  letter-spacing: 4px;
  font-weight: bold;
}

.victory-title.winner {
  color: #ffd700;
}

.victory-title.loser {
  color: #fff;
}

.score-table {
  border-collapse: collapse;
  min-width: 240px;
  font-size: 16px;
}

.score-table th {
  color: #888;
  padding: 4px 16px;
  text-align: left;
  border-bottom: 1px solid #333;
}

.score-table td {
  padding: 6px 16px;
  color: #fff;
}

.score-table tr:first-child td {
  color: #ffd700;
}

.next-round {
  font-size: 14px;
  color: #666;
  margin-top: 8px;
}

/* Reconnect overlay */
.overlay-reconnect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
}

.overlay-reconnect p {
  font-size: 20px;
  color: #fff;
}

.overlay-reconnect .reconnect-sub {
  font-size: 14px;
  color: #888;
}

/* Mute button */
#mute-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: transparent;
  border: 1px solid #444;
  color: #888;
  font-family: monospace;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  z-index: 100;
}

#mute-btn:hover {
  border-color: #888;
  color: #fff;
}

/* Kill Feed */
#kill-feed {
  position: absolute;
  top: 10px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
  pointer-events: none;
}

.kill-feed-entry {
  background: rgba(0, 0, 0, 0.7);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  animation: killFeedIn 0.3s ease-out;
}

.kill-feed-entry.fade-out {
  opacity: 0;
  transition: opacity 0.5s;
}

@keyframes killFeedIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
