/* Forgive Me Father 2 스타일 다크 코믹북 FPS + 레트로 둥근모꼴 UI 스타일시트 */

@font-face {
  font-family: 'DungGeunMo';
  src: url('./assets/fonts/DungGeunMo.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DungGeunMo';
  src: url('./assets/fonts/DungGeunMo.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DungGeunMo';
  src: url('./assets/fonts/DungGeunMo.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #09090b;
  --bg-dark: #110d1b;
  --panel-bg: rgba(20, 13, 34, 0.92);
  --crimson: #e11d48;
  --eldritch: #a855f7;
  --cyan: #22d3ee;
  --cream: #f5eedc;
  --toxic: #22c55e;
  --gold: #facc15;
  --text: var(--cream);
  --target-size: 24px;
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  background: #050409;
  color: var(--text);
  font-family: 'DungGeunMo', monospace;
  overflow-wrap: break-word;
}

body.split-dragging {
  user-select: none;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
  background: #050409;
}

#game-stage,
.monitor-pane {
  position: relative;
  overflow: hidden;
  background: var(--bg-dark);
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 32px rgba(0, 0, 0, 0.72);
  container: stage / size;
}

@media (orientation: landscape) {
  .app-shell {
    flex-direction: row;
  }

  #game-stage {
    flex: 0 0 var(--monitor-ratio, 68%);
    width: auto;
    height: 100%;
    min-width: 240px;
  }

  .split-resizer {
    flex: 0 0 10px;
    width: 10px;
    height: 100%;
    cursor: col-resize;
  }

  .split-resizer-handle {
    width: 3px;
    height: 44px;
  }

  .chat-pane {
    flex: 1 1 0;
    min-width: 180px;
    height: 100%;
  }
}

@media (orientation: portrait) {
  .app-shell {
    flex-direction: column;
  }

  #game-stage {
    flex: 0 0 var(--monitor-ratio, 46%);
    width: 100%;
    height: auto;
    min-height: 170px;
  }

  .split-resizer {
    flex: 0 0 12px;
    width: 100%;
    height: 12px;
    cursor: row-resize;
  }

  .split-resizer-handle {
    width: 48px;
    height: 3px;
  }

  .chat-pane {
    flex: 1 1 0;
    width: 100%;
    min-height: 170px;
  }
}

html.pseudo-fullscreen,
body.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

html.pseudo-fullscreen #app-shell,
body.pseudo-fullscreen #app-shell,
:fullscreen #app-shell {
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
}

button,
input,
select,
textarea,
dialog {
  font-family: 'DungGeunMo', monospace;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

#game-canvas,
#weapon-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#game-stage canvas,
#game-canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

#game-stage:not(.crt-active) #game-canvas {
  image-rendering: auto;
}

#game-canvas {
  touch-action: none;
}

#game-canvas.concussed {
  /* 뇌진탕 블러는 WebGL 후처리(_realEmSpike)로 대체해 캔버스 전체 CSS blur 컴포지터 스파이크 방지 */
}

#weapon-canvas {
  pointer-events: none;
  z-index: 2;
}

#fp-weapon-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

#fp-ads-vignette {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 34%, rgba(4, 3, 10, 0.28) 68%, rgba(2, 2, 8, 0.72) 100%);
  pointer-events: none;
}

.fp-sprite {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 100%;
  will-change: transform;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.fp-sprite-sheet {
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: 0% 0%;
  will-change: transform, background-position;
}

.fp-sprite.gold-aura {
  filter: drop-shadow(0 0 12px rgba(250, 204, 21, 0.85));
}

#fp-muzzle-flare {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fef08a 0%, #f59e0b 45%, rgba(225, 29, 72, 0.85) 72%, transparent 100%);
  border: 2px solid #09090b;
  transform-origin: 50% 50%;
  pointer-events: none;
}

#fp-sniper-scope {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0, transparent 37vmin, rgba(6, 5, 12, 0.96) 37.5vmin);
  background: radial-gradient(circle at center, transparent 0, transparent 37cqmin, rgba(6, 5, 12, 0.96) 37.5cqmin);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.fp-scope-ring {
  width: 76vmin;
  width: 76cqmin;
  height: 76vmin;
  height: 76cqmin;
  border-radius: 50%;
  border: 7px solid #09090b;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.45), inset 0 0 18px rgba(168, 85, 247, 0.35);
}

.fp-scope-crosshair {
  position: absolute;
  width: 280px;
  height: 280px;
  background:
    linear-gradient(#c084fc, #c084fc) center / 100% 2px no-repeat,
    linear-gradient(#c084fc, #c084fc) center / 2px 100% no-repeat;
}

.fp-scope-crosshair::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid #22d3ee;
}

#damage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  box-shadow: inset 0 0 115px 38px rgba(225, 29, 72, 0.88);
  transition: opacity 0.08s linear;
}

#bush-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 50%, rgba(6, 48, 42, 0.72) 84%, rgba(3, 24, 22, 0.94) 100%);
  box-shadow: inset 0 0 130px 44px rgba(13, 148, 136, 0.45), inset 0 0 60px 18px rgba(4, 26, 24, 0.88);
  transition: opacity 0.2s ease;
}

#water-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 44%, rgba(8, 52, 86, 0.68) 80%, rgba(4, 22, 48, 0.95) 100%);
  box-shadow: inset 0 0 135px 46px rgba(14, 116, 144, 0.56), inset 0 0 60px 20px rgba(6, 28, 62, 0.92);
  transition: opacity 0.22s ease;
}

.class-skill-vignette {
  position: absolute;
  inset: 8px;
  border-radius: 16px;
  pointer-events: none;
  z-index: 61;
  opacity: 0;
  background:
    radial-gradient(circle at center, transparent 62%, rgba(96, 165, 250, 0.24) 88%, rgba(37, 99, 235, 0.58) 100%),
    repeating-linear-gradient(60deg, rgba(147, 197, 253, 0.06) 0 12px, transparent 12px 24px);
  box-shadow:
    inset 0 0 46px 14px rgba(59, 130, 246, 0.72),
    inset 0 0 0 3px rgba(147, 197, 253, 0.86);
  transition: opacity 0.14s ease-out;
}

.class-skill-vignette.is-aegis {
  opacity: 1;
}

#hud-root {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.comic-box {
  background: linear-gradient(165deg, rgba(24, 15, 42, 0.92), rgba(11, 8, 20, 0.94));
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), inset 0 0 0 1px rgba(250, 204, 21, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
}

/* 상단 중앙 나침반 바 */
#compass-bar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, 46cqw);
  padding: 4px 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 4px 4px 0 var(--ink), 0 0 14px rgba(34, 211, 238, 0.25);
}

.compass-marker {
  font-size: 11px;
  line-height: 1;
  color: var(--gold);
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.75);
}

.compass-viewport {
  position: relative;
  width: 100%;
  height: 22px;
  overflow: hidden;
  border-top: 2px solid rgba(168, 85, 247, 0.4);
  mask-image: linear-gradient(90deg, transparent 0%, #000 14%, #000 86%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 14%, #000 86%, transparent 100%);
}

#compass-track {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  will-change: transform;
}

.compass-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  color: var(--cream);
  white-space: nowrap;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
}

.compass-tick::before {
  content: '';
  width: 2px;
  height: 5px;
  background: rgba(245, 238, 220, 0.55);
  margin-bottom: 1px;
}

.compass-tick.cardinal {
  color: var(--gold);
  font-size: 14px;
}

.compass-tick.cardinal::before {
  height: 7px;
  background: var(--gold);
}

.compass-tick.intercardinal {
  color: var(--cyan);
  font-size: 12px;
}

#compass-deg {
  font-size: 11px;
  line-height: 1;
  color: var(--cyan);
  letter-spacing: 0.5px;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
}

/* 입장대기 로비 상단 카운트다운 헤더 바 (비-CRT 폴백) */
.boarding-countdown-bar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, 50cqw);
  padding: 6px 12px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(12, 14, 28, 0.94);
  border-color: #facc15;
  box-shadow: 4px 4px 0 var(--ink), 0 0 18px rgba(250, 204, 21, 0.35);
  z-index: 6;
}

.boarding-countdown-bar[hidden] {
  display: none !important;
}

.boarding-countdown-bar.urgent {
  border-color: #fb7185;
  background: rgba(34, 10, 22, 0.95);
  box-shadow: 4px 4px 0 var(--ink), 0 0 22px rgba(251, 113, 133, 0.55);
}

.boarding-countdown-meta {
  font-size: 11px;
  font-weight: 700;
  color: #bae6fd;
  letter-spacing: 0.02em;
}

.boarding-countdown-sec {
  font-size: 18px;
  font-weight: 800;
  color: #fef08a;
  line-height: 1.15;
}

.boarding-countdown-bar.urgent .boarding-countdown-sec {
  color: #fda4af;
}

.boarding-countdown-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(30, 41, 59, 0.95);
  overflow: hidden;
}

.boarding-countdown-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #facc15 0%, #38bdf8 100%);
  transition: width 0.12s linear;
}

.boarding-countdown-bar.urgent .boarding-countdown-fill {
  background: linear-gradient(90deg, #fb7185 0%, #f97316 100%);
}

/* 좌측 상단: 생존/킬/자기장 + 컴팩트 킬피드 */
.hud-top-left-cluster {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 230px;
}

.hud-top-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 4px 4px 0 var(--ink), 0 0 14px rgba(168, 85, 247, 0.25);
}

.hud-big {
  font-size: 22px;
  color: var(--cream);
  letter-spacing: 1px;
  paint-order: stroke fill;
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 2px 2px 0 var(--ink), 0 0 12px rgba(34, 211, 238, 0.5);
}

#hud-kills {
  color: var(--cream);
  font-size: 13px;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
}

.zone-badge {
  color: var(--eldritch);
  font-size: 13px;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink), 0 0 10px rgba(168, 85, 247, 0.55);
}

.clock-badge {
  font-size: 13px;
  font-weight: 800;
  color: #fde68a;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
}

.clock-badge.urgent {
  color: #fb7185;
  text-shadow: 2px 2px 0 var(--ink), 0 0 12px rgba(244, 63, 94, 0.7);
}

.haul-badge {
  font-size: 13px;
  font-weight: 800;
  color: #facc15;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
}

.extract-badge {
  margin-top: 2px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid var(--ink);
  border-left: 3px solid #22d3ee;
}

.extract-badge.ready {
  color: #86efac;
  border-left-color: #4ade80;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.45);
}

.kill-feed-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  overflow: hidden;
}

.kf-item {
  background: rgba(11, 8, 18, 0.88);
  border: 2px solid var(--ink);
  border-left: 4px solid var(--crimson);
  box-shadow: 3px 3px 0 var(--ink), 0 0 10px rgba(225, 29, 72, 0.28);
  padding: 3px 8px;
  font-size: 12px;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 1px 1px 0 var(--ink);
  transition: transform 0.38s ease-in, opacity 0.38s ease-in;
}

.kf-item.is-exiting {
  transform: translateX(120%);
  opacity: 0;
}

/* 우측 상단: 원형 미니맵 + 빠른 아이콘 버튼 */
.hud-top-right-cluster {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.hud-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.comic-icon-btn {
  min-width: max(42px, var(--target-size));
  min-height: max(42px, var(--target-size));
  padding: 6px;
  border: none;
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
  background: url('./assets/ui/buttons/btn_orb_steel.png') center / 100% 100% no-repeat;
  color: var(--cream);
  cursor: pointer;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  transition: transform 0.08s ease;
}

.comic-icon-btn .btn-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
}

.comic-icon-btn:hover {
  filter: brightness(1.16);
  transform: translate(-1px, -1px);
}

.comic-icon-btn:active {
  transform: translate(2px, 2px);
}

.comic-icon-btn.active {
  box-shadow: 3px 3px 0 var(--ink), 0 0 10px rgba(168, 85, 247, 0.85);
}

.minimap-wrap {
  padding: 4px;
  border-radius: 50%;
  box-shadow: 4px 4px 0 var(--ink), 0 0 18px rgba(168, 85, 247, 0.45);
}

#minimap-canvas {
  display: block;
  border: 3px solid var(--ink);
  border-radius: 50%;
}

/* 중앙 크로스헤어 (Forgive Me Father 2 스타일 지향사격 vs 정조준 동적 레티클) & 배너 */
#crosshair {
  --ch-gap: 14px;
  --ch-len: 10px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#crosshair.sniper-ads {
  opacity: 0;
}

.ch-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  left: -2px;
  top: -2px;
  border-radius: 50%;
  background: var(--cyan);
  border: 1px solid var(--ink);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.9);
  transition: background-color 0.08s, transform 0.08s;
}

#crosshair.ads .ch-dot {
  background: #fde047;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.95);
  transform: scale(1.25);
}

.ch-arm {
  position: absolute;
  background: var(--cyan);
  border: 1.5px solid var(--ink);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.72);
  transition: background-color 0.08s, box-shadow 0.08s;
}

#crosshair.ads .ch-arm {
  background: #fde047;
  box-shadow: 0 0 7px rgba(250, 204, 21, 0.85);
}

.ch-top {
  width: 3px;
  height: var(--ch-len);
  left: -1.5px;
  bottom: var(--ch-gap);
}

.ch-bottom {
  width: 3px;
  height: var(--ch-len);
  left: -1.5px;
  top: var(--ch-gap);
}

.ch-left {
  width: var(--ch-len);
  height: 3px;
  top: -1.5px;
  right: var(--ch-gap);
}

.ch-right {
  width: var(--ch-len);
  height: 3px;
  top: -1.5px;
  left: var(--ch-gap);
}

#hit-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 28px;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.7), 2px 2px 0 var(--ink);
  pointer-events: none;
}

#hit-marker .hm-label {
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  background: rgba(9, 9, 11, 0.78);
  border: 1.5px solid currentColor;
  border-radius: 3px;
  -webkit-text-stroke: 0;
  text-shadow: 1px 1px 0 #000;
}

#hit-marker.headshot,
#hit-marker.part-head {
  color: var(--crimson);
  font-size: 34px;
  text-shadow: 0 0 12px rgba(225, 29, 72, 0.9), 2px 2px 0 var(--ink);
}

#hit-marker.part-torso {
  color: #fb923c;
}

#hit-marker.part-arm {
  color: var(--gold);
}

#hit-marker.part-leg {
  color: var(--cyan);
}

.wound-status {
  position: absolute;
  left: max(14px, env(safe-area-inset-left, 0px) + 12px);
  bottom: max(172px, env(safe-area-inset-bottom, 0px) + 166px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 6;
  pointer-events: none;
}

.wound-pill {
  padding: 4px 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(15, 10, 22, 0.9);
  border: 2px solid var(--ink);
  border-left-width: 5px;
  box-shadow: 3px 3px 0 var(--ink);
  letter-spacing: 0.3px;
}

.wound-pill.wound-concussion {
  border-left-color: #ef4444;
  color: #fca5a5;
}

.wound-pill.wound-bleed {
  border-left-color: #f97316;
  color: #fdba74;
}

.wound-pill.wound-armFracture {
  border-left-color: #facc15;
  color: #fef08a;
}

.wound-pill.wound-legCripple {
  border-left-color: #38bdf8;
  color: #bae6fd;
}

#notice-box {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top, 0px)) + 168px);
  left: 50%;
  transform: translateX(-50%);
  max-width: min(460px, max(140px, calc(100cqw - 480px)));
  padding: 4px 12px;
  color: var(--cyan);
  font-size: 14px;
  box-shadow: 4px 4px 0 var(--ink), 0 0 14px rgba(34, 211, 238, 0.38);
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#airborne-banner {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top, 0px)) + 70px);
  left: 50%;
  transform: translateX(-50%);
  max-width: min(760px, 66cqw);
  padding: 4px 14px;
  background: linear-gradient(90deg, #9f1239, var(--crimson));
  color: var(--cream);
  font-size: clamp(11px, 1.45cqw, 15px);
  letter-spacing: 0.4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 4px 4px 0 var(--ink), 0 0 16px rgba(225, 29, 72, 0.55);
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
}

#siren-alert {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top, 0px)) + 72px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.94), rgba(190, 18, 60, 0.94));
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), 0 0 18px rgba(244, 63, 94, 0.7);
  color: #fff7ed;
  font-size: 13px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  z-index: 12;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
}

@media (prefers-reduced-motion: no-preference) {
  #siren-alert:not([hidden]) {
    animation: sirenPulse 1.1s ease-in-out infinite alternate;
  }

  @keyframes sirenPulse {
    from {
      opacity: 0.84;
      transform: translateX(-50%) scale(0.985);
    }
    to {
      opacity: 1;
      transform: translateX(-50%) scale(1.02);
    }
  }
}

#stance-indicator {
  position: absolute;
  bottom: calc(max(10px, env(safe-area-inset-bottom, 0px)) + 142px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 10, 25, 0.88);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  color: #fde68a;
  font-size: 12px;
  padding: 2px 10px;
  white-space: nowrap;
}

#bush-indicator {
  position: absolute;
  bottom: calc(max(10px, env(safe-area-inset-bottom, 0px)) + 174px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(10, 40, 38, 0.95), rgba(5, 20, 22, 0.96));
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), 0 0 16px rgba(34, 211, 238, 0.4);
  color: var(--cyan);
  font-size: 14px;
  letter-spacing: 0.8px;
  white-space: nowrap;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink), 0 0 10px rgba(34, 211, 238, 0.55);
}

#loot-prompt {
  position: absolute;
  top: auto;
  bottom: calc(max(10px, env(safe-area-inset-bottom, 0px)) + 214px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--cream);
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--ink), 0 0 12px rgba(34, 211, 238, 0.45);
  white-space: nowrap;
}

#action-progress {
  position: absolute;
  top: auto;
  bottom: calc(max(10px, env(safe-area-inset-bottom, 0px)) + 260px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--cyan);
  box-shadow: 4px 4px 0 var(--ink), 0 0 12px rgba(168, 85, 247, 0.4);
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}

/* 좌측 하단: 빠른 회복 알약 + 가방 버튼 */
.hud-bottom-left-heals {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  left: max(14px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  pointer-events: auto;
  box-shadow: 4px 4px 0 var(--ink), 0 0 12px rgba(34, 197, 94, 0.22);
}

.heal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: max(34px, var(--target-size));
  padding: 6px 12px;
  border: none;
  box-shadow: none;
  background: url('./assets/ui/buttons/btn_plate_slate.png') center / 100% 100% no-repeat;
  color: var(--cream);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 0 1px 2px #000;
  filter: drop-shadow(2px 3px 0 var(--ink));
  transition: transform 0.08s ease, filter 0.12s ease;
}

.heal-pill:hover {
  filter: drop-shadow(2px 4px 0 var(--ink)) brightness(1.18);
  transform: translate(-1px, -1px);
}

.heal-pill.bag-pill {
  background-image: url('./assets/ui/buttons/btn_plate_arcane.png');
  color: var(--gold);
}

/* 하단 중앙: PUBG 모바일 무기 슬롯 & HP/부스트 바 (무기 캔버스 시야 방해 최소화) */
.hud-bottom-center {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(410px, 58cqw);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: auto;
  box-shadow: 4px 4px 0 var(--ink), 0 0 16px rgba(168, 85, 247, 0.3);
}

.center-top-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.armor-row {
  display: flex;
  gap: 5px;
}

.badge {
  background: #1e1633;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 2px 6px;
  font-size: 11px;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 1px 1px 0 var(--ink);
  white-space: nowrap;
}

.ammo-compact {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.weapon-title {
  color: var(--cyan);
  font-size: 13px;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 1px 1px 0 var(--ink), 0 0 8px rgba(34, 211, 238, 0.45);
}

.ammo-big {
  font-size: 22px;
  line-height: 1;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 2px 2px 0 var(--ink), 0 0 8px rgba(168, 85, 247, 0.45);
}

.ammo-sub {
  font-size: 13px;
  color: #cbd5e1;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 1px 1px 0 var(--ink);
}

.bar-wrap {
  position: relative;
  height: 22px;
  background: #0d0916;
  border: 3px solid var(--ink);
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #9f1239, var(--crimson), #fb7185);
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.65);
  transition: width 0.1s linear;
}

.bar-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 1px 1px 0 var(--ink);
}

.boost-wrap {
  height: 5px;
  background: #0d0916;
  border: 2px solid var(--ink);
}

.boost-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--eldritch), var(--cyan));
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.65);
}

.stamina-wrap {
  height: 4px;
  background: #0d0916;
  border: 1.5px solid var(--ink);
}

.stamina-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #d97706, var(--gold));
  box-shadow: 0 0 6px rgba(250, 204, 21, 0.45);
  transition: width 0.08s linear;
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.slot {
  min-height: max(34px, var(--target-size));
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border: none;
  box-shadow: none;
  background: url('./assets/ui/buttons/btn_plate_slate.png') center / 100% 100% no-repeat;
  color: var(--cream);
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 1px 1px 0 var(--ink);
  filter: drop-shadow(2px 2px 0 var(--ink));
  transition: transform 0.08s ease, filter 0.12s ease;
}

.slot.active {
  background-image: url('./assets/ui/buttons/btn_plate_arcane.png');
  color: #fef08a;
  filter: drop-shadow(2px 2px 0 var(--ink)) drop-shadow(0 0 8px rgba(250, 204, 21, 0.55));
}

/* PUBG 모바일 터치 조작 레이어 */
#mobile-controls {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.joystick-zone {
  position: absolute;
  left: max(24px, env(safe-area-inset-left, 0px) + 18px);
  bottom: max(125px, env(safe-area-inset-bottom, 0px) + 115px);
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle, rgba(168, 85, 247, 0.16), rgba(9, 9, 11, 0.56));
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.35), 4px 4px 0 var(--ink);
  pointer-events: auto;
  touch-action: none;
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle at 35% 35%, var(--cyan), var(--eldritch));
  box-shadow: 2px 2px 0 var(--ink), 0 0 12px rgba(34, 211, 238, 0.65);
  pointer-events: none;
}

.mbtn {
  border: none;
  box-shadow: none;
  border-radius: 50%;
  color: var(--cream);
  font-weight: 900;
  font-size: 11px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 0 1px 2px #000;
  background: url('./assets/ui/buttons/btn_orb_steel.png') center / 100% 100% no-repeat;
  border-radius: 50%;
  box-shadow: 3px 4px 0 var(--ink);
  transition: transform 0.06s ease;
}

.mbtn-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
}

.mbtn-label {
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

.mbtn:active {
  transform: scale(0.93) translate(1px, 2px);
}

.mbtn-fire-left {
  position: absolute;
  left: max(22px, env(safe-area-inset-left, 0px) + 16px);
  bottom: max(265px, env(safe-area-inset-bottom, 0px) + 255px);
  width: 66px;
  height: 66px;
  background-image: url('./assets/ui/buttons/btn_orb_crimson.png');
  box-shadow: 3px 4px 0 var(--ink), 0 0 10px rgba(225, 29, 72, 0.55);
}

.mbtn-melee {
  position: absolute;
  left: max(18px, env(safe-area-inset-left, 0px) + 12px);
  bottom: max(188px, env(safe-area-inset-bottom, 0px) + 178px);
  width: 56px;
  height: 56px;
  min-width: 44px;
  min-height: 44px;
  background-image: url('./assets/ui/buttons/btn_orb_crimson.png');
}

.mobile-action-cluster {
  position: absolute;
  right: max(16px, env(safe-area-inset-right, 0px) + 10px);
  bottom: max(24px, env(safe-area-inset-bottom, 0px) + 16px);
  width: 224px;
  height: 230px;
  pointer-events: none;
}

.mbtn-fire-right {
  position: absolute;
  right: 46px;
  bottom: 42px;
  width: 82px;
  height: 82px;
  font-size: 13px;
  background-image: url('./assets/ui/buttons/btn_orb_crimson.png');
  box-shadow: 4px 4px 0 var(--ink), 0 0 12px rgba(225, 29, 72, 0.65);
}

.mbtn-fire-right .mbtn-icon {
  width: 30px;
  height: 30px;
}

.mbtn-ads {
  position: absolute;
  right: 138px;
  bottom: 108px;
  width: 58px;
  height: 58px;
}

.mbtn-stance {
  position: absolute;
  right: 84px;
  bottom: 160px;
  width: 56px;
  height: 56px;
}

.mbtn-hold-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(#22d3ee calc(var(--hold-pct, 0) * 1%), rgba(255, 255, 255, 0) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}

.mbtn-stance.holding .mbtn-hold-ring {
  opacity: 1;
}

.mbtn-jump {
  position: absolute;
  right: 8px;
  bottom: 142px;
  width: 56px;
  height: 56px;
}

.mbtn-flash {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 56px;
  height: 56px;
}

.mbtn-reload {
  position: absolute;
  right: 74px;
  bottom: 0;
  width: 56px;
  height: 56px;
}

.mbtn-loot {
  position: absolute;
  right: 140px;
  bottom: 14px;
  width: 68px;
  height: 56px;
  border-radius: 6px;
  background-image: url('./assets/ui/buttons/btn_plate_arcane.png');
  color: var(--gold);
}

.mbtn.active,
.mbtn[aria-pressed='true'] {
  filter: drop-shadow(3px 4px 0 var(--ink)) drop-shadow(0 0 12px rgba(250, 204, 21, 0.9)) brightness(1.25);
  color: #fde68a;
}

/* 오버레이 화면 */
.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: safe center;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: radial-gradient(circle at center, rgba(24, 14, 42, 0.42), rgba(7, 5, 12, 0.72));
}

#loading-overlay {
  z-index: 60;
}

#lobby-overlay {
  z-index: 50;
}

.overlay-screen[hidden],
#hud-root[hidden],
#mobile-controls[hidden],
[hidden] {
  display: none !important;
}

.comic-panel {
  background: linear-gradient(165deg, rgba(27, 18, 43, 0.88), rgba(15, 10, 25, 0.92));
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink), inset 0 0 0 1px rgba(250, 204, 21, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 24px rgba(168, 85, 247, 0.28);
  padding: 20px 24px;
  max-width: 580px;
  width: 94%;
  max-height: min(92dvh, calc(100% - 8px));
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.panel-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.panel-top-bar.center {
  justify-content: center;
}

.gold-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: #1c132d;
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--gold);
  font-size: 15px;
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
}

.game-title {
  font-family: 'DungGeunMo', monospace;
  margin: 0;
  font-size: clamp(26px, 5vw, 40px);
  line-height: 1.05;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 4px 4px 0 var(--crimson), 0 0 18px rgba(168, 85, 247, 0.55);
}

.game-title .title-sub {
  display: inline-block;
  font-size: 0.46em;
  letter-spacing: 3px;
  color: var(--gold);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
}

.subtitle {
  margin: 8px 0 12px;
  color: var(--cyan);
  font-size: 14px;
  text-shadow: 1px 1px 0 var(--ink);
}

.lan-info-box {
  margin-bottom: 14px;
  padding: 8px 12px;
  background: rgba(11, 8, 20, 0.92);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 12px;
  line-height: 1.45;
  color: var(--cyan);
}

.lan-info-box code {
  color: var(--gold);
  user-select: text;
  -webkit-user-select: text;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
}

.form-row > *,
.form-row label {
  min-inline-size: 0;
}

.form-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.form-row input {
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  min-height: var(--target-size);
  padding: 9px 10px;
  border: 3px solid var(--ink);
  background: #0f0a18;
  color: #fff;
  font-size: 15px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-inline-size: 0;
  gap: 10px;
}

.btn-row.center {
  justify-content: center;
}

.comic-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: max(46px, var(--target-size));
  padding: 10px 22px;
  border: none;
  box-shadow: none;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.4px;
  cursor: pointer;
  color: #fffbeb;
  background: url('./assets/ui/buttons/btn_plate_slate.png') center / 100% 100% no-repeat;
  paint-order: stroke fill;
  -webkit-text-stroke: 2px #09090b;
  text-shadow: 0 2px 3px #000, 1px 1px 0 var(--ink);
  filter: drop-shadow(4px 4px 0 var(--ink)) drop-shadow(0 0 10px rgba(0, 0, 0, 0.45));
  transition: transform 0.08s ease, filter 0.12s ease;
  touch-action: manipulation;
}

.btn-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px #000);
}

.btn-icon-sm {
  width: 17px;
  height: 17px;
  object-fit: contain;
  flex-shrink: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px #000);
}

.comic-btn:hover:not(:disabled) {
  transform: translate(-1px, -2px);
  filter: drop-shadow(5px 6px 0 var(--ink)) drop-shadow(0 0 14px rgba(168, 85, 247, 0.45)) brightness(1.15);
}

.comic-btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  filter: drop-shadow(1px 2px 0 var(--ink)) brightness(0.92);
}

.comic-btn:disabled {
  opacity: 0.48;
  filter: grayscale(0.55) drop-shadow(2px 2px 0 var(--ink));
  cursor: not-allowed;
}

.comic-btn.primary {
  background-image: url('./assets/ui/buttons/btn_plate_arcane.png');
  color: #f5f3ff;
}

.comic-btn.danger {
  background-image: url('./assets/ui/buttons/btn_plate_danger.png');
  color: #fffbeb;
}

.comic-btn.gold-btn {
  background-image: url('./assets/ui/buttons/btn_plate_gold.png');
  color: #fef08a;
}

.comic-btn.small {
  min-height: max(36px, var(--target-size));
  padding: 7px 16px;
  font-size: 12px;
  gap: 6px;
}

.comic-btn.small .btn-icon {
  width: 17px;
  height: 17px;
}

.status-text {
  margin: 12px 0;
  color: var(--gold);
  font-size: 14px;
}

.lobby-list-wrap {
  border-top: 2px solid #31254a;
  padding-top: 10px;
  margin-top: 10px;
}

.lobby-list-wrap h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

#lobby-players {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: #cbd5e1;
}

.controls-guide {
  margin-top: 14px;
  padding: 10px;
  background: #0f0a18;
  border: 2px solid var(--ink);
  font-size: 12px;
  line-height: 1.5;
  color: #94a3b8;
}

.center-card {
  text-align: center;
}

/* 네이티브 <dialog> 모달 스타일 (modern-web-guidance 준수) */
dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(170deg, #1b132b 0%, #0d0817 100%);
  color: var(--text);
  border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink), 0 0 28px rgba(168, 85, 247, 0.35);
  padding: 18px 20px;
  max-width: 820px;
  width: 94%;
  max-height: 88dvh;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(5, 4, 10, 0.76);
  overflow: hidden;
  overscroll-behavior: contain;
}

/* 상점 대장간 히어로 배너 + 암시장 상인 초상화 */
.shop-hero-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 3px solid var(--ink);
  box-shadow: inset 0 1px 0 rgba(250, 204, 21, 0.35), 4px 4px 0 var(--ink);
  background:
    linear-gradient(95deg, rgba(12, 8, 22, 0.94) 15%, rgba(22, 13, 36, 0.76) 55%, rgba(12, 8, 22, 0.9) 100%),
    url('./assets/ui/shop_armory_banner.jpg') center / cover no-repeat;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.shop-merchant-portrait {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border: 3px solid var(--gold);
  box-shadow: 3px 3px 0 var(--ink), 0 0 14px rgba(250, 204, 21, 0.35);
  background: #0d0916;
  flex-shrink: 0;
}

.shop-hero-copy {
  flex: 1 1 260px;
  min-width: 0;
}

.shop-hero-eyebrow {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.6px;
  color: var(--cyan);
  margin-bottom: 2px;
}

.shop-hero-copy h2 {
  margin: 0;
  font-size: clamp(17px, 2.4vw, 22px);
  color: var(--gold);
  text-shadow: 2px 2px 0 var(--ink);
}

.shop-voice-line {
  margin: 4px 0 0;
  padding: 4px 8px;
  background: rgba(9, 7, 15, 0.84);
  border-left: 3px solid var(--gold);
  font-size: 12px;
  color: #fde68a;
  font-family: 'DungGeunMo', monospace;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 2px solid #31254a;
  padding-bottom: 8px;
}

.inv-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--gold);
}

.shop-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#inventory-content {
  overflow-y: auto;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}

.inv-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--cyan);
  border-left: 4px solid var(--eldritch);
  padding-left: 8px;
}

.inv-grid,
.inv-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}

.inv-btn {
  min-height: var(--target-size);
  padding: 8px 12px;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #432b6c, #24163e);
  color: #fff;
  cursor: pointer;
  font-weight: bold;
}

.inv-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.shop-content {
  overflow-y: auto;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}

.shop-cat-title {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--cyan);
  border-left: 4px solid var(--gold);
  padding-left: 9px;
  letter-spacing: 0.4px;
  text-shadow: 1px 1px 0 var(--ink);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}

/* 수집형 고딕 카드 디자인 (상점 & 가방 공통) */
.item-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 9px;
  background: linear-gradient(175deg, #211836 0%, #110b1d 55%, #090611 100%);
  border: 3px solid var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.25),
    4px 4px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.item-card:hover {
  transform: translateY(-2px);
}

.item-card.rarity-common {
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35), 4px 4px 0 var(--ink);
}

.item-card.rarity-rare {
  border-color: #0284c7;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45), 4px 4px 0 var(--ink), 0 0 12px rgba(14, 165, 233, 0.22);
}

.item-card.rarity-epic {
  border-color: #9333ea;
  box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.5), 4px 4px 0 var(--ink), 0 0 14px rgba(168, 85, 247, 0.28);
}

.item-card.rarity-legendary {
  border-color: #eab308;
  box-shadow: inset 0 0 0 1px rgba(254, 240, 138, 0.55), 4px 4px 0 var(--ink), 0 0 16px rgba(234, 179, 8, 0.32);
}

.item-card.equipped {
  box-shadow: inset 0 0 0 2px var(--gold), 4px 4px 0 var(--ink), 0 0 18px rgba(250, 204, 21, 0.45);
}

.item-card.empty {
  opacity: 0.55;
  filter: grayscale(0.45);
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.card-tier-tag {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.9px;
  background: rgba(9, 7, 16, 0.9);
  border: 1.5px solid #475569;
  color: #cbd5e1;
}

.rarity-rare .card-tier-tag {
  border-color: #38bdf8;
  color: #7dd3fc;
}

.rarity-epic .card-tier-tag {
  border-color: #c084fc;
  color: #e9d5ff;
}

.rarity-legendary .card-tier-tag {
  border-color: #facc15;
  color: #fef08a;
}

.card-art-frame {
  position: relative;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 5px;
  background: radial-gradient(circle at 50% 48%, rgba(168, 85, 247, 0.22), rgba(7, 5, 13, 0.96) 76%);
  border: 2px solid var(--ink);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.rarity-rare .card-art-frame {
  background: radial-gradient(circle at 50% 48%, rgba(34, 211, 238, 0.2), rgba(7, 5, 13, 0.96) 76%);
}

.rarity-legendary .card-art-frame {
  background: radial-gradient(circle at 50% 48%, rgba(250, 204, 21, 0.25), rgba(10, 6, 12, 0.96) 76%);
}

.card-art-frame.compact {
  height: 76px;
  padding: 6px;
}

.card-art-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 auto;
}

.shop-card-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--cream);
  line-height: 1.2;
}

.shop-card-price {
  font-size: 12px;
  font-weight: 900;
  color: var(--gold);
}

.shop-card-price.is-owned {
  color: #4ade80;
}

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.card-stat-pill {
  padding: 2px 6px;
  font-size: 10px;
  background: rgba(15, 10, 26, 0.92);
  border: 1.5px solid #334155;
  color: #e2e8f0;
  font-family: 'DungGeunMo', monospace;
}

.card-stat-pill b {
  color: var(--cyan);
}

.shop-card-desc {
  margin: 0;
  padding: 5px 7px;
  background: rgba(7, 5, 13, 0.72);
  border-left: 2px solid #4c1d95;
  font-size: 11px;
  line-height: 1.38;
  color: #cbd5e1;
  font-family: 'DungGeunMo', monospace;
}

.shop-action-btn,
.inv-card-btn {
  width: 100%;
  min-height: max(38px, var(--target-size));
  padding: 8px 12px;
  font-size: 12px;
}

.shop-action-btn.buy {
  background-image: url('./assets/ui/buttons/btn_plate_gold.png');
  color: #fef08a;
}

.shop-action-btn.equipped {
  background-image: url('./assets/ui/buttons/btn_plate_emerald.png');
  color: #bbf7d0;
}

.shop-action-btn:disabled,
.shop-action-btn[data-insufficient="1"] {
  opacity: 0.52;
  filter: grayscale(0.45);
}

.shop-action-btn:disabled {
  cursor: not-allowed;
}

.muted {
  color: #64748b;
  font-size: 13px;
}

.portrait-warning {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  place-items: safe center;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  background: rgba(7, 4, 14, 0.96);
}

.portrait-warning .comic-panel {
  width: min(440px, 100%);
  max-width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding: 24px 20px;
  overflow-y: auto;
}

.portrait-warning h2 {
  margin: 0 0 12px;
  font-size: clamp(20px, 5.5vw, 26px);
  line-height: 1.25;
}

.portrait-warning p {
  margin: 0 0 18px;
  font-size: clamp(13.5px, 3.8vw, 15.5px);
  line-height: 1.55;
  overflow-wrap: break-word;
}

.portrait-warning .portrait-hint {
  margin: -6px 0 14px;
  font-size: clamp(12.5px, 3.4vw, 14px);
  color: var(--gold);
}

.portrait-warning .comic-btn {
  width: 100%;
  max-width: 300px;
  min-height: 48px;
  margin: 0 auto;
  justify-content: center;
}

.loading-screen {
  z-index: 35;
  background: radial-gradient(circle at center, rgba(22, 12, 38, 0.92), rgba(7, 4, 14, 0.98));
  transition: opacity 0.25s ease;
}

.loading-card {
  max-width: 540px;
  text-align: center;
}

.loading-emblem-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 4px 12px;
  background: rgba(10, 6, 18, 0.85);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.loading-emblem-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.loading-stage-tag {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold);
}

.loading-bar-wrap {
  position: relative;
  height: 32px;
  margin: 14px 0 10px;
  background: #0a0612;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), inset 0 0 10px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.loading-bar-fill {
  position: relative;
  display: block;
  width: 0%;
  height: 100%;
  min-height: 26px;
  background:
    repeating-linear-gradient(
      -55deg,
      rgba(255, 255, 255, 0.14) 0px,
      rgba(255, 255, 255, 0.14) 10px,
      transparent 10px,
      transparent 20px
    ),
    linear-gradient(90deg, var(--crimson), var(--eldritch), var(--cyan));
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.78);
  transition: width 0.16s ease-out;
}

.loading-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 1px 1px 0 var(--ink);
}

.loading-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
}

.loading-count {
  color: var(--gold);
}

.loading-phase-pill {
  padding: 2px 8px;
  background: #1c132d;
  border: 2px solid var(--ink);
  color: var(--cyan);
}

.loading-detail {
  margin: 0;
  min-height: 20px;
  font-size: 12px;
  color: var(--cyan);
}

.loading-lazy-note {
  margin: 10px 0 0;
  font-size: 11px;
  color: #94a3b8;
}

.merchant-subtitle {
  position: absolute;
  left: 50%;
  bottom: 132px;
  transform: translateX(-50%);
  z-index: 15;
  max-width: min(580px, 86cqw);
  padding: 6px 14px;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), 0 0 14px rgba(250, 204, 21, 0.35);
  background: rgba(14, 9, 24, 0.92);
  color: var(--gold);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

.shop-voice-line {
  margin: 0 0 10px;
  padding: 6px 12px;
  background: #140d22;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
}

@media screen and (orientation: portrait) and (pointer: coarse) {
  .portrait-warning {
    display: grid;
  }
}

/* 화면 비율·뷰포트 크기 비례 반응형 모바일 가로 HUD (모바일 배틀그라운드 클래식 레이아웃·비율 동일 적용, 상호 겹침 제로) */
@media (max-width: 1180px) and (pointer: coarse), (max-width: 960px), (max-height: 540px) {
  :root {
    /* 모바일 배그 기준: 화면 세로 1dvh와 가로 0.52dvw 중 작은 축 기준으로 전 UI 비례 스케일 */
    --ui-u: clamp(3.0px, min(1dvh, 0.52dvw), 6.2px);
  }

  #game-stage {
    --ui-u: clamp(3.0px, min(1cqh, 0.52cqw), 6.2px);
  }

  .hud-top-left-cluster {
    top: max(6px, env(safe-area-inset-top, 0px));
    left: max(10px, env(safe-area-inset-left, 0px) + 4px);
    gap: calc(var(--ui-u) * 0.9);
    max-width: min(calc(var(--ui-u) * 40), 27cqw);
  }

  .hud-top-left {
    padding: calc(var(--ui-u) * 0.9) calc(var(--ui-u) * 1.4);
    gap: 1px;
    max-width: 100%;
  }

  .clock-badge,
  .haul-badge,
  #hud-kills,
  .zone-badge {
    font-size: calc(var(--ui-u) * 2.65);
    line-height: 1.18;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hud-big {
    font-size: calc(var(--ui-u) * 3.8);
    line-height: 1.08;
    -webkit-text-stroke: 2px var(--ink);
  }

  .extract-badge {
    font-size: calc(var(--ui-u) * 2.45);
    padding: 1px 5px;
    max-width: calc(var(--ui-u) * 40);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kill-feed-list {
    max-height: none;
    max-width: min(calc(var(--ui-u) * 40), 27cqw);
    overflow: hidden;
    gap: 3px;
  }

  .kf-item {
    flex-shrink: 0;
    min-height: 19px;
    line-height: 1.25;
    font-size: clamp(10px, calc(var(--ui-u) * 2.55), 12px);
    padding: 2px 6px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #compass-bar {
    top: max(4px, env(safe-area-inset-top, 0px));
    left: 48%;
    width: clamp(156px, calc(var(--ui-u) * 44), 27cqw);
    padding: 1px 6px 2px;
    gap: 1px;
  }

  .compass-viewport {
    height: calc(var(--ui-u) * 4.0);
  }

  .compass-tick {
    font-size: calc(var(--ui-u) * 2.6);
  }

  .compass-tick.cardinal {
    font-size: calc(var(--ui-u) * 2.95);
  }

  #compass-deg {
    font-size: calc(var(--ui-u) * 2.45);
  }

  #airborne-banner {
    top: calc(max(4px, env(safe-area-inset-top, 0px)) + max(50px, calc(var(--ui-u) * 13.4)));
    left: 48%;
    font-size: calc(var(--ui-u) * 2.65);
    max-width: 38cqw;
    padding: 2px 8px;
  }

  #notice-box {
    top: calc(max(4px, env(safe-area-inset-top, 0px)) + max(136px, calc(var(--ui-u) * 35.5)));
    font-size: calc(var(--ui-u) * 2.8);
    max-width: 48cqw;
    padding: 2px 8px;
  }

  .hud-top-right-cluster {
    top: max(4px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px) + 4px);
    gap: calc(var(--ui-u) * 1.0);
    align-items: flex-start;
  }

  .hud-quick-actions {
    flex-direction: row;
    gap: calc(var(--ui-u) * 0.8);
  }

  .comic-icon-btn {
    min-width: max(30px, calc(var(--ui-u) * 8.2));
    min-height: max(30px, calc(var(--ui-u) * 8.6));
    width: max(30px, calc(var(--ui-u) * 8.2));
    height: max(30px, calc(var(--ui-u) * 8.6));
    padding: 2px;
  }

  .comic-icon-btn .btn-icon {
    width: calc(var(--ui-u) * 4.0);
    height: calc(var(--ui-u) * 4.0);
  }

  .minimap-wrap {
    padding: 2px;
    border-radius: 8px;
  }

  .minimap-wrap canvas {
    width: calc(var(--ui-u) * 20.5);
    height: calc(var(--ui-u) * 20.5);
    border-radius: 6px;
    border-width: 2px;
  }

  #siren-alert {
    top: calc(max(4px, env(safe-area-inset-top, 0px)) + max(50px, calc(var(--ui-u) * 13.4)));
    left: 48%;
    font-size: calc(var(--ui-u) * 2.65);
    padding: 2px 8px;
  }

  #stance-indicator {
    top: auto;
    bottom: calc(max(5px, env(safe-area-inset-bottom, 0px)) + 92px);
    font-size: calc(var(--ui-u) * 2.5);
    padding: 1px 8px;
    z-index: 9;
  }

  #bush-indicator {
    top: auto;
    bottom: calc(max(5px, env(safe-area-inset-bottom, 0px)) + 118px);
    font-size: calc(var(--ui-u) * 2.65);
    padding: 2px 8px;
    z-index: 9;
  }

  #loot-prompt {
    top: auto;
    bottom: calc(max(5px, env(safe-area-inset-bottom, 0px)) + max(134px, calc(var(--ui-u) * 34.8)));
    font-size: calc(var(--ui-u) * 2.85);
    padding: calc(var(--ui-u) * 0.9) calc(var(--ui-u) * 2.2);
    max-width: 42cqw;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 9;
  }

  #action-progress {
    top: auto;
    bottom: calc(max(5px, env(safe-area-inset-bottom, 0px)) + 148px);
    font-size: calc(var(--ui-u) * 2.75);
    padding: 2px 8px;
    z-index: 9;
  }

  .hud-bottom-center {
    left: 50%;
    width: clamp(190px, calc(var(--ui-u) * 62), 78cqw);
    padding: calc(var(--ui-u) * 0.9) calc(var(--ui-u) * 1.4);
    gap: calc(var(--ui-u) * 0.5);
    bottom: max(6px, env(safe-area-inset-bottom, 0px) + 2px);
  }

  .center-top-meta {
    gap: calc(var(--ui-u) * 0.9);
  }

  .badge {
    font-size: calc(var(--ui-u) * 2.35);
    padding: 1px 4px;
  }

  .weapon-title {
    font-size: calc(var(--ui-u) * 2.6);
  }

  .ammo-big {
    font-size: calc(var(--ui-u) * 3.5);
  }

  .ammo-sub {
    font-size: calc(var(--ui-u) * 2.55);
  }

  .bar-wrap {
    height: clamp(15px, calc(var(--ui-u) * 3.8), 18px);
    border-width: 2px;
  }

  .bar-text {
    font-size: calc(var(--ui-u) * 2.45);
  }

  .boost-wrap {
    height: calc(var(--ui-u) * 0.75);
  }

  .slot-row {
    gap: calc(var(--ui-u) * 0.7);
  }

  .slot {
    min-height: calc(var(--ui-u) * 5.2);
    font-size: calc(var(--ui-u) * 2.35);
    padding: 1px 3px;
  }

  .hud-bottom-left-heals {
    left: calc(max(8px, env(safe-area-inset-left, 0px)) + var(--ui-u) * 28.5);
    bottom: max(4px, env(safe-area-inset-bottom, 0px) + 2px);
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: calc(var(--ui-u) * 0.5);
    padding: calc(var(--ui-u) * 0.55);
  }

  .heal-pill {
    font-size: calc(var(--ui-u) * 2.2);
    padding: calc(var(--ui-u) * 0.4) calc(var(--ui-u) * 0.85);
    min-height: calc(var(--ui-u) * 5.6);
    gap: calc(var(--ui-u) * 0.45);
    max-width: calc(var(--ui-u) * 16.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .heal-pill .btn-icon-sm {
    width: calc(var(--ui-u) * 2.8);
    height: calc(var(--ui-u) * 2.8);
  }

  .joystick-zone {
    width: calc(var(--ui-u) * 23.5);
    height: calc(var(--ui-u) * 23.5);
    left: calc(max(10px, env(safe-area-inset-left, 0px)) + var(--ui-u) * 2.0);
    bottom: calc(max(6px, env(safe-area-inset-bottom, 0px)) + var(--ui-u) * 2.0);
  }

  .joystick-zone.floating-active {
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.72), 0 0 14px rgba(168, 85, 247, 0.55);
  }

  .joystick-knob {
    width: calc(var(--ui-u) * 10.0);
    height: calc(var(--ui-u) * 10.0);
    margin: calc(var(--ui-u) * -5.0) 0 0 calc(var(--ui-u) * -5.0);
  }

  .mbtn-fire-left {
    left: calc(max(10px, env(safe-area-inset-left, 0px)) + var(--ui-u) * 4.0);
    bottom: calc(max(6px, env(safe-area-inset-bottom, 0px)) + var(--ui-u) * 30.5);
    width: calc(var(--ui-u) * 12.4);
    height: calc(var(--ui-u) * 12.4);
    min-width: 44px;
    min-height: 44px;
    font-size: calc(var(--ui-u) * 2.35);
  }

  .mbtn-melee {
    left: calc(max(10px, env(safe-area-inset-left, 0px)) + var(--ui-u) * 18.4);
    bottom: calc(max(6px, env(safe-area-inset-bottom, 0px)) + var(--ui-u) * 28.5);
    width: calc(var(--ui-u) * 11.4);
    height: calc(var(--ui-u) * 11.4);
    min-width: 44px;
    min-height: 44px;
    font-size: calc(var(--ui-u) * 2.25);
  }

  .mbtn-fire-left .mbtn-icon,
  .mbtn-melee .mbtn-icon {
    width: calc(var(--ui-u) * 4.4);
    height: calc(var(--ui-u) * 4.4);
  }

  .wound-status {
    left: auto;
    right: 6px;
    transform: none;
    bottom: calc(max(6px, env(safe-area-inset-bottom, 0px)) + 94px);
    flex-direction: column;
    align-items: flex-end;
    max-width: min(170px, 44cqw);
  }

  .wound-pill {
    font-size: calc(var(--ui-u) * 2.35);
    padding: 2px 5px;
  }

  .mobile-action-cluster {
    right: max(10px, env(safe-area-inset-right, 0px) + 6px);
    bottom: max(6px, env(safe-area-inset-bottom, 0px) + 3px);
    width: calc(var(--ui-u) * 47.5);
    height: calc(var(--ui-u) * 46.5);
    transform: none;
  }

  .mobile-action-cluster .mbtn {
    border-radius: 50%;
    min-width: 44px;
    min-height: 44px;
    font-size: calc(var(--ui-u) * 2.35);
    gap: 1px;
  }

  .mobile-action-cluster .mbtn-icon {
    width: calc(var(--ui-u) * 4.5);
    height: calc(var(--ui-u) * 4.5);
  }

  .mobile-action-cluster .mbtn-label,
  .mbtn-fire-left .mbtn-label,
  .mbtn-melee .mbtn-label {
    font-size: calc(var(--ui-u) * 2.25);
  }

  .mobile-action-cluster .mbtn-fire-right {
    right: calc(var(--ui-u) * 15.6);
    bottom: calc(var(--ui-u) * 13.8);
    width: calc(var(--ui-u) * 16.2);
    height: calc(var(--ui-u) * 16.2);
  }

  .mobile-action-cluster .mbtn-fire-right .mbtn-icon {
    width: calc(var(--ui-u) * 6.0);
    height: calc(var(--ui-u) * 6.0);
  }

  .mobile-action-cluster .mbtn-ads {
    right: calc(var(--ui-u) * 2.0);
    bottom: calc(var(--ui-u) * 33.2);
    width: calc(var(--ui-u) * 11.4);
    height: calc(var(--ui-u) * 11.4);
  }

  .mobile-action-cluster .mbtn-stance {
    right: calc(var(--ui-u) * 19.6);
    bottom: calc(var(--ui-u) * 33.2);
    width: calc(var(--ui-u) * 11.4);
    height: calc(var(--ui-u) * 11.4);
  }

  .mobile-action-cluster .mbtn-jump {
    right: calc(var(--ui-u) * 0.8);
    bottom: calc(var(--ui-u) * 19.2);
    width: calc(var(--ui-u) * 11.4);
    height: calc(var(--ui-u) * 11.4);
  }

  .mobile-action-cluster .mbtn-flash {
    right: calc(var(--ui-u) * 2.4);
    bottom: calc(var(--ui-u) * 3.6);
    width: calc(var(--ui-u) * 11.4);
    height: calc(var(--ui-u) * 11.4);
  }

  .mobile-action-cluster .mbtn-reload {
    right: calc(var(--ui-u) * 18.4);
    bottom: calc(var(--ui-u) * 0.8);
    width: calc(var(--ui-u) * 11.4);
    height: calc(var(--ui-u) * 11.4);
  }

  .mobile-action-cluster .mbtn-loot {
    right: calc(var(--ui-u) * 34.4);
    bottom: calc(var(--ui-u) * 12.0);
    width: calc(var(--ui-u) * 12.0);
    height: calc(var(--ui-u) * 11.4);
  }

  /* 모바일 가로 대합실(#lobby-overlay): Safari WebKit에서 input 고유 너비로 [출발] 버튼이 밀리지 않도록 플렉스 래핑 */
  .comic-panel {
    padding: 10px 14px;
    max-width: 680px;
    max-height: min(calc(100dvh - 12px), calc(100% - 8px));
  }

  .lobby-card .panel-top-bar {
    margin-bottom: 4px;
  }

  .lobby-card .game-title {
    font-size: 20px;
    line-height: 1.05;
    margin: 0 0 2px;
  }

  .lobby-card .game-title br {
    display: none;
  }

  .lobby-card .title-sub {
    font-size: 13px;
    margin-left: 8px;
  }

  .lobby-card .subtitle {
    font-size: 11px;
    margin: 0 0 6px;
  }

  .lobby-card .lan-info-box {
    padding: 3px 8px;
    margin-bottom: 6px;
    font-size: 10px;
  }

  .lobby-card .form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 6px;
  }

  .lobby-card .form-row label {
    flex: 1 1 130px;
    min-inline-size: 0;
    font-size: 11px;
    gap: 2px;
  }

  .lobby-card .form-row input {
    inline-size: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
    padding: 5px 8px;
    font-size: 13px;
  }

  .lobby-card .btn-row {
    flex: 1 1 240px;
    min-inline-size: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
  }

  .lobby-card .btn-row .comic-btn {
    flex: 1 1 auto;
    min-height: max(44px, var(--target-size));
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .lobby-card .status-text {
    font-size: 11px;
    margin: 2px 0;
  }

  .lobby-card .lobby-list-wrap,
  .lobby-card .controls-guide {
    margin-top: 6px;
    padding: 6px 8px;
    font-size: 10px;
  }
}

/* 퀵 버튼 마이크로 라벨 (데스크톱 전용 최소 크기를 분리해 모바일 미디어 쿼리를 덮어쓰지 않도록 유지) */
.comic-icon-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

@media (min-width: 961px) and (min-height: 541px) {
  .comic-icon-btn {
    min-width: max(46px, var(--target-size));
    min-height: max(48px, var(--target-size));
    padding: 5px 4px 4px;
  }
}

.comic-icon-btn .btn-micro-label {
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.2px;
  color: var(--cream);
  paint-order: stroke fill;
  -webkit-text-stroke: 1.5px var(--ink);
  pointer-events: none;
}

/* 방향성 피격 쐐기 표시기 */
#damage-arc {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(260px, 38vmin);
  width: min(260px, 38cqmin);
  height: min(260px, 38vmin);
  height: min(260px, 38cqmin);
  transform: translate(-50%, -50%) rotate(var(--dmg-angle, 0deg));
  border-radius: 50%;
  background: conic-gradient(
    from -28deg,
    rgba(225, 29, 72, 0.92) 0deg,
    rgba(244, 63, 94, 0.72) 56deg,
    transparent 62deg
  );
  -webkit-mask-image: radial-gradient(circle, transparent 58%, #000 62%, #000 78%, transparent 82%);
  mask-image: radial-gradient(circle, transparent 58%, #000 62%, #000 78%, transparent 82%);
  filter: drop-shadow(0 0 10px rgba(225, 29, 72, 0.85));
  pointer-events: none;
  z-index: 6;
}

/* 로비 고급 설정 아코디언 드로어 */
.lobby-advanced-drawer {
  margin-top: 10px;
  border: 2px solid var(--ink);
  background: rgba(11, 8, 20, 0.82);
  box-shadow: 3px 3px 0 var(--ink);
}

.lobby-advanced-drawer summary {
  cursor: pointer;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--cyan);
  list-style: none;
}

.lobby-advanced-drawer summary::-webkit-details-marker {
  display: none;
}

.lobby-advanced-drawer[open] summary {
  border-bottom: 1.5px solid rgba(168, 85, 247, 0.35);
}

.lobby-advanced-body {
  padding: 10px 12px;
}

/* 데스크톱 터치UI 강제 활성화 시 좌하단 회복 패널과 가상 조이스틱 겹침 방지 */
@media (min-width: 961px) and (min-height: 541px) {
  #hud-root.mobile-hud-active .hud-bottom-left-heals {
    left: 186px;
  }
}

/* 10초 전역 발각 나침반 붉은 왕관 핀 & 킬 카운트 강조 */
.compass-bounty-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.compass-crown-pin {
  position: absolute;
  top: 1px;
  left: 50%;
  text-align: center;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.15;
  color: #ffe4e6;
  text-shadow: 0 0 5px #e11d48, 1px 1px 0 #09090b;
  background: rgba(127, 29, 29, 0.86);
  border: 1px solid #fb7185;
  border-radius: 3px;
  padding: 0 3px;
  white-space: nowrap;
}

#hud-kills.crowned-active {
  color: #fda4af;
  text-shadow: 2px 2px 0 var(--ink), 0 0 10px rgba(225, 29, 72, 0.85);
}

#hud-kills.crowned-alert {
  color: #ffe4e6;
  background: rgba(159, 18, 57, 0.55);
  border-radius: 4px;
  padding: 1px 5px;
  animation: crownPulse 0.9s infinite alternate ease-in-out;
}

@keyframes crownPulse {
  from {
    box-shadow: 0 0 4px rgba(244, 63, 94, 0.5);
  }
  to {
    box-shadow: 0 0 14px rgba(251, 113, 133, 0.95);
  }
}

/* 인벤토리 상단 동적 탈출 비행선 호출지 목록 */
.inv-ext-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
}

.inv-ext-pill {
  border: 2px solid var(--ink);
  border-left-width: 5px;
  background: rgba(15, 11, 26, 0.9);
  padding: 6px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inv-ext-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--cream);
}

.inv-ext-meta {
  font-size: 11px;
  color: #cbd5e1;
}

.inv-ext-pill.ext-st-idle {
  border-left-color: #22d3ee;
}

.inv-ext-pill.ext-st-ready {
  border-left-color: #4ade80;
}

.inv-ext-pill.ext-st-inbound {
  border-left-color: #fbbf24;
}

.inv-ext-pill.ext-st-cooldown {
  border-left-color: #f97316;
}

.inv-ext-pill.ext-st-locked {
  border-left-color: #64748b;
}

/* 로비 상단 우측 버튼 그룹 및 설정 내 Gemini 보이스 녹음·저장 카드 */
.panel-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-voice-card {
  border: 2px solid var(--ink);
  background: rgba(20, 14, 34, 0.9);
  padding: 9px 10px;
  margin-bottom: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settings-voice-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--gold);
}

.settings-voice-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.settings-pill-wrap {
  font-size: 11px;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.settings-pill {
  padding: 2px 6px;
  border: 1.5px solid var(--ink);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 10.5px;
  font-weight: 800;
}

.settings-pill.active {
  background: #14532d;
  color: #86efac;
}

.settings-pill.muted {
  background: #78350f;
  color: #fde68a;
}

.settings-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: #cbd5e1;
}

.settings-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 7px;
}

.settings-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
  color: var(--cyan);
}

.settings-label input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 2px solid var(--ink);
  background: #09070f;
  color: var(--cream);
  font-size: 12px;
}

.settings-input-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.settings-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
}

.settings-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #e2e8f0;
  cursor: pointer;
}

.settings-admin-link {
  color: var(--cyan);
  font-weight: 800;
  text-decoration: none;
}

.settings-admin-link:hover {
  text-decoration: underline;
}

.settings-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tts-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tts-progress-bar {
  flex: 1;
  height: 10px;
  background: #09070f;
  border: 2px solid var(--ink);
  overflow: hidden;
}

.tts-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #eab308, #22c55e);
  transition: width 0.25s ease;
}

.tts-progress-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  min-width: 44px;
  text-align: right;
}

.tts-settings-status {
  font-size: 11px;
  line-height: 1.35;
  color: #cbd5e1;
  min-height: 15px;
}

.tts-settings-status.ok {
  color: #86efac;
}

.tts-settings-status.warn {
  color: #fde68a;
}

/* 비행정 선실 대기 중 [출발 · 다른 사냥꾼과 조인] 버튼 바 */
.airship-deploy-bar {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top, 0px)) + 114px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: auto;
}

.airship-deploy-btn {
  min-height: 44px;
  padding: 8px 18px;
  font-size: 14px;
  letter-spacing: 0.4px;
  box-shadow: 4px 4px 0 var(--ink), 0 0 18px rgba(225, 29, 72, 0.55);
  white-space: nowrap;
}

.hud-clock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ping-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border: 1.5px solid var(--ink);
  background: rgba(15, 23, 42, 0.9);
  color: #94a3b8;
  white-space: nowrap;
}

.ping-badge.ping-good {
  color: #86efac;
  background: rgba(20, 83, 45, 0.85);
}

.ping-badge.ping-mid {
  color: #fde68a;
  background: rgba(120, 53, 15, 0.85);
}

.ping-badge.ping-bad {
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.9);
}

@media (max-width: 960px), (max-height: 540px) {
  .ping-badge {
    font-size: calc(var(--ui-u) * 2.2);
    padding: 0 4px;
  }

  .airship-deploy-bar {
    top: calc(max(4px, env(safe-area-inset-top, 0px)) + max(84px, calc(var(--ui-u) * 22.0)));
    left: 48%;
    max-width: 44cqw;
  }

  .airship-deploy-btn {
    min-height: max(44px, var(--target-size));
    padding: 6px 12px;
    font-size: calc(var(--ui-u) * 3.1);
  }
}

/* 다양한 가로 비율(19.5:9·21:9 울트라와이드 & 4:3·16:10 태블릿/창모드) 컨테이너 적응형 HUD */
@container stage (min-aspect-ratio: 19 / 10) {
  #compass-bar,
  #airborne-banner,
  #siren-alert,
  .airship-deploy-bar {
    left: 50%;
  }

  .hud-bottom-center {
    left: 50%;
  }
}

@container stage (max-aspect-ratio: 15 / 10) {
  .hud-top-left-cluster {
    max-width: min(210px, 26cqw);
  }

  .hud-top-right-cluster {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }

  #compass-bar {
    width: min(280px, 32cqw);
  }

  .hud-bottom-center {
    width: min(340px, 34cqw);
  }
}

.tts-settings-status.err {
  color: #fca5a5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 읽기 전용 전장 모니터 HUD 표시 */
#hud-root,
#hud-root .hud-bottom-center,
#hud-root .slot {
  pointer-events: none;
  cursor: default;
}

.monitor-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(12, 9, 22, 0.86);
  border: 1.5px solid var(--ink);
  color: #fca5a5;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  box-shadow: 2px 2px 0 var(--ink);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseLive 1.4s ease-in-out infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

#result-overlay {
  z-index: 45;
}

#result-overlay .center-card {
  width: min(94%, 640px);
  max-width: 640px;
  padding: 20px 22px;
}

.result-kpi-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.result-kpi-grid[hidden] {
  display: none !important;
}

.result-kpi-card {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-kpi-label {
  font-size: 0.92rem;
  color: #cbd5e1;
  font-weight: 800;
}

.result-kpi-value {
  font-size: 1.55rem;
  color: #f8fafc;
  font-weight: 900;
}

.result-kpi-sub {
  font-size: 0.84rem;
  color: #cbd5e1;
  font-weight: 700;
}

@container stage (max-width: 480px) {
  .result-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.result-bonus-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(250, 204, 21, 0.45);
  background: rgba(15, 23, 42, 0.88);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.result-bonus-box[hidden] {
  display: none !important;
}

.result-bonus-line {
  font-size: 0.96rem;
  line-height: 1.42;
  color: #e2e8f0;
  font-weight: 700;
}

.result-bonus-highlight {
  color: #fde047;
  font-weight: 900;
}

.result-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.result-shop-btn {
  min-height: 42px;
  padding: 9px 22px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #111827;
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}

.result-shop-btn:hover {
  filter: brightness(1.06);
}

.result-auto-note {
  margin-top: 10px;
  font-size: 0.94rem;
  color: var(--gold);
  font-weight: 800;
}

@container stage (max-width: 620px), (max-height: 440px) {
  .hud-top-left-cluster {
    top: 6px;
    left: 6px;
    max-width: min(148px, 34cqw);
  }

  .hud-top-left {
    padding: 4px 6px;
    font-size: 0.68rem;
    max-width: 100%;
    overflow: hidden;
  }

  .hud-big {
    font-size: 0.86rem;
  }

  #kill-feed {
    max-width: 100%;
    max-height: 62px;
    overflow: hidden;
  }

  .hud-top-right-cluster {
    top: 6px;
    right: 6px;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .monitor-live-tag {
    font-size: 0.62rem;
    padding: 2px 6px;
  }

  .minimap-wrap {
    width: clamp(66px, 18cqmin, 88px);
    height: clamp(66px, 18cqmin, 88px);
  }

  #minimap-canvas {
    width: 100%;
    height: 100%;
  }

  #compass-bar {
    top: 6px;
    left: 55.5%;
    transform: translateX(-50%);
    width: min(170px, 32cqw);
    padding: 1px 6px 2px;
  }

  #notice-box {
    top: 56px;
    left: 55.5%;
    transform: translateX(-50%);
    max-width: min(200px, 37cqw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.66rem;
    padding: 1px 6px;
  }

  #airborne-banner {
    top: 80px;
    left: 55.5%;
    transform: translateX(-50%);
    max-width: min(200px, 37cqw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.64rem;
    padding: 1px 6px;
  }

  #siren-alert {
    top: 104px;
    left: 55.5%;
    transform: translateX(-50%);
    max-width: min(200px, 37cqw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.64rem;
    padding: 1px 6px;
  }

  #stance-indicator {
    bottom: 46px;
    font-size: 0.64rem;
    padding: 1px 6px;
  }

  #bush-indicator {
    bottom: 66px;
    font-size: 0.68rem;
    padding: 1px 6px;
  }

  #action-progress {
    bottom: 88px;
    font-size: 0.7rem;
    padding: 1px 6px;
  }

  .wound-status {
    left: auto;
    right: 6px;
    transform: none;
    bottom: 46px;
    flex-direction: column;
    align-items: flex-end;
    max-width: min(170px, 44cqw);
  }

  .hud-bottom-center {
    bottom: 4px;
    left: 50%;
    width: min(216px, 56cqw);
    padding: 0;
    gap: 2px;
  }

  .slot {
    font-size: 0.65rem;
    padding: 2px 4px;
  }
}

/* 모니터·채팅창 드래그 분할 리사이저 */
.split-resizer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #131314;
  border: none;
  touch-action: none;
  z-index: 35;
  transition: background-color 0.14s ease;
}

.split-resizer:hover,
.split-resizer:focus-visible,
.split-resizer.dragging {
  background: #1e1f20;
  outline: none;
}

.split-resizer-handle {
  border-radius: 999px;
  background: rgba(196, 199, 197, 0.42);
  box-shadow: none;
  transition: background-color 0.14s ease, transform 0.14s ease;
}

.split-resizer:hover .split-resizer-handle,
.split-resizer.dragging .split-resizer-handle {
  background: #a8c7fa;
  transform: scale(1.12);
}

/* 도킹된 훈수 AI 채팅 터미널 — Google Gemini 스타일 레이아웃 · GUI */
.chat-pane,
.chat-pane.gemini-chat {
  --gm-bg: #0c0f16;
  --gm-surface: #121722;
  --gm-surface-2: #182032;
  --gm-border: rgba(255, 255, 255, 0.08);
  --gm-text: #e6ecf8;
  --gm-text-dim: #9aa6bf;
  --gm-accent: #818cf8;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: max(8px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px))
    max(10px, env(safe-area-inset-bottom, 0px)) 10px;
  background: radial-gradient(120% 80% at 100% 0%, rgba(99, 102, 241, 0.07) 0%, transparent 55%), var(--gm-bg);
  border-left: 1px solid var(--gm-border);
  color: var(--gm-text);
  font-family: 'DungGeunMo', monospace;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

@media (orientation: portrait) {
  .chat-pane,
  .chat-pane.gemini-chat {
    padding: 7px max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px));
    gap: 5px;
    border-left: none;
    border-top: 1px solid var(--gm-border);
  }
}

.chat-pane.gemini-chat button,
.chat-pane.gemini-chat input,
.chat-pane.gemini-chat textarea,
.chat-pane.gemini-chat code {
  font-family: 'DungGeunMo', monospace;
}

.coach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.coach-brand-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.gemini-logo-sparkle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.coach-brand-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #e3e3e3;
  white-space: nowrap;
}

.coach-gold-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fde68a;
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(250, 204, 21, 0.45);
  white-space: nowrap;
}

.coach-learning-badge {
  font-size: 0.69rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.42);
  white-space: nowrap;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-strategy-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  color: #d2e3fc;
  background: #1e1f20;
  border: 1px solid #333537;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-strategy-badge[hidden] {
  display: none !important;
}

.coach-icon-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #333537;
  background: #1e1f20;
  color: #c4c7c5;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.coach-icon-btn:hover {
  background: #282a2c;
  border-color: #a8c7fa;
  color: #e3e3e3;
}

.coach-icon-btn.active {
  background: rgba(168, 199, 250, 0.16);
  border-color: #a8c7fa;
  color: #a8c7fa;
}

.coach-quick-dock {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.coach-quick-dock[hidden] {
  display: none !important;
}

.coach-hero-ctas {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 8px;
}

.coach-util-ctas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.coach-quick-btn {
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #141925;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.14s ease, background 0.14s ease, color 0.14s ease, box-shadow 0.16s ease;
}

.coach-quick-btn.coach-hero-btn {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.015em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

@media (orientation: portrait) {
  .coach-quick-btn.coach-hero-btn {
    min-height: 40px;
    font-size: 0.84rem;
  }
}

.coach-quick-btn.is-class {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(52, 211, 153, 0.1);
  color: #d1fae5;
}

.coach-quick-btn.is-class[data-class="tank"] {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.12);
  color: #dbeafe;
}

.coach-quick-btn.is-class[data-class="melee"] {
  border-color: rgba(244, 63, 94, 0.55);
  background: rgba(244, 63, 94, 0.12);
  color: #ffe4e6;
}

.coach-quick-btn.is-class[data-class="mage"] {
  border-color: rgba(192, 132, 252, 0.55);
  background: rgba(192, 132, 252, 0.12);
  color: #f3e8ff;
}

.coach-quick-btn:hover {
  border-color: rgba(148, 163, 184, 0.45);
  background: #1b2334;
  color: #f8fafc;
}

.coach-quick-btn:active {
  transform: translateY(1px) scale(0.985);
}

.coach-quick-btn.is-gold {
  border-color: rgba(253, 224, 71, 0.72);
  background: linear-gradient(135deg, #422b09 0%, #8a5b11 54%, #c98617 100%);
  color: #fef9c3;
  box-shadow: 0 5px 16px rgba(245, 158, 11, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.coach-quick-btn.is-gold:hover {
  border-color: #fde047;
  filter: brightness(1.08);
  box-shadow: 0 7px 20px rgba(245, 158, 11, 0.36);
}

.coach-quick-btn.is-start {
  border-color: rgba(110, 231, 183, 0.85);
  background: linear-gradient(135deg, #065f46 0%, #059669 52%, #10b981 100%);
  color: #ecfdf5;
  box-shadow: 0 5px 18px rgba(16, 185, 129, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: heroStartPulse 2.8s ease-in-out infinite;
}

.coach-quick-btn.is-start:hover {
  border-color: #a7f3d0;
  filter: brightness(1.08);
  box-shadow: 0 7px 22px rgba(16, 185, 129, 0.48);
}

.coach-quick-btn.is-start.is-warmed-up {
  border-color: #fde047;
  background: linear-gradient(135deg, #065f46 0%, #10b981 55%, #eab308 100%);
  color: #fefce8;
  box-shadow: 0 6px 24px rgba(250, 204, 21, 0.42), 0 0 0 2px rgba(253, 224, 71, 0.28);
}

@keyframes heroStartPulse {
  0%, 100% {
    box-shadow: 0 5px 16px rgba(16, 185, 129, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  50% {
    box-shadow: 0 6px 22px rgba(52, 211, 153, 0.52), 0 0 0 2px rgba(110, 231, 183, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  }
}

.coach-quick-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  animation: none;
}

/* 홈 선실 허수아비 웜업 액션 바 */
.coach-warmup-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 12px;
  background: #121722;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.coach-warmup-bar[hidden] {
  display: none !important;
}

.coach-warmup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.coach-warmup-title-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.coach-warmup-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #cbd5e1;
  white-space: nowrap;
}

.coach-warmup-status-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.coach-warmup-status {
  display: inline-block;
  width: 100%;
  font-size: 0.71rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(129, 140, 248, 0.14);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: #c7d2fe;
  white-space: normal;
  line-height: 1.3;
}

.coach-warmup-status.is-hot {
  background: rgba(249, 115, 22, 0.22);
  border-color: rgba(251, 146, 60, 0.65);
  color: #fed7aa;
}

.coach-warmup-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.coach-warmup-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.coach-warmup-chip {
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #182030;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.67rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.08s ease;
}

.coach-warmup-chip:hover {
  background: #232d44;
  border-color: rgba(129, 140, 248, 0.58);
  color: #f8fafc;
}

.coach-warmup-chip:active {
  transform: scale(0.95);
}

.coach-warmup-chip.is-combat {
  border-color: rgba(248, 113, 113, 0.38);
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
}

.coach-warmup-chip.is-combat:hover {
  border-color: rgba(248, 113, 113, 0.72);
  background: rgba(153, 27, 27, 0.44);
}

.coach-warmup-chip.is-accent {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(14, 116, 144, 0.28);
  color: #bae6fd;
}

.coach-warmup-chip.is-stop {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.55);
  color: #94a3b8;
}

.coach-warmup-chip.is-active {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.34);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4);
}

.coach-stance-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  flex-shrink: 0;
}

.coach-stance-bar[hidden] {
  display: none !important;
}

.coach-stance-btn {
  min-height: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #333537;
  background: #1e1f20;
  color: #c4c7c5;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.08s ease;
}

.coach-stance-btn:active {
  transform: translateY(2px) scale(0.97);
}

.coach-stance-btn:hover {
  background: #282a2c;
  border-color: #5f6368;
  color: #e3e3e3;
}

.coach-stance-btn.active {
  background: rgba(168, 199, 250, 0.18);
  border-color: #a8c7fa;
  color: #d2e3fc;
}

.coach-class-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  flex-shrink: 0;
}

.coach-class-bar[hidden] {
  display: none !important;
}

.visually-hidden-focusable:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.monitor-class-a11y[hidden] {
  display: none !important;
}

.monitor-class-a11y:focus-within {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-radius: 10px;
  background: rgba(8, 11, 20, 0.96);
  border: 2px solid #fbbf24;
}

.monitor-class-a11y-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.monitor-class-a11y-btn,
.monitor-class-a11y-confirm {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.monitor-class-a11y-btn[aria-pressed="true"] {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.2);
}

.monitor-class-a11y-confirm {
  border-color: #fde047;
  background: #854d0e;
  color: #fef9c3;
}

.monitor-class-a11y-btn:focus-visible,
.monitor-class-a11y-confirm:focus-visible,
.coach-quick-btn:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}

.coach-class-btn {
  min-height: 26px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid #333537;
  background: #1a1b1d;
  color: #c4c7c5;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.08s ease;
}

.coach-class-btn:hover {
  background: #282a2c;
  border-color: #5f6368;
  color: #f1f3f4;
}

.coach-class-btn.active {
  background: rgba(52, 211, 153, 0.18);
  border-color: #34d399;
  color: #d1fae5;
}

.coach-class-btn[data-class="tank"].active {
  background: rgba(96, 165, 250, 0.22);
  border-color: #60a5fa;
  color: #dbeafe;
}

.coach-class-btn[data-class="melee"].active {
  background: rgba(244, 63, 94, 0.22);
  border-color: #f43f5e;
  color: #ffe4e6;
}

.coach-class-btn[data-class="mage"].active {
  background: rgba(192, 132, 252, 0.22);
  border-color: #c084fc;
  color: #f3e8ff;
}

.coach-class-bar.is-locked .coach-class-btn {
  opacity: 0.48;
  cursor: not-allowed;
}

.coach-class-bar.is-locked .coach-class-btn:hover {
  background: #1a1b1d;
  border-color: #333537;
  color: #c4c7c5;
}

.coach-class-bar.is-locked .coach-class-btn.active {
  opacity: 0.92;
  border-style: dashed;
}

.coach-class-bar.is-locked .coach-class-btn.active::after {
  content: ' 🔒';
  font-size: 0.65rem;
  opacity: 0.92;
}

@keyframes classLockPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.55);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.35);
  }
}

.coach-class-bar.is-locking-soon .coach-class-btn.active {
  border-color: #fbbf24;
  animation: classLockPulse 0.75s ease-in-out infinite;
}

.coach-skill-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.coach-skill-bar[hidden] {
  display: none !important;
}

.coach-skill-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 26px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid #3c4043;
  background: #1f2226;
  color: #e3e3e3;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}

.coach-skill-btn.is-ready {
  border-color: rgba(168, 199, 250, 0.55);
  background: rgba(168, 199, 250, 0.12);
}

.coach-skill-btn.on-cd {
  opacity: 0.58;
  border-color: #333537;
  background: #17181a;
  color: #9aa0a6;
}

.coach-shield-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.2);
  border: 1px solid #60a5fa;
  color: #dbeafe;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.coach-shield-pill[hidden] {
  display: none !important;
}

/* 고밀도 실시간 전술 텔레메트리 스트립 (한 줄에 핵심 수치 전부 집약) */
.coach-telemetry-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(30, 31, 32, 0.9);
  border: 1px solid #2b2d30;
  font-size: 0.69rem;
  line-height: 1.3;
  color: #b8c2cc;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.cts-pill {
  font-size: 0.7rem;
  line-height: 1.2;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

.cts-pill.warn {
  color: #fca5a5;
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(127, 29, 29, 0.25);
}

.cts-pill.gold {
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.35);
}

/* AGY 상단 컨텍스트 상태 바 + 보유 골드/TTS/화면 모드 행 */
.coach-orders-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 8px;
  min-height: 30px;
  border-radius: 10px;
  background: #121722;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.coach-orders-meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.coach-tts-btn {
  min-block-size: 26px;
  min-inline-size: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #3c4043;
  background: #1e1f20;
  color: #c4c7c5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.coach-tts-btn:hover:not(:disabled) {
  background: #282a2c;
  border-color: #a8c7fa;
  color: #e3e3e3;
}

.coach-tts-btn.active {
  background: rgba(168, 199, 250, 0.16);
  border-color: rgba(168, 199, 250, 0.65);
  color: #dbeafe;
}

.coach-tts-btn.is-muted {
  background: #1e1f20;
  border-color: #3c4043;
  color: #8e918f;
}

.coach-tts-btn.is-muted .coach-tts-label {
  text-decoration: line-through;
}

.coach-tts-btn.is-speaking {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.25);
}

.coach-tts-btn:focus-visible {
  outline: 2px solid #a8c7fa;
  outline-offset: 2px;
}

.coach-tts-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.coach-tts-icon[hidden] {
  display: none !important;
}

@media (pointer: coarse) {
  .coach-tts-btn,
  .coach-gfx-btn {
    min-block-size: 32px;
    padding: 3px 10px;
  }
}

.coach-gfx-btn {
  min-block-size: 26px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.65);
  background: rgba(56, 189, 248, 0.14);
  color: #e0f2fe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.coach-gfx-btn[hidden] {
  display: none !important;
}

.coach-gfx-btn:hover {
  background: rgba(56, 189, 248, 0.24);
  border-color: #7dd3fc;
  color: #ffffff;
}

.coach-gfx-btn.is-crt {
  background: rgba(74, 222, 128, 0.14);
  border-color: rgba(74, 222, 128, 0.55);
  color: #bbf7d0;
}

.coach-gfx-btn:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.coach-orders-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 3px;
  padding: 0 2px 0 0;
  box-sizing: border-box;
  overflow-x: clip;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  flex: 1 1 auto;
}

.coach-orders-empty {
  font-size: 0.7rem;
  color: #8e918f;
  padding: 1px 5px;
}

.coach-order-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(168, 199, 250, 0.14);
  border: 1px solid rgba(168, 199, 250, 0.44);
  color: #dbeafe;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.coach-order-chip.is-updated {
  animation: orderChipFlash 0.6s ease-out;
}

@keyframes orderChipFlash {
  0% {
    transform: scale(1.1);
    background: rgba(250, 204, 21, 0.36);
    border-color: #fde047;
    color: #fef08a;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.55);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

.coach-thought-bar {
  flex-shrink: 0;
}

.coach-thought-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 10px;
  border: 1px solid #282a2c;
  background: #1e1f20;
  color: #c4c7c5;
  font-size: 0.76rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.coach-thought-btn:hover {
  background: #242628;
  border-color: #3c4043;
}

.gemini-sparkle-dot {
  font-size: 0.85rem;
  line-height: 1;
  background: linear-gradient(135deg, #4285f4, #9b72cb, #d96570);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}

.coach-thought {
  flex: 1;
  min-width: 0;
  color: #e3e3e3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.coach-thought-btn.expanded .coach-thought {
  white-space: normal;
  overflow: visible;
}

.coach-thought-chevron {
  color: #9aa0a6;
  flex-shrink: 0;
  transition: transform 0.16s ease;
}

.coach-thought-btn.expanded .coach-thought-chevron {
  transform: rotate(180deg);
}

.coach-chat-body {
  position: relative;
  flex: 1 1 0;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.coach-chat-log {
  flex: 1 1 0;
  min-height: 80px;
  overflow-y: auto;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 8px 6px 12px;
  background: transparent;
  border: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.coach-chat-log::-webkit-scrollbar {
  width: 5px;
}

.coach-chat-log::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.26);
  border-radius: 999px;
}

/* Gemini 스타일 플로팅 하단 이동 화살표 버튼 */
.coach-scroll-bottom-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 15;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(168, 199, 250, 0.55);
  background: rgba(24, 26, 32, 0.94);
  color: #d2e3fc;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.14s ease;
}

.coach-scroll-bottom-btn[hidden] {
  display: none !important;
}

.coach-scroll-bottom-btn:hover {
  background: #282c36;
  border-color: #a8c7fa;
}

.coach-scroll-bottom-btn:active {
  transform: scale(0.92);
}

.coach-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #facc15;
  color: #111827;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.coach-unread-badge[hidden] {
  display: none !important;
}

/* 모니터(#game-stage) 전화면을 꽉 채우는 강하·전술 지도 풀 모달 (WebGL2 CRT + 유리 베젤 유지, 다른 모니터 HUD만 숨김) */
#game-stage.has-map-modal > :not(#coach-map-sheet):not(#crt-glass-overlay):not(#game-canvas) {
  visibility: hidden !important;
  pointer-events: none !important;
}

.coach-map-sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: block;
  padding: 0;
  border-radius: 0;
  background: #070b14;
  border: none;
  box-shadow: none;
  overflow: hidden;
}

#game-stage.crt-active .coach-map-sheet {
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border-radius: 16px;
  clip-path: inset(0 round 16px);
  overflow: hidden;
  background: transparent;
  z-index: 40;
  padding: 0;
}

@media (max-width: 768px), (max-height: 520px) {
  #game-stage.crt-active .coach-map-sheet {
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    border-radius: 12px;
    clip-path: inset(0 round 12px);
    padding: 0;
  }
}

#game-stage.crt-active .coach-map-sheet::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    rgba(0, 0, 0, 0.22) 1px,
    rgba(0, 0, 0, 0.22) 3px
  );
  mix-blend-mode: multiply;
}

#game-stage.crt-active .coach-map-sheet-stage .coach-map-canvas {
  opacity: 0.001;
  background: transparent;
  border-color: transparent;
}

.coach-map-sheet[hidden] {
  display: none !important;
}

.coach-map-sheet-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.coach-map-sheet-stage .coach-map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border: none;
  border-radius: 0;
  background: #060912;
  cursor: crosshair;
  touch-action: none;
}

.coach-map-float-status {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  max-width: calc(100% - 58px);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 10, 20, 0.78);
  border: 1px solid rgba(114, 152, 214, 0.42);
  color: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.coach-map-float-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(12, 16, 28, 0.84);
  color: #f8fafc;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.coach-map-float-close:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #a8c7fa;
}

.coach-map-float-zoom {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(6, 10, 20, 0.82);
  border: 1px solid rgba(114, 152, 214, 0.4);
}

.coach-map-zoom-btn {
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.85);
  color: #f1f5f9;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.coach-map-zoom-btn:hover {
  border-color: #93c5fd;
  background: rgba(51, 65, 85, 0.95);
}

.coach-map-float-clear {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 6;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.45);
  background: rgba(6, 10, 20, 0.82);
  color: #fde68a;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.coach-map-float-clear:hover {
  border-color: #facc15;
  background: rgba(24, 30, 48, 0.92);
}

.coach-msg {
  font-size: 0.8rem;
  line-height: 1.5;
  word-break: break-word;
}

.coach-msg.sender-user {
  align-self: flex-end;
  max-width: min(86%, 460px);
  padding: 8px 13px;
  border-radius: 16px 16px 4px 16px;
  background: #1b2234;
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #f1f5f9;
}

.coach-msg.sender-user .coach-msg-head {
  display: none;
}

.coach-msg.sender-ai,
.coach-msg.sender-bot,
.coach-msg.sender-hunter {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  align-self: stretch;
  padding: 2px 2px;
  background: transparent;
}

.gemini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28) 0%, rgba(56, 189, 248, 0.22) 100%);
  border: 1px solid rgba(129, 140, 248, 0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #c7d2fe;
}

.coach-msg-content {
  flex: 1;
  min-width: 0;
}

.coach-msg.sender-mcp {
  align-self: flex-end;
  max-width: min(86%, 460px);
  padding: 8px 13px;
  border-radius: 16px 16px 4px 16px;
  background: rgba(245, 196, 81, 0.12);
  border: 1px solid rgba(245, 196, 81, 0.3);
}

.coach-msg.sender-system {
  align-self: stretch;
  padding: 7px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(255, 255, 255, 0.075);
  font-size: 0.78rem;
  color: #cbd5e1;
}

/* 전체 봇 상태 텔레메트리 슬림 로그 */
.coach-msg.sender-botlog {
  align-self: stretch;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 0.73rem;
  line-height: 1.38;
  color: #c4c7c5;
}

.botlog-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(168, 199, 250, 0.12);
  color: #a8c7fa;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.botlog-author {
  font-weight: 700;
  color: #e3e3e3;
  flex-shrink: 0;
}

.botlog-text {
  flex: 1;
  min-width: 120px;
  color: #b4b8bc;
}

.coach-msg.sender-botlog .coach-msg-time {
  font-size: 0.65rem;
  color: #7c8086;
  margin-left: auto;
}

.coach-msg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #9aa0a6;
  margin-bottom: 2px;
}

.coach-msg-body {
  color: #e3e3e3;
}

/* 상황별 객관식 전술 질문 카드 (컴팩트 고밀도 · 타격감) */
.coach-question-card {
  padding: 9px 11px;
  border-radius: 14px;
  background: #1e1f20;
  border: 1px solid rgba(168, 199, 250, 0.38);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coach-q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.coach-q-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #a8c7fa;
}

.coach-q-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f3f4;
  line-height: 1.32;
}

.coach-q-detail {
  margin: 0;
  font-size: 0.74rem;
  color: #c4c7c5;
  line-height: 1.35;
}

.coach-q-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.coach-q-opt {
  position: relative;
  overflow: hidden;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid #484d52;
  background: linear-gradient(180deg, #2d3034 0%, #232528 100%);
  box-shadow: 0 2px 0 #111317;
  color: #f1f5f9;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.14s ease, border-color 0.14s ease;
}

.coach-q-opt:hover:not(:disabled) {
  background: linear-gradient(180deg, #353a40 0%, #292c30 100%);
  border-color: #a8c7fa;
}

.coach-q-opt:active:not(:disabled),
.coach-q-opt.is-pressing {
  transform: translateY(3px) scale(0.975);
  box-shadow: 0 0 0 #111317, inset 0 2px 6px rgba(0, 0, 0, 0.55);
  border-color: #fde047;
}

.coach-q-opt.is-hit-burst {
  animation: mcqHitConfirm 0.22s ease-out;
  border-color: #fde047;
  color: #fef08a;
}

.coach-q-opt.is-hit-burst::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  border: 2px solid rgba(250, 204, 21, 0.9);
  pointer-events: none;
  animation: mcqShockRing 0.26s ease-out forwards;
}

@keyframes mcqHitConfirm {
  0% { transform: translateY(3px) scale(0.96); background: rgba(250, 204, 21, 0.34); }
  55% { transform: translateY(-1px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes mcqShockRing {
  0% { opacity: 0.95; transform: scale(0.98); }
  100% { opacity: 0; transform: scale(1.04); }
}

.coach-q-opt.selected {
  background: rgba(168, 199, 250, 0.18);
  border-color: #a8c7fa;
  color: #d2e3fc;
  box-shadow: 0 2px 0 #102a4e;
}

.coach-q-opt:disabled {
  cursor: default;
  opacity: 0.72;
}

.coach-q-opt.selected:disabled {
  opacity: 1;
}

.coach-q-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3c4043;
  color: #e3e3e3;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.coach-q-opt.selected .coach-q-num {
  background: #a8c7fa;
  color: #062e6f;
}

.coach-q-label {
  flex: 1;
  min-width: 0;
}

/* /? 입력 시 채팅창 내부에 열리는 주요 훈수 버튼 카드 */
.coach-help-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: #1e1f20;
  border: 1px solid #3c4043;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coach-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #a8c7fa;
}

.coach-help-close {
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #3c4043;
  background: #282a2c;
  color: #c4c7c5;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.coach-help-desc {
  margin: 0;
  font-size: 0.74rem;
  color: #c4c7c5;
}

.coach-help-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.coach-help-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #9aa0a6;
}

.coach-help-btns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 4px;
}

.coach-help-btn {
  min-height: 26px;
  padding: 3px 7px;
  border-radius: 8px;
  border: 1px solid #3c4043;
  background: #282a2c;
  color: #e3e3e3;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.coach-help-btn:hover {
  background: #333537;
  border-color: #a8c7fa;
  color: #d2e3fc;
}

.coach-help-btn.accent {
  background: rgba(168, 199, 250, 0.12);
  border-color: rgba(168, 199, 250, 0.45);
  color: #a8c7fa;
}

.coach-help-btn.accent:hover {
  background: #a8c7fa;
  color: #062e6f;
}

/* AGY 스타일 통합 플로팅 하단 컴포저 카드 (텔레메트리 스트립 + 입력 폼 일체화) */
.coach-composer-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-radius: 15px;
  background: #131824;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.coach-composer-wrap:focus-within {
  border-color: rgba(129, 140, 248, 0.62);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.44), 0 0 0 2px rgba(129, 140, 248, 0.16);
}

.coach-composer-wrap .coach-telemetry-strip {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
  padding: 4px 10px;
}

.coach-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 9px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.coach-composer-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.coach-tool-btn {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.coach-tool-btn:hover {
  background: rgba(129, 140, 248, 0.16);
  border-color: rgba(129, 140, 248, 0.45);
  color: #f8fafc;
}

#coach-input {
  flex: 1;
  min-width: 0;
  min-height: 32px;
  padding: 3px 6px;
  border: none;
  background: transparent;
  color: #f1f5f9;
  font-size: 0.81rem;
  font-family: inherit;
  user-select: text;
  -webkit-user-select: text;
}

#coach-input::placeholder {
  color: #7c8aa5;
}

#coach-input:focus {
  outline: none;
}

.coach-send-btn {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(165, 180, 252, 0.45);
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.14s ease, transform 0.1s ease;
}

.coach-send-btn:hover {
  filter: brightness(1.08);
}

.coach-send-btn:active {
  transform: scale(0.95);
}

/* 채팅창 인라인 전술 지도 카드 (.coach-map-card) & 출격 상점 카드 (.coach-shop-card) */
.coach-map-card,
.coach-shop-card {
  padding: 10px 11px;
  border-radius: 16px;
  background: #1e1f20;
  border: 1px solid rgba(168, 199, 250, 0.34);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coach-map-stage {
  display: flex;
  justify-content: center;
}

.coach-map-canvas {
  width: min(100%, 230px);
  max-height: min(230px, 34dvh);
  aspect-ratio: 1;
  display: block;
  border-radius: 12px;
  border: 1px solid #3c4043;
  background: #0c0e14;
  cursor: crosshair;
  touch-action: none;
}

@media (orientation: portrait) {
  .coach-map-canvas {
    width: min(100%, 155px);
    max-height: 155px;
  }
}

.coach-map-status {
  padding: 8px 11px;
  border-radius: 10px;
  background: #131314;
  border: 1px solid #282a2c;
  font-size: 0.86rem;
  color: #d1d5db;
  line-height: 1.4;
}

.coach-map-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.coach-map-legend {
  font-size: 0.82rem;
  color: #9aa0a6;
}

.coach-map-clear-btn {
  min-height: 34px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid #3c4043;
  background: #282a2c;
  color: #e3e3e3;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.coach-map-clear-btn:hover {
  background: #333537;
  border-color: #a8c7fa;
  color: #d2e3fc;
}

.coach-shop-card {
  max-height: 44dvh;
  overflow-y: auto;
  touch-action: pan-y;
  gap: 6px;
  padding: 9px 11px;
}

.coach-shop-status {
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.25);
  font-size: 0.8rem;
  color: #fde68a;
  line-height: 1.35;
}

.coach-shop-gold {
  margin-left: 6px;
  font-size: 0.86rem;
  color: #fde68a;
}

.coach-shop-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coach-shop-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #9aa0a6;
}

.coach-shop-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coach-shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 9px;
  background: #242628;
  border: 1px solid #333537;
}

.coach-shop-thumb {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: pixelated;
  border-radius: 6px;
  background: rgba(8, 10, 18, 0.75);
  border: 1px solid #3c4043;
}

.coach-shop-item.equipped {
  border-color: #a8c7fa;
  background: rgba(168, 199, 250, 0.1);
}

.coach-shop-item-meta {
  flex: 1;
  min-width: 0;
}

.coach-shop-item-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #f1f3f4;
  line-height: 1.25;
}

.coach-shop-item-desc {
  font-size: 0.76rem;
  color: #9aa0a6;
  line-height: 1.28;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-shop-item-btn {
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #3c4043;
  background: #282a2c;
  color: #e3e3e3;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.coach-shop-item-btn.buy {
  border-color: rgba(250, 204, 21, 0.45);
  color: #fde68a;
}

.coach-shop-item-btn.equipped {
  background: #a8c7fa;
  border-color: #a8c7fa;
  color: #062e6f;
}

.coach-shop-item-btn.soldout,
.shop-action-btn.soldout {
  background: rgba(69, 10, 10, 0.9);
  border-color: #ef4444;
  color: #fca5a5;
  cursor: not-allowed;
  opacity: 0.82;
}

.coach-shop-item-btn[data-insufficient="1"] {
  opacity: 0.5;
}

.coach-shop-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.coach-shop-start-btn {
  width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(110, 231, 183, 0.85);
  background: linear-gradient(135deg, #065f46 0%, #059669 52%, #10b981 100%);
  color: #ecfdf5;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.34);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.coach-shop-start-btn:hover {
  filter: brightness(1.06);
}

/* 모바일 ChatGPT · Gemini 원격 MCP 연동 다이얼로그 */
#mcp-guide-dialog {
  width: min(680px, 94vw);
  max-height: 88vh;
  margin: auto;
  padding: 16px 18px;
  border: 3px solid var(--gold);
  border-radius: 10px;
  background: linear-gradient(180deg, #1a122b 0%, #0f0a1a 100%);
  color: var(--text);
  box-shadow: 6px 6px 0 var(--ink), 0 0 36px rgba(245, 196, 81, 0.25);
}

#mcp-guide-dialog::backdrop {
  background: rgba(6, 4, 12, 0.78);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.mcp-guide-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.mcp-lead {
  margin: 0;
  color: #e2e8f0;
}

.mcp-url-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.42);
  border: 1.5px solid rgba(245, 196, 81, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mcp-url-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: #fde68a;
}

.mcp-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mcp-endpoint-url {
  flex: 1;
  min-width: 220px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #090612;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #86efac;
  font-size: 0.84rem;
  word-break: break-all;
}

.mcp-copy-status {
  min-height: 1.1em;
  font-size: 0.78rem;
  color: #86efac;
  font-weight: 700;
}

.mcp-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.mcp-step-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.mcp-step-card h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--gold);
}

.mcp-step-card ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
}

.mcp-tools-summary {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(192, 132, 252, 0.35);
  font-size: 0.78rem;
  line-height: 1.5;
}

.coach-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* 모니터(#game-stage) 전용 실물 CRT 브라운관 베젤 & 유리 오버레이 (채팅창·모달 제외) */
#game-stage.crt-active {
  --crt-ui-scan-alpha: 0.22;
  --crt-ui-scan-step: 3px;
  --crt-ui-mask-alpha: 0.045;
  --crt-chroma: 0.28;
  --crt-glow: 0.18;
  padding: 8px;
  background: linear-gradient(160deg, #1b1d26 0%, #0d0e14 55%, #06070c 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.09),
    inset 0 -3px 6px rgba(0, 0, 0, 0.85),
    inset 0 0 0 2px #05060a;
}

#game-stage.crt-active[data-crt-preset="arcade"] {
  --crt-ui-scan-alpha: 0.28;
  --crt-ui-scan-step: 3px;
  --crt-ui-mask-alpha: 0.062;
  --crt-chroma: 0.36;
  --crt-glow: 0.24;
}

#game-stage.crt-active[data-crt-preset="vhs"] {
  --crt-ui-scan-alpha: 0.24;
  --crt-ui-scan-step: 3px;
  --crt-ui-mask-alpha: 0.050;
  --crt-chroma: 0.44;
  --crt-glow: 0.21;
}

@media (max-width: 768px), (max-height: 520px) {
  #game-stage.crt-active {
    --crt-ui-scan-alpha: 0.105;
    --crt-ui-scan-step: 2px;
    --crt-ui-mask-alpha: 0.022;
    --crt-chroma: 0.14;
    --crt-glow: 0.10;
    padding: 4px;
  }

  #game-stage.crt-active[data-crt-preset="arcade"] {
    --crt-ui-scan-alpha: 0.14;
    --crt-ui-mask-alpha: 0.030;
    --crt-chroma: 0.18;
  }

  #game-stage.crt-active[data-crt-preset="vhs"] {
    --crt-ui-scan-alpha: 0.12;
    --crt-ui-mask-alpha: 0.025;
    --crt-chroma: 0.20;
  }
}

#game-stage.crt-active #game-canvas,
#game-stage.crt-active #weapon-canvas,
#game-stage.crt-active #fp-weapon-layer,
#game-stage.crt-active #hud-root,
#game-stage.crt-active #damage-vignette,
#game-stage.crt-active #bush-vignette,
#game-stage.crt-active #water-vignette {
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border-radius: 16px;
  overflow: hidden;
  clip-path: inset(0 round 16px);
}

#game-stage.crt-active #fp-weapon-layer {
  z-index: 2;
}

#game-stage.crt-active #game-canvas {
  cursor: grab;
}

.crt-glass-overlay {
  display: none;
  position: absolute;
  inset: 8px;
  border-radius: 16px;
  pointer-events: none !important;
  z-index: 60;
}

@media (max-width: 768px), (max-height: 520px) {
  .crt-glass-overlay {
    inset: 4px;
    border-radius: 12px;
  }

  #game-stage.crt-active #game-canvas,
  #game-stage.crt-active #weapon-canvas,
  #game-stage.crt-active #fp-weapon-layer,
  #game-stage.crt-active #hud-root,
  #game-stage.crt-active #damage-vignette,
  #game-stage.crt-active #bush-vignette,
  #game-stage.crt-active #water-vignette {
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    border-radius: 12px;
    clip-path: inset(0 round 12px);
  }
}

#game-stage.crt-active .crt-glass-overlay {
  display: block;
  background-image:
    linear-gradient(125deg, rgba(255, 255, 255, 0.018) 0%, rgba(255, 255, 255, 0.004) 18%, transparent 36%),
    radial-gradient(ellipse at 22% 14%, rgba(255, 255, 255, 0.014) 0%, rgba(255, 255, 255, 0) 44%),
    radial-gradient(ellipse at center, transparent 62%, rgba(2, 2, 8, 0.22) 100%);
  box-shadow:
    inset 0 0 0 5px #07080d,
    inset 0 4px 14px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 10px #0d0e14;
}

/* funQA: 처치/헤드샷 순간 CRT 유리 플래시 & 채팅 톤 하이라이트 & 골드 팝업 */
#game-stage.crt-kill-flash .crt-glass-overlay {
  box-shadow:
    inset 0 0 0 5px #07080d,
    inset 0 0 28px rgba(168, 199, 250, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 0 0 10px #0d0e14;
}

.coach-msg.tone-kill {
  border-left: 2px solid #f43f5e;
  padding-left: 8px;
}

.coach-msg.tone-loot {
  border-left: 2px solid #facc15;
  padding-left: 8px;
}

.coach-msg.tone-alert {
  border-left: 2px solid #f97316;
  padding-left: 8px;
}

@keyframes haulGainPulse {
  0% { transform: scale(1); color: #fde68a; }
  40% { transform: scale(1.08); color: #fef08a; }
  100% { transform: scale(1); }
}

#hud-root .haul-badge.pop {
  animation: haulGainPulse 0.42s ease-out;
}

/* 모니터 내 모든 HUD·자막·배너·비네팅 시각 UI는 오프스크린 캔버스로 단일 합성(실사·CRT 모두 DOM 중복 차단) */
#game-stage #hud-root > :not(.hud-top-right-cluster),
#game-stage #hud-root .hud-top-right-cluster > :not(.minimap-wrap),
#game-stage #merchant-subtitle,
#game-stage #result-overlay,
#game-stage #damage-vignette,
#game-stage #bush-vignette,
#game-stage #water-vignette {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#game-stage #hud-root .minimap-wrap {
  opacity: 0 !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

#game-stage.shop-open #hud-root,
#game-stage.shop-open #hud-root * {
  pointer-events: none !important;
}

#game-stage.crt-active #hud-root,
#game-stage.crt-active #fp-weapon-layer {
  filter: none;
}

#game-stage.crt-active #hud-root {
  text-shadow: none;
}

/* 최소화된 프레임리스 HUD (1인칭 손·무기 시야 확보 및 패널 배경 제거) */
#hud-root .comic-box,
#hud-root .hud-top-left,
#hud-root #compass-bar,
#hud-root .hud-bottom-center,
#hud-root #notice-box,
#hud-root #airborne-banner,
#hud-root #siren-alert,
#hud-root #bush-indicator,
#hud-root #stance-indicator,
#hud-root #action-progress {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#hud-root {
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.96),
    0 0 6px rgba(0, 0, 0, 0.85);
}

#hud-root .hud-top-left {
  padding: 2px 4px;
  gap: 1px;
}

#hud-root .clock-badge,
#hud-root .ping-badge,
#hud-root .zone-badge,
#hud-root .extract-badge,
#hud-root .badge {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0 3px 0 0;
}

#hud-root .kill-feed-list .kf-item {
  background: rgba(6, 10, 20, 0.36);
  border: none;
  box-shadow: none;
  padding: 1px 5px;
}

#hud-root #notice-box,
#hud-root #airborne-banner,
#hud-root #siren-alert {
  background: rgba(6, 10, 20, 0.36);
  border-radius: 4px;
}

#hud-root .minimap-wrap {
  background: rgba(8, 12, 22, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 1px;
  box-shadow: none;
  pointer-events: auto;
  cursor: pointer;
}

#hud-root .minimap-wrap canvas {
  border-width: 1px;
}

#hud-root .hud-bottom-center {
  bottom: 4px;
  width: min(260px, 56cqw);
  padding: 0;
  gap: 2px;
}

#hud-root .hud-bottom-center .center-top-meta {
  font-size: 0.68rem;
  gap: 6px;
}

#hud-root .hud-bottom-center .weapon-title {
  font-size: 0.72rem;
}

#hud-root .hud-bottom-center .ammo-big {
  font-size: 0.8rem;
}

#hud-root .hud-bottom-center .bar-wrap {
  height: 11px;
  border-width: 1px;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: none;
}

#hud-root .hud-bottom-center .bar-text {
  font-size: 0.64rem;
}

#hud-root .hud-bottom-center .boost-wrap,
#hud-root .hud-bottom-center .stamina-wrap {
  height: 3px;
  border: none;
  background: rgba(0, 0, 0, 0.35);
}

#hud-root .hud-bottom-center .slot-row {
  display: none;
}

@container stage (min-width: 621px) and (min-height: 441px) {
  #stance-indicator {
    bottom: 44px;
  }

  #bush-indicator {
    bottom: 66px;
  }

  #action-progress {
    bottom: 88px;
  }

  .wound-status {
    bottom: 44px;
  }

  #notice-box {
    top: 76px;
  }

  #airborne-banner {
    top: 118px;
  }

  #siren-alert {
    top: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coach-stance-btn,
  .coach-icon-btn,
  .crt-glass-overlay,
  #game-stage.crt-active #hud-root,
  .blood-blink-icon {
    transition: none;
    animation: none;
  }
}

/* 신체 SVG 부상 실루엣 + 깜빡이는 블러드 아이콘 */
.wound-body-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(10, 12, 20, 0.86);
  border: 1.5px solid rgba(244, 63, 94, 0.68);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}

.wound-body-svg {
  width: 36px;
  height: 52px;
  display: block;
}

.wound-body-svg .body-part {
  fill: rgba(148, 163, 184, 0.28);
  stroke: rgba(203, 213, 225, 0.58);
  stroke-width: 1.2;
}

.wound-body-svg .body-part.is-injured {
  fill: rgba(239, 68, 68, 0.92);
  stroke: #fecdd3;
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.85));
}

.blood-blink-icon {
  width: 18px;
  height: 24px;
  animation: bloodBlink 0.72s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.9));
}

@keyframes bloodBlink {
  0% { opacity: 0.22; transform: scale(0.88); }
  100% { opacity: 1; transform: scale(1.1); }
}

/* 상점 아이템 터치 상세 모달 (CRT 모니터 #game-stage 내부 풀사이즈 비모달 다이얼로그) */
dialog.shop-item-modal,
dialog.shop-item-modal[open] {
  position: absolute;
  inset: 0;
  z-index: 45;
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  border: none;
  box-shadow: none;
  gap: 0;
  overflow: hidden;
  background: rgba(4, 6, 12, 0.78);
  backdrop-filter: blur(4px);
  padding: clamp(10px, 2.5cqmin, 20px);
  color: #f8fafc;
}

dialog.shop-item-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-stage.crt-active dialog.shop-item-modal,
#game-stage.crt-active dialog.shop-item-modal[open] {
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border-radius: 16px;
  padding: clamp(10px, 2.4cqmin, 18px);
}

@media (max-width: 768px), (max-height: 520px) {
  #game-stage.crt-active dialog.shop-item-modal,
  #game-stage.crt-active dialog.shop-item-modal[open] {
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    border-radius: 12px;
    padding: clamp(6px, 2cqmin, 12px);
  }
}

.shop-modal-card {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.8cqh, 16px);
  padding: clamp(10px, 2.2cqmin, 22px);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(19, 15, 14, 0.98) 0%, rgba(11, 13, 20, 0.99) 100%);
  border: 2.5px solid #f59e0b;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.88),
    0 0 0 2px #05070c,
    inset 0 1px 0 rgba(253, 224, 71, 0.28);
  color: #f8fafc;
  font-family: "DungGeunMo", system-ui, sans-serif;
}

.shop-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.shop-modal-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.shop-modal-cat-pill,
.shop-modal-tag-pill {
  font-size: clamp(13px, 3.1cqmin, 22px);
  font-weight: 700;
  padding: clamp(4px, 0.9cqh, 8px) clamp(10px, 2cqw, 16px);
  border-radius: 8px;
  letter-spacing: 0.02em;
}

.shop-modal-cat-pill {
  background: rgba(14, 116, 144, 0.34);
  border: 1px solid #22d3ee;
  color: #a5f3fc;
}

.shop-modal-tag-pill {
  background: rgba(225, 29, 72, 0.88);
  border: 1px solid #fda4af;
  color: #ffffff;
}

.shop-modal-tag-pill.is-equipped {
  background: rgba(22, 163, 74, 0.92);
  border-color: #86efac;
}

.shop-modal-tag-pill.is-owned {
  background: rgba(29, 78, 216, 0.88);
  border-color: #93c5fd;
}

.shop-modal-tag-pill.is-soldout {
  background: rgba(153, 27, 27, 0.94);
  border-color: #f87171;
  color: #fee2e2;
}

.shop-modal-close-btn {
  width: clamp(36px, 7cqmin, 54px);
  height: clamp(36px, 7cqmin, 54px);
  flex-shrink: 0;
  border-radius: 10px;
  border: 1.5px solid rgba(245, 158, 11, 0.72);
  background: rgba(40, 26, 14, 0.9);
  color: #fef3c7;
  font-size: clamp(18px, 3.6cqmin, 28px);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shop-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3cqw, 30px);
  padding: 0;
}

.shop-modal-icon-wrap {
  flex: 0 0 clamp(92px, 28cqmin, 240px);
  width: clamp(92px, 28cqmin, 240px);
  height: clamp(92px, 28cqmin, 240px);
  border-radius: 16px;
  background: radial-gradient(circle at 50% 45%, rgba(34, 211, 238, 0.2), rgba(10, 12, 18, 0.96));
  border: 2.5px solid #b45309;
  box-shadow: inset 0 0 28px rgba(34, 211, 238, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1.8cqmin, 20px);
}

.shop-modal-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8));
}

.shop-modal-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.5cqh, 16px);
}

.shop-modal-title {
  margin: 0;
  font-size: clamp(20px, 5.2cqmin, 42px);
  line-height: 1.15;
  color: #fde047;
}

.shop-modal-price {
  font-size: clamp(16px, 3.8cqmin, 30px);
  font-weight: 700;
  color: #a5f3fc;
}

.shop-modal-price .price-strike {
  text-decoration: line-through;
  color: #94a3b8;
  margin-right: 8px;
  font-size: clamp(13px, 2.8cqmin, 22px);
}

.shop-modal-desc {
  margin: 0;
  font-size: clamp(13.5px, 3.1cqmin, 24px);
  line-height: 1.42;
  color: #e2e8f0;
}

.shop-modal-stats {
  flex: 0.45 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: clamp(6px, 1.4cqmin, 14px);
}

.shop-modal-stat-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: clamp(6px, 1.6cqh, 16px) clamp(7px, 1.7cqw, 20px);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.36);
  font-size: clamp(11.5px, 2.75cqmin, 22px);
}

.shop-modal-stat-label {
  color: #94a3b8;
  white-space: nowrap;
}

.shop-modal-stat-val {
  color: #f8fafc;
  font-weight: 700;
  white-space: nowrap;
}

.shop-modal-gold-note {
  padding: clamp(7px, 1.6cqh, 15px) clamp(10px, 1.8cqw, 18px);
  border-radius: 10px;
  background: rgba(30, 20, 12, 0.88);
  border: 1px solid rgba(217, 119, 6, 0.5);
  font-size: clamp(12px, 2.6cqmin, 20px);
  color: #fde68a;
  flex-shrink: 0;
}

.shop-modal-actions {
  margin-top: auto;
  display: flex;
  gap: clamp(8px, 1.5cqmin, 14px);
  flex-shrink: 0;
}

.shop-modal-primary-btn {
  flex: 1.6;
  min-height: clamp(42px, 10.5cqh, 74px);
  border-radius: 11px;
  border: 2px solid #4ade80;
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: clamp(15px, 3.4cqmin, 26px);
  font-weight: 700;
  cursor: pointer;
}

.shop-modal-primary-btn.is-equip {
  border-color: #38bdf8;
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
}

.shop-modal-primary-btn.is-unequip {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
}

.shop-modal-primary-btn.is-disabled {
  border-color: #f87171;
  background: rgba(88, 28, 38, 0.92);
  color: #fecaca;
}

.shop-modal-cancel-btn {
  flex: 0.7;
  min-height: clamp(42px, 10.5cqh, 74px);
  border-radius: 11px;
  border: 2px solid #d97706;
  background: rgba(46, 30, 16, 0.95);
  color: #fef3c7;
  font-family: inherit;
  font-size: clamp(15px, 3.4cqmin, 26px);
  font-weight: 700;
  cursor: pointer;
}

/* 사냥꾼 이름 설정 모달 (#hunter-name-dialog) */
#hunter-name-dialog {
  width: min(440px, 92vw);
  margin: auto;
  padding: 20px 20px 18px;
  border: 3px solid var(--gold);
  border-radius: 12px;
  background: linear-gradient(180deg, #1a122b 0%, #0f0a1a 100%);
  color: var(--text);
  box-shadow: 6px 6px 0 var(--ink), 0 0 36px rgba(245, 196, 81, 0.25);
  box-sizing: border-box;
}

#hunter-name-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#hunter-name-dialog:modal {
  overscroll-behavior: contain;
}

#hunter-name-dialog::backdrop {
  background: rgba(6, 4, 14, 0.86);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.hunter-guild-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1.5px solid #f59e0b;
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
}

.hunter-guild-badge.is-new {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
}

.hunter-guild-badge.is-switch {
  border-color: #c084fc;
  background: rgba(192, 132, 252, 0.16);
  color: #e9d5ff;
}

.guild-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.hunter-name-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: 0.01em;
}

.hunter-name-lead {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #cbd5e1;
}

.hunter-name-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.hunter-name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hunter-name-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #f8fafc;
}

.hunter-name-label span {
  color: #fb7185;
}

#hunter-name-input,
#hunter-password-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  box-sizing: border-box;
  border-radius: 10px;
  border: 2px solid #475569;
  background: #0b0914;
  color: #f8fafc;
  font: inherit;
  font-size: max(1rem, 1em);
  line-height: 1.3;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

#hunter-name-input::placeholder,
#hunter-password-input::placeholder {
  color: #64748b;
}

#hunter-name-input:focus-visible,
#hunter-password-input:focus-visible {
  outline: 3px solid #fde047;
  outline-offset: 2px;
  border-color: #fde047;
  box-shadow: 0 0 0 3px rgba(253, 224, 71, 0.28);
}

#hunter-name-input[aria-invalid="true"],
#hunter-password-input[aria-invalid="true"] {
  border-color: #fb7185;
  box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.25);
}

.hunter-password-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.hunter-password-row #hunter-password-input {
  flex: 1;
  min-width: 0;
}

.hunter-password-toggle {
  min-height: 48px;
  min-width: 64px;
  padding: 0 12px;
  border-radius: 10px;
  border: 2px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.hunter-password-toggle:hover {
  filter: brightness(1.07);
}

.hunter-password-toggle:focus-visible {
  outline: 3px solid #fde047;
  outline-offset: 2px;
}

.hunter-name-ghost-btn:disabled,
.hunter-name-secondary-btn:disabled,
.hunter-name-primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hunter-name-hint {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #94a3b8;
}

.hunter-name-error {
  margin: 0;
  min-height: 1.25em;
  font-size: 0.82rem;
  line-height: 1.25;
  font-weight: 700;
  color: #fda4af;
}

.hunter-name-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.hunter-name-ghost-btn,
.hunter-name-secondary-btn,
.hunter-name-primary-btn {
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.14s ease, transform 0.08s ease;
}

.hunter-name-ghost-btn {
  border: 2px solid #475569;
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
}

.hunter-name-secondary-btn {
  border: 2px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
}

.hunter-name-primary-btn {
  flex: 1;
  min-width: 140px;
  border: 2px solid #fde68a;
  background: linear-gradient(180deg, #eab308 0%, #ca8a04 100%);
  color: #09090b;
}

.hunter-name-ghost-btn:hover,
.hunter-name-secondary-btn:hover,
.hunter-name-primary-btn:hover {
  filter: brightness(1.07);
}

.hunter-name-ghost-btn:active,
.hunter-name-secondary-btn:active,
.hunter-name-primary-btn:active {
  transform: scale(0.98);
}

.hunter-name-ghost-btn:focus-visible,
.hunter-name-secondary-btn:focus-visible,
.hunter-name-primary-btn:focus-visible {
  outline: 3px solid #fde047;
  outline-offset: 2px;
}

@media (pointer: coarse) {
  #hunter-name-input,
  #hunter-password-input,
  .hunter-password-toggle,
  .hunter-name-ghost-btn,
  .hunter-name-secondary-btn,
  .hunter-name-primary-btn {
    min-height: 52px;
  }
}

/* 미들어스 네메시스 군단 계급도 오버레이 */
.nemesis-army-overlay {
  position: fixed;
  inset: 0;
  z-index: 6400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 6, 14, 0.78);
  backdrop-filter: blur(4px);
}
.nemesis-army-overlay[hidden] {
  display: none !important;
}
.nemesis-army-card {
  width: min(680px, 95vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  border: 2px solid #f59e0b;
  background: linear-gradient(180deg, rgba(19, 15, 31, 0.98) 0%, rgba(11, 9, 18, 0.98) 100%);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.72), 0 0 24px rgba(245, 158, 11, 0.18);
  color: #f8fafc;
}
.nemesis-army-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}
.nemesis-army-head h3 {
  margin: 0;
  font-size: 16px;
  color: #fde68a;
  letter-spacing: 0.03em;
}
.nemesis-army-reset-badge {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 116, 144, 0.25);
  color: #7dd3fc;
}
.nemesis-army-close {
  border: 1px solid rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.5);
  color: #fecaca;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}
.nemesis-army-body {
  padding: 12px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nemesis-tier-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #fcd34d;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.nemesis-tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 8px;
}
.nemesis-unit-card {
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.nemesis-unit-card.tier-3 {
  border-color: #ef4444;
  background: linear-gradient(180deg, rgba(69, 10, 10, 0.65), rgba(15, 23, 42, 0.85));
}
.nemesis-unit-card.tier-2 {
  border-color: #f59e0b;
  background: rgba(45, 24, 12, 0.65);
}
.nemesis-unit-card.dead {
  opacity: 0.52;
  filter: grayscale(0.65);
}
.nemesis-unit-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.nemesis-unit-meta {
  font-size: 11px;
  color: #cbd5e1;
}
.nemesis-unit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.nemesis-chip {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 2px;
}
.nemesis-chip.weak {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.45);
  color: #86efac;
}
.nemesis-chip.immune {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.nemesis-chip.rage {
  background: rgba(249, 115, 22, 0.25);
  border: 1px solid rgba(251, 146, 60, 0.7);
  color: #fdba74;
}
.nemesis-chip.adapt {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(125, 211, 252, 0.6);
  color: #bae6fd;
}
.nemesis-unit-card.clickable {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.nemesis-unit-card.clickable:hover,
.nemesis-unit-card.clickable:focus-visible {
  border-color: #fde047;
  transform: translateY(-1px);
  outline: none;
}
.nemesis-unit-hint {
  margin-top: 2px;
  font-size: 10px;
  color: #7dd3fc;
}
.nemesis-archive-bar {
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid rgba(168, 85, 247, 0.45);
  background: rgba(59, 7, 100, 0.28);
  color: #e9d5ff;
  font-size: 11px;
}

/* ===== 영혼 도킹 직접 조작 모드 (하단/우측 훈수창 숨김 + 풀스크린 HDR + 기존 전투 UI) ===== */
.coach-dock-btn {
  min-block-size: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.72);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.26), rgba(168, 85, 247, 0.24));
  color: #fef08a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.coach-dock-btn:hover {
  transform: translateY(-1px);
  border-color: #fde047;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.32);
}

#app-shell.direct-control-mode #coach-panel,
#app-shell.direct-control-mode #split-resizer {
  display: none !important;
}

#app-shell.direct-control-mode #game-stage {
  flex: 1 1 100% !important;
  width: 100% !important;
  height: 100% !important;
  box-shadow: none !important;
}

.soul-dock-overlay {
  position: absolute;
  inset: 0;
  z-index: 48;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.soul-dock-overlay[hidden] {
  display: none !important;
}
.soul-dock-vortex {
  position: absolute;
  inset: -25%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(34, 211, 238, 0) 8%,
    rgba(56, 189, 248, 0.36) 28%,
    rgba(168, 85, 247, 0.44) 48%,
    rgba(15, 23, 42, 0.82) 78%
  );
  opacity: 0;
}
.soul-dock-scantear {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.16) 0px,
    rgba(34, 211, 238, 0.12) 3px,
    transparent 3px,
    transparent 11px
  );
  opacity: 0;
  mix-blend-mode: screen;
}
.soul-dock-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(254, 240, 138, 0.92), rgba(56, 189, 248, 0.55) 45%, transparent 78%);
  opacity: 0;
}
.soul-dock-banner {
  position: relative;
  z-index: 2;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1.5px solid rgba(125, 211, 252, 0.85);
  background: rgba(8, 12, 24, 0.86);
  color: #e0f2fe;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.36);
}

.soul-dock-overlay.is-docking .soul-dock-vortex {
  animation: soulDockVortex 0.92s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.soul-dock-overlay.is-docking .soul-dock-scantear {
  animation: soulDockScantear 0.42s linear forwards;
}
.soul-dock-overlay.is-docking .soul-dock-flash {
  animation: soulDockFlash 0.65s ease-out 0.24s forwards;
}
.soul-dock-overlay.is-undocking .soul-dock-vortex {
  animation: soulUndockVortex 0.65s ease-out forwards;
}
.soul-dock-overlay.is-undocking .soul-dock-scantear {
  animation: soulDockScantear 0.36s linear forwards;
}

@keyframes soulDockVortex {
  0% { opacity: 0; transform: scale(2.4) rotate(-18deg); }
  32% { opacity: 0.96; transform: scale(0.92) rotate(6deg); }
  58% { opacity: 0.82; transform: scale(0.18) rotate(22deg); }
  100% { opacity: 0; transform: scale(0.08) rotate(36deg); }
}
@keyframes soulUndockVortex {
  0% { opacity: 0.85; transform: scale(0.25) rotate(12deg); }
  50% { opacity: 0.75; transform: scale(1.25) rotate(-6deg); }
  100% { opacity: 0; transform: scale(2.2) rotate(-18deg); }
}
@keyframes soulDockScantear {
  0% { opacity: 0; transform: translateX(0); }
  22% { opacity: 0.9; transform: translateX(-10px) skewX(-3deg); }
  50% { opacity: 0.75; transform: translateX(12px) skewX(4deg); }
  80% { opacity: 0.45; transform: translateX(-6px); }
  100% { opacity: 0; transform: translateX(0); }
}
@keyframes soulDockFlash {
  0% { opacity: 0; transform: scale(0.6); }
  25% { opacity: 0.92; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.45); }
}

.direct-combat-ui {
  position: absolute;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 14px 12px;
}
.direct-combat-ui[hidden] {
  display: none !important;
}
.direct-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.direct-lobby-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.direct-lobby-actions[hidden] {
  display: none !important;
}
.direct-top-btn {
  pointer-events: auto;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.48);
  background: rgba(10, 14, 24, 0.82);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.1s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.direct-top-btn:hover {
  transform: translateY(-1px);
  border-color: #7dd3fc;
  background: rgba(20, 28, 48, 0.92);
}
.direct-top-btn.is-start {
  border-color: rgba(52, 211, 153, 0.72);
  background: rgba(6, 78, 59, 0.86);
  color: #a7f3d0;
}
.direct-top-btn.is-gold {
  border-color: rgba(251, 191, 36, 0.72);
  background: rgba(120, 53, 15, 0.84);
  color: #fde68a;
}
.direct-top-btn.is-return {
  border-color: rgba(192, 132, 252, 0.72);
  background: rgba(46, 16, 101, 0.82);
  color: #f3e8ff;
}
.direct-bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}
.direct-controls-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(8, 12, 22, 0.78);
  backdrop-filter: blur(6px);
}
.direct-pill-btn {
  pointer-events: auto;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(20, 27, 45, 0.9);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.direct-pill-btn:hover:not(:disabled) {
  border-color: #7dd3fc;
  color: #ffffff;
}
.direct-pill-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
.direct-pill-btn.is-skill.is-ready {
  border-color: rgba(56, 189, 248, 0.72);
  color: #bae6fd;
}
.direct-pill-btn.is-skill.is-cd {
  border-color: rgba(248, 113, 113, 0.55);
  color: #fca5a5;
}
.direct-shield-pill {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: rgba(14, 116, 144, 0.35);
  color: #bae6fd;
  font-size: 0.7rem;
  font-weight: 700;
}
.direct-heal-cnt {
  color: #fde68a;
  margin-left: 2px;
}
.direct-key-hint {
  font-size: 0.68rem;
  color: rgba(226, 232, 240, 0.82);
  background: rgba(5, 8, 16, 0.62);
  padding: 2px 10px;
  border-radius: 999px;
  text-shadow: 0 1px 2px #000;
}
@media (max-width: 780px) {
  .direct-controls-cluster {
    gap: 4px;
    padding: 4px 6px;
  }
  .direct-key-hint {
    display: none;
  }
}
