:root {
  --bg: #07080c;
  --panel: #10131a;
  --ink: #e7ecf6;
  --muted: #8b93a7;
  --accent: #7ad0ff;
  --accent-2: #ffb14a;
  --blood: #ff4d4d;
  --line: #2a3142;
  --common: #c5c9d3;
  --uncommon: #3ddc7a;
  --rare: #4aa3ff;
  --epic: #c060ff;
  --legendary: #ffb020;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: "Share Tech Mono", ui-monospace, monospace; }
#app { position: relative; width: 100%; height: 100%; }
canvas { display: block; width: 100%; height: 100%; cursor: crosshair; background: #0b0e14; }
.hidden { display: none !important; }

.overlay {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(10,14,22,0.84), rgba(5,6,10,0.95));
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
.menu-inner { text-align: center; padding: 24px; max-width: 760px; }
.title-mark { letter-spacing: 0.5em; font-size: 11px; color: var(--accent); margin-bottom: 10px; }
h1 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(64px, 12vw, 128px);
  line-height: 0.85; letter-spacing: 0.04em;
}
h1 span { color: var(--accent); }
.tagline { color: var(--muted); margin: 16px 0 28px; font-size: 14px; }
.menu-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 28px; }
.ms { border: 1px solid var(--line); padding: 12px 8px; background: rgba(16,19,26,0.75); }
.ms b { display: block; font-family: "Bebas Neue", sans-serif; font-size: 28px; color: var(--accent); }
.ms span { font-size: 10px; color: var(--muted); letter-spacing: 0.12em; }
.menu-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.menu-actions.col { flex-direction: column; align-items: stretch; }
.fine { margin-top: 22px; color: #5c6478; font-size: 11px; }

.btn {
  font-family: inherit; font-size: 12px; letter-spacing: 0.16em;
  padding: 11px 18px; cursor: pointer;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
  transition: 0.15s background, 0.15s border, 0.15s color;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #071018; border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); color: #071018; }
.btn.ghost { border-style: dashed; }
.btn.danger:hover { border-color: var(--blood); color: var(--blood); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 28px 32px;
  max-width: 560px;
  width: min(92vw, 560px);
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 20px 80px rgba(0,0,0,0.45);
}
.panel.wide { max-width: 900px; width: min(94vw, 900px); }
.panel h2 { font-family: "Bebas Neue", sans-serif; font-size: 36px; letter-spacing: 0.06em; margin-bottom: 8px; }
.panel h3 { font-size: 12px; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 10px; }
.panel .sub { color: var(--muted); font-size: 12px; margin-bottom: 16px; line-height: 1.45; }
.kicker { color: var(--accent); letter-spacing: 0.28em; font-size: 11px; margin-bottom: 6px; }
.reason { margin: 14px 0; padding: 10px 12px; border-left: 2px solid var(--accent-2); color: #d7c7a2; font-size: 12px; line-height: 1.45; }
.manual { list-style: none; text-align: left; margin: 16px 0 24px; }
.manual li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: #c5ccda; }
.manual b { color: var(--accent); }

#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 20px; }
.hud-block { min-width: 220px; }
.hud-block.right { text-align: right; }
.label { font-size: 10px; letter-spacing: 0.2em; color: var(--muted); margin-bottom: 6px; }
#hud-hp-wrap { width: 220px; height: 10px; background: #241016; border: 1px solid #5a2a36; }
#hud-hp { height: 100%; width: 100%; background: linear-gradient(90deg, #8b1e30, #ff4d4d); }
#hud-hp-text { font-size: 11px; margin-top: 4px; color: #e8b4b8; }
#hud-statuses { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.st-pill { font-size: 9px; letter-spacing: 0.08em; padding: 2px 6px; border: 1px solid var(--line); color: var(--accent-2); }
.hud-center { text-align: center; }
.wave-chip { font-family: "Bebas Neue", sans-serif; font-size: 42px; letter-spacing: 0.08em; line-height: 1; text-shadow: 0 2px 0 #000; }
.alive-chip { font-size: 11px; color: var(--muted); letter-spacing: 0.16em; }
.stat-row { font-size: 13px; }
.stat-row .k { color: var(--muted); margin-right: 10px; font-size: 10px; letter-spacing: 0.14em; }
.hud-bottom {
  position: absolute; left: 0; right: 0; bottom: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
#weapon-chip {
  background: rgba(8,10,16,0.78);
  border: 1px solid var(--line);
  padding: 8px 14px;
  display: flex; align-items: center; gap: 12px;
  font-size: 12px;
}
#weapon-tags { display: flex; gap: 6px; }
.tag { font-size: 9px; letter-spacing: 0.08em; border: 1px solid var(--line); padding: 2px 6px; color: var(--muted); }
#weapon-stats { color: var(--muted); font-size: 11px; }
.hint { font-size: 10px; color: #5c6478; letter-spacing: 0.04em; }
#xp-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #161a24; }
#xp-fill { height: 100%; width: 0%; background: var(--accent); }

#pickup-prompt {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: rgba(8,10,16,0.9); border: 1px solid var(--accent);
  padding: 8px 14px; font-size: 12px; z-index: 12; color: var(--accent);
  pointer-events: none;
}
kbd { border: 1px solid currentColor; padding: 0 5px; }

#toasts {
  position: absolute; right: 16px; top: 88px; z-index: 18;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  width: min(320px, 40vw);
}
.toast {
  background: rgba(10,13,20,0.92); border: 1px solid var(--line);
  padding: 10px 12px; font-size: 12px; animation: toastIn 0.25s ease both;
}
.toast b { display: block; margin-bottom: 3px; }
.toast.rare { border-color: var(--rare); }
.toast.epic { border-color: var(--epic); }
.toast.legendary { border-color: var(--legendary); }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

#loot-pop {
  position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%);
  z-index: 20; pointer-events: auto; width: min(520px, 94vw);
}
#loot-force { margin-top: 8px; width: 100%; }
.pop-card {
  width: 100%;
  max-height: 72vh;
  overflow: auto;
  background: linear-gradient(180deg, #161b26, #0d1118);
  border: 1px solid #3a4c68;
  padding: 14px 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.holster { border: 1px solid #2a384c; padding: 8px; margin: 6px 0; background: #0c1018; }
.holster b { letter-spacing: 0.08em; }
.offer { background: linear-gradient(180deg, #182033, #10151e); border-color: #4d6d94; min-height: 150px; }
.offer-kicker { font-size: 10px; letter-spacing: 0.16em; color: #7ad0ff; }
.offer-val { font-family: "Bebas Neue", sans-serif; font-size: 26px; color: #ffe08a; line-height: 1; margin: 8px 0; }
.pop-card header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pop-card .why { font-size: 11px; color: #d7c7a2; line-height: 1.4; margin: 8px 0; }
.pop-card .stats { font-size: 12px; color: #c5ccda; }
.pop-card .cmp { margin-top: 8px; font-size: 11px; color: var(--muted); }
.pop-card .cmp em { font-style: normal; color: var(--uncommon); }
.pop-card .cmp i { font-style: normal; color: var(--blood); }
.pop-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

#wave-banner {
  position: absolute; left: 50%; top: 28%; transform: translate(-50%, -50%);
  z-index: 15; pointer-events: none;
  font-family: "Bebas Neue", sans-serif;
  font-size: 72px; letter-spacing: 0.12em;
  text-shadow: 0 4px 0 #000, 0 0 30px rgba(122,208,255,0.35);
  animation: bannerIn 1.6s ease both;
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.86); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1.04); }
}

.shop-gold { margin-bottom: 14px; color: var(--accent); letter-spacing: 0.12em; }
.shop-grid, .armory-grid, .inv-grid, .choice-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px; margin-bottom: 18px;
}
.choice-grid { grid-template-columns: repeat(3, 1fr); }
.shop-card, .armory-card, .inv-card, .eq-card, .choice-card {
  border: 1px solid var(--line); padding: 12px; background: #0c0f16; text-align: left;
}
.choice-card { cursor: pointer; }
.choice-card:hover, .eq-card:hover, .inv-card:hover, .shop-card:hover { border-color: var(--accent); }
.shop-card h4, .armory-card h4, .choice-card h4 { font-size: 13px; margin-bottom: 4px; letter-spacing: 0.08em; }
.shop-card p, .armory-card p, .choice-card p { font-size: 11px; color: var(--muted); margin-bottom: 8px; min-height: 28px; line-height: 1.35; }
.shop-card .cost { color: var(--accent); font-size: 12px; margin-bottom: 8px; }
.delta { border: 1px solid var(--line); padding: 12px; font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
.delta b { color: var(--uncommon); }

.rarity-common { color: var(--common); }
.rarity-uncommon { color: var(--uncommon); }
.rarity-rare { color: var(--rare); }
.rarity-epic { color: var(--epic); }
.rarity-legendary { color: var(--legendary); }
.rarity-pip { width: 8px; height: 8px; display: inline-block; background: var(--common); }
.rarity-pip.uncommon { background: var(--uncommon); }
.rarity-pip.rare { background: var(--rare); }
.rarity-pip.epic { background: var(--epic); }
.rarity-pip.legendary { background: var(--legendary); box-shadow: 0 0 8px var(--legendary); }

.inv-cols { display: grid; grid-template-columns: 260px 1fr; gap: 18px; }
#eq-slots { display: flex; flex-direction: column; gap: 8px; }
.eq-card, .inv-card { cursor: pointer; }
.item-detail {
  min-height: 64px; border-top: 1px solid var(--line); padding-top: 12px;
  font-size: 12px; color: #c5ccda; line-height: 1.45;
}
.go-kicker { color: var(--blood); letter-spacing: 0.3em; font-size: 11px; }
.go-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 22px; }
.go-stats div { border: 1px solid var(--line); padding: 10px; }
.go-stats b { display: block; font-family: "Bebas Neue", sans-serif; font-size: 26px; color: var(--accent); }
.go-stats span { font-size: 10px; color: var(--muted); letter-spacing: 0.12em; }

.redacted { opacity: 0.45; }
.trait-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.trait { font-size: 10px; letter-spacing: 0.08em; border: 1px solid var(--line); padding: 2px 6px; color: var(--accent); }

@media (max-width: 800px) {
  .menu-stats { grid-template-columns: 1fr 1fr; }
  .inv-cols, .choice-grid { grid-template-columns: 1fr; }
  .hint { display: none; }
  h1 { font-size: 64px; }
  .wave-chip { font-size: 28px; }
}

.audio-panel {
  margin: 18px auto 0;
  max-width: 420px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  background: rgba(8,10,16,0.55);
}
.audio-panel .alabel {
  font-size: 10px; letter-spacing: 0.18em; color: var(--muted); margin-bottom: 8px;
}
.audio-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 11px; }
.audio-row span { width: 64px; color: var(--muted); letter-spacing: 0.08em; }
.audio-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.audio-row .pct { width: 36px; text-align: right; color: var(--accent); }
.hud-tools {
  position: absolute; left: 20px; bottom: 28px;
  display: flex; gap: 8px; z-index: 11; pointer-events: auto;
}
#hud-mute, #hud-aim {
  pointer-events: auto;
  position: static;
  border: 1px solid var(--line); background: rgba(8,10,16,0.78);
  color: var(--ink); font-family: inherit; font-size: 10px;
  letter-spacing: 0.12em; padding: 6px 10px; cursor: pointer;
}
#hud-mute.on { color: var(--blood); border-color: var(--blood); }
#hud-aim.on { color: var(--accent); border-color: var(--accent); }
.choice-card { min-height: 140px; }
.choice-card h4 { font-family: "Bebas Neue", sans-serif; font-size: 22px; letter-spacing: 0.04em; }
#upgrade-pop .delta, #up-delta { font-size: 15px; line-height: 1.55; }

.cmp-head { margin-bottom: 6px; color: var(--ink); }
.cmp i { font-style: normal; color: var(--blood); }
.cmp em { font-style: normal; color: var(--uncommon); }

.shop-card.on { border-color: var(--accent); }
.menu-stats { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 800px) { .menu-stats { grid-template-columns: 1fr 1fr; } }
#hud-aim.on { color: var(--accent); border-color: var(--accent); }



/* visual pass */
.overlay { background: radial-gradient(ellipse at 50% 30%, rgba(18,28,44,0.78), rgba(4,6,10,0.94)); }
.panel, .ms, #weapon-chip {
  background: linear-gradient(180deg, rgba(22,28,40,0.92), rgba(10,13,20,0.94));
  border: 1px solid rgba(122,208,255,0.18);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.04);
}
h1 { text-shadow: 0 8px 30px rgba(122,208,255,0.18); }
.btn { border-radius: 2px; }
.btn.primary { box-shadow: 0 0 18px rgba(122,208,255,0.25); }
.wave-chip { text-shadow: 0 0 18px rgba(122,208,255,0.35), 0 2px 0 #000; }
#hud-hp-wrap { border-radius: 2px; box-shadow: inset 0 0 8px rgba(0,0,0,0.45); }
#hud-hp { background: linear-gradient(90deg, #6a1830, #ff5a6a 70%, #ffd0d4); box-shadow: 0 0 10px rgba(255,77,77,0.35); }
.shop-card, .armory-card, .inv-card, .eq-card, .choice-card, .pop-card, .toast {
  background: linear-gradient(180deg, rgba(20,26,38,0.96), rgba(8,11,18,0.96));
  border-color: rgba(122,208,255,0.16);
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 16px; }
.stat-grid div { border: 1px solid rgba(122,208,255,0.16); padding: 8px; font-size: 12px; }
.stat-grid b { display: block; font-size: 16px; color: #d7e6ff; }
.stat-grid span { color: var(--muted); letter-spacing: 0.08em; font-size: 10px; }
#stat-sheet summary { cursor: pointer; letter-spacing: 0.14em; color: var(--accent); }
.cmp-cols > div { border: 1px solid rgba(122,208,255,0.2); padding: 8px; }
.alive-chip.sick { color: #8ed45a; }
#xp-bar { height: 5px; background: #0c1018; }
#xp-fill { background: linear-gradient(90deg, #3a8ab8, #7ad0ff); box-shadow: 0 0 8px rgba(122,208,255,0.4); }
#weapon-chip { backdrop-filter: blur(6px); }
.title-mark { text-shadow: 0 0 12px rgba(122,208,255,0.35); }
.glyph { width: 28px; height: 28px; margin-right: 6px; vertical-align: middle; background: #10151e; border: 1px solid rgba(122,208,255,0.25); }

/* site links + touch notice */
.site-links { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.site-links a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; }
.site-links a:hover, .site-links a:focus { color: var(--ink); border-bottom-color: var(--accent); }
#touch-note { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(5, 7, 11, 0.94); padding: 18px; }
#touch-note.hidden { display: none; }
#touch-note .btn { text-decoration: none; display: inline-block; }
