@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap');
:root{--ink:#263b40;--mint:#72cbb3;--muted:#8b999b;--line:#e1e9e3;--cream:#faf9f3}*{box-sizing:border-box}body{margin:0;background:var(--cream);font-family:'Noto Sans KR',sans-serif;color:var(--ink);font-size:14px}button,input,select{font:inherit}button{cursor:pointer;border:0;color:inherit;background:white}button:hover{filter:brightness(.97)}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #80cbb7;outline-offset:3px}button:disabled{opacity:.5;cursor:wait}header{height:82px;display:flex;align-items:center;justify-content:space-between;padding:0 40px;border-bottom:1px solid var(--line);background:#fffdf8}.brand{text-decoration:none;color:var(--ink);font-size:23px;font-weight:800;letter-spacing:-1px;display:flex;align-items:center;gap:12px}.brand>span{font-size:31px}.brand small{font-size:11px;color:#9aa5a0;font-weight:400;letter-spacing:1px;margin-left:18px}.status{display:flex;align-items:center;gap:10px;color:#74857c;font-size:12px}.status i,.live-dot{display:inline-block;width:7px;height:7px;background:#77b98c;border-radius:50%}.status button{margin-left:15px;border-left:1px solid var(--line);padding-left:22px;background:transparent;font-size:18px}#leave{font-size:12px}.eyebrow{font-size:10px;font-weight:700;letter-spacing:2.4px;color:#73a994}#lobby{max-width:1240px;margin:0 auto;display:grid;grid-template-columns:1.15fr 1fr;gap:90px;padding:66px 40px 30px}.intro h1{font-size:40px;line-height:1.5;letter-spacing:-2px;margin:16px 0}.intro h1 span{display:inline-block;font-size:40px;color:#8fcbb0;margin-left:15px}.intro p{color:#8a9690;line-height:1.9;font-size:13px}.intro-art{position:relative;margin:3px -35px -5px}.intro-art canvas{width:100%;image-rendering:pixelated}.art-note{position:absolute;bottom:15px;left:50%;transform:translateX(-50%);font-size:10px;white-space:nowrap;color:#8a9a8d}.intro-bottom{display:flex;justify-content:space-between;font-size:10px;color:#86968c;border-top:1px solid var(--line);padding-top:20px}.lobby-panel{background:#fffefa;border:1px solid #e6e9df;border-radius:20px;padding:30px;box-shadow:0 14px 45px #527b5710;margin-top:4px;height:fit-content}.section-top{display:flex;justify-content:space-between;align-items:center}h2{font-size:22px;letter-spacing:-.8px;margin:9px 0}.icon{font-size:24px;color:#8b9d90;background:#f2f5ed;border-radius:50%;width:37px;height:37px}.muted{color:#95a198;font-size:11px}.rooms{margin-top:27px;display:grid;gap:12px;max-height:390px;overflow:auto}.room-card{border:1px solid #e6eade;border-radius:12px;background:white;display:flex;text-align:left;padding:16px 14px;align-items:center;gap:14px;width:100%;transition:transform .15s,border .15s}.room-card:hover{border-color:#89c7b0;transform:translateY(-2px)}.room-icon{width:53px;height:53px;display:grid;place-items:center;font-size:27px;background:#eef4df;border-radius:10px}.room-card:nth-child(2n) .room-icon{background:#f4e7dd}.room-card:nth-child(3n) .room-icon{background:#e8eff4}.room-info{flex:1;min-width:0}.room-info strong{font-size:13px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.room-info small{font-size:10px;color:#a0aba1;display:block;margin-top:6px}.room-count{color:#76a78d;font-size:10px;white-space:nowrap}.create-link{width:100%;padding:15px;border:1px dashed #b8d5c3;border-radius:10px;margin-top:18px;background:#f5f8ed;color:#70927d;font-size:12px}.lobby-foot{text-align:center;font-size:10px;color:#9aaa9c;margin-top:24px}.empty{color:#8b9d8f;text-align:center;padding:25px;line-height:2}#office{height:calc(100dvh - 82px);display:flex}#office[hidden],#lobby[hidden]{display:none}.world{position:relative;flex:1;min-width:0;overflow:hidden;background:#e3eee7}#scene{width:100%;height:100%;display:block;touch-action:none;image-rendering:pixelated;cursor:pointer}.room-pill{position:absolute;top:22px;left:24px;background:#fffffff0;border:1px solid #ffffff;border-radius:30px;padding:12px 17px;display:flex;align-items:center;gap:9px;box-shadow:0 3px 10px #496b5710;font-size:12px}.room-pill>span:last-child{font-size:10px;color:#a0aaa2;margin-left:10px}.world-toolbar{position:absolute;bottom:24px;left:24px;display:flex;gap:9px}.world-toolbar button{border-radius:12px;padding:13px 17px;box-shadow:0 4px 10px #4d76631c;font-size:19px;border:1px solid #e8eee6}.world-toolbar button span{font-size:11px;font-weight:700;margin-left:5px}.world-hint{position:absolute;bottom:91px;left:50%;transform:translateX(-50%);color:#7b9182;background:#ffffffd9;border-radius:20px;padding:8px 15px;font-size:10px;white-space:nowrap;pointer-events:none}.zoom{position:absolute;bottom:26px;right:20px;display:flex;background:white;border-radius:10px;align-items:center;box-shadow:0 3px 10px #496b5710}.zoom button{padding:12px}.zoom span{font-size:9px;color:#87978a}.chat{width:300px;background:#fffefa;padding:25px 20px 18px;display:flex;flex-direction:column;border-left:1px solid #dbe5dc}.chat-heading{display:flex;justify-content:space-between;align-items:center}.chat-heading h2{font-size:18px;margin:0}.chat-heading h2 span{font-size:10px;color:#6ca489;background:#e9f4e9;padding:3px 6px;border-radius:5px;margin-left:5px}.chat-heading>.muted{font-size:9px}.tabs{display:flex;background:#f2f4ee;padding:3px;border-radius:8px;margin:20px 0 10px}.tabs button{flex:1;background:transparent;font-size:11px;color:#8b9a8c;padding:9px;border-radius:6px}.tabs button.active{background:white;color:#5ea78b;box-shadow:0 1px 4px #385b4010}#messages{flex:1;overflow-y:auto;padding:15px 0;scrollbar-width:thin}.welcome{text-align:center;color:#9eafa2;font-size:30px;padding:50px 0}.welcome strong{display:block;font-size:12px;color:#7e9785;margin-top:15px}.welcome p{font-size:10px;line-height:1.8}.chat-message{display:flex;gap:9px;margin-bottom:19px}.chat-avatar{width:31px;height:34px;image-rendering:pixelated;background:#f0f6eb;border-radius:7px;flex-shrink:0}.message-body{min-width:0}.message-meta{display:flex;gap:8px;align-items:center;font-size:10px;color:#658c76}.message-meta time{font-size:8px;color:#a6b0a8}.bubble{font-size:11px;line-height:1.7;background:#f3f6ef;padding:9px 11px;border:1px solid #edf0e7;border-radius:0 9px 9px 9px;margin-top:6px;overflow-wrap:anywhere}.chat-message.mine .bubble{background:#eaf6ef;border-color:#dbede2}.system-message{text-align:center;color:#9ba99d;font-size:9px;margin:14px 0}#chat-form{display:flex;gap:7px;border:1px solid #e5eadd;padding:7px;border-radius:10px;background:white}#chat-form input{min-width:0;width:100%;border:0;background:#f5f7f1;padding:10px 8px;border-radius:6px;font-size:10px;color:var(--ink)}#chat-form button{background:#80cdb4;color:white;width:32px;border-radius:9px}dialog{border:1px solid #e5eadf;border-radius:20px;padding:32px;width:450px;max-width:calc(100% - 28px);background:#fffef9;box-shadow:0 24px 90px #233d3333}dialog::backdrop{background:#2b49354a;backdrop-filter:blur(4px)}dialog form{position:relative}.close{position:absolute;right:-10px;top:-16px;font-size:26px;color:#8a9a8e;background:transparent}dialog h2{margin-bottom:25px}label{display:block;font-size:11px;color:#6f8275;font-weight:600;margin:15px 0 6px}label small{font-size:9px;font-weight:400;color:#a7b0a5;margin-left:6px}input,select{display:block;width:100%;background:white;color:#384e40;border:1px solid #dfe7d9;border-radius:7px;padding:11px;margin-top:7px;font-size:12px}input::placeholder{color:#adb7ac}.primary{width:100%;margin-top:23px;background:#7fcbb0;color:#214e3b;font-size:12px;font-weight:700;border-radius:8px;padding:13px}.form-error{font-size:11px;color:#bf7467;min-height:12px}.avatar-layout{display:flex;gap:20px}.avatar-preview{background:#eef3e8;border-radius:12px;width:108px;flex-shrink:0;text-align:center;align-self:stretch;padding:6px}.avatar-preview canvas{width:90px;height:115px;image-rendering:pixelated}.avatar-preview span{font-size:9px;color:#9aad9b}.avatar-fields{flex:1;min-width:0}.avatar-fields label:first-child{margin-top:0}.palette{display:flex;gap:5px;flex-wrap:wrap}.palette button{width:19px;height:19px;border-radius:4px;border:2px solid transparent}.palette button.selected{outline:2px solid #5fa78b;outline-offset:2px}.palette-label{margin:10px 0 7px;font-size:10px;color:#8d9e8d}.style-row{display:flex;gap:12px}.style-row label{flex:1}select{font-size:11px;padding:9px}#map-options{display:grid;gap:6px}.map-option{padding:11px;text-align:left;border:1px solid #e2e8dc;border-radius:8px;font-size:12px;background:white}.map-option.selected{border-color:#7db79d;background:#eef6e9}.map-option small{display:block;font-size:9px;color:#9bac99;margin-top:4px}#toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%,20px);background:#315640ee;color:#fff;border-radius:10px;padding:12px 22px;font-size:12px;opacity:0;transition:.2s;pointer-events:none;z-index:9}#toast.visible{opacity:1;transform:translate(-50%,0)}@media(min-width:1600px){#lobby{padding-top:100px;max-width:1400px;gap:130px}.intro h1{font-size:48px}.intro-art{margin-top:20px}.chat{width:330px}}@media(max-width:900px){header{padding:0 20px;height:65px}.brand{font-size:19px}.brand small{display:none}#lobby{gap:30px;padding:35px 25px;grid-template-columns:1fr 1fr}.intro h1{font-size:30px}.lobby-panel{padding:22px}.intro-bottom{gap:8px;font-size:8px}#office{height:calc(100dvh - 65px)}.chat{width:255px;padding:20px 13px}.world-toolbar{left:12px;gap:5px;bottom:15px}.world-toolbar button{padding:12px 10px;font-size:16px}.world-toolbar button span{font-size:9px}.zoom{right:12px;bottom:75px}.room-pill{left:12px;top:15px}}@media(max-width:650px){header{height:58px;padding:0 15px}.brand{font-size:17px}.brand>span{font-size:25px}.status{font-size:9px;gap:5px}.status button{margin-left:4px;padding-left:9px}#lobby{display:flex;flex-direction:column;padding:28px 20px;gap:25px}.intro h1{font-size:30px;line-height:1.4;margin:12px 0}.intro p{font-size:11px}.intro-art{position:absolute;width:200px;right:6px;top:154px;opacity:.8;z-index:-1}.art-note,.intro-bottom{display:none}.lobby-panel{padding:23px;border-radius:16px;margin-top:18px}.rooms{max-height:300px;margin-top:20px}.room-card{padding:12px}#office{height:calc(100dvh - 58px);flex-direction:column}.world{flex:1;min-height:280px}.chat{width:100%;height:32%;min-height:185px;padding:10px 15px;border-left:0;border-top:1px solid var(--line)}.chat-heading{position:absolute;right:15px;margin-top:4px}.chat-heading h2{font-size:13px}.chat-heading>.muted{display:none}.tabs{width:150px;margin:0 0 5px}.tabs button{padding:5px}.welcome{padding:3px;font-size:17px}.welcome strong{display:inline;margin-left:10px}.welcome p{margin:4px}.world-toolbar button span{font-size:9px}.world-toolbar{bottom:12px}.world-hint{bottom:65px}.room-pill{padding:8px 12px}.room-pill>span:last-child{display:none}.zoom{bottom:12px;right:10px}.zoom button{padding:9px}.zoom span{display:none}.world-toolbar button{padding:10px 9px}.chat-message{margin-bottom:10px}.bubble{padding:6px 9px}.chat-avatar{width:27px;height:30px}.avatar-layout{gap:14px}}
/* Interface and player text retain their size independently of canvas zoom. */
#player-labels{position:absolute;inset:0;pointer-events:none;overflow:hidden}.player-label{position:absolute;display:flex;flex-direction:column;align-items:center;gap:6px;transform:translate(-50%,-100%);width:max-content;max-width:260px;will-change:left,top}.player-name{font-size:13px!important;line-height:1.35;font-weight:700;color:#385443;background:#fffef5f5;border:1px solid #dbe3d0;padding:4px 9px;border-radius:5px;white-space:nowrap;box-shadow:0 2px 5px #384c2820}.player-label.self .player-name{background:#e9f7df;border-color:#94c9a8;color:#356745}.player-bubble{font-size:14px!important;line-height:1.55;max-width:250px;padding:8px 12px;background:#fffffaf5;border:1px solid #d4dfd0;border-radius:11px;overflow-wrap:anywhere;box-shadow:0 3px 8px #344b2820}.player-action{font-size:20px!important;font-weight:800;line-height:1;background:#fff8dc;color:#a37526;border:1px solid #e8dba7;border-radius:50%;width:31px;height:31px;display:grid;place-items:center;box-shadow:0 2px 7px #344b2820}.player-action.searching{font-size:20px!important;color:#496650;background:#f6fff3;animation:look-around .8s ease-in-out infinite alternate}.player-label [hidden]{display:none!important}@keyframes look-around{from{transform:translateX(-3px) rotate(-12deg)}to{transform:translateX(3px) rotate(12deg)}}
#scene{image-rendering:auto}.eyebrow{font-size:12px;letter-spacing:1.7px}.brand small,.status,.muted,.intro p,.intro-bottom,.art-note,.room-info small,.room-count,.create-link,.lobby-foot,.room-pill,.room-pill>span:last-child,.world-hint,.world-toolbar button span,.zoom span,.chat-heading>.muted,.chat-heading h2 span,.tabs button,.welcome strong,.welcome p,.message-meta,.message-meta time,.system-message,#chat-form input,.primary,.form-error,label,label small,.avatar-preview span,.palette-label,select,.map-option,.map-option small{font-size:12px}.room-info strong{font-size:14px}.bubble{font-size:14px;line-height:1.65}.room-info small{line-height:1.6}.chat-avatar{width:36px;height:40px}.message-meta{flex-wrap:wrap;gap:6px}.chat{width:320px}#chat-form input{padding:11px 8px}.intro-bottom{gap:12px}.intro-bottom span{white-space:nowrap}.world-toolbar button span{margin-left:3px}.world-hint{max-width:calc(100% - 20px);white-space:normal;text-align:center}.palette button{width:21px;height:21px}.map-option small{line-height:1.6}.room-pill{max-width:calc(100% - 30px)}.room-pill strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.room-pill>span:last-child{white-space:nowrap}
@media(max-width:900px){.chat{width:280px}.world-toolbar button{padding:11px 9px}.world-toolbar button span{font-size:12px}.world-toolbar{gap:5px}.intro-bottom{flex-wrap:wrap}.intro-bottom span{font-size:12px}.chat-heading>.muted{display:none}.status{font-size:12px}}
@media(max-width:650px){.chat{width:100%;padding:10px 15px}.intro-art{top:175px}.intro p{font-size:13px}.status{font-size:12px}.status button{font-size:16px}.world-toolbar button{padding:10px 8px}.world-toolbar button span{font-size:12px}.world-toolbar button:first-child{font-size:0}.world-toolbar button:first-child span{margin:0}.world-toolbar button:not(:first-child){font-size:15px}.room-pill{padding:8px 12px}.zoom button{padding:9px 7px}.zoom{bottom:65px}.world-hint{bottom:65px;max-width:calc(100% - 80px)}.message-meta,.message-meta time,.system-message{font-size:12px}.chat-heading h2{font-size:14px}.welcome{padding:4px}.welcome p{font-size:12px}.tabs button{font-size:12px}.lobby-foot{line-height:1.8}.player-label{max-width:220px}.player-bubble{max-width:220px}}
/* Keep controls in the scene corners and forms inside the visible viewport. */
.world-hint{top:22px;right:20px;bottom:auto;left:auto;transform:none;max-width:min(310px,45%);text-align:right}
.zoom{right:16px;bottom:16px;z-index:2}
.chat,#messages,.world{min-height:0}
dialog{max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;scroll-padding:20px;margin:auto}
dialog form{min-width:0}dialog h2{padding-right:18px;overflow-wrap:anywhere}.style-row label{min-width:0}
#toast{max-width:calc(100% - 24px);text-align:center;overflow-wrap:anywhere}
@media(max-width:650px){
  header{gap:8px}.brand{gap:6px;white-space:nowrap}.status{min-width:0}.status #connection{max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.status button{flex-shrink:0}
  #lobby{width:100%;padding:24px 16px;gap:16px}.intro,.lobby-panel{min-width:0;width:100%}.intro-art{max-width:55vw;right:0;margin:0}.intro h1{font-size:clamp(25px,7.5vw,30px)}.intro h1 span{font-size:30px;margin-left:6px}.lobby-panel{padding:20px;margin-top:8px}.room-icon{flex-shrink:0;width:44px;height:44px}.room-card{gap:10px}.room-info small{overflow-wrap:anywhere}.rooms{max-height:min(390px,55dvh)}
  #office{overflow:hidden}.world{flex:1 1 62%;min-height:0}.chat{flex:0 1 38%;height:auto;min-height:145px;position:relative;padding:9px 12px}.chat-heading{right:12px}.tabs{flex-shrink:0}#messages{padding:8px 0}#chat-form{flex-shrink:0}
  .world-hint{top:12px;right:12px;bottom:auto;max-width:45%;padding:7px 10px;font-size:11px;line-height:1.5}.room-pill{top:12px;left:12px;max-width:calc(55% - 24px);gap:6px;padding:8px 10px}.room-pill .live-dot{flex-shrink:0}
  .world-toolbar{left:12px;right:12px;bottom:60px;display:grid;grid-template-columns:1.3fr 1fr 1fr;gap:5px}.world-toolbar button{min-width:0;padding:10px 4px;white-space:nowrap}.world-toolbar button span{font-size:11px;margin-left:2px}.world-toolbar button:first-child span{font-size:11px}.zoom{right:12px;bottom:12px}.zoom button{min-width:38px;min-height:36px;padding:8px}
  dialog{padding:24px 20px;max-width:calc(100% - 20px);max-height:calc(100dvh - 20px);border-radius:16px}.close{right:-7px;top:-15px;min-width:36px;min-height:36px}dialog h2{font-size:21px;margin-bottom:20px}.avatar-layout{gap:12px}.avatar-preview{width:86px;padding:3px}.avatar-preview canvas{width:78px;height:100px}.palette{gap:7px}.palette button{width:24px;height:24px}.style-row{gap:10px}input,select,#chat-form input{font-size:16px}.primary{min-height:44px}.map-option small{overflow-wrap:anywhere}
}
@media(max-width:360px){header{padding:0 10px}.status #connection{display:none}.lobby-panel{padding:16px}.avatar-layout{flex-direction:column}.avatar-preview{align-self:center;width:100%;display:flex;justify-content:center;align-items:center;gap:12px}.avatar-preview canvas{width:60px;height:76px}.avatar-fields{width:100%}.world-toolbar{left:8px;right:8px}.world-toolbar button span{font-size:10px}.world-toolbar button:first-child span{font-size:10px}}
@media(max-height:500px) and (max-width:650px){.chat{min-height:110px;flex-basis:45%}.chat-heading,.world-hint{display:none}.world-toolbar{bottom:52px}.world-toolbar button{padding:6px 3px}.room-pill{top:7px;padding:5px 8px}.zoom{bottom:7px}.zoom button{min-height:32px}.tabs button{padding:3px}.chat{padding-top:5px;padding-bottom:5px}#messages{padding:3px 0}#chat-form{padding:4px}#chat-form input{padding:7px}}
#scene{-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none}
.room-pill{max-width:calc(55% - 44px)}
@media(min-width:651px) and (max-width:900px){.world-toolbar{bottom:64px}.zoom{bottom:16px}}
/* ===== Office layout v2 (camera, bottom sheet, drawer, compact toolbar) ===== */
:root{--hh:82px}
@media(max-width:900px){:root{--hh:65px}}
@media(max-width:650px){:root{--hh:48px}}
header{height:var(--hh);padding-left:max(40px,env(safe-area-inset-left));padding-right:max(40px,env(safe-area-inset-right))}
@media(max-width:900px){header{padding-left:max(20px,env(safe-area-inset-left));padding-right:max(20px,env(safe-area-inset-right))}}
@media(max-width:650px){header{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}.brand{font-size:16px}.brand>span{font-size:22px}.brand small{display:none}.status{font-size:12px;gap:4px}.status button{min-width:40px;min-height:40px;margin-left:2px;padding-left:8px}}
body:has(#office:not([hidden])){overflow:hidden}
#office{height:calc(var(--app-h,100dvh) - var(--hh));position:relative;overflow:hidden}
.world{position:relative}
#scene{cursor:grab}#scene.dragging{cursor:grabbing}
.world-toolbar button i{font-style:normal}
.world-toolbar button span{margin-left:4px}
#recenter{display:none}.world.detached #recenter{display:inline-block;background:#e9f7df;border-color:#94c9a8}
.chat-toggle,.chat-expand,.chat-close,.chat-peek,.chat .grip{display:none}
.chat-badge{min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#e0645c;color:#fff;font-size:11px;line-height:18px;font-weight:700;text-align:center;position:absolute;top:-4px;right:-4px}
.chat{padding:0;position:relative}
.chat-panel{flex:1;min-height:0;display:flex;flex-direction:column;padding:25px 20px 10px}
#chat-form{margin:0 20px 18px;flex-shrink:0}
#chat-form .send{background:#80cdb4;color:#fff;width:36px;border-radius:9px;flex-shrink:0}
#chat-form .chat-expand{position:relative}
.world-hint{opacity:0;transition:opacity .45s;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:min(460px,calc(100% - 330px));text-align:right}
.world-hint.show{opacity:1}
.zoom button{min-width:40px;min-height:40px}
@media(pointer:coarse){.zoom{display:none}}
/* Shared compact controls: phones and tablets in portrait, short landscape screens. */
@media (orientation:portrait) and (max-width:1100px),(orientation:landscape) and (max-height:500px),(orientation:landscape) and (max-width:900px){
  #world .world-toolbar{display:flex;flex-direction:column;gap:8px;grid-template-columns:none;left:auto}
  #world .world-toolbar button,#world .world-toolbar button:first-child,#world .world-toolbar button:not(:first-child),#recenter{display:grid;place-items:center;width:46px;height:46px;padding:0;border-radius:50%;font-size:21px;line-height:1;border:1px solid #dfe8e0;background:#fffffff2;box-shadow:0 3px 10px #3a5d4a24}
  #world .world-toolbar button span{display:none}
  .world.detached #recenter{background:#e9f7df;border-color:#94c9a8}
  #world .room-pill{top:max(8px,env(safe-area-inset-top));left:max(10px,env(safe-area-inset-left));padding:6px 12px;max-width:min(60%,260px)}
  #room-map{display:none}
  #hint{font-size:12px}
  .chat-peek{display:block;position:absolute;z-index:4;top:max(52px,calc(env(safe-area-inset-top) + 44px));left:50%;transform:translateX(-50%);max-width:calc(100% - 24px);width:max-content;background:#315640ee;color:#fff;border-radius:18px;padding:9px 16px;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .chat-peek[hidden]{display:none}
  .chat .tabs button{min-height:36px}
  .chat-close{display:grid;place-items:center;position:absolute;top:6px;right:8px;width:44px;height:44px;font-size:28px;background:transparent;color:#7f9285;z-index:2}
  .chat-heading{position:static;margin:0;flex:1}.chat-heading>.muted{display:none}
  .chat-panel{display:grid;grid-template-columns:1fr 150px;grid-template-rows:auto minmax(0,1fr);align-items:center;padding:14px 56px 8px 16px;gap:0 8px}
  .chat-panel .tabs{margin:0}
  .chat-panel #messages{grid-column:1/-1;min-height:0;align-self:stretch;height:100%}
  .chat .grip{display:block;position:absolute;top:6px;left:50%;width:38px;height:4px;border-radius:2px;background:#d4ddd5;transform:translateX(-50%)}
  #chat-form input{font-size:16px}
  #chat-form{border:0;background:transparent;padding:0}
  #chat-form .send{width:44px;height:44px;border-radius:50%}
  #chat-form .chat-expand,#chat-form .send{flex-shrink:0}
  #chat-form input{height:44px;border-radius:22px;padding:0 16px;margin:0;background:#f2f5ee}
}
/* Phone / tablet portrait: bottom sheet. */
@media (orientation:portrait) and (max-width:1100px){
  #office{flex-direction:column}
  .world{flex:1 1 auto;min-height:0}
  #world .world-toolbar{right:max(10px,env(safe-area-inset-right));bottom:14px;top:auto}
  #world .world-hint{top:auto;bottom:14px;left:max(12px,env(safe-area-inset-left));right:auto;max-width:calc(100% - 84px);text-align:left;transform:none}
  .zoom{bottom:14px}
  .chat{width:100%;flex:none;border-left:0;border-top:1px solid var(--line);z-index:6;padding:0 0 env(safe-area-inset-bottom);height:auto;min-height:0}
  #chat-form{margin:0;height:60px;padding:8px max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left));gap:8px;align-items:center}
  #chat-form .chat-expand{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:#f2f5ee;font-size:20px;position:relative}
  .chat-panel{position:absolute;left:0;right:0;bottom:100%;height:min(55dvh,640px);background:#fffefa;border-radius:18px 18px 0 0;border:1px solid var(--line);border-bottom:0;box-shadow:0 -10px 30px #2b493a1f;transform:translateY(24px);opacity:0;visibility:hidden;transition:transform .25s,opacity .2s,visibility 0s .25s;overflow:hidden}
  .chat-open .chat-panel{transform:none;opacity:1;visibility:visible;transition:transform .25s,opacity .2s}
}
@media (orientation:portrait) and (min-width:651px) and (max-width:1100px){
  #chat-form{height:68px;padding-top:10px;padding-bottom:10px}
  .chat-panel{height:min(45dvh,600px)}
  .chat-peek{font-size:15px}
}
/* Short landscape: header floats, chat is a right-hand drawer, toolbar is a left column. */
@media (orientation:landscape) and (max-height:500px),(orientation:landscape) and (max-width:900px){
  #office{flex-direction:row}
  .chat{position:absolute;top:0;right:0;bottom:0;width:min(340px,62vw);z-index:7;padding:0 max(0px,env(safe-area-inset-right)) env(safe-area-inset-bottom) 0;box-shadow:-10px 0 30px #2b493a26;transform:translateX(104%);visibility:hidden;transition:transform .25s,visibility 0s .25s}
  .chat-open .chat{transform:none;visibility:visible;transition:transform .25s}
  .chat-panel{padding-top:10px}
  #chat-form{margin:0 10px 8px;height:52px;gap:8px;align-items:center}
  #chat-form .chat-expand{display:none}
  .chat-toggle{display:grid;place-items:center;position:absolute;z-index:3;right:max(12px,env(safe-area-inset-right));bottom:12px;width:48px;height:48px;border-radius:50%;font-size:22px;background:#fffffff2;box-shadow:0 3px 10px #3a5d4a24;border:1px solid #dfe8e0}
  #world .world-toolbar{left:max(10px,env(safe-area-inset-left));top:50%;bottom:auto;right:auto;transform:translateY(-35%)}
  #world .world-hint{top:auto;bottom:10px;left:50%;right:auto;transform:translateX(-50%);max-width:calc(100% - 200px);text-align:center}
  .zoom{display:none}
}
@media (orientation:landscape) and (max-height:500px){
  :root{--hh:0px}
  body:has(#office:not([hidden])) header{position:fixed;top:max(6px,env(safe-area-inset-top));right:max(8px,env(safe-area-inset-right));left:auto;width:auto;height:auto;padding:0;border:0;background:transparent;z-index:6}
  body:has(#office:not([hidden])) header .brand,body:has(#office:not([hidden])) #connection{display:none}
  body:has(#office:not([hidden])) .status{background:#fffffff0;border-radius:22px;padding:0;box-shadow:0 3px 10px #3a5d4a24;gap:0}
  body:has(#office:not([hidden])) .status i{display:none}
  body:has(#office:not([hidden])) .status button{margin:0;border:0;padding:0 12px;min-height:40px;min-width:40px}
  #lobby:not([hidden]) ~ #office{height:auto}
}
/* Dialogs: always scrollable, submit reachable. */
dialog [hidden]{display:none!important}
dialog{max-height:calc(var(--app-h,100dvh) - 24px);overflow-y:auto;overscroll-behavior:contain}
dialog .primary{position:sticky;bottom:0;z-index:2;box-shadow:0 -12px 14px -4px #fffef9}
@media(max-height:500px){
  dialog{width:min(640px,calc(100% - 24px));padding:14px 20px 12px;border-radius:14px}
  dialog h2{font-size:17px;margin:2px 0 8px;padding-right:30px}
  dialog .eyebrow{display:none}
  .close{top:-6px;right:-8px}
  #avatar-form{display:grid;grid-template-columns:1fr 1fr;column-gap:18px;align-items:start}
  #avatar-form>h2,#avatar-form>.form-error,#avatar-form>#avatar-submit{grid-column:1/-1}
  #avatar-form>.avatar-layout{grid-column:1;grid-row:2/5}
  #avatar-form>.style-row{grid-column:2;grid-row:2}
  #avatar-form>.clothing-row{grid-row:3}
  #avatar-form>#join-password-label{grid-column:2}
  #avatar-form>#avatar-submit{margin-top:8px;min-height:42px;padding:8px}
  .avatar-preview{width:84px}.avatar-preview canvas{width:70px;height:88px}
  .style-row{gap:8px}.style-row label,label{margin-top:4px}
  #avatar-form select,#avatar-form input{padding:7px 9px;margin-top:3px}
  .form-error{min-height:0;margin:2px 0 0}
  #room-dialog #map-options{grid-template-columns:1fr 1fr}
  .primary{margin-top:8px}
}

/* Effect sprites (effects.png) in the player label: fixed CSS size, independent of canvas zoom. */
.player-action.sprite{background:none;border:0;box-shadow:none;width:auto;height:44px;min-width:30px;display:flex;align-items:flex-end;justify-content:center;filter:drop-shadow(0 1px 2px #344b2855)}
.player-action.sprite img{height:42px;width:auto;max-width:54px;object-fit:contain;image-rendering:pixelated;display:block}
.player-action.sprite[data-fx^=steam] img{height:52px}
.player-action.sprite[data-fx=paper_ball] img{height:30px;animation:toss-ball .9s ease-in-out infinite}
.player-action.sprite[data-fx=magnifier]{animation:look-around .8s ease-in-out infinite alternate}
.player-action.sprite[data-fx=sparkle] img{animation:twinkle 1.1s ease-in-out infinite alternate}
.player-action.sprite[data-fx=exclaim] img{animation:pop .5s ease-out}
.player-action.sprite[data-fx=wave_hand] img{height:38px;animation:look-around .45s ease-in-out infinite alternate}
@keyframes toss-ball{0%{transform:translate(-8px,10px)}50%{transform:translate(4px,-6px)}100%{transform:translate(14px,12px)}}
@keyframes twinkle{from{transform:scale(.85)}to{transform:scale(1.1)}}
@keyframes pop{from{transform:scale(.4)}to{transform:scale(1)}}
