/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a1a2a 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Courier New', monospace;
  overflow: hidden;
}

#gameContainer {
  position: relative;
  width: 1024px;
  height: 576px;
  border: 3px solid #4a3d6c;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(100, 80, 180, 0.5), inset 0 0 60px rgba(0,0,0,0.8);
  cursor: crosshair;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  background: #0a0a1a;
}

/* 屏幕覆盖层 */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(10,10,26,0.98), rgba(26,10,46,0.95));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

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

h1 {
  color: #f59e42;
  font-size: 56px;
  margin-bottom: 10px;
  text-shadow: 0 0 20px #f59e42, 0 0 40px #ff8800, 3px 3px 0 #2a1a4a;
  letter-spacing: 8px;
}

.subtitle {
  color: #a0a0c0;
  font-size: 18px;
  margin-bottom: 40px;
  letter-spacing: 4px;
}

/* 按钮样式 */
.btn {
  padding: 16px 48px;
  font-size: 20px;
  margin: 10px;
  cursor: pointer;
  background: linear-gradient(180deg, #4a3d6c, #2a1a4a);
  border: 2px solid #6a5d8c;
  border-radius: 4px;
  color: #f59e42;
  font-family: inherit;
  letter-spacing: 2px;
  transition: all 0.15s;
}

.btn:hover {
  background: linear-gradient(180deg, #5a4d7c, #3a2a5a);
  box-shadow: 0 0 25px rgba(245,158,66,0.6);
  transform: translateY(-2px);
  border-color: #8a7dac;
}

/* 控制说明 */
.controls {
  color: #8080a0;
  font-size: 13px;
  margin-top: 30px;
  line-height: 1.8;
  text-align: center;
}

.controls span {
  color: #f59e42;
}

/* UI 层 */
#ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* 血条/经验条 */
.bar-container {
  position: absolute;
  background: rgba(0,0,0,0.7);
  border: 2px solid #3a3a5a;
  border-radius: 3px;
  overflow: hidden;
}

#hpContainer {
  top: 15px;
  left: 15px;
  width: 220px;
  height: 22px;
}

#expContainer {
  top: 42px;
  left: 15px;
  width: 180px;
  height: 14px;
}

.bar {
  height: 100%;
  transition: width 0.2s;
}

#hpBar {
  width: 100%;
  background: linear-gradient(90deg, #8b0000, #cc0000, #ff3333);
}

#expBar {
  width: 0%;
  background: linear-gradient(90deg, #4a90d9, #67a7e8, #87ceeb);
}

.bar-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  text-shadow: 1px 1px 2px #000;
}

/* 波次信息 */
#waveInfo {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  color: #f59e42;
  font-size: 20px;
  background: rgba(0,0,0,0.6);
  padding: 8px 25px;
  border-radius: 20px;
}

/* 金币显示 */
#coins {
  position: absolute;
  bottom: 15px;
  left: 15px;
  color: #ffd700;
  font-size: 18px;
  font-weight: bold;
  background: rgba(0,0,0,0.6);
  padding: 10px 20px;
  border-radius: 8px;
}

/* 武器信息 */
#weaponInfo {
  position: absolute;
  bottom: 15px;
  right: 15px;
  color: #fff;
  font-size: 16px;
  text-align: right;
  background: rgba(0,0,0,0.6);
  padding: 12px 20px;
  border-radius: 8px;
}

.weapon-slot {
  display: inline-block;
  width: 32px;
  height: 32px;
  margin: 0 4px;
  background: rgba(0,0,0,0.5);
  border: 2px solid #4a4a6a;
  border-radius: 4px;
}

.weapon-slot.active {
  border-color: #f59e42;
  box-shadow: 0 0 10px rgba(245,158,66,0.6);
}

/* BOSS 血条 */
#bossHealthContainer {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  display: none;
}

#bossHealthBar {
  width: 100%;
  height: 25px;
  background: rgba(0,0,0,0.8);
  border: 3px solid #8b0000;
  border-radius: 4px;
  overflow: hidden;
}

#bossHealthFill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #8b0000, #cc0000, #ff3333);
  transition: width 0.3s;
}

#bossHealthText {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 14px;
  line-height: 23px;
  text-align: center;
  text-shadow: 2px 2px 4px #000;
}

/* 升级面板 */
#upgradePanel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(30,20,50,0.98);
  border: 3px solid #6a5d8c;
  border-radius: 12px;
  padding: 30px 40px;
  text-align: center;
  pointer-events: auto;
}

#upgradePanel.hidden {
  display: none;
}

#upgradePanel h2 {
  color: #f59e42;
  font-size: 32px;
  margin-bottom: 20px;
}

.upgrade-options {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.upgrade-card {
  width: 180px;
  padding: 20px;
  background: rgba(50,40,70,0.6);
  border: 2px solid #4a3d6c;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.upgrade-card:hover {
  background: rgba(70,60,90,0.8);
  border-color: #f59e42;
  transform: translateY(-5px);
}

.upgrade-card .icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.upgrade-card .name {
  color: #f59e42;
  font-size: 16px;
  margin-bottom: 8px;
  font-weight: bold;
}

.upgrade-card .desc {
  color: #a0a0c0;
  font-size: 12px;
  line-height: 1.5;
}

/* 伤害数字 */
.damage-number {
  position: absolute;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  pointer-events: none;
  animation: damageFloat 1s ease-out forwards;
  z-index: 60;
}

.damage-number.crit {
  color: #ffd700;
  font-size: 28px;
}

@keyframes damageFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px) scale(1.3);
  }
}

/* v7.0 技能栏 */
#skillInfo {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 50;
}

#skillSlots {
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 15px;
  border-radius: 8px;
  border: 2px solid #4a3d6c;
}

.skill-slot {
  width: 50px;
  height: 50px;
  background: rgba(30, 30, 50, 0.9);
  border: 2px solid #666;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  transition: all 0.2s;
  cursor: pointer;
}

.skill-slot:hover {
  border-color: #fff;
  transform: scale(1.1);
}

#skillBulletTime { border-color: #f0f; }
#skillAirstrike { border-color: #f80; }
#skillFlash { border-color: #0ff; }

/* v7.0 成就通知 */
.achievement-notification {
  position: fixed;
  top: 20px;
  right: -400px;
  background: linear-gradient(135deg, rgba(20,10,40,0.98), rgba(40,20,60,0.95));
  border: 3px solid #f59e42;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  gap: 15px;
  z-index: 1000;
  transition: right 0.5s ease;
  box-shadow: 0 0 30px rgba(245,158,66,0.5);
}

.achievement-notification.show {
  right: 20px;
}

.achievement-notification .achievement-icon {
  font-size: 48px;
  animation: achievementPulse 1s infinite;
}

@keyframes achievementPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.achievement-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.achievement-title {
  color: #f59e42;
  font-size: 14px;
  font-weight: bold;
}

.achievement-name {
  color: #fff;
  font-size: 18px;
  font-weight: bold;
}

.achievement-desc {
  color: #aaa;
  font-size: 12px;
}

/* v7.0 成就面板 */
.achievement-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(20,10,40,0.98), rgba(40,20,60,0.95));
  border: 3px solid #f59e42;
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 0 50px rgba(245,158,66,0.5);
}

.achievement-panel h2 {
  color: #f59e42;
  margin-bottom: 20px;
  text-align: center;
}

.achievement-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(30,20,50,0.5);
  padding: 15px;
  border-radius: 8px;
  border: 2px solid #4a3d6c;
}

.achievement-item.unlocked {
  border-color: #f59e42;
  background: rgba(245,158,66,0.1);
}

.achievement-item .achievement-icon {
  font-size: 36px;
}

.achievement-item .achievement-info {
  flex: 1;
}

.achievement-item .achievement-name {
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 5px;
}

.achievement-item .achievement-desc {
  color: #aaa;
  font-size: 13px;
}

.achievement-item .achievement-status {
  font-size: 24px;
}

/* v7.0 无尽模式通知 */
.endless-notification {
  position: fixed;
  top: 100px;
  right: -500px;
  background: linear-gradient(135deg, rgba(40,10,60,0.98), rgba(60,20,80,0.95));
  border: 3px solid #f0f;
  border-radius: 12px;
  padding: 25px;
  display: flex;
  gap: 20px;
  z-index: 1000;
  transition: right 0.5s ease;
  box-shadow: 0 0 40px rgba(255,0,255,0.5);
}

.endless-notification.show {
  right: 20px;
}

.endless-notification .endless-icon {
  font-size: 56px;
  animation: endlessRotate 2s infinite linear;
}

@keyframes endlessRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.endless-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.endless-title {
  color: #f0f;
  font-size: 20px;
  font-weight: bold;
}

.endless-desc {
  color: #aaa;
  font-size: 14px;
}

/* v7.0 无尽排行榜 */
.endless-leaderboard {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(40,10,60,0.98), rgba(60,20,80,0.95));
  border: 3px solid #f0f;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 0 50px rgba(255,0,255,0.5);
}

.endless-leaderboard h2 {
  color: #f0f;
  margin-bottom: 20px;
  text-align: center;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.leaderboard-item {
  display: flex;
  gap: 15px;
  background: rgba(30,20,50,0.5);
  padding: 12px 15px;
  border-radius: 6px;
  border: 2px solid #4a3d6c;
  font-size: 14px;
}

.leaderboard-item .rank {
  color: #f0f;
  font-weight: bold;
  width: 40px;
}

.leaderboard-item .wave {
  color: #fff;
  flex: 1;
}

.leaderboard-item .kills {
  color: #fd0;
  width: 80px;
}

.leaderboard-item .date {
  color: #888;
  width: 100px;
  font-size: 12px;
}

.no-records {
  color: #888;
  text-align: center;
  padding: 20px;
}
