/* NO MAN'S LAND — cabinet production pass. Mud, khaki, letterboxed 2:1. */

:root {
  --mud: #1c1a16;
  --panel: #14120e;
  --ink: #e6dcc0;
  --dim: #9a8e72;
  --olive: #6e8140;
  --olive-d: #3d4a22;
  --steel: #4d6d86;
  --steel-d: #243848;
  --warn: #c4a04a;
  --defeat: #8a3a32;
  --rust: #8a5a32;
  --brass: #c4a04a;
  --wood: #4a3420;
  --wood-hi: #6a4a28;
}

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

html, body {
  height: 100%;
  background:
    radial-gradient(ellipse at 50% 40%, #2a2218 0%, #14100c 70%, #0a0806 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  background: #14120e;
  color: var(--ink);
  letter-spacing: 0.22em;
  text-transform: lowercase;
  font-size: 15px;
}

@media (orientation: portrait) and (max-width: 900px) {
  #rotate { display: flex; }
  #stage { visibility: hidden; }
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100vw, calc(100vh * 2));
  height: min(100vh, calc(100vw * 0.5));
  transform: translate(-50%, -50%);
  background: #2a261c;
  border: 3px solid #2a1c10;
  box-shadow:
    inset 0 0 0 2px #8a6a32,
    0 0 0 7px #3e2a18,
    0 0 0 9px #b08a48,
    0 0 0 18px #4a3420,
    0 0 0 20px #2a1c10,
    0 16px 44px rgba(0, 0, 0, 0.62);
}

#stage::before {
  content: "";
  position: absolute;
  inset: -20px;
  z-index: -1;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(90, 60, 28, 0.18) 0 3px,
      rgba(0, 0, 0, 0) 3px 9px
    ),
    linear-gradient(180deg, #5a3e24 0%, #3a2818 45%, #2e1e12 100%);
  pointer-events: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#game.aiming { cursor: crosshair; }

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at 50% 48%, transparent 52%, rgba(10, 8, 6, 0.42) 100%);
}

#grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.12;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.05) 0 1px, transparent 1px 4px);
  background-size: 3px 3px, 4px 4px;
}

#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 11.5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2%;
  padding: env(safe-area-inset-top, 0) 2.2% 0;
  background: linear-gradient(180deg, rgba(14, 12, 10, 0.88) 0%, rgba(14, 12, 10, 0.35) 70%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

#stage.menu #topbar,
#stage.menu #command,
#stage.menu #hint,
#stage.menu #final-banner { visibility: hidden; }

#topbar button { pointer-events: auto; }

#supply-wrap {
  min-width: 18%;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

#supply-wrap .label {
  display: block;
  font-size: clamp(9px, 1.4vw, 12px);
  color: var(--dim);
  letter-spacing: 0.16em;
}

#supply {
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

#supply-wrap .cap {
  font-size: clamp(11px, 1.6vw, 14px);
  color: var(--dim);
}

#frontline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1.4%;
  max-width: 52%;
}

.fl-you, .fl-them {
  font-size: clamp(9px, 1.35vw, 12px);
  letter-spacing: 0.14em;
  font-weight: 700;
}

.fl-you { color: #b7c86a; }
.fl-them { color: #8eb0c8; }

.meter {
  position: relative;
  flex: 1;
  height: clamp(10px, 1.8vw, 14px);
  background: #2c2820;
  border: 1px solid #4a4334;
  overflow: hidden;
}

.meter-player {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(90deg, var(--olive-d), var(--olive));
  transition: width 280ms ease;
}

.meter-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 3px;
  margin-left: -1px;
  background: var(--ink);
  box-shadow: 0 0 6px #000;
  transition: left 280ms ease;
}

#clock-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 14%;
  justify-content: flex-end;
}

#clock {
  font-variant-numeric: tabular-nums;
  font-size: clamp(16px, 2.4vw, 22px);
  font-weight: 600;
  letter-spacing: 0.04em;
}

#mute, .ghost-mute {
  width: clamp(36px, 4.2vw, 44px);
  height: clamp(36px, 4.2vw, 44px);
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #4a4334;
  background: #1e1b16;
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  border-radius: 2px;
}

#mute.muted, .ghost-mute.muted { color: var(--dim); text-decoration: line-through; }
#mute:active, .ghost-mute:active { transform: scale(0.96); }

#hint {
  position: absolute;
  top: 12.5%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(11px, 1.6vw, 14px);
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: rgba(230, 220, 192, 0.62);
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

#final-banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
  min-width: min(72%, 520px);
  padding: 10px 22px 12px;
  text-align: center;
  font-size: clamp(22px, 4.4vw, 40px);
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #f6edd0;
  background: linear-gradient(180deg, #8a7028 0%, #5a4818 100%);
  border: 3px solid #e0c060;
  box-shadow: 0 6px 0 #3a2e10, 0 10px 24px rgba(0, 0, 0, 0.45);
  text-shadow: 0 2px 0 #2a1e08;
  animation: banner-in 0.22s ease-out;
}

#final-banner[hidden] { display: none; }

@keyframes banner-in {
  from { transform: translateX(-50%) scale(0.86); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

#command {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 15%;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: 1%;
  padding: 0.5% 1.4% max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(12, 10, 8, 0.94) 0%, rgba(12, 10, 8, 0.42) 65%, transparent 100%);
  z-index: 2;
}

.cmd-rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72%;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(90, 60, 28, 0.28) 0 4px,
      rgba(0, 0, 0, 0.08) 4px 10px
    ),
    linear-gradient(180deg, #5a3e24 0%, #3a2818 100%);
  border-top: 2px solid #8a6a32;
  box-shadow: inset 0 8px 12px rgba(0, 0, 0, 0.25);
}

.cmd-group {
  display: flex;
  flex-wrap: nowrap;
  flex: 1 1 0;
  align-items: stretch;
  gap: 0.7%;
  min-width: 0;
}

.cmd-sep {
  flex: 0 0 2px;
  width: 2px;
  align-self: stretch;
  margin: 10px 0.2%;
  background: rgba(230, 220, 192, 0.2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.cmd {
  flex: 1 1 0;
  max-width: none;
  min-width: 0;
  min-height: 44px;
  height: clamp(44px, 8.6vh, 68px);
  border: 2px solid #5a5438;
  background: linear-gradient(180deg, #3a3628 0%, #242018 100%);
  color: #f2e8c4;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 3px;
  box-shadow: 0 4px 0 #1a1810, 0 6px 14px rgba(0, 0, 0, 0.4);
  padding: 3px 2px;
}

.cmd .btn-name {
  font-size: clamp(10px, 1.5vw, 15px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.1;
  white-space: nowrap;
}

.cmd .btn-meta {
  letter-spacing: 0.06em;
  font-size: clamp(10px, 1.35vw, 13px);
  font-weight: 700;
  opacity: 0.88;
  border: 1px solid rgba(242, 232, 196, 0.28);
  padding: 1px 7px;
  min-width: 32px;
  text-align: center;
}

.cmd-rifle { border-color: #8a9a4a; background: linear-gradient(180deg, #5a6a32 0%, #3d4a22 100%); box-shadow: 0 4px 0 #2a3216, 0 6px 14px rgba(0, 0, 0, 0.4); }
.cmd-assault { border-color: #d08848; background: linear-gradient(180deg, #8a5428 0%, #4a2e16 100%); color: #ffe0b8; box-shadow: 0 4px 0 #2e1c0c, 0 6px 14px rgba(0, 0, 0, 0.4); }
.cmd-mg { border-color: #6a88a0; background: linear-gradient(180deg, #3a5468 0%, #243848 100%); box-shadow: 0 4px 0 #152028, 0 6px 14px rgba(0, 0, 0, 0.4); }
.cmd-arty { border-color: #c4a04a; background: linear-gradient(180deg, #8a7028 0%, #5a4818 100%); box-shadow: 0 4px 0 #3a2e10, 0 6px 14px rgba(0, 0, 0, 0.4); }
.cmd-smoke { border-color: #b0aca4; background: linear-gradient(180deg, #6a6860 0%, #3a3834 100%); color: #e8e4d8; box-shadow: 0 4px 0 #222018, 0 6px 14px rgba(0, 0, 0, 0.4); }
.cmd-charge { border-color: #e07048; background: linear-gradient(180deg, #a04828 0%, #5a2818 100%); color: #ffd0b8; box-shadow: 0 4px 0 #3a1810, 0 6px 14px rgba(0, 0, 0, 0.4); }

.cmd:hover:not(:disabled) { filter: brightness(1.08); }
.cmd:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #1a1810; }
.cmd:disabled {
  border-color: #3a3830;
  background: #2a2822;
  color: #6a6458;
  box-shadow: none;
  cursor: default;
  filter: none;
}

.cmd.armed {
  filter: brightness(1.15);
  box-shadow: 0 0 0 2px #f0d878, 0 4px 0 #3a2e10;
  animation: pulse 0.7s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { filter: brightness(1.05); }
  to { filter: brightness(1.22); }
}

@media (max-width: 760px) {
  #stage {
    box-shadow:
      inset 0 0 0 1px #8a6a32,
      0 0 0 4px #3e2a18,
      0 0 0 5px #b08a48,
      0 0 0 10px #4a3420,
      0 10px 28px rgba(0, 0, 0, 0.55);
  }
  #stage::before { inset: -12px; }
  #command {
    min-height: 16%;
    gap: 0.7%;
    padding: 0.4% 1% max(8px, env(safe-area-inset-bottom));
  }
  .cmd-group { gap: 0.5%; }
  .cmd {
    min-height: 44px;
    height: 44px;
    padding: 2px 1px;
  }
  .cmd .btn-name {
    font-size: 10px;
    letter-spacing: 0.04em;
  }
  .cmd .btn-meta {
    font-size: 9px;
    padding: 0 5px;
    min-width: 26px;
  }
}

#start, #overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 6, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

#start[hidden], #overlay[hidden] { display: none; }

.start-card, .card {
  width: min(88%, 560px);
  padding: 22px 24px 18px;
  background:
    linear-gradient(180deg, rgba(230, 220, 192, 0.06), transparent 18%),
    linear-gradient(180deg, #2a2418 0%, #161410 100%);
  border: 3px solid #8a6a32;
  outline: 1px solid #2a1c10;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(230, 220, 192, 0.14);
}

.studio {
  display: inline-block;
  font-size: clamp(9px, 1.3vw, 11px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #2a1c10;
  background: linear-gradient(180deg, #d4b46a 0%, #8a6a32 100%);
  border: 1px solid #f0d878;
  padding: 3px 10px 4px;
  margin-bottom: 10px;
  box-shadow: 0 2px 0 #3a2a10;
}

.start-card h1 {
  font-size: clamp(28px, 5.2vw, 46px);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  color: #f2e8c4;
  text-transform: uppercase;
  text-shadow:
    0 3px 0 #1a160e,
    2px 0 0 #3a2e14,
    -1px 0 0 #8a7a48;
  -webkit-text-stroke: 0.4px #2a2210;
}

.tagline {
  margin: 8px 0 16px;
  font-size: clamp(13px, 1.8vw, 16px);
  letter-spacing: 0.12em;
  color: #c4b894;
}

.map-list {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.map-pick {
  flex: 1;
  min-height: 68px;
  border: 2px solid #8a6a32;
  background:
    linear-gradient(180deg, #6a5430 0%, #3a2a18 100%);
  color: #f2e8c4;
  cursor: pointer;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 3px;
  box-shadow: 0 3px 0 #2a1c10, inset 0 1px 0 rgba(240, 216, 120, 0.25);
}

.map-pick .map-name {
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.map-pick .map-blurb {
  font-size: clamp(9px, 1.2vw, 11px);
  letter-spacing: 0.04em;
  color: #d4c49a;
}

.map-pick.selected {
  border-color: #f0d878;
  box-shadow: 0 0 0 1px #f0d878, 0 0 12px rgba(196, 160, 74, 0.35), 0 3px 0 #2a1c10;
  background: linear-gradient(180deg, #8a6a32 0%, #4a3418 100%);
}

.map-pick.locked {
  opacity: 0.42;
  cursor: default;
  filter: grayscale(0.4);
}

.map-pick:hover:not(.locked) { filter: brightness(1.08); }

#skirmish, #rematch {
  width: 100%;
  min-height: 64px;
  border: 3px solid #e0c060;
  background: linear-gradient(180deg, #c49028 0%, #6a4814 100%);
  color: #fff6d0;
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 800;
  letter-spacing: 0.2em;
  cursor: pointer;
  box-shadow: 0 5px 0 #3a2e10, inset 0 1px 0 rgba(255, 240, 180, 0.35);
  text-shadow: 0 2px 0 #3a2a08;
}

#skirmish.first {
  animation: pulse 0.9s ease-in-out infinite alternate;
}

#skirmish:hover, #rematch:hover { filter: brightness(1.08); }
#skirmish:active, #rematch:active { transform: translateY(2px); }

.howto {
  margin-top: 12px;
  font-size: clamp(11px, 1.45vw, 13px);
  letter-spacing: 0.06em;
  color: var(--dim);
  line-height: 1.4;
}

.howto-keys {
  margin-top: 4px;
  font-size: clamp(10px, 1.3vw, 12px);
  letter-spacing: 0.08em;
  color: #c4b070;
}

.ghost-mute {
  margin: 12px auto 0;
  display: block;
}

.banner {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  margin-bottom: 8px;
}

.banner.win { color: #c8d87a; }
.banner.loss { color: #d09080; }

.result-map {
  font-size: clamp(12px, 1.6vw, 14px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--warn);
  margin-bottom: 8px;
}

.stats {
  color: var(--dim);
  font-size: clamp(13px, 1.8vw, 16px);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  line-height: 1.6;
}

.pb {
  min-height: 20px;
  font-size: clamp(12px, 1.5vw, 14px);
  letter-spacing: 0.1em;
  color: #c8d87a;
  margin-bottom: 16px;
}

.pb.old { color: var(--dim); }

#to-maps {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid #5a5438;
  background: #1e1b16;
  color: var(--ink);
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 700;
  letter-spacing: 0.2em;
  cursor: pointer;
}

#to-maps:hover { filter: brightness(1.08); }
#to-maps:active { transform: translateY(1px); }
