@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap');
:root{font-family:'Gowun Dodum',sans-serif;color:#51483e;background:#eae1d5;font-synthesis:none}*{box-sizing:border-box}body{margin:0;overflow:hidden}button,input{font:inherit}button{border:1px solid #d9cebe;background:#fffaf1;color:#645646;border-radius:13px;min-height:44px;padding:9px 15px;cursor:pointer;transition:background .2s,transform .2s}button:hover{background:#f4e7cc;transform:translateY(-2px)}button:focus-visible{outline:3px solid #6f8a77;outline-offset:2px}button.active{background:#6c806b;color:#fff;border-color:#6c806b}#world{position:fixed;inset:0 0 198px}canvas{display:block;touch-action:none;width:100%;height:100%}header{position:fixed;top:32px;left:40px;pointer-events:none}.eyebrow{font-size:10px;letter-spacing:3px;font-weight:bold;color:#8f8472}h1{font-size:32px;margin:7px 0 6px;font-weight:400}h1 span{font-size:22px;color:#b49a63;margin-left:15px}header p{font-size:13px;margin:0;color:#948573}.status{position:fixed;right:36px;top:37px;font-size:12px;background:#fff9eacc;border:1px solid #ffffff80;padding:11px 17px;border-radius:30px}.tools{position:fixed;left:40px;top:153px;display:flex;gap:6px}.tools span{width:5px}#hint{position:fixed;bottom:214px;left:50%;transform:translateX(-50%);background:#fffaf0e8;box-shadow:0 3px 20px #69563c10;border-radius:40px;padding:11px 22px;font-size:12px;white-space:nowrap;pointer-events:none}.collection{position:fixed;bottom:0;width:100%;height:198px;background:#fffaf3f5;border-top:1px solid #fff;box-shadow:0 -10px 40px #5a4b3610;padding:18px 36px 12px}.collection-head{display:flex;align-items:center;justify-content:space-between;gap:16px}.collection-head .eyebrow{font-size:9px}h2{font-size:15px;font-weight:400;margin:3px 0 10px}#count{font-size:11px;color:#a2937f;margin-left:auto}#picker{display:flex;gap:10px;overflow-x:auto;padding:2px 1px 7px;scrollbar-width:thin;scrollbar-color:#d4c6af transparent}#picker button{min-width:76px;height:76px;flex-shrink:0;padding:4px;position:relative;background:#f4eee5;border:1px solid #e9e1d6}#picker button.active{background:#e1eadb;border:2px solid #70866d}#picker img{width:61px;height:61px;object-fit:contain}footer{display:flex;justify-content:space-between;color:#a39583;font-size:10px;padding-top:6px}#selection{position:fixed;right:36px;top:96px;background:#fffaf3ed;padding:13px;border:1px solid #fff;border-radius:18px;box-shadow:0 6px 25px #6b54351a;align-items:center;gap:10px;font-size:12px}#selection:not([hidden]){display:flex}#selection label{display:flex;align-items:center;gap:6px}#scale{width:100px;accent-color:#778d70}#selection button{padding:6px 10px}#loading{position:fixed;inset:0;background:#eee6d7;display:grid;place-items:center;font-size:18px;z-index:10}dialog{border:1px solid #e5d9c7;border-radius:22px;padding:30px;background:#fffaf1;color:#665945;box-shadow:0 20px 100px #4f422633}dialog::backdrop{background:#463d3433}dialog p{font-size:13px}dialog button{margin:10px 5px 0 0}@media(max-width:650px){header{top:20px;left:20px}h1{font-size:25px}header p{font-size:11px}.status{right:16px;top:24px;font-size:10px;padding:8px 10px;max-width:130px;text-align:center}.tools{left:16px;top:119px}.tools button{font-size:12px;padding:8px 12px}#world{bottom:191px}.collection{height:191px;padding:14px 16px 10px}#picker button{min-width:67px;height:69px}#picker img{width:56px;height:56px}.collection h2{font-size:13px}#hint{bottom:202px;font-size:10px;padding:10px 12px;max-width:95%;white-space:normal;width:max-content;text-align:center}footer{font-size:9px}footer span:first-child{max-width:220px}footer span:last-child{max-width:80px;text-align:right}#selection{top:173px;right:14px;padding:8px;gap:7px}#selectedName{display:none}#scale{width:95px}}
#playerBadge{position:fixed;top:215px;left:40px;font-size:11px;padding:10px 14px;border-radius:18px;background:#f5faf0e8;color:#6c806b;border:1px solid #cadac3;pointer-events:none}#playerBadge strong{display:block;font-size:13px;margin-top:3px}#picker button.avatar-active{border:2px solid #70977d;background:#e5efdf}#picker button.avatar-active:after{content:'나';position:absolute;right:3px;top:1px;font-size:10px;background:#6c806b;border-radius:20px;padding:2px 5px;color:white}#joystick{position:fixed;left:32px;bottom:232px;width:112px;height:112px;border-radius:50%;border:1px solid #b6c7a9;background:#f6faece0;box-shadow:0 5px 25px #615c3512;touch-action:none;user-select:none;z-index:3}#joystick[hidden]{display:none}#stick{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:45px;height:45px;border-radius:50%;background:#82977ac9;box-shadow:inset 0 2px 4px #ffffff60,0 3px 8px #505f4020;pointer-events:none}#joystick small{position:absolute;bottom:8px;width:100%;text-align:center;font-size:9px;color:#697c61;pointer-events:none}@media(max-width:650px){.tools{gap:4px;left:12px}.tools button{padding:8px 9px}.tools span{width:0}#playerBadge{top:173px;left:17px;font-size:9px;padding:7px 11px}#playerBadge strong{font-size:11px}#joystick{left:22px;bottom:235px;width:104px;height:104px}body[data-mode=walk] #hint{bottom:198px;max-width:94%;font-size:9px}}
#categories{display:flex;gap:6px;position:absolute;right:150px;top:12px}#categories[hidden]{display:none}#categories button{min-height:36px;padding:5px 12px;font-size:11px}#picker[hidden],#furniturePicker[hidden]{display:none}#furniturePicker{display:flex;gap:10px;overflow-x:auto;padding:2px 0 8px}#furniturePicker button{min-width:110px;height:76px;font-size:13px}#scale:disabled{opacity:.3}@media(max-width:650px){#categories{right:12px;top:9px}#categories button{min-height:44px;padding:5px 10px}body[data-mode=edit] #count{display:none}body[data-mode=edit] #pickerTitle{max-width:185px;font-size:11px}body[data-mode=edit] .collection-head .eyebrow{letter-spacing:1px;font-size:8px}#furniturePicker button{height:69px;min-width:105px}#cancel{position:fixed;bottom:205px;right:12px;z-index:4;min-height:44px}}
#movementPanel{position:fixed;right:24px;bottom:244px;width:202px;background:#fffaf0e8;border:1px solid #e2dacb;border-radius:18px;padding:10px;text-align:center}#movementPanel[hidden]{display:none}#movementPanel>div{display:flex;gap:5px}#movementPanel button{flex:1;min-height:44px;padding:6px}#movementPanel p{font-size:11px;margin:8px 0 3px}#movementPanel small{font-size:9px;color:#8b806e;display:block;min-height:14px}#stick{width:33px;height:33px}@media(max-width:650px){#movementPanel{right:17px;bottom:235px;width:207px;padding:9px}#joystick{bottom:244px}#playerBadge{max-width:200px}.tools button{min-width:44px}}
#selection label[hidden]{display:none}#furniturePicker button{padding:5px;font-size:11px;white-space:nowrap}
#behavior{font-size:10px;max-width:95px}#selection{flex-wrap:wrap;max-width:calc(100% - 28px)}#behavior[hidden]{display:none}
body[data-mode=walk] #world{bottom:120px}body[data-mode=walk] .collection{height:120px;padding-top:8px}body[data-mode=walk] .collection-head .eyebrow,body[data-mode=walk] footer{display:none}body[data-mode=walk] .collection-head h2{font-size:12px;margin:0 0 6px}body[data-mode=walk] #joystick{bottom:155px}body[data-mode=walk] #movementPanel{bottom:147px}body[data-mode=walk] #hint{bottom:125px}body[data-mode=walk] header{top:15px;left:20px}body[data-mode=walk] header h1{font-size:22px}body[data-mode=walk] header p{display:none}body[data-mode=walk] .tools{top:82px;left:12px}body[data-mode=walk] #playerBadge{top:137px;left:16px;background:#fffaf0db}body[data-mode=walk] .status{top:19px;right:16px}body[data-mode=walk] #movementPanel small{font-size:8px}body[data-mode=walk] .tools button{background:#fffaf0e8}body[data-mode=walk] .tools button.active{background:#6c806b}
/* Portrait game HUD: scene first, sheets only on request. */
html,body{width:100%;height:100%;overscroll-behavior:none;touch-action:none}header,.status,#playerBadge,footer,#count,.collection-head .eyebrow{display:none!important}#world,body[data-mode=walk] #world{inset:0!important}#hint{display:none!important}#hint.toast{display:block!important;top:calc(env(safe-area-inset-top) + 18px);bottom:auto!important;max-width:85%;font-size:11px;z-index:12}#joystick,body[data-mode=walk] #joystick{left:24px;bottom:calc(env(safe-area-inset-bottom) + 28px);width:112px;height:112px;background:#fffaf0ad;border-color:#ffffff90;box-shadow:0 5px 20px #40553b20}#joystick small,#joystick:after{display:none!important}.tools,body[data-mode=walk] .tools{left:auto;top:auto;right:18px;bottom:calc(env(safe-area-inset-bottom) + 24px);display:grid;grid-template-columns:48px 48px;gap:8px;z-index:5}.tools button{width:48px;height:48px;padding:0!important;font-size:22px!important;border-radius:16px;background:#fffaf0dc;border:1px solid #ffffff90;box-shadow:0 3px 12px #40553b18}body[data-mode=walk] #walk,body[data-mode=walk] #orbit{display:none}body:not([data-mode=walk]) #avatarButton{display:none}.tools #home{font-size:25px!important}body:not([data-mode=walk]) .tools{bottom:auto;top:calc(env(safe-area-inset-top) + 14px);grid-template-columns:repeat(5,44px);right:12px;gap:5px}body:not([data-mode=walk]) .tools button{width:44px;height:44px}.collection,body[data-mode=walk] .collection{display:none;height:174px;padding:12px 16px calc(env(safe-area-inset-bottom) + 10px);border-radius:24px 24px 0 0;z-index:6}body[data-mode=edit] .collection,body.avatar-open .collection{display:block}body.avatar-open .tools{bottom:calc(env(safe-area-inset-bottom) + 188px)}body.avatar-open #joystick,body.settings-open #joystick{visibility:hidden}.collection-head{height:45px;align-items:center}.collection-head h2{margin:0!important;font-size:12px!important}.collection-head #closePicker{margin-left:auto;min-width:44px;height:44px;padding:0;font-size:18px}#categories{right:68px;top:12px}body[data-mode=edit] #pickerTitle{display:none}#picker,#furniturePicker{padding-top:7px}#picker button{height:75px;min-width:73px}#picker img{width:62px;height:62px}#selection{top:calc(env(safe-area-inset-top) + 72px);right:12px;padding:8px}#movementPanel,body[data-mode=walk] #movementPanel{display:none;bottom:calc(env(safe-area-inset-bottom) + 150px);right:16px;width:calc(100% - 32px);max-width:370px;padding:14px;border-radius:22px;z-index:10;box-shadow:0 10px 40px #364a3426;background:#fffaf2f5}body.settings-open #movementPanel{display:block}.sheet-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.sheet-heading strong{font-size:13px}.sheet-heading button{flex:0!important;min-width:44px}#movementPanel #controlState{display:none}#movementPanel #reset{font-size:11px;margin-top:8px;min-height:44px}#movementPanel p{font-size:12px;margin:12px 0 0}#cancel{bottom:184px!important}#loading{font-size:14px}

/* Fixed lower-left movement joystick; camera gestures start on the right canvas. */

/* Raised tools leave the lower-right thumb zone for an independent jump. */
body[data-mode=walk] .tools{right:calc(env(safe-area-inset-right) + 18px);bottom:calc(env(safe-area-inset-bottom) + 172px)}
#jumpButton{position:fixed;right:calc(env(safe-area-inset-right) + 30px);bottom:calc(env(safe-area-inset-bottom) + 30px);width:72px;height:72px;min-height:72px;padding:5px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;border-radius:50%;border:2px solid #fffaf0e8;background:#f9f6e8e8;color:#59725d;box-shadow:0 4px 18px #40553b24;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;z-index:5}
#jumpButton[hidden],body:not([data-mode=walk]) #jumpButton{display:none}
#jumpButton span{font-family:sans-serif;font-size:30px;font-weight:bold;line-height:30px;pointer-events:none}
#jumpButton small{font-size:11px;line-height:17px;pointer-events:none}
#jumpButton:hover{transform:none}
#jumpButton[data-pressed=true]{background:#d9e9cf;transform:scale(.95)}
#jumpButton[data-airborne=true]{border-color:#a8c59d}
body.avatar-open #jumpButton,body.settings-open #jumpButton,body.avatar-open .tools,body.settings-open .tools{visibility:hidden;pointer-events:none}
@media(max-height:540px){
  body[data-mode=walk] .tools{bottom:calc(env(safe-area-inset-bottom) + 118px);grid-template-columns:44px 44px;gap:6px}
  body[data-mode=walk] .tools button{width:44px;height:44px}
  #jumpButton{right:calc(env(safe-area-inset-right) + 26px);bottom:calc(env(safe-area-inset-bottom) + 20px);width:64px;height:64px;min-height:64px}
  #movementPanel,body[data-mode=walk] #movementPanel{bottom:calc(env(safe-area-inset-bottom) + 12px);max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);overflow-y:auto}
}

/* v24 top-safe HUD: appended only; original v23 stylesheet above is preserved. */
html,body{touch-action:auto}
body{display:flex;flex-direction:column;align-items:flex-end;gap:8px;padding:calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + 12px);isolation:isolate}
.tools,body[data-mode=walk] .tools,body:not([data-mode=walk]) .tools{position:relative;inset:auto;display:flex;flex:none;gap:6px;max-width:100%}
.tools button,body[data-mode=walk] .tools button,body:not([data-mode=walk]) .tools button{width:44px;height:44px;min-width:44px;min-height:44px;flex:none}
.tools button:hover{transform:none}
.collection,body[data-mode=walk] .collection{position:relative;inset:auto;width:100%;max-width:440px;height:auto;min-height:62px;flex:0 1 auto;padding:8px;border:1px solid #fff;border-radius:18px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.collection-head{height:auto;min-height:44px;display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.collection-head>div:first-child{min-width:0;flex:1}
.collection-head #closePicker{width:44px;flex:none}
body[data-mode=edit] .collection-head>div:first-child{display:none}
#categories{left:8px;right:auto;top:8px;gap:6px}
#categories button{min-width:44px;min-height:44px;padding:5px 12px}
#picker,#furniturePicker{padding:8px 0 3px;gap:8px;touch-action:pan-x;overscroll-behavior:contain}
#picker button,#furniturePicker button{height:75px}
#cancel{position:static;inset:auto!important;min-height:44px;width:100%;order:10;padding:6px;font-size:12px}
#selection{position:relative;inset:auto;width:100%;max-width:440px;flex:none;padding:0;font-size:12px;gap:4px;border-radius:18px;grid-template-columns:minmax(0,1fr) 44px 44px;z-index:5}
#selection:not([hidden]){display:grid}
#selection[hidden]{display:none}
#selectedName{display:none}
#selection label{grid-column:1/-1;min-height:44px;min-width:0;display:flex;padding:0 6px}
#selection label[hidden]{display:none}
#scale{width:100%;min-width:44px;height:44px;flex:1}
#selection button{min-height:44px;min-width:44px;padding:6px}
#behavior{grid-column:1;max-width:none;font-size:11px}
#delete{grid-column:2}
#deselect{grid-column:3}
#movementPanel,body[data-mode=walk] #movementPanel{position:relative;inset:auto;width:100%;max-width:440px;max-height:100%;min-height:44px;flex:0 1 auto;padding:12px;border-radius:18px;overflow-y:auto;overscroll-behavior:contain}
body.settings-open #selection,body.settings-open .collection{display:none}
body.avatar-open .tools,body.settings-open .tools{position:absolute;inset:auto}
#joystick,body[data-mode=walk] #joystick{left:calc(env(safe-area-inset-left) + 24px)}
#hint.toast{top:calc(env(safe-area-inset-top) + 64px)}

/* Bounded shared scroll area keeps context + picker reachable on tiny screens. */
.hudPanels{display:flex;flex-direction:column;gap:8px;align-items:stretch;position:relative;width:100%;max-width:440px;min-height:0;flex:0 1 auto;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;touch-action:auto;z-index:6}
body[data-mode=walk]:not(.avatar-open):not(.settings-open) .hudPanels{display:none}
body .hudPanels #selection,body .hudPanels .collection,body .hudPanels #movementPanel{flex:none;max-height:none;overflow:visible}
.hudPanels #picker,.hudPanels #furniturePicker{touch-action:pan-x pan-y;overscroll-behavior-x:contain;overscroll-behavior-y:auto}
@media(max-height:300px){#joystick,body[data-mode=walk] #joystick{width:88px;height:88px;bottom:calc(env(safe-area-inset-bottom) + 16px)}}

/* v28 background orbit and nonblocking desktop input hints. Mobile HUD unchanged. */
#desktopHelp{display:none;pointer-events:none;user-select:none}
@media(hover:hover) and (pointer:fine){
  body[data-mode=walk] #world canvas{cursor:grab}
  body[data-mode=walk] #world canvas[data-looking=true]{cursor:grabbing}
  #world canvas:focus-visible{outline:2px solid #93aa88;outline-offset:-2px}
}
@media(min-width:760px) and (hover:hover) and (pointer:fine){
  body[data-mode=walk]:not(.settings-open):not(.avatar-open) #desktopHelp{display:block;position:fixed;left:calc(env(safe-area-inset-left) + 18px);top:calc(env(safe-area-inset-top) + 16px);padding:9px 13px;border-radius:14px;background:#fffaf0d9;color:#60725b;font-size:12px;line-height:1.6;z-index:3}
}

/* v29 compact gathering bag. Leave lower joystick/jump hit areas untouched. */
#gatherPanel{position:fixed;top:calc(env(safe-area-inset-top) + 70px);left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);padding:9px 13px;border-radius:17px;background:#fffaf0ed;box-shadow:0 3px 16px #66584115;z-index:4;text-align:center;pointer-events:none;color:#5d7259;font-size:11px;line-height:1.6}
#gatherPanel[hidden],#gatherButton[hidden],#gatherProgress[hidden]{display:none}
#gatherBag{font-weight:700;white-space:normal}#gatherStatus{font-size:11px}
#gatherButton{pointer-events:auto;touch-action:manipulation;min-height:42px;margin-top:5px;padding:8px 22px;border:0;border-radius:18px;background:#91af85;color:white;font-weight:700}
#gatherButton:disabled{opacity:.6}#gatherProgress{display:block;width:100%;height:7px;margin-top:6px;accent-color:#91af85}
@media(max-height:450px){#gatherPanel{left:calc(env(safe-area-inset-left) + 8px);top:8px;transform:none;max-width:42vw}}
