@import url('https://fonts.googleapis.com/css2?family=DotGothic16&family=Fragment+Mono&display=swap');

:root {
  --g: #00ff41;
  --g2: #00a832;
  --bg: #0d0208;
  --panel: rgba(4, 15, 8, 0.92);
  --line: rgba(0, 255, 65, 0.38);
  --muted: #8abd91;
  --warn: #ffc928;
  --hot: #ff5e6c;
  --ink: #031006;
  --pink: #ff7ab8;
  --orange: #ff9f1c;
  --blue: #7ec8ff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--g);
  font-family: 'Fragment Mono', ui-monospace, monospace;
}
body {
  background:
    radial-gradient(ellipse at 50% 18%, #0b3416 0%, #061007 38%, #0d0208 78%);
  overflow: hidden;
}
.scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0 1px,
    transparent 1px 4px
  );
  mix-blend-mode: soft-light;
}
.back-link {
  position: fixed;
  top: 14px;
  left: 18px;
  z-index: 50;
  color: #83e8ab;
  background: #041b0d;
  border: 1px solid #00a854;
  padding: 8px 10px;
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.back-link:hover,
.back-link:focus-visible {
  color: #001608;
  background: #00f078;
  outline: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  max-width: none;
}
/* Branding lives in the menu panel; stage owns the full browser. */
.topbar {
  display: none;
}
.brand {
  font: 12px/1 'DotGothic16', monospace;
  letter-spacing: 0.28em;
  color: var(--muted);
}
.panel > .brand {
  margin-bottom: 2px;
}
.panel > h2 {
  margin-top: 0;
}
.tag {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #020805;
  box-shadow: none;
  overflow: hidden;
  aspect-ratio: auto;
}
#game {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #020805;
  pointer-events: none; /* WASD-only game; keep UI clicks above the canvas */
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(3, 12, 7, 0.88), rgba(2, 8, 5, 0.94));
  overflow: auto;
}
.panel.hidden,
.hidden { display: none !important; }
.panel h2 {
  margin: 0;
  font: clamp(22px, 4vw, 36px)/1 'DotGothic16', monospace;
  letter-spacing: 0.08em;
  text-shadow: 0 0 14px rgba(0, 255, 65, 0.35);
}
.copy {
  margin: 0;
  max-width: 46ch;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.hint {
  margin: 4px 0 0;
  color: #4f7858;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  position: relative;
  z-index: 20;
  pointer-events: auto;
  flex-shrink: 0;
}
#screen-select .btn-row {
  position: sticky;
  bottom: 0;
  padding: 10px 0 4px;
  margin-top: 4px;
  background: linear-gradient(180deg, rgba(2, 8, 5, 0), rgba(2, 8, 5, 0.96) 28%);
  /* Keep the action row above goon cards for hit-testing while sticky. */
  isolation: isolate;
}
.btn {
  border: 1px solid var(--line);
  background: rgba(0, 255, 65, 0.05);
  color: var(--g);
  font: 12px 'Fragment Mono', monospace;
  letter-spacing: 0.08em;
  padding: 11px 16px;
  cursor: pointer;
  min-width: 112px;
  position: relative;
  z-index: 21;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
#btn-start {
  min-width: 168px;
}
.btn:hover,
.btn:focus-visible {
  background: rgba(0, 255, 65, 0.16);
  outline: none;
}
.btn.primary {
  background: var(--g);
  color: var(--ink);
  border-color: var(--g);
  font-family: 'DotGothic16', monospace;
  font-size: 15px;
}
.btn.primary:hover,
.btn.primary:focus-visible { filter: brightness(1.08); }
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: none;
}
#btn-start[aria-disabled="true"] {
  opacity: 0.45;
}
#btn-start.is-ready {
  box-shadow: 0 0 0 1px rgba(0, 255, 65, 0.35), 0 0 18px rgba(0, 255, 65, 0.18);
}
#btn-start.needs-goon {
  animation: goon-shake 0.35s ease;
  border-color: var(--hot);
}
@keyframes goon-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.btn[aria-pressed="true"] {
  color: var(--warn);
  border-color: var(--warn);
}

.hi-box {
  width: min(360px, 100%);
  border: 1px solid rgba(0, 255, 65, 0.22);
  background: rgba(0, 0, 0, 0.28);
  padding: 10px 12px;
}
.hi-title {
  font: 11px 'DotGothic16', monospace;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.hi-box ol {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.hi-box li b { color: var(--g); font-weight: 400; }

.goon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(820px, 100%);
}
.goon-card {
  text-align: left;
  border: 1px solid rgba(0, 255, 65, 0.28);
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
  padding: 12px;
  cursor: pointer;
  min-height: 168px;
  font: 11px/1.45 'Fragment Mono', monospace;
}
.goon-card:hover,
.goon-card:focus-visible {
  border-color: var(--g);
  background: rgba(0, 255, 65, 0.08);
  outline: none;
}
.goon-card.selected {
  border-color: var(--warn);
  box-shadow: inset 0 0 0 1px rgba(255, 201, 40, 0.45);
}
.goon-card .name {
  font: 16px 'DotGothic16', monospace;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.goon-card .weapon { color: var(--warn); margin-bottom: 6px; }
.goon-card .blurb { color: var(--muted); }
.goon-card .stats {
  margin-top: 8px;
  color: #6fa879;
  font-size: 10px;
}
.goon-card[data-id="valley"] .name { color: var(--pink); }
.goon-card[data-id="chud"] .name { color: var(--orange); }
.goon-card[data-id="nerd"] .name { color: var(--blue); }

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(760px, 100%);
}
.upgrade-card {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  color: var(--g);
  padding: 14px 12px;
  cursor: pointer;
  text-align: left;
  min-height: 120px;
  font: 11px/1.45 'Fragment Mono', monospace;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.upgrade-card:hover,
.upgrade-card:focus-visible {
  background: rgba(0, 255, 65, 0.12);
  outline: none;
}
.upgrade-card .u-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
}
.upgrade-card .u-body { min-width: 0; }
.upgrade-card .u-name {
  font: 15px 'DotGothic16', monospace;
  margin-bottom: 6px;
  color: var(--warn);
}
.upgrade-card .u-desc { color: var(--muted); }

#hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #000;
}
.xp-track {
  width: 100%;
  height: 10px;
  border: none;
  border-bottom: 1px solid rgba(0, 255, 65, 0.4);
  background: rgba(0, 0, 0, 0.72);
  overflow: hidden;
  flex-shrink: 0;
}
.xp-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--g);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.35);
}
.hud-top,
.hud-bot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px 0;
}
.hud-bot { padding: 0 12px; }
.hud-spacer { flex: 1 1 auto; min-height: 0; }

/* Loadout stays clickable/hoverable above pause overlay */
#loadout {
  position: absolute;
  right: 10px;
  bottom: 36px;
  z-index: 12;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 128px;
  max-width: 128px;
  padding: 8px 9px;
  border: 1px solid rgba(0, 255, 65, 0.28);
  background: rgba(2, 10, 6, 0.82);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.lo-sec { display: flex; flex-direction: column; gap: 4px; }
.lo-title {
  font: 10px 'DotGothic16', monospace;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.lo-slots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  width: 112px;
}
.lo-slot {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 255, 65, 0.32);
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  cursor: default;
}
.lo-slot.empty {
  opacity: 0.45;
  border-style: dashed;
}
.lo-slot .lo-lv {
  position: absolute;
  right: 1px;
  bottom: 0;
  font-size: 8px;
  color: var(--warn);
  text-shadow: 0 1px 0 #000;
  line-height: 1;
}
.lo-empty { color: #3f5c46; font-size: 12px; }
.loadout-tip {
  position: absolute;
  z-index: 14;
  pointer-events: none;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 255, 65, 0.4);
  background: rgba(2, 12, 7, 0.94);
  color: var(--g);
  font-size: 10px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.loadout-tip .tip-name {
  font: 12px 'DotGothic16', monospace;
  color: var(--warn);
  margin-bottom: 4px;
}
.loadout-tip .tip-body { color: var(--muted); }
#screen-pause {
  /* Leave loadout readable/hoverable while paused */
  background: linear-gradient(180deg, rgba(3, 12, 7, 0.72), rgba(2, 8, 5, 0.78));
}

/* Compact CSS icons for weapons + passives */
.ico {
  display: block;
  width: 22px;
  height: 22px;
  position: relative;
  image-rendering: pixelated;
}
.ico::before,
.ico::after {
  content: '';
  position: absolute;
  box-sizing: border-box;
}
.ico-weapon.ico-valley {
  border: 2px solid #ff7ab8;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 122, 184, 0.25);
}
.ico-weapon.ico-chud {
  background: #ff9f1c;
  clip-path: polygon(90% 50%, 10% 90%, 28% 50%, 10% 10%);
}
.ico-weapon.ico-nerd {
  background: #7ec8ff;
  border: 1px solid #2a4a6a;
  box-shadow: inset 3px 0 0 #f4fbff;
}
/* Bud Light — silver beer can + blue band */
.ico-weapon.ico-budlight {
  background: #c8d0d8;
  border: 1px solid #6a7480;
  border-radius: 2px;
  box-shadow:
    inset 0 2px 0 #e8eef4,
    inset 0 -2px 0 #9aa4b0;
}
.ico-weapon.ico-budlight::before {
  left: 0; top: 7px; width: 100%; height: 8px;
  background: #1e4a9a;
  box-shadow: inset 0 1px 0 #4a7ad0;
}
.ico-weapon.ico-budlight::after {
  left: 3px; top: 10px; width: 16px; height: 2px;
  background: #ffe66a;
  box-shadow: 0 -3px 0 #f4fbff;
}
.ico-passive.ico-cockring {
  border: 3px solid #e8c86a;
  border-radius: 50%;
}
.ico-passive.ico-cockring::before {
  width: 4px; height: 4px; left: 9px; top: 3px;
  background: #fff6a8; transform: rotate(45deg);
}
.ico-passive.ico-cockring::after {
  width: 2px; height: 6px; left: -3px; top: 8px;
  background: #e8c86a; box-shadow: 23px 0 0 #e8c86a;
}
.ico-passive.ico-steroids {
  background: linear-gradient(180deg, #d8d4c8 35%, #9a9688 35% 70%, #d8d4c8 70%);
  width: 8px; height: 18px; left: 7px; top: 2px;
  border-radius: 2px;
}
.ico-passive.ico-steroids::before {
  width: 12px; height: 4px; left: -2px; top: -1px;
  background: #6a6860; border-radius: 1px;
}
.ico-passive.ico-steroids::after {
  width: 4px; height: 4px; left: 2px; bottom: -2px;
  background: #ff5e6c; border-radius: 50%;
}
.ico-passive.ico-dew {
  background: #7dff3a;
  border: 1px solid #1d5a12;
  border-radius: 3px 3px 2px 2px;
  box-shadow: inset 0 -6px 0 #5bbf28;
}
.ico-passive.ico-dew::before {
  left: 4px; top: 5px; width: 12px; height: 6px;
  background: #0d3a08; border-radius: 1px;
}
.ico-passive.ico-dew::after {
  left: 6px; top: 6px; width: 8px; height: 2px;
  background: #c01820;
}
.ico-passive.ico-peptides {
  background:
    linear-gradient(115deg, transparent 40%, #ff4d6a 40% 48%, transparent 48%),
    linear-gradient(65deg, transparent 40%, #4d8dff 40% 48%, transparent 48%);
  border: 1px solid #334;
  border-radius: 50%;
}
.ico-passive.ico-printer {
  background: #8a9098;
  border: 1px solid #333;
  box-shadow: inset 0 -5px 0 #5a6068;
}
.ico-passive.ico-printer::before {
  left: 4px; top: 3px; width: 12px; height: 5px;
  background: #cfd3da;
}
.ico-passive.ico-printer::after {
  left: 6px; bottom: 2px; width: 8px; height: 3px;
  background: #ff9f1c;
}
.ico-passive.ico-tower {
  background: #9aa3ad;
  width: 4px; height: 14px; left: 9px; top: 6px;
}
.ico-passive.ico-tower::before {
  left: -5px; top: -4px; width: 14px; height: 6px;
  border: 2px solid #7ec8ff; border-bottom: none; border-radius: 8px 8px 0 0;
}
.ico-passive.ico-tower::after {
  left: -3px; top: 2px; width: 10px; height: 4px;
  border: 1px solid #7ec8ff88; border-bottom: none; border-radius: 6px 6px 0 0;
}
.ico-passive.ico-magnet {
  width: 16px; height: 14px; left: 3px; top: 4px;
  border: 3px solid #c0c8d0;
  border-top: none;
  border-radius: 0 0 10px 10px;
}
.ico-passive.ico-magnet::before {
  left: -3px; top: -4px; width: 5px; height: 6px; background: #fff;
}
.ico-passive.ico-magnet::after {
  right: -3px; top: -4px; width: 5px; height: 6px; background: #3a7dff;
}
.ico-passive.ico-bouncy {
  border-radius: 50%;
  background: conic-gradient(#ff5e6c, #ffc928, #7dff3a, #7ec8ff, #ff7ab8, #ff5e6c);
}
.ico-passive.ico-timbs {
  background: #8a5a28;
  width: 16px; height: 10px; left: 3px; top: 8px;
  border-radius: 1px 2px 2px 1px;
  box-shadow: 0 -4px 0 #6a4218;
}
.ico-passive.ico-timbs::before {
  left: 0; top: -7px; width: 10px; height: 5px; background: #a06a32;
}
.ico-passive.ico-honeypack {
  background: linear-gradient(135deg, #f0c45a, #c99220);
  border: 1px solid #8a6410;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(255, 240, 180, 0.35);
}
.ico-passive.ico-pill {
  width: 18px; height: 10px; left: 2px; top: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ff5e6c 50%, #7ec8ff 50%);
  border: 1px solid #223;
}

.stats {
  width: min(420px, 100%);
  border: 1px solid rgba(0, 255, 65, 0.22);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.stats b { color: var(--g); font-weight: 400; }

@media (max-width: 720px) {
  .goon-grid,
  .upgrade-grid { grid-template-columns: 1fr; }
  .goon-card { min-height: 0; }
  .panel { justify-content: flex-start; padding-top: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

#hud-timer.freeze {
  color: #9fe9ff;
  text-shadow: 0 0 6px rgba(120, 210, 255, 0.55);
}
