* {
  box-sizing: border-box;
}

html,
body,
#game {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111f;
}

body {
  cursor: default;
}

body.locked {
  cursor: none;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

.webgl-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 24px;
  color: #f8fafc;
  background: #141821;
  text-align: center;
  font-size: 18px;
}

.hud,
.toolbar,
#crosshair,
#toast,
#minimap {
  position: fixed;
  z-index: 2;
}

.panel {
  color: #f8fafc;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 14px;
  background: linear-gradient(180deg, rgb(2 6 23 / 78%), rgb(15 23 42 / 66%));
  box-shadow: 0 18px 50px rgb(0 0 0 / 28%);
  backdrop-filter: blur(14px);
  text-shadow: 0 1px 2px rgb(0 0 0 / 45%);
}

.top-left {
  top: 16px;
  left: 16px;
  width: min(360px, calc(100% - 32px));
  padding: 12px;
}

.top-right {
  top: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: 152px 46px 132px 112px;
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.brand {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.03em;
}

#status {
  margin-top: 4px;
  color: #bfdbfe;
  font-size: 13px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
  font-size: 12px;
}

.stats span,
.help span {
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  padding: 7px 8px;
  background: rgb(15 23 42 / 66%);
}

.stats b {
  float: right;
  color: #fff;
}

.wanted b {
  color: #facc15;
  letter-spacing: 0.03em;
}

input,
select,
button {
  font: inherit;
}

#name,
#chat-input,
#block-type,
#tool {
  height: 38px;
  min-width: 0;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 10px;
  color: #fff;
  background: rgb(15 23 42 / 84%);
  outline: none;
}

#name,
#chat-input {
  padding: 0 10px;
}

#block-type,
#tool {
  padding: 0 8px;
}

#name:focus,
#chat-input:focus,
#block-type:focus,
#tool:focus {
  border-color: rgb(125 211 252 / 82%);
  box-shadow: 0 0 0 3px rgb(14 165 233 / 24%);
}

#color {
  width: 46px;
  height: 38px;
  padding: 2px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 10px;
  background: rgb(15 23 42 / 84%);
}

.toolbar {
  left: 50%;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.colors {
  bottom: 18px;
}

.types {
  bottom: 68px;
}

.toolbar button {
  height: 38px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 10px;
  color: #f8fafc;
  background: rgb(15 23 42 / 78%);
  box-shadow: 0 10px 24px rgb(0 0 0 / 22%);
  cursor: pointer;
}

.colors button {
  width: 38px;
  background: var(--swatch);
}

.types button {
  padding: 0 12px;
}

.toolbar button.active {
  outline: 3px solid #fff;
  transform: translateY(-2px);
}

.bottom-left {
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(520px, calc(100% - 32px));
  padding: 10px;
  font-size: 12px;
}

.chat {
  right: 16px;
  bottom: 16px;
  width: min(340px, calc(100% - 32px));
  padding: 10px;
}

#chat-log {
  display: flex;
  height: 150px;
  flex-direction: column;
  justify-content: end;
  gap: 5px;
  overflow: hidden;
  font-size: 12px;
}

#chat-log p {
  margin: 0;
  line-height: 1.35;
  color: #dbeafe;
}

#chat-log strong {
  color: #fff;
}

#chat-input {
  width: 100%;
  margin-top: 8px;
}

#minimap {
  right: 16px;
  top: 112px;
  width: 152px;
  height: 152px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 49%, rgb(255 255 255 / 14%) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgb(255 255 255 / 14%) 50%, transparent 51%),
    radial-gradient(circle, rgb(15 23 42 / 88%), rgb(2 6 23 / 82%));
  box-shadow: 0 18px 50px rgb(0 0 0 / 30%);
  backdrop-filter: blur(10px);
}

#minimap i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #94a3b8;
}

#minimap .you {
  width: 10px;
  height: 10px;
  background: #22d3ee;
  box-shadow: 0 0 0 3px rgb(34 211 238 / 24%);
}

#minimap .player { background: #a78bfa; }
#minimap .vehicle { background: #f97316; }
#minimap .cop { background: #38bdf8; }
#minimap .npc { background: #f472b6; }

#crosshair {
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid rgb(255 255 255 / 92%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgb(0 0 0 / 55%), 0 0 18px rgb(255 255 255 / 22%);
  pointer-events: none;
}

body[data-tool="blaster"] #crosshair {
  width: 22px;
  height: 22px;
  border-color: #facc15;
}

body[data-tool="mine"] #crosshair {
  border-radius: 4px;
  border-color: #fb7185;
}

#toast {
  left: 50%;
  top: 84px;
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 13px;
  color: #fff;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  background: rgb(15 23 42 / 82%);
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .top-right {
    left: 16px;
    right: auto;
    top: 172px;
    grid-template-columns: 150px 46px;
  }

  #minimap {
    top: 16px;
  }
}

@media (max-width: 740px) {
  .types,
  .chat,
  #minimap {
    display: none;
  }

  .colors {
    bottom: 78px;
  }

  .bottom-left {
    font-size: 11px;
  }
}
