* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0e14;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #e8ecf1;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1b2636 0%, #0a0e14 100%);
  z-index: 20;
}

.login-box {
  width: 360px;
  max-width: 90vw;
  padding: 28px 32px;
  background: rgba(20, 26, 38, 0.9);
  border: 1px solid #2a3648;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.login-box h1 {
  margin: 0 0 4px;
  font-size: 28px;
  letter-spacing: 0.5px;
  color: #7fd1ff;
}

.subtitle {
  margin: 0 0 20px;
  color: #8a97a8;
  font-size: 13px;
}

.step label {
  display: block;
  font-size: 12px;
  color: #8a97a8;
  margin-bottom: 6px;
}

.step input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 6px;
  border: 1px solid #34435a;
  background: #101722;
  color: #e8ecf1;
  font-size: 14px;
}

.step input:focus {
  outline: none;
  border-color: #7fd1ff;
}

.step button {
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 6px;
  background: #2f9bdb;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.step button:hover {
  background: #3fabec;
}

.step button:disabled {
  background: #395268;
  cursor: not-allowed;
}

.error {
  color: #ff6b6b;
  font-size: 12px;
  min-height: 16px;
  margin: 6px 0 0;
}

.status {
  color: #8a97a8;
  font-size: 12px;
  min-height: 16px;
  margin: 12px 0 0;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-size: 13px;
}

#hud-top-left {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 10px 14px;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  line-height: 1.5;
}

#hud-conn {
  color: #ffcf6b;
}

#hud-conn.ok {
  color: #6bff9e;
}

#hud-conn.down {
  color: #ff6b6b;
}

#hud-players {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 10px 14px;
  min-width: 160px;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  max-height: 40vh;
  overflow-y: auto;
}

#hud-players .p-row {
  color: #bcd;
  white-space: nowrap;
}

#hud-players .p-self {
  color: #6bff9e;
  font-weight: 600;
}

#chat {
  position: absolute;
  bottom: 14px;
  left: 14px;
  width: 380px;
  max-width: calc(100vw - 28px);
  pointer-events: auto;
}

#chat-log {
  height: 160px;
  overflow-y: auto;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  font-size: 12px;
  line-height: 1.5;
}

#chat-log .msg .who {
  color: #7fd1ff;
  margin-right: 6px;
}

#chat-log .msg.self .who {
  color: #6bff9e;
}

#chat-form input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 20, 0.75);
  color: #e8ecf1;
  font-size: 13px;
}

#chat-form input:focus {
  outline: none;
  border-color: #7fd1ff;
}

#hud-help {
  position: absolute;
  bottom: 14px;
  right: 14px;
  padding: 6px 10px;
  background: rgba(10, 14, 20, 0.5);
  border-radius: 6px;
  color: #8a97a8;
  font-size: 11px;
}
