:root{--app-bottom:calc(66px + env(safe-area-inset-bottom,0px));--app-top:env(safe-area-inset-top,0px)}
.language-switch{display:flex;align-items:center;gap:6px;padding:5px 8px;background:#0c1822ed;border:1px solid #adbbc440;border-radius:8px;color:#e0e7eb;font:12px/1.5 system-ui}.language-switch select{background:#132431;color:inherit;border:0;width:auto}
#app-navigation{display:none}#app-install{position:fixed;left:24px;top:16px;z-index:20;min-height:44px;padding:8px 14px;color:#d5e0e9;background:#0d1c2de8;border:1px solid #90a6b444;border-radius:12px;font:13px system-ui;cursor:pointer}
body:has(.signature) #app-install{top:auto;bottom:115px}#app-install[hidden],#app-network[hidden]{display:none!important}
#app-network{position:fixed;z-index:150;left:50%;transform:translateX(-50%);top:calc(8px + var(--app-top));width:max-content;max-width:90vw;padding:10px 16px;border:1px solid #d2be8b66;background:#172632;color:#ecdcad;border-radius:12px;font:13px/1.5 system-ui;pointer-events:none}
.app-install-dialog{width:min(430px,calc(100% - 32px));max-height:85dvh;box-sizing:border-box;padding:26px;color:#e5ebee;background:#101e2b;border:1px solid #b6c9d144;border-radius:18px;line-height:1.8}.app-install-dialog::backdrop{background:#020914bc}.app-install-dialog h2{font-size:24px}.app-install-dialog p{color:#b8c8d1}.app-install-dialog button{min-height:48px;padding:8px 24px;background:#decba1;color:#17222a;border:0;border-radius:10px}
:where(button,a,input,select,textarea):focus-visible{outline:2px solid #e7cc94;outline-offset:3px}
@media(max-width:760px),(pointer:coarse){
 button,.button,input:not([type=checkbox]):not([type=radio]),select{min-height:44px}button,.button{touch-action:manipulation}input,select,textarea{font-size:16px}button:disabled{cursor:wait}
 .language-switch{top:calc(8px + var(--app-top))!important;right:max(12px,env(safe-area-inset-right))!important;box-sizing:border-box;min-height:44px;z-index:110}.language-switch select{min-height:36px;font-size:16px}
 #app-navigation{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:24;height:var(--app-bottom);box-sizing:border-box;padding:5px max(8px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));background:#0b1825f7;border-top:1px solid #829aaf33;backdrop-filter:blur(16px);gap:3px}
 #app-navigation a{flex:1;min-width:0;min-height:52px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;text-decoration:none;color:#acbfcc;font:11px/1.3 system-ui;border-radius:12px}#app-navigation a>span:first-child{font-size:21px;line-height:24px}#app-navigation a[aria-current]{color:#ecd7a6;background:#d9c89912}
 body:has(dialog[open]) #app-navigation,body:has(dialog[open]) #app-install{visibility:hidden}
 #app-install,body:has(.signature) #app-install{left:14px;top:calc(8px + var(--app-top));bottom:auto;min-height:44px;font-size:12px;padding:8px 12px}
 body:has(.signature) .signature{top:calc(64px + var(--app-top));left:20px;max-width:calc(100vw - 40px);pointer-events:none}.signature h1{font-size:13px}.signature>p:not(.site-intro){font-size:14px;margin-top:6px}.signature .site-intro{display:none}
 body:has(#room)>#dm-notifier,body:has(#room)>.hub-entry{display:none}.room-footer{bottom:calc(var(--app-bottom) + 10px);left:16px;right:16px;gap:8px;flex-direction:column;align-items:stretch}.room-caption>span:first-child,.room-caption #hint{display:none}.local-clock{margin-left:0}.world-controls{display:flex;flex-wrap:wrap;gap:6px}.world-controls button{padding:6px 10px;min-height:44px;font-size:12px}.world-controls #world-place{flex-basis:100%;font-size:12px}.controls{display:flex;flex-wrap:wrap;gap:6px}.controls button{flex:1;padding:7px 8px;font-size:11px;min-height:44px}.room-footer .music-picker{max-width:100%}#sound-hint{bottom:calc(var(--app-bottom) + 185px);right:18px;font-size:11px}
 #object-index{left:12px;right:12px;width:auto;bottom:calc(var(--app-bottom) + 70px);max-height:55dvh;overflow:auto;box-sizing:border-box}#object-index button{min-height:54px}
 body:has(.site-header){padding-bottom:var(--app-bottom)}.site-header{padding:calc(66px + var(--app-top)) 16px 16px;gap:16px}.site-header nav{justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto;gap:8px;scrollbar-width:none}.site-header nav a{display:inline-flex;align-items:center;min-height:44px;white-space:nowrap;padding:0 10px}.site-header .brand{font-size:18px}.site-header .brand span{font-size:9px}.site-header #account-nav{margin-left:auto;gap:8px}.site-header .account-label{max-width:80px;overflow:hidden;text-overflow:ellipsis}.site-header .author{min-height:44px}
 #view{padding-left:16px;padding-right:16px;padding-bottom:28px}.site-footer{padding:20px 16px 28px}.read-body{font-size:17px;line-height:1.95}.card-body{padding:18px}.actions{gap:10px;flex-wrap:wrap}.actions button{min-height:48px}.form-error{overflow-wrap:anywhere}
 body:has(.site-header) #dm-notifier{bottom:calc(var(--app-bottom) + 10px);right:12px}.hub-toast,#activity-notifier{bottom:calc(var(--app-bottom) + 12px)!important;max-width:calc(100vw - 24px)}
 dialog{max-height:calc(100dvh - var(--app-top) - 24px);overscroll-behavior:contain}#panel{width:calc(100% - 16px)}#panel .panel-inner{padding:20px 16px}#panel .language-switch{position:static!important}#panel #close{min-width:70px;min-height:44px}.game-pagination button{height:44px;width:48px}.game-enter{min-height:50px;width:100%}.game-contents button{min-height:44px}
 /* Fullscreen games keep their own controls; no site navigation over combat. */
 body:has(#game) .screen{padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}body:has(#game) .hud-top{top:calc(12px + var(--app-top));left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right))}.hud-top .wave{max-width:100px}.hud-top .wave small{display:none}.hud-top .hud-audio{max-width:64px;min-width:44px;font-size:10px;padding:6px}.hud-top .icon-btn{min-width:44px;padding:6px}.hud-bottom{bottom:calc(30px + env(safe-area-inset-bottom));right:max(16px,env(safe-area-inset-right))}.skills button{width:74px;height:70px}.modal{padding:calc(12px + var(--app-top)) 12px calc(12px + env(safe-area-inset-bottom));align-items:safe center}.modal .panel{max-height:90dvh;overflow:auto;box-sizing:border-box}.menu-links a{display:inline-flex;min-height:44px;align-items:center;margin-right:8px}
 #cloud-dock{max-width:calc(100vw - 24px);box-sizing:border-box;bottom:calc(12px + env(safe-area-inset-bottom))}#cloud-dock button,.cloud-panel button{min-height:48px}.cloud-panel{max-height:85dvh;overflow:auto}
}
@media(max-width:760px){body:has(#game) h1{display:block;font-size:clamp(27px,8vw,38px);letter-spacing:1px;line-height:1.15;overflow-wrap:normal}body:has(#game) h1 em{display:block;margin:10px 0 0;font-size:9px;letter-spacing:3px}body:has(#game) .title-block{min-width:0}body:has(#game)>.language-switch{position:fixed;top:calc(68px + var(--app-top))!important;z-index:15}body:has(#game) .screen>header{padding-bottom:64px}body:has(#hud:not([hidden]))>.language-switch{display:none}body:has(#game) #soundBtn{min-width:70px}}
@media(max-height:520px) and (orientation:landscape){body:has(#room) .signature>p{display:none}.room-footer .room-caption{display:none}#app-navigation{height:calc(54px + env(safe-area-inset-bottom))}#app-navigation a{min-height:44px}.room-footer{bottom:calc(60px + env(safe-area-inset-bottom))}.game-art{height:90px}.game-inside-cover{padding:12px}.game-description{margin:8px auto}.hud-top .wave{max-width:none}}

#app-game-return{position:fixed;left:max(12px,env(safe-area-inset-left));bottom:calc(12px + env(safe-area-inset-bottom));z-index:75;background:#13241eee;color:#e6d7ae;border:1px solid #a69b7855;border-radius:12px;min-height:44px;padding:8px 12px;box-sizing:border-box;display:flex;align-items:center;text-decoration:none;font:13px system-ui}body:has(#app-game-return) #cloud-dock{max-width:calc(100vw - 140px)}body:has(#cloud-dock) #language-switch{top:70px;bottom:auto}body:has(#cloud-dock) .home-footer{padding-bottom:90px}
