:root {
  color-scheme: dark;
  --blood: #e24b45;
  --toxic: #28ff5f;
  --amber: #ffd166;
  --ice: #8bd7ff;
  --panel: rgba(23, 25, 14, 0.62);
  --line: rgba(255, 236, 177, 0.24);
  --text: #fff8df;
  --muted: #dfc98e;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #d8b676;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #d8b676;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 50%, rgba(0, 0, 0, 0.028) 50%),
    radial-gradient(circle at center, transparent 48%, rgba(64, 35, 10, 0.12) 100%);
  background-size: 100% 4px, 100% 100%;
  mix-blend-mode: soft-light;
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(125, 242, 125, 0.9));
}

.crosshair::before,
.crosshair::after,
.crosshair span {
  content: "";
  position: absolute;
  background: rgba(238, 246, 248, 0.88);
  border-radius: 2px;
}

.crosshair::before {
  left: 13px;
  top: 0;
  width: 2px;
  height: 9px;
}

.crosshair::after {
  left: 13px;
  bottom: 0;
  width: 2px;
  height: 9px;
}

.crosshair span:first-child {
  top: 13px;
  left: 0;
  width: 9px;
  height: 2px;
}

.crosshair span:last-child {
  top: 13px;
  right: 0;
  width: 9px;
  height: 2px;
}

.hud {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.hud-top {
  left: clamp(14px, 2.4vw, 28px);
  right: clamp(14px, 2.4vw, 28px);
  top: clamp(12px, 2vw, 24px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stat {
  min-width: 94px;
  padding: 9px 13px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.stat.health {
  border-color: rgba(226, 75, 69, 0.48);
}

.stat.armor {
  border-color: rgba(139, 215, 255, 0.5);
}

.stat.stamina {
  border-color: rgba(125, 242, 125, 0.48);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 27px;
  line-height: 1;
}

.stat small {
  display: block;
  margin-top: 4px;
  color: #cbe9f7;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.weapon-strip {
  left: 50%;
  bottom: clamp(14px, 2.8vw, 30px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, minmax(108px, 1fr));
  gap: 8px;
  width: min(520px, calc(100vw - 28px));
}

.weapon-card {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 13, 17, 0.7);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.weapon-card.active {
  border-color: rgba(255, 209, 102, 0.9);
  background: rgba(89, 68, 20, 0.74);
}

.weapon-card.locked {
  opacity: 0.58;
  filter: grayscale(0.55);
}

.weapon-key {
  color: var(--amber);
  font-size: 11px;
  font-weight: 900;
}

.weapon-name {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weapon-ammo {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.weapon-unlock {
  display: block;
  margin-top: 2px;
  color: #cbe9f7;
  font-size: 10px;
  font-weight: 900;
}

.combat-log {
  position: absolute;
  left: 50%;
  top: clamp(76px, 10vw, 94px);
  z-index: 2;
  max-width: min(520px, calc(100vw - 30px));
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(139, 215, 255, 0.26);
  border-radius: 999px;
  background: rgba(5, 9, 12, 0.64);
  color: #cbe9f7;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.92;
  text-align: center;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.combat-log.dim {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

.damage-flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(226, 75, 69, 0.45) 100%),
    rgba(226, 75, 69, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 80ms linear;
}

.mini-map {
  position: absolute;
  left: clamp(14px, 2.4vw, 28px);
  bottom: clamp(18px, 3vw, 32px);
  z-index: 4;
  width: clamp(172px, 15vw, 220px);
  height: auto;
  border: 1px solid rgba(139, 215, 255, 0.42);
  border-radius: 8px;
  background: rgba(3, 7, 9, 0.82);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  image-rendering: pixelated;
  pointer-events: none;
}

.online-panel {
  position: absolute;
  top: clamp(76px, 9vw, 94px);
  right: clamp(14px, 2.4vw, 28px);
  z-index: 6;
  width: min(310px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid rgba(139, 215, 255, 0.28);
  border-radius: 8px;
  background: rgba(6, 11, 14, 0.76);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px);
}

.online-form {
  display: grid;
  grid-template-columns: minmax(68px, 0.7fr) minmax(84px, 1fr) auto;
  gap: 7px;
  align-items: end;
}

.online-form label {
  min-width: 0;
}

.online-form span {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.online-form input,
.room-form input,
.room-form select,
.lobby-controls select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(2, 5, 7, 0.72);
  color: var(--text);
  outline: none;
  padding: 7px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.online-form input:focus,
.room-form input:focus,
.room-form select:focus,
.lobby-controls select:focus {
  border-color: rgba(125, 242, 125, 0.62);
}

#online-button,
#menu-online-button {
  min-width: 70px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--ice);
  color: #071018;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

#online-button:hover,
#menu-online-button:hover {
  filter: brightness(1.06);
}

.online-status {
  margin-top: 8px;
  color: #cbe9f7;
  font-size: 12px;
  font-weight: 800;
}

.online-status.connected {
  color: var(--toxic);
}

.online-status.error {
  color: var(--blood);
}

.online-peers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 18px;
  margin-top: 7px;
}

.online-peer {
  max-width: 132px;
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e7f5f8;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-peer.ready {
  border-color: rgba(125, 242, 125, 0.42);
  color: #dfffe7;
}

.online-peer.host {
  border-color: rgba(255, 209, 102, 0.5);
}

.lobby-controls {
  display: none;
  gap: 8px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(139, 215, 255, 0.18);
}

.lobby-controls.connected {
  display: grid;
}

.lobby-phase {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.lobby-controls label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

#lobby-ready-button,
#lobby-start-button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(139, 215, 255, 0.9);
  color: #061018;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

#lobby-ready-button.ready,
#lobby-start-button:not(:disabled) {
  background: var(--toxic);
  color: #06130b;
}

#lobby-ready-button:disabled,
#lobby-start-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(42, 25, 8, 0.84), rgba(94, 65, 22, 0.54)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px);
}

.overlay.hidden {
  display: none;
}

.overlay-panel {
  width: min(780px, 100%);
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(36, 27, 12, 0.86);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.48);
}

.kicker {
  margin: 0 0 10px;
  color: var(--toxic);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 10vw, 84px);
  line-height: 0.92;
  letter-spacing: 0;
}

.overlay-copy {
  max-width: 560px;
  margin: 18px 0 18px;
  color: #c8d6da;
  font-size: 17px;
  line-height: 1.5;
}

.room-menu {
  margin: 0 0 20px;
  padding: 18px 0 0;
  border-top: 1px solid rgba(255, 236, 177, 0.18);
}

.room-form {
  display: grid;
  grid-template-columns:
    minmax(88px, 0.8fr)
    minmax(110px, 1fr)
    minmax(116px, 1fr)
    minmax(96px, 0.9fr)
    minmax(72px, 0.65fr)
    minmax(86px, 0.65fr)
    minmax(96px, auto);
  gap: 9px;
  align-items: end;
}

.room-form label {
  min-width: 0;
}

.room-form span {
  display: block;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.room-form input,
.room-form select {
  min-height: 42px;
  font-size: 14px;
}

.private-toggle {
  display: grid;
  align-content: end;
}

.private-toggle input {
  width: 42px;
  height: 42px;
  margin: 0;
  accent-color: var(--toxic);
}

.room-form select {
  appearance: none;
  padding-right: 28px;
  background:
    linear-gradient(45deg, transparent 50%, var(--amber) 50%) calc(100% - 17px) 18px / 6px 6px no-repeat,
    linear-gradient(135deg, var(--amber) 50%, transparent 50%) calc(100% - 11px) 18px / 6px 6px no-repeat,
    rgba(2, 5, 7, 0.72);
}

#menu-online-button {
  min-height: 42px;
  background: var(--toxic);
  color: #06130b;
}

.room-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-height: 18px;
  margin-top: 10px;
  color: #cbe9f7;
  font-size: 12px;
  font-weight: 900;
}

#room-status-copy.connected {
  color: var(--toxic);
}

#room-status-copy.error {
  color: var(--blood);
}

#room-mode-copy {
  color: var(--muted);
}

.copy-link-button,
#refresh-rooms-button {
  min-height: 30px;
  border: 1px solid rgba(139, 215, 255, 0.34);
  border-radius: 8px;
  background: rgba(8, 13, 17, 0.72);
  color: #e7f5f8;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.copy-link-button {
  padding: 0 10px;
}

.copy-link-button.compact {
  min-height: 28px;
  margin-top: 7px;
}

.copy-link-button:hover,
#refresh-rooms-button:hover {
  border-color: rgba(125, 242, 125, 0.62);
}

.room-browser {
  margin-top: 14px;
  border: 1px solid rgba(255, 236, 177, 0.16);
  border-radius: 8px;
  background: rgba(3, 7, 9, 0.32);
}

.arsenal-panel {
  display: grid;
  gap: 7px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid rgba(139, 215, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 7, 9, 0.34);
}

.arsenal-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.arsenal-row {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.arsenal-row span,
.arsenal-row strong,
.arsenal-row small {
  position: relative;
  z-index: 1;
}

.arsenal-row span {
  color: var(--amber);
  font-weight: 900;
  text-align: center;
}

.arsenal-row strong {
  font-size: 13px;
}

.arsenal-row small {
  padding-right: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.arsenal-row i {
  position: absolute;
  inset: auto auto 0 0;
  width: calc(var(--progress) * 100%);
  height: 3px;
  background: var(--toxic);
}

.arsenal-row.locked i {
  background: var(--amber);
}

.room-browser-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px 12px 8px;
}

.room-browser-head strong {
  color: #e7f5f8;
  font-size: 13px;
}

#refresh-rooms-button {
  padding: 0 9px;
}

.room-browser-list {
  display: grid;
  gap: 6px;
  max-height: 138px;
  overflow: auto;
  padding: 0 10px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.room-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.room-row strong {
  display: block;
  color: var(--text);
  font-size: 12px;
}

.room-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.room-row button {
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  background: var(--toxic);
  color: #06130b;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

#start-button {
  min-width: 150px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--amber);
  color: #15100a;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
}

#start-button:hover {
  filter: brightness(1.05);
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 720px) {
  .hud-top {
    align-items: stretch;
    gap: 7px;
  }

  .stat {
    min-width: 0;
    flex: 1;
    padding: 7px 6px;
  }

  .stat strong {
    font-size: 18px;
  }

  .stat-label {
    font-size: 9px;
  }

  .stat small {
    font-size: 8px;
  }

  .weapon-strip {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
    gap: 5px;
  }

  .weapon-card {
    padding: 7px 6px;
  }

  .weapon-name {
    font-size: 11px;
  }

  .weapon-ammo {
    font-size: 10px;
  }

  .combat-log {
    top: 88px;
    font-size: 12px;
  }

  .mini-map {
    top: 136px;
    bottom: auto;
    left: 10px;
    width: 132px;
    opacity: 0.92;
  }

  .online-panel {
    top: auto;
    right: 10px;
    bottom: 88px;
    width: min(360px, calc(100vw - 20px));
    padding: 8px;
  }

  .online-form {
    grid-template-columns: 72px 1fr 64px;
    gap: 6px;
  }

  .online-form input,
  #online-button {
    min-height: 32px;
    font-size: 12px;
  }

  .online-peers {
    max-height: 56px;
    overflow: hidden;
  }

  .lobby-controls {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .overlay {
    align-items: start;
    padding: 18px 12px;
  }

  .overlay-panel {
    padding: 22px 18px;
  }

  .overlay-copy {
    font-size: 15px;
  }

  .room-form {
    grid-template-columns: 1fr 1fr;
  }

  #menu-online-button {
    grid-column: 1 / -1;
  }

  .private-toggle {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .room-browser-list {
    max-height: 112px;
  }

  .room-form input,
  .room-form select {
    min-height: 40px;
    font-size: 13px;
  }
}
