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

body, html {
  width: 100%;
  height: 100%;
  background-color: #0c0f0d;
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 520px; /* 经典手机竖屏 9:16 居中自适应 */
  background: #0a0f0c;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
}

canvas#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 顶部战斗 HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 14px 16px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

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

.badge {
  background: rgba(16, 21, 18, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #ece7db;
  display: flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(8px);
}

.exp-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(26, 36, 30, 0.8);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.exp-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #46b171, #57c584);
  transition: width 0.15s ease-out;
}

/* 城墙血条 */
.wall-hp-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 21, 18, 0.7);
  padding: 4px 10px;
  border-radius: 12px;
  width: fit-content;
}

.wall-bar {
  width: 120px;
  height: 6px;
  background: #2a352e;
  border-radius: 3px;
  overflow: hidden;
}

.wall-fill {
  width: 100%;
  height: 100%;
  background: #46b171;
  transition: width 0.2s, background 0.3s;
}

.wall-num {
  font-size: 11px;
  font-weight: 800;
  color: #ece7db;
  font-variant-numeric: tabular-nums;
}

/* 低血量红晕 + 受击闪屏 + 战斗横幅 */
#vignette {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(185, 28, 28, 0.55) 100%);
  animation: vignette-pulse 1.1s ease-in-out infinite;
}

@keyframes vignette-pulse {
  50% { filter: brightness(1.35); }
}

#screen-flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: rgba(239, 68, 68, 0.35);
  opacity: 0;
}

#screen-flash.play {
  animation: screen-flash 0.22s ease-out;
}

@keyframes screen-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.battle-banner {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  pointer-events: none;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ece7db;
  text-shadow: 0 2px 0 rgba(8, 14, 10, 0.9), 0 0 24px rgba(212, 175, 55, 0.9);
  padding: 10px 26px;
  border-top: 2px solid rgba(212, 175, 55, 0.7);
  border-bottom: 2px solid rgba(212, 175, 55, 0.7);
  background: linear-gradient(90deg, transparent, rgba(8, 14, 10, 0.75) 18%, rgba(8, 14, 10, 0.75) 82%, transparent);
  opacity: 0;
  white-space: nowrap;
}

.battle-banner.play {
  animation: banner-in 1.7s ease-out forwards;
}

.battle-banner.elite {
  top: 33%;
  font-size: 19px;
  color: #e9d5ff;
  border-color: rgba(168, 85, 247, 0.8);
  text-shadow: 0 2px 0 rgba(8, 14, 10, 0.9), 0 0 22px rgba(168, 85, 247, 1);
  animation-duration: 1.8s;
}

.battle-banner.boss {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.8);
  text-shadow: 0 2px 0 rgba(8, 14, 10, 0.9), 0 0 26px rgba(239, 68, 68, 1);
  animation-duration: 2s;
}

@keyframes banner-in {
  0% { opacity: 0; transform: translateX(-50%) scale(1.6); }
  12% { opacity: 1; transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(0.96); }
}

/* 模态弹窗 */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 14, 10, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
  transition: opacity 0.2s;
}

.hidden {
  display: none !important;
}

/* 肉鸽技能三选一 */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.skill-card {
  background: linear-gradient(135deg, #1c2620, #10150f);
  border: 2px solid rgba(212, 175, 55, 0.75);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2);
}

.skill-card:active, .skill-card:hover {
  transform: scale(1.03);
  border-color: #e8cf7a;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
}

.card-icon {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-info h4 {
  color: #ffffff;
  font-size: 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-info p {
  color: #98a19a;
  font-size: 12px;
  line-height: 1.4;
}

.card-lvl {
  font-size: 12px;
  color: #e8cf7a;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 999px;
  padding: 1px 8px;
}

/* 三选一卡片依次入场 */
.cards-container .skill-card {
  animation: card-in 0.3s ease-out backwards;
}
.cards-container .skill-card:nth-child(2) { animation-delay: 0.08s; }
.cards-container .skill-card:nth-child(3) { animation-delay: 0.16s; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

/* 商业化局外大厅 */
.lobby-box {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(160deg, rgba(26, 36, 30, 0.97), rgba(8, 14, 10, 0.97));
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 20px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #ece7db;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: modal-pop 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(22px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.btn-primary {
  background: linear-gradient(90deg, #2c8a4f, #46b171);
  border: none;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  padding: 14px 24px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
  transition: transform 0.1s;
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-primary.ghost {
  background: #2a352e;
  font-size: 15px;
  padding: 10px;
  box-shadow: none;
}

.btn-primary.compact,
.btn-ad.compact {
  font-size: 12px;
  padding: 6px 12px;
  width: auto;
}

.btn-ad {
  background: linear-gradient(90deg, #efd88a, #d4af37 60%, #a8842a);
  border: none;
  color: #241a06;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
  position: relative;
  overflow: hidden;
}

/* 广告按钮流光扫过，买量感 */
.btn-ad:not(.compact)::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: btn-shine 2.4s ease-in-out infinite;
}

@keyframes btn-shine {
  0%, 55% { left: -60%; }
  100% { left: 130%; }
}

.btn-ad:active {
  transform: scale(0.96);
}

.upgrades-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.upgrade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(26, 36, 30, 0.7);
  padding: 8px 12px;
  border-radius: 10px;
}

.resource-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  color: #ece7db;
}
.resource-row span {
  background: rgba(26, 36, 30, 0.8);
  border-radius: 10px;
  padding: 6px 8px;
}
.up-title { font-weight: 700; }
.up-desc { font-size: 11px; color: #98a19a; }
.modal-title { margin-bottom: 6px; font-size: 22px; }
.modal-title.big {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #f5e6b8 20%, #e8cf7a 55%, #d4af37);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 3px 10px rgba(212, 175, 55, 0.45));
}
.modal-title.cyan { color: #e8cf7a; text-shadow: 0 0 12px rgba(212, 175, 55, 0.8); }
.modal-title.red { color: #ef4444; text-shadow: 0 0 14px #ef4444; font-size: 26px; }
.modal-title.green { color: #57c584; text-shadow: 0 0 14px #46b171; font-size: 26px; }
.modal-sub { color: #98a19a; font-size: 13px; margin-bottom: 8px; }
.badge.fps { border-color: rgba(16, 185, 129, 0.45); color: #6ee7b7; font-variant-numeric: tabular-nums; }
.btn-cta {
  background: linear-gradient(90deg, #ff8ba4, #e8434f 60%, #a92836);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
}
.btn-primary:disabled,
.btn-ad:disabled { opacity: 0.45; cursor: not-allowed; }

/* 已解锁装备栏 */
#equip-bar {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.equip-badge {
  background: rgba(16, 21, 18, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fde68a;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 10px;
  backdrop-filter: blur(6px);
  animation: card-in 0.3s ease-out;
}

/* 买量导演模式调试浮窗 (按 H 键切换) */
#director-panel {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  color: #cbd5e1;
  z-index: 90;
  pointer-events: auto;
  line-height: 1.5;
}

/* OASIS 站群回链（大厅底部，引流闭环） */
.oasis-footer {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 175, 55, 0.18);
}

.oasis-footer a {
  color: #98a19a;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-decoration: none;
  transition: color 0.25s;
}

.oasis-footer a:hover { color: #e8cf7a; }

/* 标题贴合站群衬线气质 */
.modal-title.big { font-family: 'Noto Serif SC', serif; }
