body[data-layout=mobile]{display:block;margin:0;height:100dvh;min-height:0;overflow:hidden;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);background:#030a12;}
body[data-layout=mobile] #game{width:min(100%,600px);height:100%;margin:auto;aspect-ratio:auto;display:grid;grid-template-rows:minmax(0,1fr) auto;box-shadow:none;}
body[data-layout=mobile] #field{height:100%;min-height:0;overflow:hidden;}
body[data-layout=mobile] .topline{top:8px;left:9px;right:9px;gap:8px;font-size:12px;}
body[data-layout=mobile] .preview-label{font-size:10px;}
body[data-layout=mobile] .resources{gap:7px;}
body[data-layout=mobile] .wave-bar{top:34px;left:7px;right:7px;font-size:10px;padding:6px;}
body[data-layout=mobile] #hint{font-size:10px;left:8px;right:8px;bottom:4px;}
body[data-layout=mobile] #notice{top:80px;font-size:12px;padding:8px;z-index:4;}
body[data-layout=mobile] footer{height:auto;display:grid;grid-template-columns:1fr;padding:5px 8px 7px;background:#091b2b;border-top:3px ridge #b3a157;gap:4px;}
body[data-layout=mobile] .crest,body[data-layout=mobile] .map-frame,body[data-layout=mobile] .portrait-frame,body[data-layout=mobile] .readout,body[data-layout=mobile] .caption,body[data-layout=mobile] .unit-info{display:none;}
body[data-layout=mobile] .stats{margin:0;border:0;border-radius:0;padding:3px;background:none;box-shadow:none;min-width:0;}
body[data-layout=mobile] .stats:before,body[data-layout=mobile] .stats:after{display:none;}
body[data-layout=mobile] h1{font-size:11px;text-align:left;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
body[data-layout=mobile] .commands{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,44px);gap:4px;padding:0;background:none;}
body[data-layout=mobile] button{min-height:44px;touch-action:manipulation;font-size:12px;}
body[data-layout=mobile] .commands>button>span{display:none;}
body[data-layout=mobile] .commands>button small{position:static;font-size:12px;}
body[data-layout=mobile] .commands.building-selected{grid-template-rows:44px;}
body[data-layout=mobile] .commands.building-selected #upgrade{grid-column:1/3;grid-row:1;}
body[data-layout=mobile] .commands.building-selected #deselect-building{grid-column:3;grid-row:1;}
body[data-layout=mobile] .game-dialog,body[data-layout=mobile] .unit-gallery{max-height:85dvh;overflow:auto;max-width:94vw;padding:14px;font-size:12px;}
body[data-layout=mobile] .mobile-sheet{width:min(94vw,480px);margin:auto auto max(env(safe-area-inset-bottom),10px);}
.mobile-sheet header{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;}
.mobile-sheet header button{padding:6px 16px;}
.mobile-tools h2,.mobile-roster h2{font-size:11px;color:#b4cfe5;margin:0 0 10px;}
.mobile-upgrades{display:grid;gap:6px;}
.mobile-upgrades button{padding:8px;}
.mobile-view{display:flex;gap:6px;align-items:center;margin-top:10px;}
.mobile-view button{padding:6px 12px;min-width:44px;}
.mobile-view a{color:#a8bed0;margin-left:auto;font-size:10px;}
.mobile-unit-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
.mobile-unit-list button{font-size:10px!important;line-height:1.5;padding:6px;}
.mobile-unit-list canvas{display:block;width:42px;height:42px;margin:0 auto;image-rendering:pixelated;}
.mobile-unit-list span{font-family:inherit;font-size:10px;line-height:1.5;}
.mobile-unit-list button[aria-pressed=true]{border-color:#77cb85;color:#c8f3c2;}
.mobile-extra{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
.mobile-extra button{height:54px;}
.mobile-extra button span{font-size:18px;}
.mobile-extra button small{font-size:10px;}
body[data-layout=mobile] #overview{position:static;width:auto;margin:0;opacity:1;font-size:11px;}
body[data-layout=mobile] #move[aria-pressed=true]{border-color:#e9d77b;}
@media(orientation:landscape) and (max-height:600px){
 body[data-layout=mobile] #game{width:100%;max-width:none;grid-template-columns:minmax(0,1fr) 210px;grid-template-rows:minmax(0,1fr);}
 body[data-layout=mobile] footer{align-content:center;border-top:0;border-left:3px ridge #b3a157;}
 body[data-layout=mobile] .commands{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,48px);}
 body[data-layout=mobile] .commands.building-selected{grid-template-columns:1fr;grid-template-rows:repeat(2,48px);}
 body[data-layout=mobile] .commands.building-selected #upgrade,body[data-layout=mobile] .commands.building-selected #deselect-building{grid-column:1;grid-row:auto;}
}
