/* GEAR Arena NEXT Tactical Field 03 / Portrait HUD & 50:50 deployment lanes
   UI-only. Existing JS IDs and combat engine untouched. */
@media(max-width:799px){
 /* Recover space from the old tall hand region and allocate it to deployment. */
 #battle:not(.hidden){
   grid-template-rows:minmax(88px,12.5%) minmax(0,1fr) minmax(132px,21%) minmax(94px,16%) !important;
   gap:4px !important;
 }
 #battle .arena-top-hud{grid-template-rows:27px minmax(0,1fr)!important;gap:3px;min-height:0}
 /* Real ship art replaces the large square image in the middle of the battlefield. */
 #battle .battle-side{position:relative}
 #battle .hud-machine-portrait{
   position:absolute;z-index:4;left:6px;top:4px;width:64px;height:calc(100% - 8px);
   overflow:hidden;border:1px solid #51798a;border-left:3px solid #88cfe1;
   background:#081724;clip-path:polygon(0 0,100% 0,100% 83%,84% 100%,0 100%);
 }
 #battle .hud-machine-portrait img{display:block;width:100%;height:100%;object-fit:cover;object-position:50% 21%;filter:contrast(1.15) saturate(.85);pointer-events:none}
 #battle .hud-machine-portrait span{position:absolute;bottom:0;left:0;right:0;padding:2px;background:#06131edb;font:800 8px/1 ui-monospace,monospace;letter-spacing:.13em;text-align:center;color:#d3eff8}
 #battle .enemy-machine-portrait{border-left-color:#e0a19b;border-color:#815962;}
 #battle .enemy-machine-portrait img{filter:sepia(.65) hue-rotate(300deg) saturate(.8) brightness(.72) contrast(1.2)}
 #battle .enemy-machine-portrait span{color:#ffc3b4}
 #battle .enemy-side .side-information{min-width:0;min-height:0;padding-left:70px}
 #battle .enemy-side .name-row{min-width:0;gap:4px;margin:0 0 2px}
 #battle .enemy-side .name-row b{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px}
 #battle .enemy-side .name-row span{flex:0 0 auto;font-size:9px}
 #battle .enemy-side .resource{gap:2px;min-height:0;white-space:nowrap;overflow:hidden;font-size:8px}
 #battle .enemy-side .resource>*{padding:1px 3px;min-width:0;overflow:hidden;text-overflow:ellipsis}
 #battle .enemy-side .hp-row.hp-number-only{min-height:17px}
 #battle .enemy-side .hp-row.hp-number-only strong{font-size:16px}
 #battle .player-side{padding:4px 5px!important}
 #battle .player-side .pilot-vitals{padding-left:70px;min-height:0}
 #battle .player-side .name-row{max-width:none;margin-bottom:3px;min-height:13px;gap:4px}
 #battle .player-side .name-row b{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px}
 #battle .player-side .name-row span{white-space:nowrap;flex:0 0 auto;font-size:8px}
 #battle .player-side .hp-row.hp-number-only{min-height:19px}
 #battle .player-side .hp-row.hp-number-only strong{font-size:16px}
 #battle .player-side .resource{font-size:9px;gap:3px;min-height:16px}
 #battle .player-side .resource>*{padding:2px 4px}
 #battle .player-side .equipment{margin-top:6px;max-height:34px!important;min-height:28px}
 #battle .player-side .equip-cell{max-height:34px!important;padding:3px 5px}
 #battle .arena-bottom-hud{grid-template-rows:minmax(0,1fr) 47px!important;gap:3px;min-height:0;overflow:visible}
 #battle .arena-bottom-hud .controls{height:47px;min-height:47px;padding:2px 5px!important}
 /* Enemy/ally each get exactly half of the deployment space; the center separator is neutral. */
 #battle .battle-center{
   display:grid!important;
   grid-template-columns:minmax(0,1fr)!important;
   grid-template-rows:minmax(0,1fr) 46px minmax(0,1fr)!important;
   place-items:stretch!important;
   min-height:0;
 }
 #battle .field-sector{min-height:0;height:100%;grid-template-rows:16px minmax(0,1fr);gap:3px;padding:4px 7px 5px}
 #battle .field-sector .sector-title{font-size:9px;letter-spacing:.09em}
 #battle .enemy-sector{grid-row:1;}
 #battle .ally-sector{grid-row:3;}
 #battle .field-positions{min-height:0}
 #battle .field-positions>.units .unit{min-height:0;max-height:none;padding:3px 3px 16px}
 #battle .field-conflict{
   grid-row:2;position:relative;z-index:9;min-height:46px;
   width:100%;height:46px;overflow:visible!important;
   background:linear-gradient(90deg,#09202e,#0c2938 45%,#132d3a);
   border-top:1px solid #587b89;border-bottom:1px solid #587b89;
 }
 #battle .field-conflict .mech-portrait{display:none!important}
 #battle .battle-center:after{content:'FIELD 01 / ENGAGEMENT';top:50%;left:11px;bottom:auto;transform:translateY(-50%);max-width:170px;padding:0 0 0 5px;font:700 9px/1.25 ui-monospace,monospace;white-space:nowrap;letter-spacing:.08em;color:#a6d9e6;background:transparent;z-index:10}
 #battle .field-conflict .combat-coordinate{display:none!important}
 #battle .field-conflict .field-emblem{opacity:.3}
 #battle .field-conflict .field-end-turn{
    right:10px!important;left:auto!important;
    top:50%!important;transform:translateY(-50%)!important;
    width:124px!important;height:44px!important;min-height:44px!important;
    font-size:12px!important;padding:4px 9px!important;
    z-index:12;pointer-events:auto;
 }
 #battle .hand-panel{padding:4px 5px 4px!important;gap:2px;min-height:0}
 #battle .hand-heading{flex:0 0 17px;font-size:10px}
 #battle .hand-list{min-height:0;flex:1 1 auto;gap:5px;padding:1px 1px 2px}
 #battle .small-card{flex:0 0 94px;width:94px;min-width:94px;max-width:94px;min-height:0;height:100%;gap:2px;padding:4px}
 #battle .small-card b{font-size:9px;max-height:25px;line-height:1.25}
 #battle .small-card .stat{font-size:9px}
 #battle .small-card p{font-size:8px;line-height:1.2;-webkit-line-clamp:2}
}
@media(max-width:799px) and (max-height:730px){
 #battle:not(.hidden){grid-template-rows:88px minmax(0,1fr) 132px 95px!important;gap:3px!important}
 #battle .arena-top-hud{grid-template-rows:25px minmax(0,1fr)!important}
 #battle .field-sector{grid-template-rows:13px minmax(0,1fr);padding:2px 4px 3px;gap:2px}
 #battle .battle-center{grid-template-rows:minmax(0,1fr) 44px minmax(0,1fr)!important}
 #battle .field-conflict{height:44px;min-height:44px}
 #battle .field-conflict .field-end-turn{width:116px!important;height:44px!important}
 #battle .player-side .equipment{margin-top:3px!important;max-height:27px!important;min-height:24px!important}
 #battle .player-side .equip-cell{max-height:27px!important}
 #battle .hud-machine-portrait{width:57px}
 #battle .enemy-side .side-information,#battle .player-side .pilot-vitals{padding-left:62px}
 #battle .small-card{flex-basis:89px;min-width:89px;width:89px;max-width:89px}
}
@media(max-width:799px){
 /* Keep equipment slot 1 visible: portrait occupies only the top status row. */
 #battle .player-side .ally-machine-portrait{height:56px!important;max-height:56px!important}
 #battle .player-side .equipment{position:relative;z-index:5}
}
@media(max-width:799px) and (max-height:730px){
 #battle .player-side .ally-machine-portrait{height:48px!important;max-height:48px!important}
}
