/* 폰 화면 맞춤(2026-11-16 대표 "스마트폰마다 맞춰 줘", 요청서 claude/코드세션_요청_폰화면맞춤.md)
   기준 7가지(344x850 폴드 접음, 360x780, 375x667 아이폰 SE, 390x844, 430x932, 673x841 폴드 펼침, 844x390 가로)에서
   단추가 안 잘리고, 누르는 자리 44px 이상(작아 보여도 누르는 범위는 44), 글 13px 이상. style.css·hb_skin.css 다음에 읽어 그 위에 덮음.
   옷장·가게(#hbw)는 아바타 세션 mk45가 스스로 맞추므로 여기서 건드리지 않음(safe-area도 옷장이 비움) */

/* ---------- 1. 화면 높이: 보이는 높이(fit.js가 visualViewport로 적음), 없으면 100dvh, 그것도 없으면 100vh ---------- */
:root{--app-h:100vh}
@supports (height:100dvh){:root{--app-h:100dvh}}
.phone{position:fixed;left:0;right:0;top:var(--app-top,0px);height:var(--app-h)!important}

/* ---------- 2. 노치·아래 막대·가로 화면 양옆(safe-area) ---------- */
header.top,form.say{padding-left:max(var(--side),calc(8px + env(safe-area-inset-left)));padding-right:max(var(--side),calc(8px + env(safe-area-inset-right)))}
body #main .menubar{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
#sheet{padding-left:max(18px,env(safe-area-inset-left));padding-right:max(18px,env(safe-area-inset-right))}
#sheet.low,#lpanel,#pcard{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right));padding-bottom:calc(10px + env(safe-area-inset-bottom))}

/* ---------- 3. 누르는 자리 44px: 단추 둘레에 안 보이는 칸(::after, 켬/끔 스위치는 ::before)을 깔아 가로·세로 44까지 넓힘.
   :where로 점수 0이라 단추마다 정한 position이 있으면 그대로 씀. 옷장(#hbw)은 제외 ---------- */
:where(#main) button:where(:not(#hbw button)){position:relative}
:where(#main) button:where(:not(.sw,#hbw button))::after,:where(#main) .sw::before{content:"";position:absolute;left:50%;top:50%;width:max(100%,44px);height:max(100%,44px);transform:translate(-50%,-50%)}
/* 입력 칸: 높이 44, 글 16px(아이폰이 입력 칸을 누를 때 화면을 키우지 않게) */
#main input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]),#main select,#main textarea{font-size:16px!important}
#main input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]),#main select{min-height:44px}
/* 옆으로 미는 칩 줄은 줄 안에서 잘리므로 위아래 여백을 넓혀 44가 들어가게 */
.bchips{padding-top:8px;padding-bottom:8px;margin-top:-8px;margin-bottom:2px}
.bslide .bchips{margin-bottom:-6px}
.bslide{margin-bottom:8px}
.bsl,.bsr{width:40px;bottom:0}
/* 소식 띠: 높이 36, 안의 단추 누르는 자리가 띠 밖까지 닿게 */
#newsBand{height:36px;overflow:visible}
#newsBand .nlab{position:relative;z-index:1}
#newsText{height:44px;margin:-4px 0;position:relative;z-index:2}
#newsFold{position:relative;z-index:2}
#newsBand{position:relative;z-index:31}

/* ---------- 4. 위 막대 ---------- */
#bellBtn{width:40px;height:40px}
@media (max-width:360px){#bellBtn{width:38px;height:38px}#bellBtn .mic{width:24px;height:24px}}

/* ---------- 5. 말하기 칸: 높이 44, 글 16px ---------- */
form.say{height:auto;min-height:60px;padding-top:8px;padding-bottom:8px}
form.say input{height:44px}
form.say .send{height:44px}

/* ---------- 6. 아래 메뉴: 344에서도 다섯 칸 한 줄, 글 13, 단추 52 이상 ---------- */
body #main .menubar{gap:6px;padding-top:8px;min-height:calc(74px + env(safe-area-inset-bottom));padding-bottom:calc(8px + env(safe-area-inset-bottom))}
#main .menubar button{min-height:56px;font-size:13px!important;white-space:nowrap}

/* ---------- 7. 13px보다 작던 글 ---------- */
#stateTxt,#main header.top .pill,#newsFold,.gate .small,#netState,.pill,.mgTag,.gtag,.mtag,.logNote,.whNew,.lbConeItem,.cmdl li i,.tdItem button{font-size:13px!important}
.whLine em{font-size:13px}
#main #chatBtn,#main #emBtn,#main #mapBtn{font-size:13px!important}
#main #townLog{font-size:13px!important}
#mapOv>div:last-child{font-size:13px!important}
.mbadge{font-size:13px!important}

/* ---------- 8. 창: 최대 높이 = 보이는 높이의 85%, 넘치면 안에서 밀고, 닫기 [X]는 늘 보이게 ---------- */
#sheetBox{max-height:85%}
#pcard .pcBox,#lpanel .lpBox{max-height:85%}
#lpanel .lpHead,#pcard .pcHead{position:sticky;top:-14px;z-index:3;margin-top:-14px;padding-top:14px;background:#FFF9EE}
/* 넓은 화면(폴드 펼침·가로)에서 아래 창은 가운데 560까지 */
#sheet.low #sheetBox{max-width:560px}

/* ---------- 9. 표정 고르기: 칸 44, 3줄 격자, 넘치면 안에서 밀기 ---------- */
#main #emOv{width:196px!important;max-height:calc(100% - 248px);overflow-y:auto;overscroll-behavior:contain}
#emList{grid-template-columns:repeat(3,1fr)!important}
#emList button{min-height:44px}

/* ---------- 10. 줄로 된 단추·작은 꼬리표: 실제 높이 44 ---------- */
.grow,.brmore,.pcPost{min-height:44px;position:relative;z-index:1} /* 제 칸 44는 옆 단추의 넓힌 자리보다 위 */
.bclike,#sheetBody .sw,#lpanel .sw{z-index:1}
.bclinks button{min-width:44px} /* 댓글 아래 답글 달기·지우기·신고: 서로 넓힌 자리가 겹치지 않게 */
.gfind input,.gfind button{height:44px}
.lbLv em{font-size:13px}
.pcChip{border-top:8px solid transparent!important;border-bottom:8px solid transparent!important;background-clip:padding-box!important;box-shadow:inset 0 0 0 2px #2B2B3A!important}
.pcAll,.fdLink{min-height:44px}
#chatOv{max-height:calc(100% - 16px)}

/* ---------- 11. 가로로 눕힌 폰(높이 500 이하, fit.js가 html.land를 붙임): 아래 메뉴를 오른쪽 세로 줄로, 위 막대·말하기 칸을 낮게 해서 마을을 넓게 ---------- */
html.land #main.screen.on{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto minmax(0,1fr) auto}
html.land #main>header.top{grid-column:1;grid-row:1}
html.land #main>#newsBand{grid-column:1;grid-row:2}
html.land #main>#townWrap{grid-column:1;grid-row:3}
html.land #main>form.say{grid-column:1;grid-row:4}
html.land body #main .menubar{grid-column:2;grid-row:1 / 5;display:flex;flex-direction:column;justify-content:center;width:auto;min-height:0;height:auto; padding:calc(6px + env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) 8px;border-top:0;border-left:3px solid #2B2B3A;gap:8px}
html.land #main .menubar button{width:72px;min-height:52px;flex:0 1 60px;margin:0}
html.land body #main header.top{min-height:calc(50px + env(safe-area-inset-top))}
html.land form.say{min-height:56px;padding-top:6px;padding-bottom:6px}
html.land #zoomBtn{right:82px!important;top:12px!important}
html.land #main #hint{display:none}
html.land #joy.jw{bottom:46px}
html.land #doorBtn{right:82px;bottom:62px}
html.land #main #emOv{right:82px!important;bottom:8px!important;max-height:calc(100% - 16px)}
/* ---------- 12. 옷장 제목 옆 [?](게임이 옷장 제목에 붙이는 것, 24px): 누르는 자리만 44 ---------- */
#hbw_ttl .ghelp{position:relative!important}
#hbw_ttl .ghelp::after{content:"";position:absolute;left:-10px;top:-10px;right:-10px;bottom:-10px}
@media (max-width:400px){#hbw_ttl .ghelp{display:none!important}} /* 좁은 폰은 옷장 제목이 "옷장..."으로 잘려서 [?]를 뺌(게임 안내는 [더 보기]에서) */

/* ---------- 13. 말하기 모드(2026-11-16 대표 확정, 요청서 1-2, 시안 채팅자판_시안.png): 폰에서 말하기 칸을 누르면(app.js가 #main.talk)
   위 프로필 줄·소식 줄·아래 메뉴를 0.15초에 접고, 맨 위에 "동네 · n채널 · n명" 한 줄만. 비워진 만큼 마을이 넓어짐(town.js가 칸을 다시 잡음) ---------- */
#main>header.top,#main>#newsBand,body #main .menubar{max-height:240px}
#main.talk>header.top,#main.talk>#newsBand,body #main.talk .menubar{max-height:0!important;min-height:0!important;padding-top:0!important;padding-bottom:0!important;border-width:0!important;opacity:0;overflow:hidden;pointer-events:none}
html.land #main.talk .menubar{display:none!important}
#talkTop{flex:none;max-height:0;overflow:hidden;opacity:0;display:flex;align-items:center;padding:0 max(12px,env(safe-area-inset-left));background:var(--cream);font-family:'Jua',sans-serif;font-size:14px;color:var(--ink);white-space:nowrap;text-overflow:ellipsis}
#main.talk>#talkTop{max-height:80px;opacity:1;padding-top:calc(6px + env(safe-area-inset-top));padding-bottom:6px;border-bottom:2px solid #2B2B3A}
html.land #main>#talkTop{grid-column:1;grid-row:1}
#main.talk #mapName,#main.talk #hint,#main.talk #newsOpen,#main.talk #joy{display:none!important} /* 말하는 동안은 조이스틱도 접음(자판이 올라오면 마을이 낮아 조이스틱이 마을을 거의 덮음) */
/* 눕힌 폰은 자판이 올라오면 마을이 낮아서 오른쪽·왼쪽 단추를 접음(대화 단추만 둠) */
html.land #main.talk #emBtn,html.land #main.talk #mapBtn,html.land #main.talk #joy,html.land #main.talk #zoomBtn,html.land #main.talk #emOv,html.land #main.talk #doorBtn{display:none!important}
/* 눕힌 폰 말하기: 대화 줄은 왼쪽 아래 반쪽에(가운데 내 아바타를 안 가림), 넘치면 새 줄만 보이게. 위 한 줄은 얇게 */
html.land #main.talk #townLog{right:auto!important;width:min(46%,420px);max-height:calc(100% - 16px);overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end}
html.land #main.talk>#talkTop{padding-top:calc(3px + env(safe-area-inset-top));padding-bottom:3px;font-size:13px}
html.land body #main .menubar{max-height:none} /* 세로 줄은 접는 높이 제한(13.)을 안 받음 */
/* 말하기 모드인데 아이폰이 자판 높이를 알려 주지 않을 때(app.js #main.kbTop, 2026-11-16 아이폰 18 프로 맥스 홈 화면 앱): 입력 칸을 맨 위 한 줄 바로 아래로, 대화 줄은 마을 위쪽에 */
html:not(.land) #main.talk.kbTop>#talkTop{order:-2}
html:not(.land) #main.talk.kbTop>#plazaForm{order:-1;border-bottom:2px solid #2B2B3A}
html:not(.land) #main.talk.kbTop #townLog{bottom:auto!important;top:8px}
html:not(.land) #main.talk.kbTop #emBtn,html:not(.land) #main.talk.kbTop #mapBtn,html:not(.land) #main.talk.kbTop #chatBtn,html:not(.land) #main.talk.kbTop #doorBtn{display:none!important}
/* 화면보다 넓은 것이 잠깐이라도 생기면 아이폰이 페이지 전체를 줄여 보이고(대표 아이폰 0.85배, 2026-11-16) 그 상태로 남음 → 옆으로 넘치는 것은 잘라 냄 */
html,body{overflow-x:hidden;max-width:100%}
/* 2026-11-30 대표 제보(갤럭시 Z폴드6 접은·펼친 화면): 마을을 누를 때마다 화면 전체가 잠깐 파랗게 번쩍임.
   안드로이드 크롬·앱(TWA)·삼성 인터넷은 누를 수 있는 것(마을 그림판 전체가 하나)을 누르면 반투명 파란 막(탭 하이라이트)을 덮음 → 모두 끔.
   단추를 누른 느낌은 각 단추의 :active 모양으로 */
html{-webkit-tap-highlight-color:transparent}
*{-webkit-tap-highlight-color:transparent}

