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

.hidden {
  display: none !important;
}

body {
  overflow: hidden;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #e8f0f8;
  color: #1a2838;
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.screen.active {
  display: flex;
}

.screen.hidden {
  display: none !important;
}

/* 明亮主菜单 */
.menu-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(255, 180, 80, 0.35) 0%, transparent 45%),
    linear-gradient(200deg, rgba(120, 190, 255, 0.45) 0%, transparent 50%),
    linear-gradient(180deg, #f0f6fc 0%, #d8e8f4 50%, #c8dce8 100%);
}

.menu-content {
  position: relative;
  text-align: center;
  z-index: 1;
}

.logo {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  background: linear-gradient(180deg, #ff7700 0%, #cc4400 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(255, 100, 0, 0.25));
}

.subtitle {
  font-size: 0.9rem;
  letter-spacing: 0.35em;
  color: #5a7088;
  margin: 0.5rem 0 3rem;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.btn-primary, .btn-secondary {
  padding: 0.9rem 3rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-width: 220px;
}

.btn-primary {
  background: linear-gradient(180deg, #ff8800, #dd5500);
  color: #fff;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  box-shadow: 0 4px 16px rgba(255, 120, 0, 0.35);
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(255, 120, 0, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: #446;
  border: 2px solid #aac;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.btn-secondary:hover {
  border-color: #ff7700;
  color: #cc4400;
}

.credit {
  margin-top: 3rem;
  font-size: 0.75rem;
  color: #7a90a8;
}

/* 面板 */
.help-panel, .pause-panel, .result-panel, .shop-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid #ff7700;
  padding: 2.5rem;
  max-width: 440px;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  box-shadow: 0 8px 32px rgba(0, 60, 120, 0.15);
  color: #334;
}

.help-panel h2, .pause-panel h2, .result-panel h2, .shop-panel h2 {
  color: #dd5500;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.help-panel ul {
  list-style: none;
  margin-bottom: 1.5rem;
}

.help-panel li {
  padding: 0.4rem 0;
  color: #445;
}

kbd {
  display: inline-block;
  background: #eef4f8;
  border: 1px solid #ccd;
  padding: 0.15rem 0.5rem;
  margin-right: 0.5rem;
  font-family: monospace;
  color: #dd5500;
  min-width: 2rem;
  text-align: center;
}

.help-panel p {
  color: #667;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.help-panel .btn-primary,
.pause-panel .btn-primary,
.result-panel .btn-primary,
.shop-panel .btn-primary {
  margin-bottom: 0.75rem;
}

/* HUD — 半透明亮色 */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

#hud.hidden {
  display: none;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.75) 0%, transparent 100%);
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hud-item .label {
  font-size: 0.75rem;
  color: #556;
  text-transform: uppercase;
  font-weight: 600;
}

.bar-wrap {
  width: 140px;
  height: 10px;
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
}

.bar.health {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00aa44, #44dd88);
  transition: width 0.2s, background 0.3s;
}

#health-text {
  font-weight: 700;
  color: #223;
  min-width: 2rem;
}

.hud-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(255,255,255,0.6);
  padding: 0.4rem 1rem;
  border-radius: 4px;
}

#wave-text {
  font-size: 1.1rem;
  color: #dd5500;
  font-weight: 700;
}

#score-text {
  font-size: 0.85rem;
  color: #556;
}

.ammo-box {
  flex-direction: column;
  align-items: flex-end;
  background: rgba(255,255,255,0.6);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
}

#ammo-text {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: monospace;
  color: #223;
}

/* 准星 */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: #ff2200;
  box-shadow: 0 0 0 1px #fff, 0 0 6px rgba(255, 40, 0, 0.8);
}

#crosshair::before {
  width: 2px;
  height: 14px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#crosshair::after {
  width: 14px;
  height: 2px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#crosshair.kick {
  animation: crosshair-kick 0.12s ease-out;
}

@keyframes crosshair-kick {
  0% { transform: translate(-50%, -50%) scale(1.35); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

#lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  padding: 1rem 2rem;
  z-index: 55;
  letter-spacing: 0.04em;
}

#sprint-tag {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: #dd5500;
  background: rgba(255,255,255,0.75);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.08em;
}

.pause-hint {
  margin: 0.5rem 0 1rem;
  color: #556;
  font-size: 0.95rem;
}

.pause-keys {
  text-align: left;
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  color: #445;
  font-size: 0.9rem;
  line-height: 1.8;
}

.pause-keys kbd {
  margin-right: 0.15rem;
}

#hit-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  color: #ff3333;
  font-weight: bold;
  text-shadow: 0 0 4px #fff;
  animation: hitFlash 0.18s ease-out;
}

@keyframes hitFlash {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

#reload-hint {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.9);
  padding: 0.5rem 1.2rem;
  color: #dd5500;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid #ffaa66;
}

#message {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.35rem;
  font-weight: 700;
  color: #dd5500;
  background: rgba(255,255,255,0.85);
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  border-left: 4px solid #ff7700;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  white-space: nowrap;
}

/* 受伤红屏 */
#damage-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  box-shadow: inset 0 0 0 0 rgba(200, 0, 0, 0);
  transition: box-shadow 0.05s;
}

#damage-overlay.flash {
  box-shadow: inset 0 0 120px 40px rgba(220, 40, 20, 0.45);
}

/* 低血量警告 */
#low-health-warn {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  color: #cc2200;
  font-weight: 700;
  font-size: 1rem;
  background: rgba(255, 240, 230, 0.92);
  padding: 0.4rem 1rem;
  border-radius: 4px;
  border: 1px solid #ff6644;
  animation: pulseWarn 0.8s ease-in-out infinite;
}

@keyframes pulseWarn {
  50% { opacity: 0.65; }
}

/* 屏幕外敌人方向指示 */
#enemy-markers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
}

.enemy-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid #ff2200;
  filter: drop-shadow(0 0 6px #ff4400);
  animation: arrowPulse 0.6s ease-in-out infinite;
}

@keyframes arrowPulse {
  50% { opacity: 0.5; }
}

/* 访问密码门 */
html.gate-locked #menu,
html.gate-locked #game-canvas {
  visibility: hidden;
}

#access-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e8f4fc, #c8dce8);
}

.gate-panel {
  background: #fff;
  border: 2px solid #ff7700;
  padding: 2rem 2.5rem;
  border-radius: 8px;
  text-align: center;
  max-width: 360px;
  box-shadow: 0 12px 40px rgba(0, 60, 120, 0.15);
}

.gate-panel h2 {
  color: #dd5500;
  margin-bottom: 0.75rem;
}

.gate-panel p {
  color: #556;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

#gate-password {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  border: 2px solid #ccc;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

#gate-password:focus {
  border-color: #ff7700;
  outline: none;
}

.gate-error {
  color: #cc2200;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

#gate-submit {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(180deg, #ff8800, #dd5500);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#gate-submit:hover {
  filter: brightness(1.05);
}

.gate-note {
  margin-top: 1rem !important;
  font-size: 0.75rem !important;
  color: #888 !important;
}

.menu-content a {
  color: #dd5500;
}

.lock-hint {
  font-size: 0.8rem;
  color: #6a8098;
  margin-top: 1rem;
  max-width: 320px;
  line-height: 1.5;
}

.version-tag {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #00aa44;
  letter-spacing: 0.05em;
}

.help-wide {
  max-width: 480px;
}

.hint-green { color: #00aa44; font-weight: 700; }
.hint-orange { color: #dd7700; font-weight: 700; }

#weapon-name {
  font-size: 0.8rem;
  color: #dd5500;
  font-weight: 700;
}

#weapon-bar {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  background: rgba(255,255,255,0.82);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  pointer-events: auto;
}

.wslot {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}

.wslot kbd {
  font-size: 0.7rem;
  margin: 0 0 0.15rem;
  min-width: 1.2rem;
}

.wslot span {
  font-size: 0.72rem;
  font-weight: 700;
  color: #445;
}

.wslot.active {
  opacity: 1;
  border-color: #ff7700;
  background: rgba(255, 120, 0, 0.12);
}

.wslot.active span { color: #cc4400; }

#headshot-popup.show {
  animation: headshot-pop 0.7s ease-out;
}

#combo-popup {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-weight: 800;
  color: #ff8800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 52;
}

#combo-popup.show {
  animation: combo-pop 0.85s ease-out;
}

@keyframes combo-pop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.85; }
}

.grenade-hud {
  display: block;
  font-size: 0.72rem;
  color: #556;
  margin-top: 0.2rem;
}

.grenade-hud kbd {
  font-size: 0.65rem;
  min-width: 1.2rem;
  padding: 0.05rem 0.35rem;
}

#grenade-count {
  color: #dd5500;
  font-weight: 700;
}

#headshot-popup {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-size: 2.8rem;
  font-weight: 900;
  color: #ffcc00;
  letter-spacing: 0.2em;
  text-shadow:
    0 0 8px #ff2200,
    0 2px 0 #cc4400,
    0 4px 12px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 60;
  opacity: 0;
}

#headshot-popup.show {
  opacity: 1;
  animation: headshotPop 0.65s ease-out forwards;
}

@keyframes headshotPop {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(0.9); opacity: 0; }
}

#pickup-toast {
  position: absolute;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 80, 40, 0.9);
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid #4f8;
}

#pickup-toast.ammo-toast {
  background: rgba(120, 60, 0, 0.9);
  border-color: #fa4;
}

#crosshair.knife-mode::before,
#crosshair.knife-mode::after {
  background: #44aaff;
  box-shadow: 0 0 0 1px #fff, 0 0 8px rgba(60, 160, 255, 0.9);
}

#crosshair.knife-mode::before { height: 10px; }
#crosshair.knife-mode::after { width: 10px; }

#prog-mini {
  font-size: 0.72rem;
  color: #dd7700;
  font-weight: 700;
}

#xp-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.12);
  border-radius: 2px;
  margin-top: 0.2rem;
  overflow: hidden;
}

#xp-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff8800, #ffcc44);
  transition: width 0.25s;
}

.shop-panel {
  max-width: 520px;
  width: min(92vw, 520px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.75rem 2rem;
}

.shop-gp {
  font-size: 1.05rem;
  font-weight: 700;
  color: #dd5500;
  margin: 0.35rem 0 0.25rem;
  flex-shrink: 0;
}

.shop-hint {
  font-size: 0.82rem;
  color: #667;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.shop-progress-wrap {
  flex-shrink: 0;
  margin-bottom: 0.65rem;
}

#shop-progress-text {
  font-size: 0.75rem;
  color: #667;
  margin-bottom: 0.25rem;
}

#shop-progress-track {
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

#shop-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff7700, #ffcc44);
  transition: width 0.3s ease;
}

.shop-status {
  font-size: 0.8rem;
  color: #dd5500;
  background: rgba(255, 119, 0, 0.1);
  border-left: 3px solid #ff7700;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
  line-height: 1.45;
}

.shop-status.elite {
  color: #0066aa;
  background: rgba(0, 100, 200, 0.08);
  border-left-color: #2288cc;
}

.shop-status.complete {
  color: #008844;
  background: rgba(0, 160, 80, 0.1);
  border-left-color: #00aa44;
}

.shop-status.hidden {
  display: none;
}

.upgrade-grid {
  text-align: left;
  flex: 1;
  min-height: 0;
  max-height: 52vh;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  padding-right: 0.35rem;
}

.upgrade-grid::-webkit-scrollbar {
  width: 6px;
}

.upgrade-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 3px;
}

.upgrade-grid::-webkit-scrollbar-track {
  background: transparent;
}

.shop-cat.elite { color: #2288cc; border-bottom-color: #cce8ff; }

.shop-cat.honor { color: #886600; border-bottom-color: #eeddaa; }

.shop-cat.supply { color: #00aa66; border-bottom-color: #c8eedd; }

.shop-row.locked { opacity: 0.45; }

.shop-row.consumable { background: rgba(0, 170, 100, 0.04); }

.shop-lock {
  font-size: 0.72rem;
  color: #999;
  margin-left: 0.25rem;
}

.shop-locked-note {
  font-size: 0.8rem;
  color: #778;
  padding: 0.35rem 0 0.6rem;
  font-style: italic;
}

.shop-cat {
  font-size: 0.9rem;
  color: #dd5500;
  margin: 0.75rem 0 0.35rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.25rem;
}

.shop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.shop-row.maxed { opacity: 0.55; }

.shop-info { flex: 1; font-size: 0.85rem; line-height: 1.45; }

.shop-lv {
  font-size: 0.75rem;
  color: #888;
  font-weight: 600;
}

.shop-desc { color: #556; font-size: 0.78rem; }

.shop-buy {
  min-width: 5.5rem;
  padding: 0.35rem 0.6rem !important;
  font-size: 0.8rem !important;
}

.shop-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.shop-continue-hint {
  font-size: 0.78rem;
  color: #778;
}

#upgrade-shop.active {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 24, 42, 0.58);
  backdrop-filter: blur(3px);
}
