:root {
  color-scheme: dark;
  --ink: #e8e7dc;
  --muted: #8f968d;
  --acid: #c9f45b;
  --blood: #ef5547;
  --panel: #151b18;
  --line: rgba(232, 231, 220, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: #090d0b;
}

body {
  color: var(--ink);
  font-family: "Arial Narrow", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 72% 16%, rgba(131, 158, 88, 0.08), transparent 29rem),
    linear-gradient(135deg, #101613 0%, #090c0b 70%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
}

button {
  font: inherit;
}

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1500px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: 18px 26px 14px;
}

.topbar,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 6px;
  height: 43px;
  border-radius: 1px;
  background: var(--acid);
  box-shadow: 9px 0 0 rgba(201, 244, 91, 0.24);
  transform: skew(-8deg);
}

.eyebrow,
.brand h1,
.weapon-card span,
.weapon-card strong {
  margin: 0;
}

.eyebrow {
  color: var(--acid);
  font: 700 9px/1.2 monospace;
  letter-spacing: 0.22em;
}

.brand h1 {
  margin-top: 2px;
  font-size: clamp(18px, 2vw, 25px);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.weapon-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
  padding: 8px 15px 8px 11px;
  border: 1px solid var(--line);
  background: rgba(21, 27, 24, 0.74);
  transform: skew(-5deg);
}

.top-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.save-button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(21, 27, 24, 0.74);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.save-button:hover {
  border-color: var(--acid);
  color: var(--acid);
}

.save-button b {
  padding: 3px 5px;
  border: 1px solid currentColor;
  font: 900 9px monospace;
}

.weapon-card > * {
  transform: skew(5deg);
}

.knife-icon {
  color: var(--acid) !important;
  font-size: 27px;
  transform: rotate(-42deg) skew(5deg);
}

.weapon-card div {
  display: grid;
  gap: 2px;
}

.weapon-card span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.weapon-card strong {
  font-size: 12px;
  letter-spacing: 0.08em;
}

.arena-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(232, 231, 220, 0.18);
  background: #111714;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
}

.arena-wrap::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  border: 10px solid rgba(4, 7, 5, 0.3);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.55);
}

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

.hud {
  position: absolute;
  z-index: 4;
  top: 20px;
  left: 22px;
  right: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.health-panel {
  width: min(250px, 28vw);
}

.hud-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font: 700 10px/1 monospace;
  letter-spacing: 0.16em;
}

.hud-label strong {
  color: var(--ink);
  letter-spacing: 0.05em;
}

.health-track {
  height: 8px;
  padding: 2px;
  border: 1px solid rgba(232, 231, 220, 0.24);
  transform: skew(-15deg);
}

.health-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--acid);
  box-shadow: 0 0 15px rgba(201, 244, 91, 0.34);
  transition: width 160ms ease, background 160ms ease;
}

.stats-panel {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 9px 20px;
  border: 1px solid var(--line);
  background: rgba(10, 14, 12, 0.66);
  transform: translateX(-50%);
  backdrop-filter: blur(6px);
}

.stats-panel div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stats-panel span,
.enemy-panel span:not(.enemy-dot) {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.15em;
}

.stats-panel strong {
  font: 900 20px/1 monospace;
}

.stats-panel i {
  width: 1px;
  height: 21px;
  background: var(--line);
}

.enemy-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px solid rgba(239, 85, 71, 0.35);
  background: rgba(10, 14, 12, 0.46);
}

.enemy-panel strong {
  color: var(--blood);
  font: 800 13px monospace;
}

.enemy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blood);
  box-shadow: 0 0 8px var(--blood);
}

.screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  visibility: hidden;
  padding: 22px;
  opacity: 0;
  background: rgba(7, 10, 8, 0.68);
  backdrop-filter: blur(4px);
  transition: opacity 250ms ease, visibility 250ms;
}

.screen-overlay.visible {
  visibility: visible;
  opacity: 1;
}

.poster {
  position: relative;
  width: min(520px, 100%);
  padding: clamp(27px, 5vw, 52px);
  overflow: hidden;
  border: 1px solid rgba(232, 231, 220, 0.18);
  background:
    linear-gradient(110deg, rgba(201, 244, 91, 0.05), transparent 38%),
    rgba(14, 19, 16, 0.94);
  box-shadow: 0 30px 100px #000;
}

.poster::before {
  position: absolute;
  top: -70px;
  right: -30px;
  width: 180px;
  height: 280px;
  content: "";
  border: 20px solid rgba(201, 244, 91, 0.035);
  transform: rotate(24deg);
}

.poster-kicker {
  margin: 0 0 17px;
  color: var(--acid);
  font: 700 10px monospace;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.poster h2 {
  margin: 0;
  font-size: clamp(39px, 7vw, 68px);
  line-height: 0.93;
  letter-spacing: -0.05em;
}

.poster h2 em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 1px var(--acid);
}

.poster-copy {
  max-width: 410px;
  margin: 22px 0;
  color: #acb1aa;
  font-size: 13px;
  line-height: 1.8;
}

.controls-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 25px;
}

.controls-guide div {
  display: grid;
  gap: 6px;
}

kbd {
  min-width: 55px;
  padding: 6px 8px;
  border: 1px solid rgba(232, 231, 220, 0.24);
  border-radius: 2px;
  color: var(--ink);
  background: #202722;
  box-shadow: inset 0 -2px 0 #0b0e0c;
  font: 700 10px monospace;
  text-align: center;
}

.controls-guide span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-align: center;
}

.start-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 17px;
  border: 0;
  color: #10150f;
  background: var(--acid);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: filter 140ms, transform 140ms;
}

.start-button:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
}

.start-button b {
  font-size: 24px;
}

.boss-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding: 11px 16px;
  border: 1px solid rgba(239, 85, 71, 0.5);
  color: var(--blood);
  background: rgba(239, 85, 71, 0.06);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  cursor: pointer;
}

.continue-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding: 11px 16px;
  border: 1px solid rgba(201, 244, 91, 0.45);
  color: var(--acid);
  background: rgba(201, 244, 91, 0.06);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  cursor: pointer;
}

.continue-button:hover:not(:disabled) {
  color: #10150f;
  background: var(--acid);
}

.continue-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.continue-button b {
  padding: 3px 7px;
  border: 1px solid currentColor;
  font: 900 11px monospace;
}

.boss-button:hover {
  color: #140807;
  background: var(--blood);
}

.boss-button b {
  padding: 3px 7px;
  border: 1px solid currentColor;
  font: 900 11px monospace;
}

.game-over-poster h2 em {
  -webkit-text-stroke-color: var(--blood);
}

.game-over-poster .poster-kicker {
  color: var(--blood);
}

.victory-poster h2 em {
  -webkit-text-stroke-color: var(--acid);
}

.final-score {
  margin: 28px 0;
  color: var(--muted);
  font-size: 14px;
}

.final-score strong {
  margin: 0 5px;
  color: var(--ink);
  font: 900 28px monospace;
}

.mobile-controls {
  position: absolute;
  z-index: 6;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 45px);
  grid-template-rows: repeat(2, 45px);
}

.dpad button,
.attack-button,
.shoot-button {
  border: 1px solid rgba(232, 231, 220, 0.3);
  color: rgba(232, 231, 220, 0.8);
  background: rgba(15, 21, 17, 0.76);
  backdrop-filter: blur(4px);
  pointer-events: auto;
  touch-action: none;
}

.dpad button[data-key="KeyW"] { grid-column: 2; }
.dpad button[data-key="KeyA"] { grid-row: 2; grid-column: 1; }
.dpad button[data-key="KeyS"] { grid-row: 2; grid-column: 2; }
.dpad button[data-key="KeyD"] { grid-row: 2; grid-column: 3; }

.dpad button:active,
.attack-button:active,
.shoot-button:active {
  color: #111;
  background: var(--acid);
}

.attack-button,
.shoot-button {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-color: rgba(201, 244, 91, 0.45);
  border-radius: 50%;
}

.attack-button span {
  font-size: 25px;
  font-weight: 900;
}

.attack-button small {
  margin-top: -13px;
  color: var(--acid);
  font: 7px monospace;
  letter-spacing: 0.16em;
}

.mobile-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.mobile-actions button {
  pointer-events: auto;
}

.shoot-button {
  width: 62px;
  height: 62px;
  border-color: rgba(232, 231, 220, 0.35);
}

.shoot-button span {
  font-size: 21px;
  font-weight: 900;
}

.shoot-button small {
  margin-top: -11px;
  color: var(--ink);
  font: 7px monospace;
  letter-spacing: 0.14em;
}

.boss-hud {
  position: absolute;
  z-index: 5;
  right: 15%;
  bottom: 24px;
  left: 15%;
  visibility: hidden;
  padding: 12px 15px;
  opacity: 0;
  border: 1px solid rgba(239, 85, 71, 0.35);
  background: rgba(8, 11, 9, 0.86);
  transition: opacity 300ms, visibility 300ms;
}

.boss-hud.visible {
  visibility: visible;
  opacity: 1;
}

.boss-hud > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
}

.boss-hud span,
.boss-hud b {
  font: 8px monospace;
  letter-spacing: 0.16em;
}

.boss-hud > div:first-child span {
  color: var(--blood);
}

.boss-hud strong {
  font-size: 12px;
  letter-spacing: 0.12em;
}

.boss-hud b {
  margin-left: auto;
  color: var(--muted);
}

.boss-track {
  height: 7px;
  border: 1px solid rgba(232, 231, 220, 0.22);
  padding: 1px;
}

.boss-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #9d241e, var(--blood));
  transition: width 180ms ease;
}

.loot-panel {
  position: absolute;
  z-index: 5;
  bottom: 18px;
  left: 20px;
  display: flex;
  align-items: stretch;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(232, 231, 220, 0.14);
  background: rgba(8, 12, 9, 0.78);
  backdrop-filter: blur(6px);
}

.loot-count {
  display: grid;
  grid-template-columns: 12px auto;
  grid-template-rows: auto auto;
  column-gap: 6px;
  min-width: 52px;
  padding: 5px 7px;
  border-right: 1px solid rgba(232, 231, 220, 0.08);
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  color: var(--ink);
  background: transparent;
}

.loot-count i {
  grid-row: 1 / 3;
  align-self: center;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #c5a33c;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.3);
}

.loot-count span {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.1em;
}

.loot-count strong {
  font: 900 13px monospace;
}

.loot-count.silver i { background: #b9c0bd; }
.loot-count.copper i { background: #a76032; }
.loot-count.poop i { height: 9px; border-radius: 50% 50% 42% 42%; background: #765035; }
.loot-count.poop { cursor: pointer; }
.loot-count.poop:hover { background: rgba(118, 80, 53, 0.2); }

#reaperButton {
  display: grid;
  grid-template-columns: 25px auto;
  grid-template-rows: auto auto;
  align-items: center;
  min-width: 118px;
  padding: 4px 9px;
  border: 1px solid rgba(239, 85, 71, 0.25);
  color: var(--ink);
  background: rgba(239, 85, 71, 0.06);
  cursor: pointer;
}

#reaperButton b {
  grid-row: 1 / 3;
  width: 21px;
  height: 21px;
  padding-top: 3px;
  border: 1px solid rgba(232, 231, 220, 0.24);
  font: 900 11px monospace;
}

#reaperButton span { font-size: 9px; font-weight: 900; letter-spacing: 0.1em; }
#reaperButton small { color: var(--muted); font: 7px monospace; }
#reaperButton.ready { border-color: rgba(239, 85, 71, 0.7); background: rgba(239, 85, 71, 0.17); box-shadow: 0 0 18px rgba(239, 85, 71, 0.12); }
#reaperButton.active { color: #130706; background: var(--blood); }

footer {
  padding-top: 10px;
  color: #5f665f;
  font: 9px monospace;
  letter-spacing: 0.1em;
}

footer p {
  margin: 0;
}

footer p span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--acid);
}

.version {
  letter-spacing: 0.2em;
}

@media (pointer: coarse), (max-width: 760px) {
  .game-shell {
    padding: 10px;
  }

  .topbar {
    padding-bottom: 9px;
  }

  .weapon-card {
    min-width: auto;
  }

  .save-button {
    padding: 0 8px;
  }

  .save-button span {
    display: none;
  }

  .eyebrow,
  footer {
    display: none;
  }

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

  .weapon-card span {
    display: none;
  }

  .weapon-card strong {
    font-size: 9px;
  }

  .hud {
    top: 13px;
    right: 13px;
    left: 13px;
  }

  .health-panel {
    width: 38vw;
  }

  .stats-panel {
    top: 34px;
    gap: 10px;
    padding: 7px 10px;
  }

  .stats-panel span {
    display: none;
  }

  .enemy-panel {
    padding: 6px;
  }

  .enemy-panel span:not(.enemy-dot) {
    display: none;
  }

  .mobile-controls {
    display: flex;
  }

  .mobile-actions {
    gap: 6px;
  }

  .mobile-actions .shoot-button {
    width: 50px;
    height: 50px;
  }

  .mobile-actions .attack-button {
    width: 66px;
    height: 66px;
  }

  .poster {
    padding: 27px;
  }

  .boss-hud { right: 10px; bottom: 105px; left: 10px; }

  .loot-panel {
    top: 58px;
    right: 10px;
    bottom: auto;
    left: auto;
    gap: 1px;
  }

  .loot-count {
    min-width: 31px;
    grid-template-columns: auto;
    padding: 3px 4px;
    text-align: center;
  }

  .loot-count i,
  .loot-count span { display: none; }

  #reaperButton { min-width: 80px; padding: 3px 5px; }
}

@media (max-height: 650px) {
  .poster-copy {
    margin: 13px 0;
    line-height: 1.5;
  }

  .controls-guide {
    margin-bottom: 14px;
  }
}
