/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cs-orange: #e8870a;
  --cs-orange2: #ff9f1c;
  --cs-dark: #0a0c0f;
  --cs-panel: rgba(8,10,14,0.92);
  --cs-border: rgba(232,135,10,0.35);
  --cs-red: #e03030;
  --cs-green: #2ecc71;
  --cs-text: #d4cfc8;
  --hp-green: #27ae60;
  --hp-yellow: #f39c12;
  --hp-red: #e74c3c;
}

body {
  background: var(--cs-dark);
  font-family: 'Courier New', monospace;
  color: var(--cs-text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

canvas#gameCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ===== LOBBY ===== */
#lobby {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.lobby-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(232,135,10,0.06) 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(232,135,10,0.04) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(232,135,10,0.04) 40px),
    #070910;
  animation: bgPulse 6s ease-in-out infinite alternate;
}
@keyframes bgPulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.08); }
}

.lobby-card {
  position: relative;
  background: var(--cs-panel);
  border: 1px solid var(--cs-border);
  border-radius: 4px;
  padding: 40px 44px 36px;
  width: min(460px, 94vw);
  box-shadow: 0 0 60px rgba(232,135,10,0.08), 0 0 0 1px rgba(232,135,10,0.12) inset;
}

.logo-wrap {
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.logo-cs {
  font-size: 3.4rem;
  font-weight: 900;
  color: var(--cs-orange);
  text-shadow: 0 0 30px rgba(232,135,10,0.6);
}
.logo-3d {
  font-size: 3.4rem;
  font-weight: 900;
  color: #fff;
  margin-left: 4px;
}

.tagline {
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: rgba(212,207,200,0.45);
  margin-bottom: 32px;
  text-transform: uppercase;
}

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  color: var(--cs-orange);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(232,135,10,0.25);
  border-radius: 3px;
  padding: 10px 14px;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus {
  border-color: var(--cs-orange);
  box-shadow: 0 0 12px rgba(232,135,10,0.18);
}
.form-group input::placeholder { color: rgba(255,255,255,0.2); }

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  padding: 12px 20px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--cs-orange);
  color: #000;
  box-shadow: 0 0 20px rgba(232,135,10,0.3);
}
.btn-primary:hover { box-shadow: 0 0 30px rgba(232,135,10,0.5); }

.btn-secondary {
  background: transparent;
  color: var(--cs-orange);
  border: 1px solid var(--cs-orange);
}
.btn-secondary:hover { background: rgba(232,135,10,0.08); }

.btn-danger {
  background: var(--cs-red);
  color: #fff;
  width: 100%;
  margin-top: 14px;
  font-size: 0.85rem;
  box-shadow: 0 0 20px rgba(224,48,48,0.3);
}
.btn-danger:hover { box-shadow: 0 0 30px rgba(224,48,48,0.5); }

.lobby-status {
  margin-top: 14px;
  font-size: 0.78rem;
  color: rgba(212,207,200,0.6);
  min-height: 20px;
  letter-spacing: 0.05em;
  text-align: center;
}
.lobby-status.ok  { color: var(--cs-green); }
.lobby-status.err { color: var(--cs-red); }

.player-list {
  margin-top: 16px;
  border: 1px solid var(--cs-border);
  border-radius: 3px;
  padding: 10px 14px;
}
.player-list h4 {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--cs-orange);
  margin-bottom: 8px;
}
.player-item {
  font-size: 0.82rem;
  padding: 3px 0;
  color: #ddd;
}
.player-item::before { content: '▸ '; color: var(--cs-orange); }

/* ===== HUD ===== */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 0 6px rgba(0,0,0,0.8);
  pointer-events: none;
  font-family: monospace;
  line-height: 1;
}

#hud-top {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 40px;
  align-items: center;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 8px 24px;
}
#score-self, #score-enemy {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}
#score-self { color: var(--cs-green); }
#score-enemy { color: var(--cs-red); }
.score-label { font-size: 0.6rem; color: rgba(255,255,255,0.4); letter-spacing: 0.1em; }

#timer {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cs-orange);
  min-width: 60px;
  text-align: center;
}

#hud-bottom {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 30px;
  align-items: center;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 10px 24px;
}

#health-wrap, #ammo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hud-icon { font-size: 1rem; }

#healthBar {
  width: 120px; height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
#healthFill {
  height: 100%;
  width: 100%;
  background: var(--hp-green);
  border-radius: 4px;
  transition: width 0.3s, background 0.3s;
}
#healthNum {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  min-width: 28px;
}

#ammoCount {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cs-orange);
}
.ammo-sep { color: rgba(255,255,255,0.3); margin: 0 2px; }
#ammoReserve { font-size: 0.85rem; color: rgba(255,255,255,0.5); }

#hit-marker {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  color: #ff4444;
  text-shadow: 0 0 10px #ff0000;
  pointer-events: none;
  animation: hitFlash 0.3s ease-out forwards;
}
@keyframes hitFlash {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

#damage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 0;
  transition: box-shadow 0.1s;
}
#damage-vignette.active {
  box-shadow: inset 0 0 80px 20px rgba(220,30,30,0.55);
  animation: vignetteFlash 0.4s ease-out forwards;
}
@keyframes vignetteFlash {
  0%   { box-shadow: inset 0 0 80px 20px rgba(220,30,30,0.55); }
  100% { box-shadow: inset 0 0 0px 0px rgba(220,30,30,0); }
}

#kill-feed {
  position: absolute;
  top: 70px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  align-items: flex-end;
}
.kill-entry {
  background: rgba(0,0,0,0.55);
  border-left: 3px solid var(--cs-orange);
  padding: 5px 10px;
  font-size: 0.72rem;
  border-radius: 0 3px 3px 0;
  animation: killSlide 0.2s ease-out;
}
@keyframes killSlide {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

#reload-text {
  position: absolute;
  bottom: 90px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--cs-orange);
  animation: reloadPulse 0.6s ease-in-out infinite alternate;
}
@keyframes reloadPulse {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

#minimap {
  position: absolute;
  bottom: 20px; right: 20px;
  border: 1px solid rgba(232,135,10,0.4);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(0,0,0,0.6);
}
#minimapCanvas { display: block; }

/* ===== DEATH SCREEN ===== */
#deathScreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.death-msg {
  font-size: 3rem;
  font-weight: 900;
  color: var(--cs-red);
  text-shadow: 0 0 40px rgba(224,48,48,0.7);
  letter-spacing: 0.2em;
}
#respawnTimer {
  font-size: 4rem;
  font-weight: 700;
  color: #fff;
  margin: 16px 0 8px;
}
.death-sub {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.4);
}

/* ===== END SCREEN ===== */
#endScreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  gap: 16px;
}
#endTitle {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--cs-orange);
  text-shadow: 0 0 40px rgba(232,135,10,0.5);
}
#endDetails {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.08em;
}

/* ===== SUPABASE CONFIG PANEL ===== */
.section-label {
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: rgba(232,135,10,0.55);
  text-transform: uppercase;
  margin-bottom: 10px;
  margin-top: 4px;
}

.supa-help {
  margin-top: -8px;
  margin-bottom: 14px;
}
.supa-help a {
  font-size: 0.7rem;
  color: rgba(212,207,200,0.4);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.supa-help a:hover { color: var(--cs-orange); }

.divider {
  height: 1px;
  background: var(--cs-border);
  margin: 18px 0 16px;
}
