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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: #050510;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* === HUD === */
#hud {
  position: fixed;
  top: 0.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
}

#hud-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(5, 5, 16, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.4rem 1.2rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.12);
}

#noxi-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #a855f7;
  text-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

#xp-bar {
  width: 110px;
  height: 4px;
  background: rgba(26, 26, 46, 0.5);
  border-radius: 2px;
  margin-top: 0.3rem;
  overflow: hidden;
}

#xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 2px;
  transition: width 0.5s ease;
}

#xp-label {
  font-size: 0.55rem;
  color: #555;
  margin-top: 0.15rem;
}

/* === Chat Overlay === */
#chat-overlay {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  z-index: 20;
  padding: 0 0.8rem 0.8rem;
  pointer-events: none;
}

#chat-messages {
  max-height: 28vh;
  overflow-y: auto;
  padding: 0.4rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: auto;
  mask-image: linear-gradient(transparent 0%, black 25%);
  -webkit-mask-image: linear-gradient(transparent 0%, black 25%);
}

.message {
  max-width: 78%;
  padding: 0.45rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.35;
  animation: msg-in 0.3s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  align-self: flex-end;
  background: rgba(99, 102, 241, 0.75);
  color: white;
  border-bottom-right-radius: 3px;
}

.message.noxi {
  align-self: flex-start;
  background: rgba(12, 12, 28, 0.7);
  color: #ddd;
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-bottom-left-radius: 3px;
}

#chat-form {
  display: flex;
  gap: 0.4rem;
  padding-top: 0.3rem;
  pointer-events: auto;
}

#chat-input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(8, 8, 20, 0.7);
  color: #e0e0e0;
  font-size: 0.82rem;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#chat-input:focus {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.08);
}

#chat-form button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(99, 102, 241, 0.75);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

#chat-form button:hover {
  background: rgba(168, 85, 247, 0.85);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.25);
}

#chat-messages::-webkit-scrollbar {
  width: 2px;
}
#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.12);
  border-radius: 2px;
}
