/* 위시윅 폰 화면 맞춤 (mobile.js 가 <html> 에 ui-mobile / ui-portrait 를 붙였을 때만 적용).
   값은 원본처럼 PC 기준 픽셀로 쓰고, 화면에서는 --uis 배율만큼 줄어든다. */

/* ── 폰 공통 ── */
/* 판이 화면 폭을 넘지 않게 하고, 넘치는 내용은 판 안에서 밀어 보게 한다 */
.ui-mobile :is(#studyPanel, #workPanel, #trader, #setMenu, #mainMenu, #stagePop, #letterPop .board, #intro .board, #overScreen .board, #slotScreen .board) {
  max-width: calc(var(--vw) - 16px) !important;
  box-sizing: border-box;
}
.ui-mobile :is(#studyPanel, #workPanel, #stagePop, #setMenu) { overflow: auto !important; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
/* 연구 판: 원본은 폭에 맞춰 통째로 줄여(폰에서 글자 5px 남짓) 읽을 수 없다. 배율은 다른 판과 같게 두고 옆으로 밀어 본다 */
.ui-mobile #studyPanel { zoom: var(--uis) !important; max-height: var(--pmax) !important; }
/* 손가락으로는 마우스 올리기가 없어 버튼 이름표가 안 보인다. 누르고 있는 동안 보이게 한다 */
.ui-mobile .bar .tool:active span { opacity: 1; transition-delay: 0s; }
/* 자원 표지판: 원본은 화면 위 가운데에 매달려 있어 폰 전체 화면 안내·카메라 구멍에 가린다.
   오른쪽 위 단계 표시(개척지) 아래로 옮겨 묶음마다 한 줄씩 세로로 쌓는다 */
.ui-mobile #res { left: auto; right: 4px; top: 66px; transform: none !important; flex-direction: column; align-items: flex-end; gap: 0; }
.ui-mobile #res .rg { padding: 4px 6px; background-image: none !important; } /* 매단 끈 그림은 세로로 쌓으면 어색해 뺀다(칸마다 자기 틀이 있다) */
.ui-mobile #res .ri .tip { left: auto; right: calc(100% + 4px); top: 50%; transform: translateY(-50%); } /* 이름표는 화면 밖으로 나가지 않게 왼쪽에 */
/* 두 번 탭 확대·길게 눌러 글자 고르기를 막아 조작과 겹치지 않게 한다 */
.ui-mobile body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
/* 손가락으로 누르기 쉽게(2026-11-17): 화면에서 46px 이상. 판이 --uis 배율로 줄어드니 그만큼 나눠 키운다.
   주민 얼굴 목록(왼쪽, 24px)은 사람 수만큼 쌓여 키우면 화면을 덮으므로 그대로 둔다 */
.ui-mobile .tmenu button, .ui-mobile #tDiff button[data-diff] { height: auto; min-height: calc(46px / var(--uis, 1)); }
.ui-mobile #speeds .tool { width: calc(46px / var(--uis, 1)); height: calc(46px / var(--uis, 1)); }

/* ── 폰 세로 ── */
/* 아래 줄: 가운데 탭 5개, 속도 버튼은 오른쪽 끝에 세로로 세운다(한 줄에 다 넣으면 폭을 넘어 겹친다) */
.ui-portrait .bar:not(.sub):not(.corner) { gap: 6px; bottom: 10px; }
.ui-portrait .bar #speeds { flex-direction: column-reverse; right: 8px; bottom: 0; }
.ui-portrait .bar #speeds .tool span { display: none; } /* 이름표가 옆 탭을 가린다. 지금 속도는 눌린 버튼 색으로 보인다 */
.ui-portrait .bar #shape { left: 8px; bottom: 76px; }
.ui-portrait .bar #erase { left: 8px; bottom: 152px; }
/* 하위 버튼 줄(건물 고르기·명령 등): 속도 기둥 자리를 비우고, 넘치면 위로 줄을 더 쌓는다 */
.ui-portrait .bar.sub { bottom: 86px; left: 8px; right: 80px; gap: 6px; flex-wrap: wrap-reverse; align-content: flex-start; }
/* 날짜·시간 판은 속도 기둥 위로 */
.ui-portrait #clockBoard { bottom: 300px; right: 8px; flex-direction: column; align-items: flex-end; }
.ui-portrait #letters { bottom: 380px; right: 8px; }
/* 짓기 확인·취소·비용: 속도 기둥 왼쪽으로 */
.ui-portrait #goBuild { right: 80px; bottom: 170px; width: 220px; }
.ui-portrait #goCancel { right: 308px; bottom: 170px; }
.ui-portrait #goCost { right: 80px; bottom: 232px; min-width: 220px; }
.ui-portrait #info { bottom: 170px; max-width: calc(var(--vw) - 100px); }
.ui-portrait #hint { bottom: 360px; padding: 0 12px; white-space: normal; line-height: 1.3; }
.ui-portrait #stageChip { min-width: 0; }
/* 큰 판을 열면 그 판의 오른쪽 위를 가리므로 잠시 숨긴다 */
.ui-portrait body:has(:is(#studyPanel, #workPanel, #trader):not([hidden])) :is(#stageChip, #res) { display: none !important; }
/* 큰 판은 위에서 조금 내려 아래 줄을 가리지 않게 */
.ui-portrait :is(#studyPanel, #workPanel, #trader) { top: 76px; }

/* ── 폰 가로 ── */
/* 높이가 낮아 난이도 목록 끝(뒤로)이 잘린다: 메뉴를 화면 높이 안에 두고 넘치면 밀어 본다 */
.ui-landscape #titleScreen .tmenu { max-height: calc(100vh / var(--uis) - 24px); overflow-y: auto; box-sizing: border-box; }
.ui-landscape #tDiff button[data-diff] { height: auto; }
