:root {
  --ink: #081114;
  --panel: rgba(9, 21, 24, 0.82);
  --line: rgba(240, 162, 74, 0.55);
  --amber: #f0a24a;
  --amber-soft: #ffcf8a;
  --teal: #5ec8c0;
  --red: #e8452c;
  --text: #e9f0e6;
  --muted: #8fa39c;
  --rarity: #a6b8ab;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 18px;
  color: var(--text);
  background-color: #070d0f;
  background-image:
    repeating-linear-gradient(135deg, rgba(240, 162, 74, 0.05) 0 2px, transparent 2px 18px),
    radial-gradient(circle at 50% 0%, rgba(94, 200, 192, 0.12), transparent 60%);
  font-family: "Bahnschrift", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

button:focus-visible {
  outline: 3px solid var(--amber-soft);
  outline-offset: 4px;
}

.stage {
  width: min(1320px, 100%);
  height: min(820px, calc(100dvh - 36px));
  min-height: 420px;
}

.frame {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(240, 162, 74, 0.35);
  border-radius: 20px;
  background: #0a1416;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 80px rgba(0, 0, 0, 0.7);
}

.frame::before {
  content: "";
  position: absolute;
  z-index: 40;
  top: 0;
  left: 0;
  width: 100%;
  height: 7px;
  background: repeating-linear-gradient(115deg, var(--amber) 0 16px, #141c1c 16px 32px);
  opacity: 0.85;
  pointer-events: none;
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.fx-grain {
  position: absolute;
  inset: 0;
  z-index: 15;
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 255, 255, 0.55) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.fx-vignette {
  position: absolute;
  inset: 0;
  z-index: 14;
  box-shadow: inset 0 0 160px 30px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

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

.vitals {
  display: grid;
  gap: 7px;
  padding: 12px 14px;
  min-width: 268px;
  background: var(--panel);
  border: 1px solid rgba(240, 162, 74, 0.28);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  backdrop-filter: blur(6px);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.bar-tag {
  width: 22px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.bar {
  position: relative;
  flex: 1;
  height: 9px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 100%;
  transition: width 140ms linear;
}

.bar.hp i {
  background: linear-gradient(90deg, #d8402a, #f0743f);
}

.bar.armor i {
  background: linear-gradient(90deg, #3c8fa8, var(--teal));
}

.bar-num {
  min-width: 38px;
  color: #cfdcd3;
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-row.is-empty {
  opacity: 0.35;
}

.run-stats {
  display: flex;
  gap: 0;
  background: var(--panel);
  border: 1px solid rgba(240, 162, 74, 0.28);
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%, 0 12px);
  backdrop-filter: blur(6px);
}

.stat {
  display: grid;
  gap: 2px;
  min-width: 74px;
  padding: 9px 14px;
  text-align: right;
}

.stat + .stat {
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.stat span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.stat strong {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--amber-soft);
}

.gear-bar {
  position: absolute;
  z-index: 20;
  left: 26px;
  bottom: 26px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.gear-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 150px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--rarity);
  backdrop-filter: blur(6px);
  transition: border-color 200ms ease, transform 200ms ease;
}

.gear-slot.is-empty {
  opacity: 0.5;
}

.gear-slot svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: var(--rarity);
  opacity: 0.9;
}

.gear-slot svg .cut {
  fill: #081114;
  opacity: 0.55;
}

.slot-meta {
  display: grid;
  min-width: 0;
}

.slot-tag {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.slot-name {
  overflow: hidden;
  color: var(--rarity);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ammo-box {
  position: absolute;
  z-index: 20;
  right: 26px;
  bottom: 26px;
  min-width: 186px;
  padding: 9px 14px 8px;
  text-align: right;
  background: var(--panel);
  border: 1px solid rgba(240, 162, 74, 0.28);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.gun-name {
  overflow: hidden;
  color: var(--amber-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ammo-line {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  line-height: 1;
}

.ammo-line strong {
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.ammo-line span {
  color: var(--muted);
  font-size: 16px;
}

.ammo-line em {
  font-size: 15px;
  font-style: normal;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.reload-track {
  height: 3px;
  margin-top: 5px;
  background: rgba(255, 255, 255, 0.12);
}

.reload-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--amber);
}

.ammo-hint {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.pickup-hint {
  position: absolute;
  z-index: 22;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  padding: 9px 16px;
  background: rgba(8, 17, 20, 0.92);
  border: 1px solid var(--amber);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  animation: hint-in 160ms ease-out;
}

.pickup-hint b {
  color: var(--amber-soft);
}

@keyframes hint-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast {
  position: absolute;
  z-index: 23;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  background: rgba(8, 17, 20, 0.9);
  border-left: 3px solid var(--rarity);
  color: var(--rarity);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.key-hint {
  position: absolute;
  z-index: 19;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  color: rgba(233, 240, 230, 0.3);
  font-size: 10px;
  letter-spacing: 0.14em;
  white-space: nowrap;
  pointer-events: none;
}

.overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 34px 20px;
  background: rgba(4, 10, 12, 0.74);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.panel {
  position: relative;
  width: min(760px, 100%);
  padding: 34px 40px 30px;
  background: linear-gradient(160deg, rgba(14, 28, 30, 0.97), rgba(8, 18, 20, 0.98));
  border: 1px solid rgba(240, 162, 74, 0.4);
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 26px 100%, 0 calc(100% - 26px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 150px;
  height: 3px;
  background: var(--amber);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
}

h1, h2, .lead, .gear-title {
  margin: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(46px, 6vw, 68px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 4px 24px rgba(240, 162, 74, 0.25);
}

h1 span {
  color: var(--amber);
}

h2 {
  margin-bottom: 10px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.lead {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.loadout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.loadout-card {
  display: grid;
  gap: 5px;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top: 2px solid rgba(240, 162, 74, 0.6);
}

.loadout-card svg {
  width: 26px;
  height: 26px;
  fill: var(--amber-soft);
}

.loadout-card svg .cut {
  fill: #0d1c1e;
}

.loadout-card strong {
  font-size: 14px;
  letter-spacing: 0.1em;
}

.loadout-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 26px;
  padding: 14px 0 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.controls > div {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  color: var(--amber-soft);
  background: rgba(240, 162, 74, 0.1);
  border: 1px solid rgba(240, 162, 74, 0.4);
  font-family: inherit;
  font-size: 11px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  height: 50px;
  padding: 0 30px;
  color: #10100a;
  background: var(--amber);
  border: 0;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.cta:hover { background: var(--amber-soft); transform: translateY(-2px); }
.cta:active { transform: translateY(1px); }

.ghost {
  display: block;
  margin: 14px auto 0;
  padding: 6px 10px;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-size: 12px;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.ghost:hover { color: var(--amber-soft); }

.footnote {
  margin: 14px 0 0;
  color: rgba(233, 240, 230, 0.35);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.compact {
  width: min(430px, 100%);
  text-align: center;
}

.compact .cta { margin-top: 6px; }

.over-panel { width: min(520px, 100%); text-align: center; }

.final-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 18px 0 20px;
  padding: 16px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.14);
}

.final-stats div { display: grid; gap: 3px; }
.final-stats div + div { border-left: 1px solid rgba(255, 255, 255, 0.1); }

.final-stats strong {
  color: var(--amber-soft);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.final-stats span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.gear-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.22em;
}

.final-gear {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.final-gear li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--rarity);
  font-size: 12px;
}

.final-gear li span { color: var(--muted); }
.final-gear li b { color: var(--rarity); font-weight: 700; }

@media (max-width: 900px) {
  body { padding: 0; }
  .stage { width: 100%; height: 100dvh; min-height: 0; }
  .frame { border: 0; border-radius: 0; }
  .hud { top: 18px; left: 12px; right: 12px; }
  .vitals { min-width: 190px; padding: 9px 10px; }
  .stat { min-width: 56px; padding: 7px 9px; }
  .stat strong { font-size: 16px; }
  .gear-bar { left: 12px; bottom: 14px; gap: 5px; }
  .gear-slot { width: 104px; padding: 6px 7px; }
  .gear-slot svg { width: 17px; height: 17px; }
  .slot-name { font-size: 10px; }
  .ammo-box { right: 12px; bottom: 14px; min-width: 140px; }
  .ammo-line strong { font-size: 27px; }
  .key-hint { display: none; }
  .pickup-hint { bottom: 96px; }
  .panel { padding: 26px 20px 22px; }
  .loadout { grid-template-columns: 1fr 1fr; }
}

@media (max-height: 660px) {
  .panel { padding-top: 20px; padding-bottom: 18px; }
  h1 { font-size: 42px; }
  .loadout { margin-bottom: 14px; }
  .loadout-card { padding: 9px 10px; }
  .controls { margin-bottom: 16px; padding-top: 10px; }
  .lead { margin-bottom: 14px; }
  .cta { height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
