/* ── 전투 화면 ── */
.hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.hud button, .hud .slot { pointer-events: auto; }

/* 파티 */
.hud-party { position: absolute; left: 12px; top: calc(12px + var(--safe-t)); display: flex; flex-direction: column; gap: 6px; }
.pframe {
  display: flex; align-items: center; gap: 8px; width: 210px;
  padding: 5px 8px 5px 5px; border-radius: 10px;
  background: rgba(14, 14, 16, 0.78); border: 1px solid rgba(74, 66, 52, 0.8);
}
.pframe { pointer-events: auto; cursor: var(--cur-point); }
.pframe:hover { border-color: var(--accent); }
.pframe-me { border-color: rgba(232, 163, 58, 0.7); }
.pframe-dead { filter: grayscale(1); opacity: 0.6; }
.pframe-face { width: 40px; height: 40px; border-radius: 8px; background: #1a1a1a; flex: none; }
.pframe-info { flex: 1; min-width: 0; }
.pframe-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pframe-sub { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.bar-party .bar-fill { background: linear-gradient(180deg, #5ad86a, #2a9a3a); }
.bar-pxp { height: 5px; margin-top: 3px; }
.bar-pxp .bar-fill { background: linear-gradient(180deg, #f6c66a, #b8741c); }
.bar-pxp.is-guard .bar-fill { background: linear-gradient(180deg, #e9cf8f, #9a7428); }

/* 위쪽 가운데: 우두머리·대상 */
.hud-top { position: absolute; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); width: min(520px, 50vw); }
.bossbar { text-align: center; }
.bossbar-name { font-family: var(--font-title); font-size: 22px; color: #ffb0a0; text-shadow: 0 2px 0 #000; margin-bottom: 4px; }
.bar-boss { height: 14px; border-color: #5a1a14; }
.bar-boss .bar-fill { transform: scaleX(var(--hp, 1)); background: linear-gradient(180deg, #ff4a3a, #9a1a10); }
.bossbar .bar-fill { transform: scaleX(var(--hp, 1)); }
.target { text-align: center; width: 260px; margin: 0 auto; }
/* 차원 균열 진행도: 우두머리 막대 위 */
.riftbar { text-align: center; width: min(360px, 100%); margin: 0 auto 8px; }
.riftbar-name { font-size: 13px; font-weight: 700; color: #d8b8ff; text-shadow: 0 1px 2px #000; margin-bottom: 3px; }
.bar-rift { height: 9px; border-color: #3a1a5a; }
.bar-rift .bar-fill { transform: scaleX(var(--p, 0)); background: linear-gradient(180deg, #c07aff, #6a2aa8); }
.riftbar.is-guard .riftbar-name { color: #ffb0a0; }
.riftbar.is-done .riftbar-name { color: var(--good); }
.riftbar.is-done .bar-rift .bar-fill { background: linear-gradient(180deg, #8af09a, #2a9a3a); }
.target-name { font-size: 14px; font-weight: 700; text-shadow: 0 1px 2px #000; margin-bottom: 3px; }
.target-r1 .target-name { color: var(--r1); }
.target-r2 .target-name { color: var(--r2); }
.target-r3 .target-name { color: var(--r3); }
.target-r4 .target-name { color: var(--r4); }
.target-affix { font-size: 12px; color: #d8cdb8; text-shadow: 0 1px 2px #000; margin-top: 3px; min-height: 0; }
.target .bar-fill { transform: scaleX(var(--hp, 1)); }

/* 오른쪽 위: 미니맵 */
.hud-corner { position: absolute; right: 12px; top: calc(12px + var(--safe-t)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.mapbox { background: rgba(14, 14, 16, 0.8); border: 1px solid rgba(74, 66, 52, 0.85); border-radius: 12px; padding: 6px; }
.mapbox-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px 6px; }
.map-name { font-weight: 700; font-size: 13px; color: var(--accent-2); white-space: nowrap; }
.room-chip {
  border: 1px solid var(--line); background: #1e1d1a; border-radius: 6px;
  font-size: 11px; font-weight: 700; padding: 2px 6px; letter-spacing: 0.08em; color: var(--sky);
}
.room-chip:hover { border-color: var(--sky); }
.minimap { display: block; width: 168px; height: 168px; border-radius: 8px; background: #07080b; }
.corner-buttons { display: flex; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; padding: 4px; border-radius: 10px;
  background: rgba(14, 14, 16, 0.8); border: 1px solid rgba(74, 66, 52, 0.85);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn { position: relative; }
.icon-btn.has-points::after {
  content: '+'; position: absolute; right: -5px; top: -5px; width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #1a1208; font-size: 14px; font-weight: 900; line-height: 1;
  box-shadow: 0 0 0 2px #1a140e; animation: orb-pulse 1.2s ease-in-out infinite;
}
.icon-btn img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }
.menu-lines, .menu-lines::before, .menu-lines::after {
  display: block; width: 20px; height: 2px; background: var(--text); border-radius: 1px; position: relative;
}
.menu-lines::before, .menu-lines::after { content: ''; position: absolute; left: 0; }
.menu-lines::before { top: -6px; }
.menu-lines::after { top: 6px; }

/* 안내 문구 */
.hint {
  position: absolute; left: 50%; bottom: calc(132px + var(--safe-b)); transform: translateX(-50%);
  padding: 6px 14px; border-radius: 8px; background: rgba(14, 14, 16, 0.75);
  color: #d8cfbd; font-size: 13px; white-space: nowrap;
}

/* 사망 */
.death {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: calc(150px + var(--safe-b, 0px)); /* 가운데의 묘지를 가리지 않게 아래쪽에 */
  background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.25), rgba(0, 0, 0, 0.6));
}
.death-title { font-family: var(--font-title); font-size: 48px; color: #ff6a5a; text-shadow: 0 3px 0 #000; }
.death-sub { color: #e0d6c6; margin-top: 8px; }

/* 아래: 체력 구슬과 기술 칸 */
.actionbar {
  position: absolute; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 12px;
}
.orb {
  position: relative; width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #2a0a08, #0a0404);
  border: 3px solid #5a4630; box-shadow: 0 0 0 2px #1a140e, 0 6px 20px rgba(0, 0, 0, 0.6);
}
.orb-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  transform-origin: bottom; transform: scaleY(var(--hp, 1));
  background: radial-gradient(circle at 40% 30%, #ff6a5a, #b8180e 60%, #6a0806);
  transition: transform 0.2s ease;
}
.orb-low .orb-fill { animation: orb-pulse 0.8s ease-in-out infinite; }
@keyframes orb-pulse { 50% { filter: brightness(1.5); } }
.orb-shine { position: absolute; left: 18%; top: 10%; width: 40%; height: 28%; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.orb-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; text-shadow: 0 1px 2px #000; }

.actionbar-main { display: flex; flex-direction: column; gap: 6px; }
.slots { display: flex; gap: 6px; padding: 6px; background: rgba(14, 14, 16, 0.82); border: 1px solid rgba(74, 66, 52, 0.85); border-radius: 12px; }
.slot {
  position: relative; width: 58px; height: 58px; border-radius: 10px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #34302a, #16140f); border: 1px solid #3a342a;
}
.slot-icon { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
.slot-cd {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.66);
  transform-origin: bottom; transform: scaleY(var(--cd, 0));
}
.slot-cd-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900; text-shadow: 0 1px 3px #000; }
.slot-key { position: absolute; left: 4px; top: 2px; font-size: 10px; font-weight: 700; color: #d8cfbd; text-shadow: 0 1px 2px #000; }
.slot-count { position: absolute; right: 4px; bottom: 2px; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.slot-potion { border-color: #4a3a22; margin-left: 8px; }
.slot-roll { border-color: #3a2e4a; }
.slot-none .slot-icon { opacity: 0.25; }
.slot-empty .slot-icon { filter: grayscale(1) brightness(0.6); }

.xp { position: relative; height: 12px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); border: 1px solid #2c2820; overflow: hidden; }
.xp-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--xp, 0)); background: linear-gradient(180deg, #f6c66a, #b8741c); transition: transform 0.3s ease; }
.xp-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }

/* 작은 화면 */
@media (max-width: 900px), (max-height: 560px) {
  .pframe { width: 168px; padding: 3px 6px 3px 3px; }
  .pframe-face { width: 32px; height: 32px; }
  .minimap { width: 112px; height: 112px; }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn img { width: 26px; height: 26px; }
  .hud-top { top: calc(10px + var(--safe-t)); width: min(320px, 44vw); }
  .bossbar-name { font-size: 16px; }
  .toast-area { font-size: 26px; }
}

.death-wait { color: #bfb5a6; margin-top: 4px; font-size: 13px; min-height: 18px; }
.death-btn { margin-top: 16px; pointer-events: auto; }

/* 귀환 차원문 정신집중 막대: 단축키 줄 위 가운데 */
.cast {
  position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%);
  width: min(260px, 60vw); pointer-events: none; text-align: center; z-index: 20;
}
.cast-label { font-size: 13px; font-weight: 700; color: #cfe6ff; text-shadow: 0 1px 2px #000; margin-bottom: 4px; }
.cast-bar { height: 10px; border-radius: 6px; background: rgba(8, 12, 24, 0.8); border: 1px solid #3f6fb8; overflow: hidden; }
.cast-fill { height: 100%; width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, #4a8cff, #b8e2ff); }
