/* Multiplayer Lab Arena — styles.css */

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

html, body {
  width: 100%;
  height: 100%;
  background: #0a0c0e;
  color: #e8eaf0;
  font-family: 'Courier New', Courier, monospace;
  overflow: hidden;
}

/* ─── Root layout ──────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

/* ─── Lobby screen ─────────────────────────────────────────────────────── */
#lobby-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 520px;
  max-width: 98vw;
  padding: 24px;
  background: #111418;
  border: 1px solid #2a3040;
  border-radius: 8px;
}

#lobby-screen.hidden { display: none; }

#lobby-title {
  font-size: 22px;
  font-weight: bold;
  color: #00e5ff;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

#lobby-subtitle {
  font-size: 11px;
  color: #607080;
  text-align: center;
  letter-spacing: 1px;
}

#connection-status {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  background: #1a2030;
  border: 1px solid #2a3040;
}
#connection-status.connected { color: #00ff88; border-color: #00ff88; }
#connection-status.connecting { color: #ffcc00; border-color: #ffcc00; }
#connection-status.disconnected { color: #ff4444; border-color: #ff4444; }

#server-url-display {
  font-size: 10px;
  color: #405060;
  text-align: center;
}

.lobby-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lobby-section-title {
  font-size: 10px;
  color: #607080;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid #1e2838;
  padding-bottom: 4px;
}

.btn-row {
  display: flex;
  gap: 8px;
}

button {
  background: #1a2a3a;
  color: #c8d8e8;
  border: 1px solid #2a4060;
  border-radius: 4px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  text-transform: uppercase;
  letter-spacing: 1px;
}
button:hover { background: #253545; border-color: #4080c0; }
button:active { background: #162030; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

button.btn-primary {
  background: #0a4060;
  border-color: #00aadd;
  color: #00e5ff;
}
button.btn-primary:hover { background: #0a5070; }

button.btn-ready {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  background: #0a3020;
  border-color: #00aa44;
  color: #00ff88;
}
button.btn-ready:hover { background: #0a4028; border-color: #00dd66; }
button.btn-ready.is-ready {
  background: #1a4010;
  border-color: #88ff44;
  color: #aaffaa;
}

input[type="text"] {
  background: #0e1620;
  border: 1px solid #2a4060;
  border-radius: 4px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #c8d8e8;
  flex: 1;
}
input[type="text"]:focus {
  outline: none;
  border-color: #00aadd;
}
input[type="text"]::placeholder { color: #405060; }

/* ─── Player slots ─────────────────────────────────────────────────────── */
.player-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.player-slot {
  padding: 10px;
  background: #0c1420;
  border: 1px solid #1e2838;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.player-slot.connected { border-color: #2a5070; }
.player-slot.p1-color { border-left: 3px solid #00aadd; }
.player-slot.p2-color { border-left: 3px solid #ffaa00; }
.player-slot.p3-color { border-left: 3px solid #66dd66; }
.player-slot.p4-color { border-left: 3px solid #dd66dd; }

.slot-label {
  font-size: 11px;
  color: #607080;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.slot-name { font-size: 13px; font-weight: bold; }
.slot-name.p1 { color: #00e5ff; }
.slot-name.p2 { color: #ffcc44; }
.slot-name.p3 { color: #66dd66; }
.slot-name.p4 { color: #dd66dd; }
.slot-status { font-size: 10px; color: #607080; }
.slot-ping { font-size: 10px; color: #4080a0; }
.slot-host-badge {
  font-size: 9px;
  color: #00ff88;
  border: 1px solid #00ff88;
  border-radius: 3px;
  padding: 1px 5px;
  display: inline-block;
  width: fit-content;
}
.slot-ready-badge {
  font-size: 9px;
  color: #88ff44;
  border: 1px solid #88ff44;
  border-radius: 3px;
  padding: 1px 5px;
  display: inline-block;
  width: fit-content;
}
.slot-waiting {
  font-size: 11px;
  color: #405060;
  font-style: italic;
}

#lobby-status-text {
  font-size: 12px;
  color: #88aacc;
  text-align: center;
  min-height: 18px;
}

#lobby-error {
  font-size: 12px;
  color: #ff6644;
  text-align: center;
  min-height: 18px;
}

#lobby-room-code {
  font-size: 24px;
  font-weight: bold;
  color: #00e5ff;
  letter-spacing: 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ─── Game canvas wrapper ──────────────────────────────────────────────── */
#game-wrapper {
  position: relative;
  display: none;
}
#game-wrapper.visible { display: block; }

#game-canvas {
  display: block;
  background: #0d1a0d;
}

/* ─── Countdown overlay ────────────────────────────────────────────────── */
#countdown-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#countdown-number {
  font-size: 120px;
  font-weight: bold;
  color: #ffffff;
  text-shadow:
    0 0 20px #00e5ff,
    0 0 60px #00e5ff80;
  display: none;
  transition: transform 0.1s;
  animation: countPop 0.4s ease-out;
}

@keyframes countPop {
  0%   { transform: scale(1.5); opacity: 0; }
  60%  { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ─── Network warning banner ───────────────────────────────────────────── */
#net-warning {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: #aa0000cc;
  border: 1px solid #ff4444;
  color: #ff8888;
  padding: 4px 16px;
  font-size: 12px;
  border-radius: 4px;
  display: none;
  pointer-events: none;
  z-index: 100;
}
#net-warning.visible { display: block; }

/* ─── Debug overlays ───────────────────────────────────────────────────── */
#debug-f1 {
  position: absolute;
  top: 0; right: 0;
  background: #000000cc;
  border-left: 1px solid #2a4060;
  border-bottom: 1px solid #2a4060;
  padding: 10px 12px;
  font-size: 10px;
  line-height: 1.7;
  color: #8ab8d8;
  min-width: 240px;
  max-height: 100%;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
#debug-f1.visible { display: block; }
#debug-f1 .dbg-section { color: #00e5ff; margin-top: 6px; font-weight: bold; border-bottom: 1px solid #1e3050; }
#debug-f1 .dbg-row { display: flex; justify-content: space-between; gap: 12px; }
#debug-f1 .dbg-key { color: #607080; }
#debug-f1 .dbg-val { color: #c8d8e8; }

#debug-f2 {
  position: absolute;
  bottom: 0; left: 0;
  background: #000000cc;
  border-top: 1px solid #2a4060;
  border-right: 1px solid #2a4060;
  padding: 8px;
  font-size: 9px;
  line-height: 1.5;
  color: #607888;
  width: 420px;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
#debug-f2.visible { display: block; }
#debug-f2 .msg-row { border-bottom: 1px solid #1a2030; padding: 2px 0; }
#debug-f2 .msg-time { color: #4070a0; }
#debug-f2 .msg-type { color: #00aadd; }
#debug-f2 .msg-payload { color: #405060; }

/* ─── Mute button ──────────────────────────────────────────────────────── */
#mute-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: #1a2030cc;
  border: 1px solid #2a4060;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  color: #607080;
  cursor: pointer;
  z-index: 100;
}
#mute-btn:hover { color: #c8d8e8; border-color: #4080c0; }

/* ─── Disconnected overlay ─────────────────────────────────────────────── */
#disconnected-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000000cc;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 300;
}
#disconnected-overlay.visible {
  display: flex;
}
#disconnected-overlay h2 { color: #ff4444; font-size: 24px; }
#disconnected-overlay p { color: #8898a8; font-size: 14px; text-align: center; }

/* ─── Round-over overlay ───────────────────────────────────────────────── */
#round-over-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #0a1420ee;
  border: 2px solid #2a4060;
  border-radius: 8px;
  padding: 28px 40px;
  text-align: center;
  display: none;
  flex-direction: column;
  gap: 14px;
  z-index: 250;
  min-width: 320px;
}
#round-over-overlay.visible { display: flex; }
#round-over-title { font-size: 40px; font-weight: bold; letter-spacing: 3px; }
#round-over-title.victory { color: #00ff88; text-shadow: 0 0 20px #00ff88; }
#round-over-title.defeat  { color: #ff4444; text-shadow: 0 0 20px #ff4444; }
#round-over-stats { font-size: 15px; color: #8898a8; line-height: 2; }
.round-over-btns { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }

/* ─── Upgrade overlay ──────────────────────────────────────────────────── */
#upgrade-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #060e18f0;
  border: 2px solid #00aadd;
  border-radius: 12px;
  padding: 28px 36px;
  text-align: center;
  display: none;
  flex-direction: column;
  gap: 16px;
  z-index: 240;
  min-width: 520px;
  box-shadow: 0 0 40px #00aadd33, 0 0 80px #00000088;
}
#upgrade-overlay.visible { display: flex; }
#upgrade-title {
  font-size: 20px;
  color: #00e5ff;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 0 0 12px #00e5ff44;
}
#upgrade-timer { font-size: 14px; color: #88aacc; }
.upgrade-cards {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.upgrade-card {
  flex: 1;
  padding: 18px 16px;
  background: #0a1828;
  border: 2px solid #2a4060;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: left;
  min-width: 150px;
}
.upgrade-card:hover {
  border-color: #00aadd;
  background: #0d1e30;
  transform: translateY(-3px);
}
.upgrade-card-name {
  font-size: 16px;
  color: #00e5ff;
  font-weight: bold;
  margin-bottom: 8px;
}
.upgrade-card-desc {
  font-size: 13px;
  color: #8898a8;
  line-height: 1.5;
}
.upgrade-card.voted {
  border-color: #00ff88;
  background: #0a2a1a;
  pointer-events: none;
  transform: translateY(-3px);
}
.upgrade-card.voted::after {
  content: "VOTED";
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #00ff88;
  font-weight: bold;
  letter-spacing: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0a0c0e; }
::-webkit-scrollbar-thumb { background: #2a4060; border-radius: 2px; }
