/* 荒野幸存者 —— 暗色霓虹风，全程序化视觉 */

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #0b0e14;
  color: #e6edf3;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  z-index: 2;
}

#hurt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 120px rgba(255, 30, 30, 0.6);
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 3;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

#xpbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
}
#xpfill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2f9e44, #6bcb77);
  transition: width 0.15s;
}

#hud-top {
  position: fixed;
  top: 12px; left: 12px; right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#hpwrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 340px;
}
#hpbar {
  flex: 1;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
}
#hpfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3fbf5f, #6bcb77);
  transition: width 0.15s;
}
#hptext { font-size: 13px; color: #c9d4de; white-space: nowrap; }

#timer {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: #e6edf3;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}
#timer.danger { color: #ff4757; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

#hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 340px;
  justify-content: flex-end;
}
#kills { font-size: 14px; color: #c9d4de; white-space: nowrap; }

.hbtn {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e6edf3;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  min-height: 36px;
}
.hbtn:hover { background: rgba(255, 255, 255, 0.2); }

#level-badge {
  position: fixed;
  top: 42px;
  left: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #6bcb77;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

#bossbar {
  position: fixed;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 72vw);
  text-align: center;
}
#bossname {
  font-size: 13px;
  font-weight: 700;
  color: #ff6b6b;
  letter-spacing: 3px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
#bosstrack {
  margin-top: 3px;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.5);
  border-radius: 6px;
  overflow: hidden;
}
#bossfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #a32035, #ff4757);
  transition: width 0.15s;
}

#weaponbar {
  position: fixed;
  bottom: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 70vw;
}
.wslot {
  position: relative;
  width: 36px;
  height: 36px;
  border: 2px solid var(--c, #fff);
  border-radius: 9px;
  background: rgba(10, 14, 20, 0.75);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--c, #fff);
}
.wslot i {
  position: absolute;
  bottom: -5px;
  right: -5px;
  font-size: 10px;
  font-style: normal;
  background: #11161f;
  border: 1px solid var(--c, #fff);
  border-radius: 4px;
  padding: 0 3px;
  line-height: 1.3;
}
.wslot.evo { box-shadow: 0 0 10px var(--c, #ffd93d); }
.wslot.pas { border-style: dashed; opacity: 0.9; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 24, 34, 0.92);
  border: 1px solid rgba(255, 217, 61, 0.5);
  color: #ffe9a8;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
#toast.show { animation: toast 2.2s ease forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translateX(-50%) translateY(12px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  82% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- 虚拟摇杆 ---------- */
#joystick {
  position: fixed;
  width: 112px;
  height: 112px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: none;
  pointer-events: none;
  z-index: 5;
}
#joystick.on { display: block; }
#joyknob {
  position: absolute;
  left: 56px;
  top: 56px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

/* ---------- 全屏界面 ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(5, 8, 13, 0.84);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-align: center;
  padding: 24px;
  overflow-y: auto;
}

.screen h1 {
  font-size: clamp(38px, 9vw, 68px);
  letter-spacing: 10px;
  color: #ffd93d;
  text-shadow: 0 0 30px rgba(255, 217, 61, 0.35), 0 4px 12px rgba(0, 0, 0, 0.8);
}
.screen h2 { font-size: clamp(24px, 5vw, 36px); letter-spacing: 4px; }

.sub { color: #9aa7b4; font-size: 15px; }
.gold { color: #ffd93d; }
.red { color: #ff4757; }

.help {
  max-width: 480px;
  color: #9aa7b4;
  font-size: 14px;
  line-height: 1.9;
  text-align: left;
}
.help b { color: #c9d4de; margin-right: 4px; }

.big-btn {
  font-size: 18px;
  padding: 13px 40px;
  min-width: 230px;
  border-radius: 11px;
  border: 1px solid #ffd93d;
  background: rgba(255, 217, 61, 0.12);
  color: #ffd93d;
  cursor: pointer;
  letter-spacing: 2px;
  transition: background 0.15s, transform 0.1s;
}
.big-btn:hover { background: rgba(255, 217, 61, 0.28); transform: translateY(-2px); }
.big-btn:active { transform: translateY(0); }

.records { color: #8b949e; font-size: 13px; }

/* ---------- 升级卡片 ---------- */
#cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
}
.card {
  width: 210px;
  padding: 20px 16px 14px;
  border-radius: 15px;
  background: rgba(20, 26, 36, 0.96);
  border: 2px solid var(--c, #fff);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.card:hover { transform: translateY(-5px) scale(1.03); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 14px var(--c, #fff); }
.card-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--c, #fff);
  border: 1px solid var(--c, #fff);
  border-radius: 5px;
  padding: 1px 8px;
  margin-bottom: 10px;
}
.card-char { font-size: 36px; font-weight: 700; color: var(--c, #fff); }
.card-name { font-size: 17px; font-weight: 700; margin: 8px 0 6px; }
.card-desc { font-size: 13px; color: #9aa7b4; line-height: 1.6; min-height: 40px; }
.card-key { margin-top: 10px; font-size: 11px; color: #5d6a77; }

/* ---------- 结算统计 ---------- */
.stats { width: min(360px, 88vw); }
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.14);
  font-size: 15px;
}
.stat-row span { color: #9aa7b4; }
.stat-row b { color: #e6edf3; font-variant-numeric: tabular-nums; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 640px) {
  .card { width: min(78vw, 300px); padding: 14px; }
  .card-desc { min-height: 0; }
  #cards { flex-direction: column; align-items: center; gap: 10px; }
  #timer { font-size: 16px; }
  #hpwrap { flex-basis: 150px; }
  #hptext { display: none; }
  .hbtn { padding: 6px 9px; font-size: 12px; }
  .screen h1 { letter-spacing: 5px; }
  .help { font-size: 13px; }
}
