* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101418;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #eef3f6;
}

canvas#scene {
  display: block;
  position: fixed;
  inset: 0;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8eef2;
  background: linear-gradient(180deg, #f4f1ea, #8aa0b0 40%, #1c242c);
  z-index: 50;
}
#loading.hidden { display: none; }

#join-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 18%, #f7f4ee 0%, #9eb4c4 38%, #1c2830 100%);
}
#join-screen.hidden { display: none; }

#join-card {
  background: rgba(16, 22, 28, 0.82);
  border: 1px solid rgba(31, 138, 132, 0.45);
  border-radius: 14px;
  padding: 2.2rem 2.6rem;
  width: min(440px, 90vw);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
#join-card h1 {
  margin: 0 0 0.2rem;
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f4f7f8;
}
#join-card .subtitle {
  margin: 0 0 1.4rem;
  color: #b7c9d4;
  font-size: 0.92rem;
}
#join-card label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  color: #c5d4de;
  margin-bottom: 0.3rem;
}
#name-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(180, 200, 210, 0.35);
  background: #1a242c;
  color: #f4f7f8;
  font-size: 1rem;
  margin-bottom: 1rem;
}
#join-btn {
  width: 100%;
  padding: 0.7rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(180deg, #3daba4, #1f6f6a);
  color: #f4fffe;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#join-btn:hover { filter: brightness(1.08); }
#join-card .hint {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: #9eb0bc;
}

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#hud.hidden { display: none; }

#crosshair-info {
  position: absolute;
  bottom: 22px;
  left: 22px;
  background: rgba(12, 16, 20, 0.55);
  border: 1px solid rgba(200, 214, 222, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

#minimap {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 180px;
  height: 180px;
  border-radius: 10px;
  border: 2px solid rgba(244, 241, 234, 0.55);
  background: #12181e;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

#chat-overlay {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 70vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
#chat-log {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  text-align: center;
  margin-bottom: 8px;
}
#chat-log .line {
  background: rgba(10, 14, 18, 0.55);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.88rem;
  color: #f4f7f8;
  align-self: center;
}
#chat-log .line .who { color: #7fd4ce; font-weight: 600; }

#chat-input {
  pointer-events: auto;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  border: 1px solid rgba(200, 214, 222, 0.35);
  background: rgba(12, 16, 20, 0.7);
  color: #f4f7f8;
  font-size: 0.9rem;
  text-align: center;
  opacity: 0.75;
}
#chat-input:focus { opacity: 1; outline: none; border-color: #3daba4; }

#player-list {
  position: absolute;
  top: 18px;
  left: 22px;
  background: rgba(12, 16, 20, 0.5);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  max-width: 220px;
}
#player-list .row { display: flex; align-items: center; gap: 6px; }
#player-list .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
