/* Retro PS1 Deathmatch Style CSS */

/* Load retro pixel font */
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  font-family: 'VT323', monospace;
  image-rendering: pixelated;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0c10;
  color: #c5c6c7;
}

/* --- Container for retro scaling --- */
#viewport-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#game-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* --- CRT Scanlines and curvature simulation --- */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
}

.crt-overlay::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: radial-gradient(
    circle, 
    transparent 60%, 
    rgba(0, 0, 0, 0.45) 120%
  );
  z-index: 11;
}

/* --- Screen Flash on taking damage --- */
#damage-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(139, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 9;
  transition: opacity 0.05s ease-out;
}

/* --- HUD Panel (Doom / Quake style) --- */
#hud-container {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  height: 90px;
  background: #121212;
  border-top: 4px solid #444444;
  border-left: 4px solid #444444;
  border-right: 4px solid #444444;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.8);
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  align-items: center;
  z-index: 5;
  padding: 4px;
  font-size: 2.2rem;
}

.hud-panel {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  padding: 0 10px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.hud-label {
  font-size: 1.1rem;
  color: #888888;
  letter-spacing: 2px;
}

.hud-value {
  font-size: 3.5rem;
  font-weight: bold;
  text-shadow: 2px 2px 0px #000;
  letter-spacing: 1px;
}

/* Center Avatar Face */
#hud-face {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#hud-face-canvas {
  width: 76px;
  height: 76px;
  border: 3px solid #333333;
}

/* Hotbar slots overlay */
#hotbar-overlay {
  position: absolute;
  bottom: 95px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}

.hotbar-slot {
  background: rgba(18, 18, 18, 0.85);
  border: 2px solid #555555;
  padding: 4px 8px;
  font-size: 1.2rem;
  color: #888888;
  display: flex;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.hotbar-slot.active {
  border-color: #00ffff;
  color: #ffffff;
  background: rgba(0, 50, 50, 0.85);
}

.hotbar-slot.disabled {
  opacity: 0.25;
}

/* --- Crosshair --- */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 5;
}

#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: rgba(0, 255, 255, 0.7);
}

/* Horizontal line */
#crosshair::before {
  top: 7px;
  left: 0;
  width: 16px;
  height: 2px;
}

/* Vertical line */
#crosshair::after {
  top: 0;
  left: 7px;
  width: 2px;
  height: 16px;
}

#hitmarker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.05s ease-out;
}

#hitmarker::before, #hitmarker::after {
  content: '';
  position: absolute;
  background: #ff3333;
}

#hitmarker::before {
  top: 9px;
  left: 0;
  width: 20px;
  height: 2px;
}

#hitmarker::after {
  top: 0;
  left: 9px;
  width: 2px;
  height: 20px;
}

/* --- Lobby / Login Screen --- */
#lobby-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.logo-container {
  margin-bottom: 30px;
  text-align: center;
}

.logo-main {
  font-size: 5rem;
  font-weight: bold;
  color: #ff3333;
  text-shadow: 4px 4px 0px #330000, 0 0 20px rgba(255,51,51,0.5);
  letter-spacing: 4px;
  animation: logo-glow 2s infinite alternate;
}

.logo-sub {
  font-size: 1.8rem;
  color: #00ffff;
  letter-spacing: 6px;
}

.lobby-box {
  background: #1b1c22;
  border: 4px solid #444;
  padding: 30px;
  width: 380px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-label {
  font-size: 1.4rem;
  color: #888888;
}

.lobby-input {
  background: #0b0c10;
  border: 2px solid #555;
  color: #fff;
  padding: 8px 12px;
  font-size: 1.5rem;
  outline: none;
}

.lobby-input:focus {
  border-color: #00ffff;
}

.lobby-btn {
  background: #ff3333;
  color: #fff;
  border: none;
  font-size: 1.8rem;
  font-weight: bold;
  padding: 10px;
  cursor: pointer;
  box-shadow: 0 4px 0 #990000;
  outline: none;
}

.lobby-btn:hover {
  background: #ff5555;
}

.lobby-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #990000;
}

.controls-guide {
  font-size: 1.1rem;
  color: #666;
  border-top: 1px solid #333;
  padding-top: 15px;
}

.controls-guide span {
  color: #00ffff;
}

/* --- Scoreboard Overlay --- */
#scoreboard-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 15;
}

.scoreboard-box {
  background: #121212;
  border: 4px solid #555555;
  padding: 20px;
  width: 500px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.9);
}

.scoreboard-title {
  font-size: 2.2rem;
  text-align: center;
  color: #ff3333;
  border-bottom: 2px solid #333;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.scoreboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.6rem;
}

.scoreboard-table th {
  text-align: left;
  border-bottom: 2px solid #555;
  color: #00ffff;
  padding: 6px;
}

.scoreboard-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #222;
}

.scoreboard-table tr.self {
  background: rgba(0, 255, 255, 0.1);
  color: #00ffff;
}

/* --- Killfeed (Top Right) --- */
#killfeed {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  pointer-events: none;
  z-index: 5;
}

.killfeed-item {
  background: rgba(0, 0, 0, 0.7);
  border-left: 4px solid #ff3333;
  padding: 4px 12px;
  font-size: 1.4rem;
  color: #ffffff;
  animation: feed-slide-in 0.2s ease-out;
  transition: opacity 0.5s;
}

/* --- Chat System (Bottom Left) --- */
#chat-container {
  position: absolute;
  bottom: 110px;
  left: 20px;
  width: 320px;
  height: 220px;
  display: flex;
  flex-direction: column;
  z-index: 5;
  pointer-events: auto;
}

#chat-list {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(0,0,0,0.4);
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

#chat-list::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.chat-message {
  font-size: 1.3rem;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  line-height: 1.2;
  word-wrap: break-word;
}

.chat-sender {
  color: #00ffff;
}

#chat-input {
  background: rgba(18, 18, 18, 0.9);
  border: 2px solid #444;
  color: #fff;
  font-size: 1.3rem;
  padding: 6px 10px;
  outline: none;
}

#chat-input:focus {
  border-color: #ff3333;
}

/* --- Key Animations --- */
@keyframes logo-glow {
  from {
    text-shadow: 4px 4px 0px #330000, 0 0 10px rgba(255,51,51,0.3);
  }
  to {
    text-shadow: 4px 4px 0px #330000, 0 0 30px rgba(255,51,51,0.8);
  }
}

@keyframes feed-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* --- Arena Records & Rampage Styling --- */
.arena-records {
  text-align: center;
  font-size: 1.3rem;
  color: #888888;
  margin-top: -10px;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.lobby-records {
  border: 2px dashed #444;
  padding: 10px;
  margin-top: 5px;
  background: rgba(0, 0, 0, 0.3);
  text-align: center;
}

.lobby-records .records-title {
  font-size: 1.3rem;
  color: #00ffff;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.lobby-records .record-row {
  font-size: 1.2rem;
  color: #c5c6c7;
  margin: 3px 0;
}

#spree-announcer {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-size: 2.8rem;
  font-weight: bold;
  color: #ffaa00;
  text-shadow: 2px 2px 0px #000, -2px -2px 0px #000, 2px -2px 0px #000, -2px 2px 0px #000;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.15s;
  z-index: 12;
  letter-spacing: 2px;
}

#spree-announcer.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

/* --- HUD Records Overlay --- */
#records-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(18, 18, 24, 0.7);
  border-left: 4px solid #00ffff;
  padding: 8px 12px;
  font-size: 1.3rem;
  color: #c5c6c7;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  min-width: 220px;
}

.overlay-records-title {
  font-size: 1.4rem;
  color: #00ffff;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 4px;
  border-bottom: 1px dashed #444;
  padding-bottom: 2px;
}

.overlay-record-row {
  margin: 2px 0;
  text-shadow: 1px 1px 0 #000;
}
