@media(max-width:760px){
:root{--tb:38px;--hb:34px}
body #top{height:38px!important}
:root body #commBar,:root body.map-expanded #commBar,body #commBar.collapsed{top:calc(var(--tb) + 4px)!important;left:auto!important;right:6px!important;width:auto!important;max-width:208px;height:auto!important;padding:4px!important;gap:4px!important;flex-direction:row!important;flex-wrap:wrap!important;justify-content:flex-end!important;overflow:visible!important;background:#0b1725e6!important;border:1px solid #2e4660;border-radius:12px;z-index:16}
body #commBar.collapsed{background:transparent!important;border:0;padding:0!important}
body #commBar .cbtn{width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important;font-size:16px!important;flex:none;padding:0!important}
body #mapTools{left:4px!important;top:calc(var(--tb) + 4px)!important;gap:4px!important}
body #mapTools button{width:34px!important;height:34px!important;min-height:34px!important;font-size:15px!important}
body #top{gap:2px!important;padding:0 4px!important}
body #top .sysbadge{font-size:10px!important;padding:3px 5px!important;min-width:0!important}
body #top .resbox{flex:1 1 auto;min-width:0;gap:0!important;justify-content:space-between}
body #top .chip{padding:2px 3px!important;gap:2px!important;min-width:0!important;font-size:11px!important}
body #top .chip b{font-size:11px!important}
body #top .chip svg{width:12px!important;height:12px!important}
body #top .powerchip{padding:2px 5px!important}
body #top .avbtn{width:30px!important;height:30px!important;flex:none}
body #top .avbtn canvas{width:26px!important;height:26px!important}
body #top .sysbadge{max-height:26px}
}
@media(max-width:760px){
body #commBar.collapsed{box-shadow:none!important;backdrop-filter:none!important;width:auto!important;min-width:0!important}
body #commBar.collapsed #cbHide{box-shadow:0 0 6px #000a}
body #mapTools #finder #finderBtn{width:34px!important;height:34px!important;min-height:34px!important;font-size:15px!important}
}
/* ===== телефон в горизонтальном положении ===== */
@media(max-height:500px) and (orientation:landscape){
:root{--tb:32px;--hb:30px;--detail:min(330px,42vw)}
body #top{height:32px!important;padding:0 6px!important;gap:6px!important}
body #top .sysbadge{font-size:10px!important;padding:2px 6px!important}
body #top .chip{padding:1px 6px!important;font-size:12px!important;gap:3px!important}
body #top .chip b{font-size:12px!important}body #top .chip small{font-size:9px!important}
body #top .chip svg{width:13px!important;height:13px!important}
body #top .avbtn{width:26px!important;height:26px!important}body #top .avbtn canvas{width:22px!important;height:22px!important}
body #econBar,body #chatFeed,body #fleetStrip,body #touchHint{display:none!important}
body #map{top:32px!important;height:calc(100% - 32px)!important}
body #side{top:32px!important;width:var(--detail)!important}
body #mapTools{left:4px!important;top:36px!important;gap:3px!important}
body #mapTools button,body #mapTools #finder #finderBtn{width:30px!important;height:30px!important;min-height:30px!important;font-size:13px!important}
:root body #commBar,:root body.map-expanded #commBar,body #commBar.collapsed{top:36px!important;left:auto!important;right:6px!important;width:auto!important;max-width:260px;height:auto!important;padding:3px!important;gap:3px!important;flex-direction:row!important;flex-wrap:wrap!important;justify-content:flex-end!important;overflow:visible!important;background:#0b1725e6!important;border:1px solid #2e4660;border-radius:10px;z-index:16}
body.bp-open #commBar,body:not(.map-expanded) #commBar{right:calc(var(--detail) + 8px)!important}
body #commBar.collapsed{background:transparent!important;border:0;padding:0!important;box-shadow:none!important}
body #commBar .cbtn{width:30px!important;height:30px!important;min-width:30px!important;min-height:30px!important;font-size:14px!important;padding:0!important}
body #quickDock,body.map-expanded #quickDock{left:4px!important;bottom:4px!important;gap:4px!important;padding:2px!important;height:auto!important;width:auto!important;max-width:calc(100vw - var(--detail) - 16px)!important;background:#0a1424cc;border-radius:12px}
body.map-expanded #quickDock{max-width:calc(100vw - 16px)!important}
body #quickDock .qd{width:34px!important}body #quickDock .qd .ic{width:32px!important;height:32px!important}
body #quickDock .qd .ic svg{width:17px!important;height:17px!important}body #quickDock .qd small{display:none!important}
body #quickDock .qd .lk{font-size:10px!important;top:-4px!important;right:0!important}
}
/* ===== карточка планеты (тап по планете) ===== */
.tgt-coords{display:flex!important;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px!important;border-radius:12px!important;background:linear-gradient(160deg,#0f2236,#0a1624)!important;border:1px solid #274560}
.tgt-coords .tc-l{display:flex;align-items:center;gap:8px;min-width:0;font-size:18px}.tgt-coords .tc-l>span{display:flex;flex-direction:column;line-height:1.2}.tgt-coords .tc-l small{font-size:10px;color:#8fb0c8;letter-spacing:.06em;text-transform:uppercase}.tgt-coords .tc-l b{font-size:15px;color:#e8f4ff;white-space:nowrap}
.tgt-coords .tc-b{display:flex;gap:6px;flex:none}.tgt-coords .tc-b button{min-height:34px!important;padding:4px 10px!important;font-size:12px!important;border-radius:9px;white-space:nowrap}
.tgt-acts{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:2px}.tgt-acts button{min-height:42px;border-radius:11px;font-size:14px;font-weight:600;background:linear-gradient(#1f3a54,#152b40);border:1px solid #33607f;color:#e8f4ff}
.tgt-note{font-size:11.5px;line-height:1.4;opacity:.8}
@media(max-width:760px){.tgt-coords{flex-wrap:wrap}.tgt-coords .tc-b{width:100%}.tgt-coords .tc-b button{flex:1}.tgt-body .tag{font-size:12px;padding:4px 9px}}
/* ===== альянс: герб ===== */
@media(max-width:760px){
.a-ed{display:flex!important;flex-direction:column;gap:8px!important}
.a-ed-l{position:static!important;display:flex;align-items:center;gap:10px;padding:6px 8px;background:#0b1226f5;border-radius:10px;border:1px solid #26305e}
.a-ed-l canvas{width:58px!important;height:70px!important;flex:none}.a-ed-l .dim{font-size:12px;text-align:left!important}
.a-ed .opts{display:grid!important;grid-template-columns:repeat(auto-fill,minmax(46px,1fr))!important;gap:6px!important}
.a-ed .opts button{padding:3px!important;min-height:0}.a-ed .opts canvas{width:100%!important;height:auto!important}
.a-ed .sw{display:flex!important;flex-wrap:wrap;gap:5px}.a-ed .sw i{width:26px!important;height:26px!important}
.a-ed .primary{position:sticky;bottom:0;z-index:3;min-height:46px;box-shadow:0 -10px 14px #0b1226}
.a-ed-r{padding-bottom:6px}
}
/* ===== подсказки/оповещения не лезут поверх окон и друг на друга (телефон) ===== */
@media(max-width:760px){
#poiHud{z-index:14!important;top:calc(var(--tb) + 8px)!important;max-width:calc(100vw - 100px)!important;font-size:12px!important;padding:6px 10px!important}
#poiHud *{font-size:12px!important}
#scoutHud{z-index:14!important;width:170px!important;font-size:11px!important;padding:7px!important;right:8px!important;bottom:178px!important}
}
@media(max-width:760px){body:has(#target.tp[style*="block"]) #chatFeed{display:none!important}}
/* audit fixes: overlaps with open panels */
@media(max-width:760px),(max-height:500px) and (orientation:landscape){
body.bp-open #ttResume,body.bp-open #poiHud,body.bp-open #scoutHud,body.bp-open #miniMap,body.bp-open #minimap{display:none!important}
body:has(#cityView.cv-compact) #poiHud{display:none!important}
}
body:has(.cwin.show) #ttResume,body:has(#techView[style*="block"]) #ttResume,body:has(#target[style*="block"]) #ttResume{display:none!important}
@media(max-width:760px),(max-height:500px) and (orientation:landscape){body:has(.cwin.show) #poiHud,body:has(.cwin.show) #scoutHud{display:none!important}}
@media(max-height:500px) and (orientation:landscape){
#poiHud{left:58px!important;transform:none!important;align-items:flex-start!important;max-width:calc(100vw - var(--detail) - 80px)!important;top:40px!important}
body #target.tp{left:58px!important;right:auto!important;width:min(300px,46vw)!important;bottom:48px!important;top:auto!important;max-height:calc(100vh - 100px)!important;overflow:auto!important}
}
@media(max-height:500px) and (orientation:landscape){
#poiHud{top:auto!important;bottom:50px!important}
body:has(#target[style*="block"]) #poiHud{display:none!important}
}
/* tablet: side panel must not run under commBar / dock */
@media(min-width:761px) and (max-width:1100px) and (min-height:600px){
body #side{top:100px!important;bottom:84px!important;z-index:12!important}
body #commBar{z-index:11!important}
}
@media(min-width:761px) and (max-width:1100px) and (min-height:600px){#chatWin{bottom:92px!important}}
@media(max-height:500px) and (orientation:landscape){
#chatWin{bottom:52px!important;left:58px!important;height:min(280px,calc(100vh - 100px))!important}
.sq-head,.sq-hd,#squadsWin header,#squadsView header{flex-wrap:wrap;gap:6px}
.sq-head button,.sq-hd button{padding:6px 8px;font-size:12px}
}
@media(max-width:760px){
#techView .tv-tree>div{zoom:.72}
#techView .tv-head{flex-wrap:wrap;gap:8px;padding:8px 10px}
#techView .tv-q{max-width:none;flex:1 1 100%;order:3}
#techView .tv-tabs button{padding:7px 12px}
}
