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

body {
  background: #0a0a1a;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* ===== Login Screen ===== */
#mobile-error {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.mobile-error-box {
  background: rgba(15, 15, 40, 0.95);
  border: 1px solid #663333;
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 0 60px rgba(200, 80, 80, 0.15);
}

.mobile-error-box h1 {
  font-size: 1.8rem;
  color: #ff6666;
  margin-bottom: 12px;
}

.mobile-error-box p {
  color: #aa7777;
  font-size: 1rem;
}

/* ===== Login Screen ===== */
#login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.login-box {
  background: rgba(15, 15, 40, 0.95);
  border: 1px solid #333366;
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 0 60px rgba(80, 80, 200, 0.15);
  min-width: 360px;
}

.login-box h1 {
  font-size: 2rem;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.subtitle {
  color: #7777aa;
  margin-bottom: 28px;
  font-size: 0.95rem;
}

#nickname {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #444477;
  border-radius: 8px;
  background: #111133;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}

#nickname:focus {
  border-color: #6666cc;
}

#join-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4444cc, #6666ee);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

#join-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(80, 80, 220, 0.4);
}

#join-btn:active {
  transform: translateY(0);
}

/* ===== Game Screen ===== */
.hidden {
  display: none !important;
}

#game-screen {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container {
  position: relative;
  display: inline-block;
}

#game-canvas {
  display: block;
  border: 2px solid #222244;
  border-radius: 4px;
  background: #080820;
  max-width: 100vw;
  max-height: 100vh;
}

/* ===== HUD ===== */
#hud-score {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 10;
}

.hud-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #8888aa;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.hud-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

#hud-health {
  position: absolute;
  bottom: 16px;
  left: 14px;
  z-index: 10;
}

.health-bar-bg {
  width: 180px;
  height: 12px;
  background: #222244;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 4px;
}

.health-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4444, #ff6666);
  border-radius: 6px;
  transition: width 0.2s;
}

.health-bar-fill.low {
  background: linear-gradient(90deg, #cc0000, #ff2222);
}

/* ===== Death Overlay ===== */
#death-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  text-align: center;
  pointer-events: none;
}

.death-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ff4444;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
  margin-bottom: 6px;
}

.respawn-text {
  font-size: 0.9rem;
  color: #aaa;
}

/* ===== Chat ===== */
#chat-panel {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 10;
  width: 260px;
  background: rgba(10, 10, 30, 0.85);
  border: 1px solid #333355;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

#chat-messages {
  height: 120px;
  overflow-y: auto;
  padding: 8px;
  font-size: 0.75rem;
  line-height: 1.4;
}

#chat-messages .msg {
  margin-bottom: 3px;
  word-break: break-word;
}

#chat-messages .msg .name {
  color: #4ecdc4;
  font-weight: 600;
}

#chat-messages .msg .text {
  color: #ccc;
}

#chat-input {
  border: none;
  border-top: 1px solid #333355;
  background: rgba(0, 0, 20, 0.6);
  color: #e0e0e0;
  padding: 8px 10px;
  font-size: 0.78rem;
  outline: none;
  border-radius: 0 0 8px 8px;
}

#chat-input::placeholder {
  color: #555;
}

/* ===== Scrollbar ===== */
#chat-messages::-webkit-scrollbar {
  width: 4px;
}
#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#chat-messages::-webkit-scrollbar-thumb {
  background: #333355;
  border-radius: 2px;
}
