* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1018;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  color: #f4f6fb;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#game-canvas.hd-mode {
  image-rendering: auto;
}

#vfx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 5;
}

.hidden {
  display: none !important;
}

/* HUD */
.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 16px;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hud-left-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-panel {
  background: rgba(14, 18, 28, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55);
  padding: 8px 12px;
  pointer-events: auto;
}

.hud-progress {
  min-width: 265px;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.map-badge {
  font-weight: 800;
  font-size: 14px;
  color: #ffe066;
  text-shadow: 2px 2px 0 #000;
}

.rank-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  background: #2f3b58;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #9be7ff;
}

.rank-badge.hot {
  background: #d9480f;
  color: #fff3bf;
}

.rank-badge.max {
  background: #f59f00;
  color: #111;
}

.progress-track {
  position: relative;
  height: 18px;
  background: #141926;
  border: 2px solid rgba(255, 255, 255, 0.26);
  overflow: hidden;
  margin-bottom: 5px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff922b, #ffd43b, #ff595e);
  transition: width 0.14s ease-out;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
}

.hud-subrow {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #c7d2e8;
}

.unlock-goal {
  color: #74c0fc;
  font-weight: 700;
}

/* Interactive Mini-Mission Card */
.mission-card {
  max-width: 290px;
  border-color: rgba(116, 192, 252, 0.45);
  padding: 7px 10px;
}

.mission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #74c0fc;
  margin-bottom: 3px;
}

.mission-reward {
  color: #ffd43b;
}

.mission-title {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 5px;
}

.mission-track {
  height: 6px;
  background: #101522;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mission-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  transition: width 0.15s ease-out;
}

.hud-center-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.value-box {
  background: rgba(14, 18, 28, 0.82);
  border: 2px solid rgba(255, 224, 102, 0.45);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.55);
  padding: 5px 14px;
  font-size: 13px;
  color: #dce3f2;
}

.value-box strong {
  color: #ffd43b;
  font-size: 16px;
  margin-left: 4px;
  text-shadow: 2px 2px 0 #000;
}

.combo-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: linear-gradient(135deg, #ff595e, #ff922b);
  border: 2px solid #fff3bf;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
  padding: 4px 14px;
}

.combo-box.pop {
  animation: comboPop 0.2s ease-out;
}

@keyframes comboPop {
  0% { transform: scale(1.26) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.combo-label {
  font-size: 12px;
  font-weight: 800;
  color: #fff3bf;
}

.combo-num {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 2px 2px 0 #7a1c00;
}

.hud-controls-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.map-switcher,
.util-buttons {
  display: flex;
  gap: 5px;
}

.pixel-btn {
  appearance: none;
  background: #232b3e;
  color: #e9effa;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.65);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, background 0.12s;
}

.pixel-btn:hover {
  background: #33405c;
  transform: translate(-1px, -1px);
}

.pixel-btn:active {
  transform: translate(1px, 1px);
}

.pixel-btn.active {
  background: #3b82f6;
  border-color: #bfdbfe;
  color: #fff;
}

.pixel-btn.locked {
  opacity: 0.6;
  background: #171c28;
}

.pixel-btn.accent {
  background: #f59f00;
  border-color: #fff3bf;
  color: #151515;
}

/* Crosshair & Target HP Readout */
.crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ch-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%);
  background: #ffffff;
  box-shadow: 0 0 0 1px #000;
}

.ch-arm {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8);
}

.ch-top { width: 2px; height: 6px; left: 11px; top: 0; }
.ch-bottom { width: 2px; height: 6px; left: 11px; bottom: 0; }
.ch-left { width: 6px; height: 2px; left: 0; top: 11px; }
.ch-right { width: 6px; height: 2px; right: 0; top: 11px; }

.hit-marker {
  position: absolute;
  inset: -4px;
  opacity: 0;
  transition: opacity 0.08s;
}

.hit-marker::before,
.hit-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 3px;
  background: #ffd43b;
  box-shadow: 0 0 4px #ff595e;
}

.hit-marker::before { transform: translate(-50%, -50%) rotate(45deg); }
.hit-marker::after { transform: translate(-50%, -50%) rotate(-45deg); }
.hit-marker.show { opacity: 1; }

.target-pill {
  position: fixed;
  left: 50%;
  top: calc(50% + 26px);
  transform: translateX(-50%);
  min-width: 150px;
  background: rgba(12, 16, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 4px 9px;
  pointer-events: none;
}

.target-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 3px;
}

.target-tag {
  font-size: 10px;
  padding: 1px 4px;
  background: #e03131;
  color: #fff3bf;
}

.target-tag.water { background: #0c8599; }
.target-tag.electric { background: #1971c2; }
.target-tag.paper { background: #d97706; }

.target-hp-track {
  height: 5px;
  background: #1e293b;
}

.target-hp-fill {
  height: 100%;
  width: 100%;
  background: #4ade80;
  transition: width 0.08s;
}

/* Toast Notification */
.toast-banner {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f59f00, #ff6b6b);
  border: 2px solid #fff3bf;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.65);
  padding: 8px 20px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.65);
  z-index: 15;
}

/* Pointer lock hint positioned cleanly above bottom hotbar */
.lock-hint {
  position: fixed;
  bottom: 94px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 16, 26, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 5px 12px;
  font-size: 12px;
  color: #dbe4ff;
  white-space: nowrap;
}

/* Milestone Banner */
.milestone-banner {
  position: fixed;
  right: 18px;
  top: 112px;
  width: 300px;
  background: rgba(18, 24, 38, 0.94);
  border: 2px solid #ffd43b;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.65);
  padding: 12px 14px;
  pointer-events: auto;
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.milestone-title {
  font-size: 16px;
  font-weight: 900;
  color: #ffd43b;
  margin-bottom: 4px;
}

.milestone-sub {
  font-size: 12px;
  color: #d6def0;
  margin-bottom: 10px;
  line-height: 1.45;
}

.milestone-actions {
  display: flex;
  gap: 8px;
}

/* Weapon Hotbar */
.hud-bottom {
  display: flex;
  justify-content: center;
  padding-bottom: 4px;
}

.weapon-bar {
  display: flex;
  gap: 8px;
  background: rgba(14, 18, 28, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
  padding: 7px 10px;
  pointer-events: auto;
}

.weapon-slot {
  position: relative;
  min-width: 92px;
  padding: 6px 10px;
  background: #1d2436;
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #dce4f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.12s, background 0.12s;
}

.weapon-slot:hover {
  background: #28334d;
  transform: translateY(-2px);
}

.weapon-slot.active {
  background: #2b4c7e;
  border-color: #74c0fc;
  box-shadow: inset 0 0 0 1px #a5d8ff;
}

.weapon-slot.locked {
  opacity: 0.62;
  background: #141824;
  cursor: not-allowed;
}

.lock-badge {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #ffd43b;
}

.ammo-pips {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}

.ammo-pips span {
  width: 9px;
  height: 4px;
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.ammo-pips span.lit {
  background: #ff922b;
  box-shadow: 0 0 4px #ff595e;
}

.slot-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 10px;
  font-weight: 800;
  color: #9aa8c7;
}

.slot-icon {
  font-size: 18px;
  line-height: 1.1;
}

.slot-name {
  font-size: 12px;
  font-weight: 800;
}

.kick-slot {
  min-width: 78px;
  background: #1b3138;
  border-color: rgba(56, 189, 248, 0.35);
}

.ult-slot {
  min-width: 124px;
  background: #231e36;
  border-color: rgba(165, 180, 252, 0.35);
}

.ult-slot.ready {
  background: linear-gradient(180deg, #2b2c5c, #1a3a66);
  border-color: #ffd43b;
  animation: ultPulse 1.3s infinite ease-in-out;
}

@keyframes ultPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 212, 59, 0.35); }
  50% { box-shadow: 0 0 18px rgba(116, 192, 252, 0.75); }
}

.ult-bar-track {
  width: 100%;
  height: 5px;
  background: #10131f;
  margin-top: 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ult-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4dabf7, #ffd43b);
  transition: width 0.1s linear;
}

.ult-ready-tag {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  font-weight: 900;
  color: #ffd43b;
}

/* Title / Menu Overlay */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(14, 18, 30, 0.38), rgba(8, 10, 18, 0.82));
  padding: 20px;
}

.menu-card {
  width: min(940px, 100%);
  background: rgba(16, 21, 33, 0.92);
  border: 3px solid rgba(255, 255, 255, 0.28);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.65);
  padding: 22px 26px;
}

.menu-header {
  text-align: center;
  margin-bottom: 18px;
}

.menu-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #74c0fc;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(116, 192, 252, 0.4);
  padding: 3px 10px;
  margin-bottom: 8px;
}

.menu-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffd43b;
  text-shadow: 4px 4px 0 #c92a2a;
  margin-bottom: 6px;
}

.menu-subtitle {
  font-size: 14px;
  color: #c8d3eb;
}

.map-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.map-card {
  background: #1b2234;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.1s, border-color 0.12s, background 0.12s;
}

.map-card:hover {
  transform: translateY(-3px);
  background: #232c44;
  border-color: rgba(255, 255, 255, 0.45);
}

.map-card.selected {
  background: #253454;
  border-color: #ffd43b;
  box-shadow: 4px 4px 0 #c92a2a;
}

.map-card.locked {
  opacity: 0.72;
}

.map-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-num {
  font-size: 11px;
  font-weight: 900;
  color: #74c0fc;
}

.map-size-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  background: #2d3852;
  color: #d0ebff;
}

.map-size-tag.hot {
  background: #e8590c;
  color: #fff3bf;
}

.map-card-title {
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
}

.map-card-desc {
  font-size: 12px;
  color: #b8c4de;
  line-height: 1.5;
  flex: 1;
}

.map-card-meta {
  font-size: 11px;
  font-weight: 700;
  color: #ffd43b;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 7px;
}

.menu-controls-guide {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  padding: 10px 12px;
  background: rgba(10, 13, 22, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  color: #c2cde4;
  margin-bottom: 18px;
}

.menu-controls-guide b {
  color: #ffd43b;
  margin-right: 3px;
}

.menu-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.start-btn {
  appearance: none;
  background: linear-gradient(180deg, #ffd43b, #f59f00);
  color: #161616;
  border: 3px solid #fff9db;
  box-shadow: 5px 5px 0 #c92a2a;
  padding: 12px 34px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.08s;
}

.start-btn:hover { transform: translate(-2px, -2px); }
.start-btn:active { transform: translate(2px, 2px); }

.sandbox-toggle-btn {
  appearance: none;
  background: #232b3e;
  color: #d0ebff;
  border: 2px solid rgba(116, 192, 252, 0.4);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.55);
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.sandbox-toggle-btn.on {
  background: #1c7ed6;
  border-color: #fff3bf;
  color: #ffffff;
}

@media (max-width: 760px) {
  .map-cards { grid-template-columns: 1fr; }
  .hud-top { flex-wrap: wrap; }
  .weapon-slot { min-width: 68px; padding: 5px 6px; }
}
