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

html, body {
  width: 100%; height: 100%;
  background: #05080a;
  overflow: hidden;
  font-family: "Courier New", monospace;
  color: #cfe;
}

#app { width: 100vw; height: 100vh; }

/* ── Lobby ─────────────────────────────────────────────────────────── */
#lobby-screen {
  width: 100%; height: 100%;
  overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px 48px;
  background: radial-gradient(circle at 50% 30%, #102420 0%, #05080a 75%);
}

#lobby-title {
  font-size: 40px; font-weight: bold; letter-spacing: 4px;
  color: #fff; text-shadow: 0 0 18px rgba(120,220,160,0.5);
  margin-top: 8px;
}
#lobby-subtitle { font-size: 13px; color: #7fae9a; margin: 4px 0 16px; }

#connection-status {
  font-size: 13px; padding: 4px 12px; border-radius: 12px; margin-bottom: 4px;
}
#connection-status.disconnected { color: #ef9a9a; }
#connection-status.connecting { color: #ffd54f; }
#connection-status.connected { color: #80e0a0; }
#server-url-display { font-size: 10px; color: #46605a; margin-bottom: 18px; }

.lobby-section {
  width: 100%; max-width: 560px;
  background: rgba(12,28,24,0.72);
  border: 1px solid #1d3a32;
  border-radius: 10px;
  padding: 14px 16px; margin-bottom: 14px;
}
.lobby-section-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 2px;
  color: #6fae93; margin-bottom: 10px;
}

.btn-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.btn-row:last-child { margin-bottom: 0; }

button {
  font-family: inherit; font-size: 14px; font-weight: bold;
  padding: 10px 16px; border: none; border-radius: 8px;
  background: #1f3d34; color: #cfe; cursor: pointer;
  transition: background .12s, transform .05s;
}
button:hover:not(:disabled) { background: #2c574a; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: #2e7d52; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #379961; }

input[type="text"] {
  flex: 1; font-family: inherit; font-size: 14px; letter-spacing: 2px;
  padding: 10px 12px; border: 1px solid #2c574a; border-radius: 8px;
  background: #0a1714; color: #fff;
}

#lobby-room-code {
  font-size: 26px; font-weight: bold; letter-spacing: 6px; text-align: center;
  color: #ffd54f; padding: 8px; background: #0a1714; border-radius: 8px; margin-bottom: 8px;
}

/* Character cards */
.char-cards { display: flex; gap: 10px; }
.char-card {
  flex: 1; padding: 12px 8px; border-radius: 10px; text-align: center;
  background: #0c1c18; border: 2px solid #1d3a32; cursor: pointer;
  transition: border-color .12s, background .12s, transform .06s;
}
.char-card:hover { border-color: #3a6f5d; transform: translateY(-2px); }
.char-card.selected { border-color: #ffd54f; background: #142c20; box-shadow: 0 0 16px rgba(255,213,79,0.25); }
.char-portrait {
  width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 8px; position: relative;
}
.char-portrait span {
  position: absolute; right: -4px; top: 18px; width: 12px; height: 9px; border-radius: 2px;
}
.char-name { font-size: 15px; font-weight: bold; color: #fff; }
.char-role { font-size: 10px; color: #7fae9a; margin: 2px 0; }
.char-passive { font-size: 10px; color: #b39ddb; }

/* Player slots */
.player-slots { display: flex; flex-wrap: wrap; gap: 10px; }
.player-slot {
  flex: 1 1 120px; min-width: 120px; padding: 10px; border-radius: 8px;
  background: #0c1c18; border: 1px solid #1d3a32;
  border-left-width: 3px;
}
/* Distinct per-player accent (matches in-game ring colors P1..P4). */
#slot-p1 { border-left-color: #4aa3ff; }
#slot-p2 { border-left-color: #ff9f43; }
#slot-p3 { border-left-color: #5cd65c; }
#slot-p4 { border-left-color: #e056fd; }
.slot-label { font-size: 12px; color: #6fae93; margin-bottom: 4px; }
.host-tag { color: #ffd54f; font-size: 10px; }
.slot-char { font-size: 16px; font-weight: bold; color: #fff; }
.slot-status { font-size: 11px; color: #8aa; margin-top: 2px; }
.slot-status.ready { color: #80e0a0; font-weight: bold; }
.slot-ping { font-size: 10px; color: #557; margin-top: 2px; }

.btn-ready {
  width: 100%; font-size: 18px; padding: 14px; background: #2e7d52; color: #fff;
}
.btn-ready.is-ready { background: #c79a2e; }
#lobby-status-text { font-size: 12px; color: #7fae9a; text-align: center; margin-top: 10px; }
#lobby-error { font-size: 12px; color: #ef9a9a; text-align: center; margin-top: 6px; min-height: 14px; }

.help-text { font-size: 11px; color: #5e8076; line-height: 1.8; }

/* ── Game ──────────────────────────────────────────────────────────── */
#game-wrap {
  width: 100vw; height: 100vh; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #0d1a18 0%, #05080a 80%);
}
#game {
  display: block;
  max-width: 100vw; max-height: 100vh; width: auto; height: auto;
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #000; box-shadow: 0 0 40px rgba(0,0,0,0.8);
  cursor: none;
}

#countdown-overlay {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center; pointer-events: none;
}
#countdown-number {
  font-size: 140px; font-weight: bold; color: #fff;
  text-shadow: 0 0 30px rgba(120,220,160,0.7);
}

#net-warning {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: none; background: rgba(120,0,0,0.85); color: #fff;
  padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: bold;
}

#disconnected-overlay {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  background: rgba(5,8,10,0.92); text-align: center; gap: 12px;
}
#disconnected-overlay h2 { color: #ef9a9a; font-size: 28px; }
#disconnected-overlay p { color: #9ab; font-size: 14px; max-width: 380px; }

#mute-btn {
  position: absolute; bottom: 12px; right: 12px;
  font-size: 12px; padding: 6px 10px; background: rgba(20,40,34,0.8);
}
