/* Same gameplay and permissions. Touch-only controls never appear on mouse PCs. */
.mobile-bottom-nav,.touch-command{display:none}.game-page main>*{min-width:0}.game-page input,.game-page select,.game-page textarea{max-width:100%}
.more-menu{max-height:75vh;max-height:75dvh;overflow:auto;max-width:95vw}
.game-dialog{overscroll-behavior:contain}.game-dialog:not(.mobile-menu){padding:12px!important;overflow-y:auto;align-items:start!important;align-content:start!important}
.game-dialog>section,.game-dialog>form{max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overflow-y:auto!important;margin:auto;overscroll-behavior:contain}
.game-dialog>section>header{position:sticky;top:0;z-index:2;background:#f4ecd8}.game-dialog>section>header>div{min-width:0}.game-dialog [data-dialog-close],.game-dialog button[aria-label^="Close"]{flex-shrink:0;min-height:44px;min-width:44px}
body.game-dialog-open{overflow:hidden}.game-dialog-open .mobile-bottom-nav{visibility:hidden}
.table-scroll{overflow-x:auto;max-width:100%;overscroll-behavior-x:contain}.table-scroll:focus-visible{outline:2px solid #e7b855;outline-offset:3px}
.map-touch-hint{font-size:12px;color:#c6cdb8;margin:8px 0}.touch-map{touch-action:none;user-select:none;-webkit-user-select:none}.touch-map img{-webkit-user-drag:none}.touch-map:focus-visible{outline:3px solid #fde047;outline-offset:-3px}
.outpost-map-viewport{overflow:auto;max-width:100%;height:min(60vh,520px);border-radius:16px;background:#243018}.outpost-map-viewport .outpost-map{width:var(--outpost-width,900px);max-width:none;min-width:700px}.outpost-map-toolbar{display:flex;gap:8px;align-items:center;margin:0 0 8px}.outpost-map-toolbar button{background:#29392e;border:1px solid #a17e36;border-radius:6px;min-width:44px;min-height:44px}.outpost-map-toolbar span{font-size:12px;color:#c6cdb8}
.mobile-menu-heading{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px}.mobile-menu-heading h2{font-size:20px;font-weight:800}.mobile-menu-heading button{border:1px solid #a17e36;border-radius:8px;padding:8px 14px}
#world-tile-detail,.touch-map{scroll-margin-top:calc(var(--game-header-height,160px) + 12px)}
@media(max-width:1023px){
 #game-header .game-top-row{height:auto;min-height:48px;flex-wrap:wrap;gap:6px;padding:6px 0}
 #game-header .game-top-row>div:first-child{width:100%;min-width:0}#game-header .game-top-row img{height:30px}
 #game-header .resource-strip{width:100%;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px;font-size:12px}
 #game-header .resource-strip>span,#game-header .resource-strip>a{min-width:0;justify-content:center;gap:3px;white-space:nowrap}
 #game-header .resource-strip>a{padding:5px 2px;display:flex}
 #mobile-game-menu{position:fixed;inset:0;z-index:60;height:100vh;height:100dvh;overflow-y:auto;align-content:start;background:#172334;padding:calc(12px + env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
 #mobile-game-menu .war-nav-link{white-space:normal;min-width:0;min-height:54px}#mobile-game-menu .mobile-menu-heading{position:sticky;top:-12px;background:#172334;padding:10px 0;z-index:1}
 #game-content{padding:16px 12px;overflow-wrap:anywhere}#game-content .grid>*{min-width:0}
 #game-content form .flex{flex-wrap:wrap}#game-content form .flex>input,#game-content form .flex>select{min-width:0}
 #game-content input[type=datetime-local]{width:100%;flex-basis:100%}
 #game-content .game-dialog{overflow-wrap:anywhere}.game-dialog>section>header{padding:12px!important;gap:8px!important}.game-dialog>section>header img{width:48px;height:48px}.game-dialog h2{font-size:20px!important}
 .village-viewport,.world-viewport{height:58vh!important;height:58svh!important;min-height:280px}
 .outpost-map-viewport{height:55svh;min-height:260px}
 #beta-stage{height:58svh;min-height:300px}.beta-heading{flex-wrap:wrap}.beta-toolbar .beta-segments{width:100%;margin:0}.beta-segments button{flex:1}
}
@media(max-width:480px){
 #game-header .resource-strip{grid-template-columns:repeat(3,minmax(0,1fr));font-size:13px}#game-header .resource-strip>span{padding:2px 0}
 #game-header .resource-strip a{min-height:32px}#game-header .resource-strip a>span:last-child:not(.tabular-nums){display:none}
 #game-header>div{padding-left:10px;padding-right:10px}#game-header a[href="quests.php"] .w-24{display:none}
 #game-content .min-w-64{min-width:0;width:100%}.game-dialog .p-6{padding:14px}
}
@media(pointer:coarse){
 .touch-command{display:inline-flex}.desktop-command{display:none}
 .game-page button:not(.build-plot):not(.occupied-plot):not(.outpost-plot),.game-page summary{min-height:44px}.game-page input:not([type=hidden]):not([type=checkbox]):not([type=radio]),.game-page select{min-height:44px;font-size:16px}.game-page textarea{font-size:16px}
 .village-controls button,.map-controls button{width:44px!important;height:44px!important}
 .build-plot{border-color:#d6b36580!important;background:#d6b36518!important}.build-plot span{opacity:.85!important;width:28px!important;height:28px!important;font-size:20px!important}
 .outpost-plot>span:not(.outpost-label){opacity:1!important}.outpost-plot:focus .outpost-label{opacity:1}
 .game-page a,.game-page button{-webkit-tap-highlight-color:#d5a24855}
}
@media(pointer:coarse) and (max-width:1023px){
 .game-page{padding-bottom:calc(76px + env(safe-area-inset-bottom,0px))}
 #game-header .game-nav-row{display:none}
 .mobile-bottom-nav{position:fixed;bottom:0;left:0;right:0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));z-index:45;background:#1e293bf5;border-top:1px solid #7c693d;padding:4px max(8px,env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));backdrop-filter:blur(10px)}
 .mobile-bottom-nav>a,.mobile-bottom-nav>button{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:52px;font-size:11px;font-weight:700;color:#e2dfc8;border-radius:7px;text-decoration:none;gap:2px}
 .mobile-bottom-nav span{font-size:21px;line-height:1}.mobile-bottom-nav [aria-current=page]{background:#78350f;color:#ffecb2}
}
@media(prefers-reduced-motion:reduce){.game-page *{scroll-behavior:auto!important}.crownbound-companion{animation:none!important}}

.game-chat-link{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:4px 12px;border:1px solid #b68b40;border-radius:7px;background:#443016;color:#ffe6ac;font-weight:700;white-space:nowrap}.game-chat-link[aria-current=page]{background:#80521f}

/* One visible mobile chat entry: the floating 3D controls on scene pages,
   otherwise the bottom navigation. The full game menu remains available. */
@media(pointer:coarse){
 body:has(#beta-touch-tools) .game-chat-link,
 body:has(#beta-touch-tools) .beta-toolbar a[href="chat.php"]{display:none}
}
@media(pointer:coarse) and (max-width:1023px){
 .game-chat-link{display:none}
 body:has(#beta-touch-tools) .mobile-bottom-nav a[href="chat.php"]{display:none}
 body:has(#beta-touch-tools) .mobile-bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))}
}

/* Keep the four ordinary resources balanced while the Crown Market is closed. */
@media(max-width:1023px){#game-header .resource-strip.market-closed{grid-template-columns:repeat(4,minmax(0,1fr))}}
