/* pvz-contra/style.css - 手机横屏动作射击专用样式 */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  touch-action: none;
}

#contra-app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #0a0e14;
}

/* 主游戏画布 (自动自适应等比充满屏幕) */
#game-canvas {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  display: block;
}

/* 顶部状态栏 HUD */
#hud-bar {
  position: absolute;
  top: env(safe-area-inset-top, 8px);
  left: env(safe-area-inset-left, 12px);
  right: env(safe-area-inset-right, 12px);
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(18, 18, 24, 0.75);
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

#hud-hp {
  font-size: 16px;
  letter-spacing: 2px;
}

#hud-lives {
  color: #81c784;
  font-size: 13px;
  font-weight: 800;
}

.hud-sun-box {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffd600;
  font-weight: 800;
  font-size: 14px;
}

.weapon-badge {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 6px;
  font-weight: 900;
  font-size: 14px;
  color: #000;
  background: #ffeb3b;
  box-shadow: 0 0 8px #ffeb3b;
}

.weapon-S { background: #ffeb3b; box-shadow: 0 0 10px #ffeb3b; }
.weapon-M { background: #00e676; box-shadow: 0 0 10px #00e676; }
.weapon-F { background: #ff3d00; box-shadow: 0 0 10px #ff3d00; color: #fff; }
.weapon-L { background: #00e5ff; box-shadow: 0 0 10px #00e5ff; }
.weapon-P { background: #aed581; }

.hud-score-box {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* 浮动虚拟摇杆 */
#joystick-base {
  position: absolute;
  width: 100px;
  height: 100px;
  margin-left: -50px;
  margin-top: -50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.35);
  pointer-events: none;
  display: none;
  z-index: 20;
}

#joystick-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  background: radial-gradient(circle, #81c784 0%, #2e7d32 100%);
  border: 2px solid #aed581;
  box-shadow: 0 0 12px rgba(129, 199, 132, 0.6);
  pointer-events: none;
}

/* 右手虚拟动作按键区 */
#action-controls {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 16px);
  right: env(safe-area-inset-right, 16px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  z-index: 25;
  pointer-events: none;
}

/* 战术呼叫快捷栏 (阳光技能) */
.tactic-row {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.tactic-btn {
  width: 52px;
  height: 52px;
  background: rgba(33, 33, 33, 0.85);
  border: 2px solid #ffd600;
  border-radius: 12px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.08s, opacity 0.1s;
}

.tactic-btn.pressed {
  transform: scale(0.92);
  background: #ff6f00;
}

.tactic-btn.disabled {
  opacity: 0.45;
  border-color: #757575;
  filter: grayscale(0.8);
}

.tactic-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.tactic-cost {
  color: #ffd600;
  font-size: 9px;
}

/* 主操作大按键 (JUMP & FIRE) */
.main-buttons-row {
  display: flex;
  gap: 16px;
  pointer-events: auto;
}

.action-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.06s;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.btn-jump {
  background: linear-gradient(135deg, #42a5f5, #1565c0);
  border: 3px solid #90caf9;
  color: #fff;
}

.btn-jump.pressed {
  transform: scale(0.9);
  background: #0d47a1;
}

.btn-fire {
  background: linear-gradient(135deg, #ff5252, #c62828);
  border: 3px solid #ff8a80;
  color: #fff;
  width: 82px;
  height: 82px;
}

.btn-fire.pressed {
  transform: scale(0.9);
  background: #b71c1c;
  box-shadow: 0 0 20px #ff1744;
}

/* 模态弹窗 (结算 & 暂停) */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: linear-gradient(180deg, #263238 0%, #102027 100%);
  border: 3px solid #ffd600;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
  color: #fff;
}

.modal-title {
  font-size: 26px;
  font-weight: 900;
  color: #ffd600;
  margin-bottom: 12px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.modal-title-danger {
  color: #ff1744;
}

.modal-btn {
  background: linear-gradient(180deg, #4caf50 0%, #2e7d32 100%);
  border: 2px solid #81c784;
  color: #fff;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 16px;
}

/* 竖屏握持提示 */
#rotate-device-tip {
  display: none;
  position: fixed;
  inset: 0;
  background: #111;
  color: #ffd600;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding: 20px;
}

@media screen and (orientation: portrait) {
  #rotate-device-tip {
    display: flex;
  }
}
