* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  background: #0a0d12;
  color: #e8ecff;
  display: grid;
  place-items: center;
  padding: 12px;
}

.hidden {
  display: none !important;
}

/* Setup */
.setup-screen {
  width: min(440px, 94vw);
}

.setup-card-split {
  width: min(720px, 96vw);
}

.split-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}

@media (max-width: 640px) {
  .split-setup-grid {
    grid-template-columns: 1fr;
  }
}

.split-heading {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #c8d4ff;
}

.split-hint {
  margin: 0 0 12px;
  font-size: 0.75rem;
  opacity: 0.7;
  line-height: 1.35;
}

.setup-card {
  background: linear-gradient(160deg, #1a2235 0%, #121820 100%);
  border: 1px solid #3d4a66;
  border-radius: 12px;
  padding: 24px 22px 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.setup-card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.setup-lead {
  margin: 0 0 18px;
  font-size: 0.92rem;
  opacity: 0.85;
  line-height: 1.45;
}

.setup-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
}

.field span {
  opacity: 0.9;
}

.field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #4a5a78;
  background: #0f141c;
  color: #e8ecff;
  font-size: 1rem;
}

.btn-start {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(180deg, #c9a227 0%, #8b6914 100%);
  color: #1a1508;
}

.btn-start:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 700;
  border: 1px solid #5a6a8a;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(180deg, #2a3548 0%, #1a2235 100%);
  color: #e8ecff;
}

.btn-secondary:hover {
  filter: brightness(1.1);
}

.btn-text {
  background: none;
  border: none;
  color: #8a9abf;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 8px 0;
  text-decoration: underline;
}

.btn-text:hover {
  color: #c8d4ff;
}

.btn-back-margin {
  margin-top: 14px;
}

.main-menu-screen {
  width: min(480px, 94vw);
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-actions-col {
  margin-top: 8px;
}

.menu-hint {
  margin: 16px 0 0;
  font-size: 0.78rem;
  opacity: 0.65;
  line-height: 1.4;
}

.menu-hint code {
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
}

.field input[type="text"] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #4a5a78;
  background: #0f141c;
  color: #e8ecff;
  font-size: 1rem;
}

.lobby-code-label {
  margin: 0 0 8px;
  font-size: 0.95rem;
  opacity: 0.9;
}

.lobby-code {
  margin: 0 0 16px;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
  color: #e8c547;
}

.lobby-step {
  width: 100%;
}

.setup-error {
  margin: 12px 0 0;
  font-size: 0.88rem;
  color: #ff8a8a;
}

.game-wrapper {
  width: min(1280px, 98vw);
  position: relative;
}

.ally-corner {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  max-width: min(340px, 88vw);
}

.ally-line {
  font-size: 0.92rem;
  font-weight: 600;
  color: #b8e0ff;
  margin-bottom: 4px;
}

.ally-death {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ff9a9a;
  line-height: 1.35;
}

.toast {
  position: absolute;
  left: 50%;
  top: 52px;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(20, 26, 38, 0.95);
  border: 1px solid #5a6a8a;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  max-width: 90vw;
  text-align: center;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 6px;
}

.countdown {
  font-size: 1.05rem;
  font-weight: 700;
}

.alive-hud {
  font-size: 1.02rem;
  font-weight: 700;
  color: #a8d4ff;
}

.weapon-hud {
  font-size: 0.95rem;
  opacity: 0.95;
}

.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.82rem;
  opacity: 0.75;
  margin-bottom: 10px;
}

.canvas-wrap {
  border: 2px solid #3d4a66;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  background: #1a2332;
}
