:root {
  --bg: #0d120e;
  --card: #151c17;
  --panel: rgba(16, 22, 18, 0.86);
  --line: #2a362d;
  --text: #e6eee7;
  --muted: #8fa394;
  --accent: #5dd27a;
  --accent-hover: #74e08f;
  --accent-ink: #082210;
  --warn: #f2c94c;
  --radius: 12px;
  color-scheme: dark;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

h1,
h2,
p {
  margin: 0;
}

h2 {
  font-size: 17px;
}

.hidden,
[hidden] {
  display: none !important;
}

button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: #222c25;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
}

button:hover {
  background: #2a362e;
}

button.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}

button.primary:hover {
  background: var(--accent-hover);
}

input {
  font: inherit;
  color: var(--text);
  background: #0f1511;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.tag {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

.tag.you {
  color: var(--accent);
  border-color: rgba(93, 210, 122, 0.4);
}

.tag.off {
  color: var(--warn);
}

/* ---- lobby ---- */

.lobby {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  padding: 40px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2a1f 0%, var(--bg) 60%);
}

.lobby-inner {
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.lobby-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.lobby-head h1 {
  font-size: 28px;
  letter-spacing: 0.04em;
}

.online {
  color: var(--muted);
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.count {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.rooms,
.slots,
.hud-players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.rooms li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.rooms li.playing {
  opacity: 0.6;
}

.room-info {
  display: grid;
  flex: 1;
  min-width: 0;
}

.room-info small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slots li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint,
.empty,
.help p {
  color: var(--muted);
}

.help {
  font-size: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- game ---- */

.game {
  position: fixed;
  inset: 0;
  user-select: none;
  -webkit-user-select: none;
}

.game canvas.world {
  display: block;
  width: 100%;
  height: 100%;
}

/* Health bars and the selection box, drawn over the 3D view. */
.game canvas.marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(6px);
}

.hud-players {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 10px 12px;
  gap: 4px;
  font-size: 14px;
  max-width: 260px;
}

.hud-players li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-players li.left .pname,
.hud-players li.defeated .pname {
  text-decoration: line-through;
  color: var(--muted);
}

.hud-players li.team {
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hud-players li.team:first-child {
  margin-top: 0;
}

.hud-players .note {
  color: var(--warn);
  font-size: 12px;
}

.hud-top {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
}

.ping {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.minimap {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 180px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  cursor: crosshair;
}

.hud-selection {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  white-space: nowrap;
}

.hud-selection:empty {
  display: none;
}

.hud-help {
  position: absolute;
  right: 12px;
  bottom: 12px;
  max-width: 320px;
  font-size: 12px;
  color: rgba(230, 238, 231, 0.7);
  text-align: right;
  text-shadow: 0 1px 2px #000;
  pointer-events: none !important;
}

.hud-lock,
.hud-aim {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none !important;
}

button.icon {
  padding: 6px 8px;
  line-height: 0;
}

.hud-aim {
  color: #ffb3a9;
}

.game.aiming canvas.world {
  cursor: crosshair;
}

/* Drawn in place of the real cursor while the mouse is locked. */
.game .cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  will-change: transform;
}

.game .cursor svg {
  display: block;
}

.game .cursor .cross,
.game.aiming .cursor .arrow {
  display: none;
}

/* The crosshair's center is the hot spot. */
.game.aiming .cursor .cross {
  display: block;
  margin: -13px 0 0 -13px;
}

/* ---- overlays ---- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.dialog {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  display: grid;
  gap: 14px;
}

.dialog h2 {
  font-size: 24px;
}

.dialog p {
  color: var(--muted);
}

.banner,
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 14px;
  white-space: nowrap;
}

.banner {
  top: 12px;
  color: var(--warn);
}

.toast {
  bottom: 220px;
}

@media (max-width: 720px) {
  .hud-help {
    display: none;
  }

  .minimap {
    width: 120px;
    height: 120px;
  }
}
