/* 오른쪽 아래(왼손 조이스틱이면 왼쪽 아래): 큰 「게임 대기」 + 둘레 작은 버튼(2026-11-15 확정, 시안 docs/features/ui-sheet.html).
 * 작은 버튼은 큰 버튼 가운데에서 같은 거리(--r) · 45° 간격: 채팅(옆) · 빈스윙(대각선) · 콕 정리(위). 콕 정리가 없어져도 나머지 자리는 그대로.
 * 벽치기는 게임 고르기 팝업(game-pick.js) 안으로, 내 장비 · 내 정보는 위 줄(콕 · 급수 동그라미 → 내 정보)로 옮겼다. DOM 과 보이기 조건은 game.js hud() 그대로.
 * 위치 계산: 큰 버튼 반지름 39 + 거리 82 - 작은 버튼 반지름 25 = 96 · 대각선 39 + 58 - 25 = 72 · 가운데 맞춤 39 - 25 = 14 */
#stage #acts {
  width: 146px; height: 146px; max-width: none; display: block; padding: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none;
}
#stage #acts[hidden], #stage #acts #mine, #stage #acts #wallGo { display: none; }
#stage #acts > button, #stage #acts #emoteControl { position: absolute; pointer-events: auto; }

/* 작은 버튼: 흰 동그라미 + 아이콘 + 이름 */
#stage #acts > button, #stage #acts #swingGo {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-sizing: border-box;
  width: 50px; min-width: 0; height: 50px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.9); color: var(--ink); box-shadow: 0 4px 14px rgba(0,0,0,.16);
}
#stage #acts > button[hidden] { display: none; }
#stage #acts > button i, #stage #acts #swingGo i { font-size: 18px; }
#stage #acts > button span, #stage #acts #swingGo span, #stage #acts #megaGo small { font-size: 10px; font-weight: 800; line-height: 1.1; }
#stage #acts > button:not([hidden]) ~ button:not([hidden]) { border-left: 0; }
#stage #acts #megaGo { display: none; visibility: visible; backdrop-filter: none; -webkit-backdrop-filter: none; }
#stage #acts #megaGo.on { display: flex; }

/* 큰 「게임 대기」: 초록 동그라미. 대기 중이면 「난타 대기 중」 + 숨쉬기 */
#stage #acts #queueGo { right: 0; bottom: 0; width: 78px; height: 78px; gap: 2px; background: var(--green); color: var(--white); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
#stage #acts #queueGo i { font-size: 24px; }
#stage #acts #queueGo span { max-width: 4em; font-size: 12px; font-weight: 900; }
#stage #acts #queueGo.on { border-radius: 50%; animation: dockBreathe 1.3s ease-in-out infinite; box-shadow: 0 0 0 5px rgba(26,127,75,.3), 0 6px 18px rgba(0,0,0,.28); }
#stage #acts #queueGo.on span { font-size: 11px; }
@keyframes dockBreathe { 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { #stage #acts #queueGo.on { animation: none; } }

/* 둘레 자리 */
#stage #acts #megaGo { right: 96px; bottom: 14px; }        /* 옆: 채팅(확성기) */
#stage #acts #emoteControl { right: 72px; bottom: 72px; width: 50px; height: 50px; display: block; flex: none; } /* 대각선: 빈스윙 */
#stage #acts #emoteControl:has(#swingGo[hidden]) { display: none; }
#stage #acts #swingGo { position: absolute; inset: 0; }
#stage #acts #emoteToggle { position: absolute; top: -3px; right: -3px; z-index: 1; width: 18px; min-width: 0; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: var(--white); color: var(--ink); font-size: 10px; line-height: 18px; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
#stage #acts #sweepGo { right: 14px; bottom: 96px; }       /* 위: 콕 정리(주울 콕이 있을 때만) */
#stage #acts #sortGo { right: 14px; bottom: 14px; }        /* 콕 정리방: 큰 버튼 자리(게임 대기는 없다) */

/* 탑 위 · 콕 정리방: 채팅(확성기)만 — 모서리(내려오기 · 일어나기 바로 위), 정리방에 서 있으면 콕 정리 위 */
#stage #acts.mega-only #megaGo { right: 14px; bottom: 14px; }
#stage #acts.mega-only:has(#sortGo:not([hidden])) #megaGo { bottom: 96px; }

/* 왼손 조이스틱: 좌우를 뒤집는다 */
body.lefty #stage #acts > button, body.lefty #stage #acts #emoteControl { right: auto; }
body.lefty #stage #acts #queueGo { left: 0; }
body.lefty #stage #acts #megaGo { left: 96px; }
body.lefty #stage #acts #emoteControl { left: 72px; }
body.lefty #stage #acts #sweepGo, body.lefty #stage #acts #sortGo, body.lefty #stage #acts.mega-only #megaGo { left: 14px; }

/* ── 코트 안(단식 · 복식): 스윙 버튼 둘레에 같은 방식(같은 간격 18px · 45°) — 옆 💬 채팅 · 대각선 📣 확성기 · 위 🚪 나가기.
 * 경기 중엔 💬만(보이기 조건은 singles.js 그대로). 스윙 108px(낮은 가로 88px) 가운데에서 97px(87px) */
#stage :is(#sgDock, #dgDock):not([hidden]) { display: contents; }
#stage :is(#sgDock, #dgDock) > button:not([hidden]) {
  position: absolute; z-index: calc(var(--z-hud) - 1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-sizing: border-box;
  width: 50px; height: 50px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--ink);
  font-size: 18px; line-height: 1; box-shadow: 0 4px 14px rgba(0,0,0,.16);
}
#stage :is(#sgDock, #dgDock) > button:not([hidden])::after { font-size: 10px; font-weight: 800; line-height: 1.1; }
#stage :is(#sgMacro, #dgMacro)::after { content: '채팅'; }
#stage :is(#sgMega, #dgMega)::after { content: '확성기'; }
#stage :is(#sgMacro, #dgMacro) { right: calc(144px + env(safe-area-inset-right)); bottom: calc(55px + env(safe-area-inset-bottom)); }
#stage :is(#sgMega, #dgMega) { right: calc(116px + env(safe-area-inset-right)); bottom: calc(124px + env(safe-area-inset-bottom)); }
/* 🚪 나가기: 다른 「나가기」처럼 어두운 바탕. 원래 글자(「🚪 나가기」)는 읽기용으로 두고, 동그라미엔 아이콘 + 이름으로 */
#stage :is(#sgDock, #dgDock) > :is(#sgLeave, #dgLeave):not([hidden]) {
  left: auto; top: auto; right: calc(47px + env(safe-area-inset-right)); bottom: calc(152px + env(safe-area-inset-bottom));
  background: rgba(29,29,27,.82); color: var(--white); font-size: 0;
}
#stage :is(#sgLeave, #dgLeave)::before { content: '🚪'; font-size: 18px; line-height: 1; }
#stage :is(#sgLeave, #dgLeave)::after { content: '나가기'; }
@media (orientation: landscape) and (max-height: 540px) {
  body.touch #stage :is(#sgMacro, #dgMacro) { right: calc(124px + env(safe-area-inset-right)); bottom: calc(45px + env(safe-area-inset-bottom)); }
  body.touch #stage :is(#sgMega, #dgMega) { right: calc(99px + env(safe-area-inset-right)); bottom: calc(107px + env(safe-area-inset-bottom)); }
  body.touch #stage :is(#sgDock, #dgDock) > :is(#sgLeave, #dgLeave):not([hidden]) { right: calc(37px + env(safe-area-inset-right)); bottom: calc(132px + env(safe-area-inset-bottom)); }
}
body.touch.lefty #stage :is(#sgDock, #dgDock) > button:not([hidden]) { right: auto; }
body.touch.lefty #stage :is(#sgMacro, #dgMacro) { left: calc(144px + env(safe-area-inset-left)); }
body.touch.lefty #stage :is(#sgMega, #dgMega) { left: calc(116px + env(safe-area-inset-left)); }
body.touch.lefty #stage :is(#sgDock, #dgDock) > :is(#sgLeave, #dgLeave):not([hidden]) { right: auto; left: calc(47px + env(safe-area-inset-left)); }
@media (orientation: landscape) and (max-height: 540px) {
  body.touch.lefty #stage :is(#sgMacro, #dgMacro) { left: calc(124px + env(safe-area-inset-left)); }
  body.touch.lefty #stage :is(#sgMega, #dgMega) { left: calc(99px + env(safe-area-inset-left)); }
  body.touch.lefty #stage :is(#sgDock, #dgDock) > :is(#sgLeave, #dgLeave):not([hidden]) { left: calc(37px + env(safe-area-inset-left)); }
}

/* 코트 안 위 줄: 급수 동그라미는 숨기고, 단식 · 복식은 점수판만(제목 · 인원도 숨기고 점수판을 맨 위로) */
body.in-court #stage #xp { display: none; }
body.sg-court #stage #hudL { display: none; }
body.sg-court #stage :is(#sgTop, #dgTop) { top: calc(10px + env(safe-area-inset-top)); }
