:root {
  --bg: #0b1016;
  --panel: rgba(12, 19, 27, 0.82);
  --teal: #38e1cf;
  --red: #ff4655;
  --orange: #ff9a2e;
  --text: #ece8e1;
  --dim: #8f9aa5;
  --line: rgba(255, 255, 255, 0.12);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05080c;
  font-family: "Bahnschrift", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

#view {
  position: fixed;
  inset: 0;
  display: block;
  background: #05080c;
  touch-action: none;
}

.hidden { display: none !important; }

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

/* 小地图 */
#minimap-wrap {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  left: calc(18px + env(safe-area-inset-left));
  width: 168px;
  height: 168px;
  padding: 6px;
  background: rgba(8, 14, 20, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
#minimap { width: 100%; height: 100%; }

/* 回合信息 */
#round-info {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background: rgba(8, 14, 20, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 26px;
  backdrop-filter: blur(4px);
}
#round-label {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--teal);
}
#enemies-left { font-size: 12px; color: var(--dim); letter-spacing: 1px; margin-top: 2px; }

/* 击杀播报 */
#kill-feed {
  position: absolute;
  top: calc(86px + env(safe-area-inset-top));
  right: calc(20px + env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.feed-item {
  background: rgba(10, 16, 23, 0.82);
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  padding: 6px 12px;
  font-size: 13px;
  letter-spacing: 1px;
  border-radius: 4px;
  animation: feedIn 0.25s ease;
}
@keyframes feedIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 生命与护甲 */
#hp-wrap {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  bottom: calc(26px + env(safe-area-inset-bottom));
  width: 320px;
}
#agent-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--teal);
  margin-bottom: 6px;
}
.bar-shell {
  position: relative;
  height: 18px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}
#hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #1fbf9c, #38e1cf);
  transition: width 0.15s ease;
  border-radius: 3px;
}
#shield-fill {
  height: 100%;
  background: linear-gradient(90deg, #2f6bff, #4f8cff);
  transition: width 0.15s ease;
}
#hp-text {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
#shield-text {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  color: #cfe0ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* 技能 */
#ability-wrap {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  bottom: calc(122px + env(safe-area-inset-bottom));
  width: 168px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#ability-wrap.ready { border-color: var(--teal); box-shadow: 0 0 16px rgba(56, 225, 207, 0.25); }
#ability-top { display: flex; align-items: center; gap: 10px; }
#ability-key {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 700;
  color: var(--teal);
}
#ability-name { font-size: 14px; font-weight: 700; letter-spacing: 1px; }
#ability-cd {
  margin-left: auto;
  font-size: 18px;
  font-weight: 700;
  color: var(--orange);
}
.bar-thin {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
#ability-bar {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
}

/* 弹药 */
#ammo-wrap {
  position: absolute;
  right: calc(26px + env(safe-area-inset-right));
  bottom: calc(26px + env(safe-area-inset-bottom));
  text-align: right;
}
#ammo-count {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 2px;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}
#ammo-reserve { font-size: 16px; color: var(--dim); margin-left: 8px; }
#weapon-name {
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--dim);
}
#reload-hint {
  margin-top: 6px;
  height: 3px;
  width: 150px;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
}
#reload-hint.show { opacity: 1; }
#reload-fill {
  height: 100%;
  background: var(--orange);
}

/* 准星 */
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.ch-line {
  position: absolute;
  width: 2px;
  height: 9px;
  background: #0a0f14;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65), 0 0 4px rgba(0, 0, 0, 0.45);
}
#ch-t { left: 0; top: 0; transform: translate(-50%, -8px); }
#ch-b { left: 0; top: 0; transform: translate(-50%, 8px); }
#ch-l { left: 0; top: 0; transform: translate(-8px, -50%); width: 9px; height: 2px; }
#ch-r { left: 0; top: 0; transform: translate(8px, -50%); width: 9px; height: 2px; }
#ch-dot {
  position: absolute;
  left: 0; top: 0;
  width: 3px; height: 3px;
  transform: translate(-50%, -50%);
  background: #0a0f14;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

/* 命中标记 */
#hitmarker {
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}
#hitmarker::before, #hitmarker::after {
  content: '';
  position: absolute;
  inset: 0;
}
#hitmarker::before {
  background:
    linear-gradient(45deg, transparent 42%, #fff 42%, #fff 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, #fff 42%, #fff 58%, transparent 58%);
}
#hitmarker::after {
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transform: scale(0.7);
}
#hitmarker.show { animation: hm 0.16s ease; }
#hitmarker.crit::before {
  background:
    linear-gradient(45deg, transparent 42%, #ffb02e 42%, #ffb02e 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, #ffb02e 42%, #ffb02e 58%, transparent 58%);
}
#hitmarker.crit::after { border-color: #ffb02e; }
@keyframes hm {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(0.9); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* 特效遮罩 */
#damage-vignette, #lowhp-vignette, #shield-flash, #overdrive-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
#damage-vignette {
  background: radial-gradient(ellipse at center, rgba(255, 40, 40, 0) 38%, rgba(200, 20, 30, 0.65) 100%);
}
#lowhp-vignette {
  background: radial-gradient(ellipse at center, rgba(255, 60, 50, 0) 46%, rgba(160, 10, 20, 0.55) 100%);
}
#shield-flash {
  background: radial-gradient(ellipse at center, rgba(80, 140, 255, 0) 45%, rgba(60, 110, 255, 0.5) 100%);
}
#overdrive-tint {
  background: radial-gradient(ellipse at center, rgba(255, 150, 40, 0) 50%, rgba(255, 110, 30, 0.42) 100%);
}
#overdrive-timer {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  font-size: 22px;
  font-weight: 700;
  color: var(--orange);
  text-shadow: 0 0 12px rgba(255, 140, 40, 0.8);
}
#dir-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 180px;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}
#dir-wrap::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid rgba(255, 70, 85, 0.9);
  filter: drop-shadow(0 0 6px rgba(255, 70, 85, 0.7));
}

/* 横幅 */
#banner {
  position: absolute;
  left: 50%;
  /* 小屏横屏时下移，避免与顶部回合信息重叠 */
  top: max(26%, 140px);
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
#banner.show { opacity: 1; }
#banner-title {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--text);
  text-shadow: 0 0 24px rgba(56, 225, 207, 0.45), 0 4px 20px rgba(0, 0, 0, 0.8);
}
#banner-sub {
  margin-top: 8px;
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--dim);
}

/* 触屏按钮 */
#touch-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}
#touch-ui .btn {
  position: absolute;
  pointer-events: auto;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(15, 24, 32, 0.55);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  touch-action: none;
}
#fire-btn { right: calc(26px + env(safe-area-inset-right)); bottom: calc(34px + env(safe-area-inset-bottom)); width: 96px; height: 96px; background: rgba(255, 70, 85, 0.35); border-color: rgba(255, 70, 85, 0.7); }
#reload-btn { right: calc(138px + env(safe-area-inset-right)); bottom: calc(44px + env(safe-area-inset-bottom)); width: 64px; height: 64px; }
#ability-btn { right: calc(150px + env(safe-area-inset-right)); bottom: calc(128px + env(safe-area-inset-bottom)); width: 64px; height: 64px; color: var(--teal); border-color: rgba(56, 225, 207, 0.6); }
#touch-ui #touch-pause-btn {
  right: calc(18px + env(safe-area-inset-right));
  top: calc(18px + env(safe-area-inset-top));
  width: 58px;
  height: 58px;
  font-size: 22px;
  border-color: rgba(255, 255, 255, 0.5);
}
#joy-base {
  position: fixed;
  width: 128px;
  height: 128px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.05);
  display: none;
  pointer-events: none;
}
#joy-base.active { display: block; }
#joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(56, 225, 207, 0.55);
}

/* ============ 覆盖层 ============ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 35%, rgba(10, 20, 28, 0.72), rgba(5, 8, 12, 0.94));
  backdrop-filter: blur(6px);
}

.panel {
  width: min(960px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  text-align: center;
  padding: 44px 40px;
  background: linear-gradient(180deg, rgba(16, 25, 34, 0.95), rgba(9, 14, 20, 0.95));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.game-title {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 12px;
  background: linear-gradient(90deg, var(--teal), #7df3e6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.game-sub {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 6px;
  color: var(--dim);
}

#agent-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 30px 0;
}
.agent-card {
  text-align: left;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.agent-card:hover { transform: translateY(-3px); border-color: var(--accent, var(--teal)); }
.agent-card.selected {
  border-color: var(--accent, var(--teal));
  box-shadow: 0 0 0 1px var(--accent, var(--teal)), 0 10px 30px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.07);
}
.agent-avatar {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #081018;
  margin-bottom: 12px;
}
.agent-name { font-size: 21px; font-weight: 800; letter-spacing: 2px; }
.agent-role {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent, var(--teal));
  border: 1px solid var(--accent, var(--teal));
  border-radius: 999px;
  padding: 2px 10px;
}
.agent-stats {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--dim);
}
.agent-stats span { white-space: nowrap; }
.agent-desc {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.55;
  color: #b8c2cc;
}

.btn-primary {
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 15px 54px;
  color: #06151a;
  background: linear-gradient(90deg, var(--teal), #7df3e6);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(56, 225, 207, 0.35);
}
.btn-mp {
  margin-top: 14px;
  background: linear-gradient(90deg, #4f8cff, #7db3ff);
  color: #06121f;
}
.btn-mp:hover { box-shadow: 0 10px 30px rgba(79, 140, 255, 0.35); }
.btn-ghost {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  padding: 12px 30px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-ghost:hover { border-color: var(--teal); background: rgba(56, 225, 207, 0.1); }

.controls {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  font-size: 12px;
  color: var(--dim);
}
.controls kbd {
  display: inline-block;
  min-width: 26px;
  padding: 3px 7px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: #d7dde3;
  font-family: inherit;
}

#pause h2, #result h2 { font-size: 38px; letter-spacing: 6px; margin-bottom: 22px; }
#pause h2.win, #result h2.win { color: var(--teal); }
#pause h2.lose, #result h2.lose { color: var(--red); }
#pause-agent { color: var(--dim); margin-bottom: 26px; }
.settings-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin: 4px 0 28px;
  flex-wrap: wrap;
  color: var(--dim);
  font-size: 13px;
}
.setting { display: flex; align-items: center; gap: 8px; }
.setting.check { cursor: pointer; }
#sens-range { accent-color: var(--teal); width: 140px; cursor: pointer; }
.setting.check input { accent-color: var(--teal); width: 16px; height: 16px; cursor: pointer; }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

#crosshair.lock .ch-line { background: #ff8a95; box-shadow: 0 0 4px rgba(255, 70, 85, 0.9); }
#crosshair.lock #ch-dot { background: #ff4655; box-shadow: 0 0 6px rgba(255, 70, 85, 0.9); }

#result-stats {
  margin: 26px auto 30px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 460px;
  text-align: left;
}
#result-stats div {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#result-stats span { color: var(--dim); }
#result-stats b { font-size: 17px; letter-spacing: 1px; }

/* ============ 多人对战大厅 ============ */
.mp-panel { max-width: 540px; }
.mp-title { font-size: 30px; letter-spacing: 4px; margin-bottom: 26px; }
.mp-section { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.mp-name-row input, .mp-code-input {
  font-family: inherit;
  font-size: 16px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  text-align: center;
  letter-spacing: 2px;
}
.mp-name-row input { width: 180px; }
.mp-code-input { width: 160px; text-transform: uppercase; }
.mp-name-row input:focus, .mp-code-input:focus { border-color: var(--teal); }
.mp-divider { color: var(--dim); font-size: 12px; letter-spacing: 2px; }
.mp-join-row { display: flex; gap: 10px; align-items: center; }
.mp-error { color: var(--red); font-size: 13px; min-height: 18px; }
.mp-lobby-top { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px; flex-wrap: wrap; }
.mp-role { font-size: 13px; color: var(--teal); letter-spacing: 2px; }
.mp-room-code { font-size: 26px; font-weight: 800; letter-spacing: 4px; color: var(--orange); }
.mp-players { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.mp-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}
.mp-player .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.mp-player .name { font-weight: 700; letter-spacing: 1px; }
.mp-player .tag { margin-left: auto; font-size: 11px; color: var(--dim); letter-spacing: 1px; }
.mp-wait { color: var(--dim); font-size: 13px; letter-spacing: 1px; }

/* 计分板 */
#scoreboard {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  width: 220px;
  background: rgba(8, 14, 20, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  backdrop-filter: blur(4px);
}
#scoreboard-title {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--teal);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#scoreboard-list { display: flex; flex-direction: column; gap: 6px; }
.sb-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sb-row .sb-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sb-row .sb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-row .sb-kills { color: var(--orange); font-weight: 700; }
.sb-row .sb-hp { width: 54px; height: 5px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
.sb-row .sb-hp i { display: block; height: 100%; background: #38e1cf; border-radius: 3px; transition: width 0.15s ease; }
.sb-row.dead .sb-name { color: var(--dim); text-decoration: line-through; }
body.touch #scoreboard { top: calc(92px + env(safe-area-inset-top)); }
#hud.multiplayer #kill-feed { top: calc(150px + env(safe-area-inset-top)); }
body.touch #hud.multiplayer #kill-feed { top: calc(230px + env(safe-area-inset-top)); }
#hud.multiplayer #ability-wrap,
#hud.multiplayer #ability-btn,
#hud.multiplayer #reload-btn { display: none; }

#mute-btn {
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  top: calc(20px + env(safe-area-inset-top));
  z-index: 30;
  font-family: inherit;
  font-size: 13px;
  color: var(--dim);
  background: rgba(10, 16, 23, 0.6);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}
#mute-btn:hover { color: var(--text); border-color: var(--teal); }

/* 触屏设备：右下角给开火/换弹/技能按钮让位，弹药数字（无限）不再与按钮重叠 */
body.touch #ammo-wrap { display: none; }
body.touch #fire-btn {
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 88px;
  height: 88px;
}
body.touch #reload-btn {
  right: calc(120px + env(safe-area-inset-right));
  bottom: calc(30px + env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
}
body.touch #ability-btn {
  right: calc(118px + env(safe-area-inset-right));
  bottom: calc(108px + env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
}
body.touch #mute-btn {
  right: calc(108px + env(safe-area-inset-right));
  top: calc(22px + env(safe-area-inset-top));
  bottom: auto;
}

/* 竖屏提示 */
#portrait-hint {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: #05080c;
  color: var(--text);
  font-size: 20px;
  letter-spacing: 3px;
  text-align: center;
}
#portrait-hint.show { display: flex; }

@media (max-width: 820px) {
  .game-title { font-size: 34px; letter-spacing: 7px; }
  #agent-cards { grid-template-columns: 1fr; }
  .panel { padding: 28px 20px; }
}

/* 横屏手机等紧凑视口：HUD 整体缩小 */
@media (max-width: 900px), (max-height: 500px) {
  #minimap-wrap { width: 116px; height: 116px; }
  #round-info { padding: 6px 16px; }
  #round-label { font-size: 16px; letter-spacing: 2px; }
  #enemies-left { font-size: 11px; }
  #hp-wrap { width: 220px; }
  #ability-wrap { width: 146px; padding: 8px 10px; }
  #banner-title { font-size: 32px; letter-spacing: 5px; }
  #banner-sub { font-size: 13px; letter-spacing: 2px; }
}

/* 更小的横屏（老款手机/小屏）：HUD 再压缩 */
@media (max-height: 380px) {
  #minimap-wrap { width: 92px; height: 92px; }
  #round-label { font-size: 14px; }
  #hp-wrap { width: 180px; }
  #ability-wrap { width: 130px; }
  #hp-text { font-size: 11px; }
  body.touch #fire-btn {
    right: calc(18px + env(safe-area-inset-right));
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: 76px;
    height: 76px;
  }
  body.touch #reload-btn {
    right: calc(112px + env(safe-area-inset-right));
    bottom: calc(26px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
  }
  body.touch #ability-btn {
    right: calc(110px + env(safe-area-inset-right));
    bottom: calc(90px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
  }
  #touch-ui #touch-pause-btn {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }
}
