/* ==========================================================================
   《残明狂刀》街机无双实时战斗 HUD 与移动端自适应虚拟手柄样式
   ========================================================================== */

.hud-layer {
  z-index: var(--z-hud);
  pointer-events: none;
  box-shadow: inset 0 0 96px 24px rgba(4, 4, 8, 0.64);
  padding:
    calc(12px + var(--safe-top))
    calc(18px + var(--safe-right))
    calc(14px + var(--safe-bottom))
    calc(18px + var(--safe-left));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-interactive {
  pointer-events: auto;
}

/* ======================== 顶部三栏布局 ======================== */
.hud-top-row {
  display: grid;
  grid-template-columns: minmax(250px, 330px) 1fr auto;
  align-items: start;
  gap: 12px;
  width: 100%;
}

/* ---------- 1. 左上角：鎏金武将圆框头像 + 立体延迟血条 + 护盾 + 无双怒气 ---------- */
.hud-commander {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.hud-avatar-frame {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 3px;
  background: var(--grad-gold-metal);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.85), 0 0 14px rgba(212, 175, 55, 0.35);
  flex-shrink: 0;
}

.hud-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #140f12;
  border: 1.5px solid #1a120b;
}

.hud-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  transform: scale(1.65);
  transform-origin: center 24%;
}

.hud-avatar-img[data-hero="qin"] {
  object-position: center 29%;
  transform: scale(1.82);
  transform-origin: center 30%;
}

.hud-avatar-img[data-hero="shen"] {
  object-position: center 17%;
  transform: scale(1.78);
  transform-origin: center 18%;
}

.hud-avatar-img[data-hero="sun"] {
  object-position: center 23%;
  transform: scale(1.72);
  transform-origin: center 24%;
}

.hud-weapon-lv {
  position: absolute;
  right: -4px;
  bottom: -2px;
  padding: 1px 6px;
  background: linear-gradient(135deg, #b45309, #f59e0b);
  border: 1px solid #fef08a;
  border-radius: 10px;
  font-family: var(--font-num);
  font-size: 0.7rem;
  font-weight: 800;
  color: #fffbeb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.hud-bars-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}

.hud-name-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.hud-hero-name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.1em;
  color: var(--gold-200);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}

.hud-hero-title-sub {
  font-size: 0.9rem;
  opacity: 0.92;
}

.hud-hp-numbers {
  font-family: var(--font-num);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-ivory);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-shield-num {
  color: var(--jade-300);
  margin-left: 5px;
}

/* 猩红立体斜切血槽 + 白色平滑延迟残影条 */
.hud-hp-track {
  position: relative;
  width: 100%;
  height: 15px;
  background: rgba(8, 6, 10, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.58);
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.9), 0 4px 12px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.hud-hp-track.is-low-hp {
  border-color: #ef4444;
  animation: lowHpDanger 1s ease-in-out infinite;
}

.hud-hp-delayed {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(180deg, #ffffff 0%, #fde68a 100%);
  opacity: 0.92;
  transition: width 0.08s linear;
}

.hud-hp-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: var(--grad-crimson-bar);
  box-shadow: inset 0 1px 0 rgba(255, 210, 210, 0.45);
}

.hud-shield-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--grad-shield-bar);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.85);
}

/* 琥珀鎏金无双怒气槽 */
.hud-rage-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-rage-track {
  position: relative;
  flex: 1;
  height: 9px;
  background: rgba(10, 8, 12, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.45);
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  overflow: hidden;
}

.hud-rage-track.is-full {
  border-color: #fef08a;
  animation: rageFlamePulse 1.1s ease-in-out infinite;
}

.hud-rage-fill {
  height: 100%;
  background: var(--grad-rage-bar);
  transition: width 0.08s ease-out;
}

.hud-musou-ready-tag {
  padding: 1px 8px;
  background: linear-gradient(135deg, #dc2626, #b45309);
  border: 1px solid #fef08a;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  color: #fffbeb;
  letter-spacing: 0.06em;
  cursor: pointer;
  pointer-events: auto;
  animation: rageFlamePulse 1s ease-in-out infinite;
  white-space: nowrap;
}

/* 纹银、复活玉佩与实时战斗状态胶囊 */
.hud-resource-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.hud-res-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(10, 8, 13, 0.82);
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: 3px;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.hud-res-chip strong {
  font-family: var(--font-num);
  font-size: 0.84rem;
  color: var(--gold-200);
}

.hud-res-chip.is-jade {
  border-color: rgba(56, 189, 248, 0.45);
}

.hud-res-chip.is-jade strong {
  color: #7dd3fc;
}

.hud-buff-pill {
  padding: 2px 7px;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.hud-buff-pill.is-witch {
  background: rgba(109, 40, 217, 0.85);
  border: 1px solid #e9d5ff;
  color: #faf5ff;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.8);
}

.hud-buff-pill.is-armor {
  background: rgba(180, 83, 9, 0.85);
  border: 1px solid #fde68a;
  color: #fffbeb;
}

.hud-buff-pill.is-berserk {
  background: rgba(185, 28, 28, 0.9);
  border: 1px solid #fca5a5;
  color: #fff1f2;
}

/* ---------- 2. 顶部居中：战区铭牌 + 破阵号角 + 巨型双轨黑金龙纹 Boss 血条 ---------- */
.hud-top-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hud-stage-plaque {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 16px;
  background: linear-gradient(90deg, transparent 0%, rgba(12, 10, 15, 0.88) 15%, rgba(12, 10, 15, 0.88) 85%, transparent 100%);
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  border-bottom: 1px solid rgba(212, 175, 55, 0.35);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}

.stage-act-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--gold-300);
  letter-spacing: 0.1em;
}

.stage-sep {
  color: rgba(212, 175, 55, 0.45);
  font-size: 0.7rem;
}

.stage-room-info {
  font-size: 0.8rem;
  color: var(--text-primary);
}

.stage-wave-badge {
  padding: 1px 8px;
  background: rgba(185, 28, 28, 0.35);
  border: 1px solid rgba(239, 68, 68, 0.52);
  border-radius: 2px;
  font-size: 0.74rem;
  color: #fecaca;
}

.stage-wave-badge.is-cleared {
  background: rgba(21, 128, 61, 0.35);
  border-color: rgba(134, 239, 172, 0.55);
  color: #bbf7d0;
}

/* 破阵向右推进金色号角横幅 */
.hud-advance-banner {
  padding: 6px 20px;
  background: linear-gradient(90deg, rgba(146, 64, 14, 0.92), rgba(185, 28, 28, 0.92));
  border: 1px solid #fef08a;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  color: #fffbeb;
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.55);
  animation: hornPulseRight 0.9s ease-in-out infinite;
}

/* Boss 巨型双轨黑金龙纹首领血条 */
.hud-boss-panel {
  width: min(560px, 50vw);
  padding: 8px 14px 10px;
  background: linear-gradient(180deg, rgba(16, 11, 14, 0.94) 0%, rgba(9, 7, 11, 0.92) 100%);
  border: 1px solid rgba(212, 175, 55, 0.65);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85), 0 0 24px rgba(185, 28, 28, 0.32);
  position: relative;
}

.boss-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.boss-name-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.boss-name {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: #fef08a;
  letter-spacing: 0.12em;
}

.boss-title {
  font-size: 0.76rem;
  color: var(--crimson-300);
}

.boss-phase-tag {
  padding: 1px 8px;
  background: rgba(185, 28, 28, 0.72);
  border: 1px solid rgba(252, 165, 165, 0.65);
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: #fff1f2;
}

.boss-hp-track {
  position: relative;
  width: 100%;
  height: 14px;
  background: rgba(5, 4, 7, 0.95);
  border: 1px solid var(--gold-400);
  overflow: hidden;
}

.boss-hp-delayed {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, #ffffff, #fde68a);
  transition: width 0.1s linear;
}

.boss-hp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, #ff6b6b 0%, #dc2626 48%, #7f1d1d 100%);
}

/* 65% 与 30% 二/三阶段血线刻度 */
.boss-phase-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(254, 240, 138, 0.85);
  box-shadow: 0 0 4px #000;
  z-index: 2;
}

.boss-hp-num-overlay {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-num);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px #000;
  z-index: 3;
}

/* 霸体金盾槽 */
.boss-armor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.boss-armor-label {
  font-size: 0.68rem;
  color: var(--gold-300);
  white-space: nowrap;
}

.boss-armor-track {
  position: relative;
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.45);
  overflow: hidden;
}

.boss-armor-fill {
  height: 100%;
  background: linear-gradient(90deg, #b45309 0%, #f59e0b 55%, #fef08a 100%);
  transition: width 0.08s ease-out;
}

.boss-armor-broken-banner {
  margin-top: 4px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: #fef08a;
  letter-spacing: 0.14em;
  text-shadow: 0 0 10px #ef4444;
}

.boss-phase-roar-banner {
  margin-top: 5px;
  padding: 3px 10px;
  background: linear-gradient(90deg, transparent, rgba(185, 28, 28, 0.88), transparent);
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: #fffbeb;
  letter-spacing: 0.16em;
}

/* ---------- 3. 右上角：实用快捷按钮 + 狂草连斩大字与六阶武学印章 ---------- */
.hud-top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.hud-quick-btns {
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: auto;
}

.hud-mini-btn {
  height: 32px;
  padding: 0 11px;
  background: rgba(11, 9, 14, 0.84);
  border: 1px solid rgba(212, 175, 55, 0.42);
  border-radius: 3px;
  color: var(--gold-200);
  font-family: var(--font-display);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.hud-mini-btn:hover {
  background: rgba(40, 24, 20, 0.92);
  border-color: var(--gold-300);
}

/* 狂草连斩评级台 */
.hud-combo-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 10px 18px;
  background: linear-gradient(270deg, rgba(14, 10, 14, 0.9) 0%, rgba(14, 10, 14, 0.55) 75%, transparent 100%);
  border-right: 3px solid var(--combo-color, #f59e0b);
  position: relative;
  transition: opacity 0.22s ease, transform 0.22s var(--ease-out-expo);
}

.hud-combo-panel.is-inactive {
  opacity: 0;
  transform: translateX(26px);
  pointer-events: none;
}

.combo-main-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.combo-digits-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  transform-origin: right center;
}

.combo-digits-row.pop-anim {
  animation: comboHitPop 0.18s var(--ease-spring);
}

.combo-number {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  font-weight: 900;
  font-style: italic;
  line-height: 0.95;
  background: linear-gradient(180deg, #ffffff 0%, var(--combo-color, #fbbf24) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 4px;
  will-change: transform;
}

.combo-unit {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-ivory);
  text-shadow: 0 2px 8px #000;
}

.combo-bonus-text {
  margin-top: 2px;
  font-size: 0.7rem;
  color: var(--gold-200);
  letter-spacing: 0.04em;
}

.combo-decay-track {
  width: 124px;
  height: 4px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.combo-decay-fill {
  height: 100%;
  background: var(--combo-color, #f59e0b);
  box-shadow: 0 0 8px var(--combo-color, #f59e0b);
}

/* 六阶武学狂草大印章 */
.combo-rank-seal {
  min-width: 50px;
  height: 50px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 9, 13, 0.92);
  border: 2px solid var(--combo-color, #cbd5e1);
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 900;
  color: var(--combo-color, #cbd5e1);
  box-shadow: 0 0 18px var(--combo-color, rgba(203, 213, 225, 0.45)), inset 0 0 10px rgba(255, 255, 255, 0.08);
  transform: rotate(-6deg);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

/* ======================== 顶部居中偏下浮动：传送战门 & 行营铁匠快捷牌（避开右侧 Canvas 战门） ======================== */
.hud-mid-prompts {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-self: center;
  gap: 10px;
  margin: 6px 0 auto;
  max-width: min(820px, 94vw);
  pointer-events: auto;
}

.portal-quick-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px;
  background: linear-gradient(180deg, rgba(24, 16, 22, 0.92), rgba(11, 9, 14, 0.95));
  border: 1px solid var(--portal-color, var(--gold-400));
  border-bottom: 3px solid var(--portal-color, var(--gold-400));
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.82), 0 0 14px rgba(212, 175, 55, 0.22);
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.portal-quick-card:hover {
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.12);
}

.portal-quick-emblem {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.portal-quick-text {
  text-align: left;
}

.portal-quick-title {
  font-family: var(--font-display);
  font-size: 0.96rem;
  color: #fef08a;
}

.portal-quick-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ======================== 底部栏：流派徽记微缩槽 + 桌面端招式冷却角标 ======================== */
.hud-bottom-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

/* 左下：已获流派真实徽记、共鸣、潜能、神兵遗物槽 */
.hud-build-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  max-width: min(740px, 64vw);
  pointer-events: auto;
}

.sect-badge-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px 4px 6px;
  background: rgba(11, 9, 15, 0.88);
  border: 1px solid var(--sect-color, rgba(212, 175, 55, 0.45));
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.75);
  cursor: pointer;
}

.sect-badge-slot.synergy-ready {
  box-shadow: 0 0 14px var(--sect-color, rgba(245, 158, 11, 0.5));
}

.sect-badge-slot img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.sect-badge-count {
  font-family: var(--font-num);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-ivory);
}

.synergy-pill-slot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.88), rgba(153, 27, 27, 0.88));
  border: 1px solid #fde047;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: #fef08a;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
  cursor: pointer;
}

.micro-item-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(16, 13, 20, 0.86);
  border: 1px solid rgba(212, 175, 55, 0.36);
  border-radius: 3px;
  font-size: 0.74rem;
  color: var(--gold-200);
  cursor: pointer;
}

.micro-item-chip.is-relic {
  border-color: rgba(245, 158, 11, 0.58);
  color: #fde68a;
}

/* 右下（桌面端）：简洁招式冷却角标坞 */
.hud-skill-dock {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  pointer-events: auto;
}

body.touch-controls-visible .hud-skill-dock,
body.touch-controls-visible .hud-build-strip {
  /* 触屏虚拟摇杆与五键激活时，流派微缩槽上移至左上状态栏下方，避免与摇杆重叠 */
}

body.touch-controls-visible .hud-skill-dock {
  display: none;
}

body.touch-controls-visible .hud-bottom-row {
  justify-content: center;
  padding-bottom: 4px;
}

body.touch-controls-visible .hud-build-strip {
  max-width: 44vw;
  justify-content: center;
}

.skill-slot-box {
  position: relative;
  width: 54px;
  height: 54px;
  background: linear-gradient(180deg, rgba(24, 19, 24, 0.92), rgba(10, 8, 12, 0.96));
  border: 1.5px solid rgba(212, 175, 55, 0.55);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  cursor: pointer;
}

.skill-slot-box.is-musou {
  width: 60px;
  height: 60px;
  border-color: rgba(245, 158, 11, 0.75);
}

.skill-slot-box.is-musou.is-ready {
  border-color: #fef08a;
  background: linear-gradient(160deg, #991b1b, #b45309);
  animation: rageFlamePulse 1.1s ease-in-out infinite;
}

/* 扇形实时冷却遮罩 */
.skill-cd-sweep {
  position: absolute;
  inset: 0;
  background: conic-gradient(rgba(5, 4, 8, 0.84) var(--cd-deg, 0deg), transparent 0deg);
  pointer-events: none;
}

.skill-slot-kanji {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-ivory);
  z-index: 2;
  line-height: 1.1;
}

.skill-slot-sub {
  font-family: var(--font-num);
  font-size: 0.68rem;
  color: var(--gold-300);
  z-index: 2;
}

.skill-cd-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fef08a;
  text-shadow: 0 1px 6px #000;
  z-index: 3;
}

.skill-key-cap {
  position: absolute;
  top: 2px;
  left: 3px;
  font-family: var(--font-num);
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(245, 212, 122, 0.82);
  z-index: 3;
}

.dash-pips-row {
  display: flex;
  gap: 3px;
  margin-top: 2px;
  z-index: 2;
}

.dash-pip-dot {
  width: 7px;
  height: 4px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.dash-pip-dot.is-full {
  background: #38bdf8;
  box-shadow: 0 0 5px #38bdf8;
}

/* ======================== 移动端/触屏自适应虚拟手柄 (touch.js) ======================== */
.touch-layer {
  z-index: var(--z-touch);
  pointer-events: none;
  touch-action: none;
}

/* 左下灵敏半透明玄黑鎏金罗盘摇杆区 */
.touch-joystick-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46%;
  height: 62%;
  pointer-events: auto;
  touch-action: none;
}

.joystick-base {
  position: absolute;
  left: calc(34px + var(--safe-left));
  bottom: calc(28px + var(--safe-bottom));
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, rgba(10, 8, 14, 0.62) 72%, rgba(212, 175, 55, 0.18) 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.48);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.65), inset 0 0 18px rgba(212, 175, 55, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.joystick-base.is-active {
  border-color: rgba(253, 224, 71, 0.88);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75), 0 0 20px rgba(245, 158, 11, 0.42);
}

/* 罗盘四方刻度装饰 */
.joystick-compass-ring {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px dashed rgba(212, 175, 55, 0.28);
  pointer-events: none;
}

.joystick-stick {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fef08a 0%, #d4af37 45%, #785512 100%);
  border: 2px solid #fffbeb;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8), 0 0 14px rgba(212, 175, 55, 0.55);
  pointer-events: none;
  will-change: transform;
}

/* 右下人体工学扇形五大街机按键簇 */
.touch-buttons-cluster {
  position: absolute;
  right: calc(22px + var(--safe-right));
  bottom: calc(20px + var(--safe-bottom));
  width: 230px;
  height: 220px;
  pointer-events: none;
  touch-action: none;
}

.touch-btn {
  position: absolute;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
  background: radial-gradient(circle at 50% 35%, rgba(36, 26, 28, 0.88), rgba(11, 9, 14, 0.92));
  border: 2px solid rgba(212, 175, 55, 0.62);
  color: var(--text-ivory);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 240, 195, 0.25);
  overflow: hidden;
  transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.touch-btn.is-pressed {
  transform: scale(0.91);
  border-color: #fef08a;
  box-shadow: 0 0 22px rgba(253, 224, 71, 0.85), inset 0 0 16px rgba(245, 158, 11, 0.55);
}

/* 核心主按键【斩】84px */
.touch-btn-attack {
  right: 8px;
  bottom: 10px;
  width: 86px;
  height: 86px;
  background: radial-gradient(circle at 45% 32%, #dc2626 0%, #991b1b 58%, #450a0a 100%);
  border: 2.5px solid #fde68a;
  box-shadow: 0 8px 26px rgba(185, 28, 28, 0.68), inset 0 0 16px rgba(255, 235, 180, 0.3);
}

.touch-btn-attack .t-kanji {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 900;
  color: #fffbeb;
}

/* 环绕四副键扇形坐标 (半径约 108px 环绕主斩键) */
.touch-btn-dash {
  right: 118px;
  bottom: 6px;
  width: 58px;
  height: 58px;
  border-color: rgba(56, 189, 248, 0.72);
}

.touch-btn-skill {
  right: 112px;
  bottom: 76px;
  width: 62px;
  height: 62px;
  border-color: rgba(249, 115, 22, 0.78);
}

.touch-btn-jump {
  right: 64px;
  bottom: 126px;
  width: 56px;
  height: 56px;
}

.touch-btn-musou {
  right: 2px;
  bottom: 118px;
  width: 64px;
  height: 64px;
  border-color: rgba(245, 158, 11, 0.85);
}

.touch-btn-musou.is-ready {
  background: radial-gradient(circle, #f59e0b 0%, #dc2626 65%, #7f1d1d 100%);
  border-color: #fef08a;
  animation: rageFlamePulse 1s ease-in-out infinite;
}

.touch-btn .t-kanji {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  z-index: 2;
  line-height: 1;
}

.touch-btn .t-sub {
  font-family: var(--font-num);
  font-size: 0.64rem;
  color: var(--gold-200);
  z-index: 2;
  margin-top: 2px;
}

.touch-btn-cd-sweep {
  position: absolute;
  inset: 0;
  background: conic-gradient(rgba(5, 4, 8, 0.82) var(--cd-deg, 0deg), transparent 0deg);
  pointer-events: none;
}

/* 小屏手机 HUD 与虚拟按键紧凑化防遮挡 */
@media (max-width: 860px), (max-height: 460px) {
  .hud-layer {
    padding:
      calc(6px + var(--safe-top))
      calc(10px + var(--safe-right))
      calc(8px + var(--safe-bottom))
      calc(10px + var(--safe-left));
  }
  .hud-top-row {
    grid-template-columns: minmax(185px, 238px) 1fr auto;
    gap: 6px;
  }
  .hud-avatar-frame {
    width: 46px;
    height: 46px;
  }
  .hud-hero-name {
    font-size: 0.94rem;
  }
  .hud-hero-title-sub,
  .hud-esc-kbd {
    display: none;
  }
  .hud-mini-btn {
    height: 28px;
    padding: 0 9px;
    font-size: 0.78rem;
  }
  .hud-stage-plaque {
    padding: 4px 10px;
    gap: 6px;
  }
  .stage-act-title {
    font-size: 0.82rem;
  }
  .stage-room-info {
    font-size: 0.74rem;
  }
  .hud-hp-track {
    height: 11px;
  }
  .hud-rage-track {
    height: 7px;
  }
  .hud-boss-panel {
    width: min(380px, 46vw);
    padding: 5px 10px 6px;
  }
  .boss-name {
    font-size: 0.96rem;
  }
  .combo-number {
    font-size: 1.9rem;
  }
  .combo-rank-seal {
    min-width: 38px;
    height: 38px;
    font-size: 1.05rem;
  }
  .portal-quick-card {
    padding: 4px 9px;
    gap: 6px;
  }
  .portal-quick-emblem {
    width: 24px;
    height: 24px;
  }
  .portal-quick-title {
    font-size: 0.84rem;
  }
  .portal-quick-sub {
    display: none;
  }
  .joystick-base {
    width: 108px;
    height: 108px;
    left: calc(18px + var(--safe-left));
    bottom: calc(16px + var(--safe-bottom));
  }
  .joystick-stick {
    width: 44px;
    height: 44px;
  }
  .touch-buttons-cluster {
    transform: scale(0.84);
    transform-origin: bottom right;
    right: calc(10px + var(--safe-right));
    bottom: calc(10px + var(--safe-bottom));
  }
}

@media (max-width: 520px) and (orientation: portrait) {
  .hud-top-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .hud-top-center {
    grid-column: 1 / -1;
    order: 3;
  }
  .hud-boss-panel {
    width: 94vw;
  }
}
