/* Keep the map primary and battle controls within thumb reach. */
body[data-screen=arena] .arena-tools{display:flex;align-items:center;gap:8px;padding:2px;overflow:visible}
body[data-screen=arena] .arena-tools .battle-menu-trigger{display:grid;place-items:center;width:42px;height:42px;min-width:42px;min-height:42px;padding:9px;border:1px solid #84b0b6;border-radius:11px;background:#143f50;color:#ffe6a1;box-shadow:none;animation:none;transform:none}
.battle-menu-trigger svg{width:20px;height:20px}.battle-menu-trigger:hover{background:#205369!important}
.arena-status{display:flex;align-items:center;gap:5px;font:700 10px var(--font);color:#e0eee1;text-shadow:0 1px 2px #153c4c}
.arena-status::before{content:'';width:5px;height:5px;border-radius:50%;background:#ffdc7d}
.battle-menu-actions{display:grid;gap:12px}.battle-menu-actions button{display:flex;align-items:center;justify-content:center;gap:9px;min-height:46px;box-shadow:none}
#spectator-panel{display:flex;align-items:center;justify-content:space-between;gap:14px}#spectator-panel[hidden]{display:none}#spectator-panel strong{display:block;font:800 16px var(--font)}#spectator-panel p{font-size:11px;margin:5px 0 0;color:#bfd5d6}#spectator-panel .primary{font-size:12px;min-height:44px;padding:10px 14px;white-space:nowrap}
.is-spectating .reserve-meter,.is-spectating #capacity-label,.is-spectating #land-detail,.is-spectating #cycle-label{visibility:hidden}
@media(max-width:700px){body[data-screen=arena] .arena-header{align-items:center!important;padding:0!important}body[data-screen=arena] .arena-header h1{font-size:19px!important;line-height:1.1}.arena-status{font-size:9px}#spectator-panel strong{font-size:13px}#spectator-panel p{font-size:10px}#spectator-panel .primary{padding:8px 11px}.battle-menu-actions{gap:13px}}
.standings-toggle{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;background:none;color:#d6e5de;padding:2px 0 9px;font:800 10px var(--font);text-align:left}
.standings-toggle span{transition:transform .15s}.empire-ranking:not(.collapsed) .standings-toggle span{transform:rotate(180deg)}
.empire-ranking:not(.expanded) .ranking-row:not(.rank-top):not(.is-you){display:none}
.empire-ranking .ranking-row.is-you{color:#ffe19a}
.empire-ranking .ranking-row.is-you .rank{color:#ffe19a}
.empire-ranking.expanded #standings{max-height:min(420px,55dvh);overflow:auto;overscroll-behavior:contain}
.game-hud>.battle-presence{grid-column:1/-1;display:flex;flex-direction:row;align-items:center;gap:13px;border-top:1px solid #6b919365;padding-top:5px;margin-top:-4px}
.game-hud>.battle-presence>span{font:500 10px var(--font);letter-spacing:0;white-space:nowrap}.battle-presence b{color:#f0edce;margin-left:3px}
.battle-details{margin-left:auto;pointer-events:auto;font:600 10px var(--font)}
.battle-details summary{cursor:pointer;list-style:none;padding:5px 0 5px 10px;min-height:26px;color:#ffdf9b}.battle-details summary::-webkit-details-marker{display:none}
.battle-details dl{position:absolute;top:calc(100% + 7px);right:0;width:205px;padding:12px;margin:0;background:#123b4ff5;border:1px solid #88acae;border-radius:10px;box-shadow:0 5px 14px #092b4b66;z-index:6}
.battle-details dl>div{display:flex;justify-content:space-between;gap:12px;line-height:1.4;padding:4px 0}.battle-details dt{color:#b9d0d1}.battle-details dd{margin:0;color:#fff0be}
.land-distribution{display:flex;align-items:center;gap:8px;border-top:1px solid #90b0af35;margin-top:4px;padding-top:8px;color:#d6e3d7;font:600 9px var(--font)}
.land-distribution>span small{display:block;color:#a8c5ca;font-size:8px;margin-top:3px}
#land-chart{width:42px;height:42px;flex:0 0 auto;border-radius:50%;border:1px solid #96b3ac;display:grid;place-items:center}
#land-chart-value{display:grid;place-items:center;width:28px;height:28px;background:#143e50;border-radius:50%;font-size:8px;color:#fff0bf}
#team-shares{padding-top:8px;font-size:9px}#team-shares[hidden]{display:none}#team-shares>div{display:flex;align-items:center;gap:5px;padding:3px 0}#team-shares i{width:7px;height:7px;border-radius:2px}#team-shares strong{margin-left:auto}
.battle-feed{position:absolute;z-index:3;bottom:24px;right:16px;width:240px;max-width:28vw;display:flex;flex-direction:column;align-items:flex-end;gap:5px;pointer-events:none}
.battle-event{margin:0;padding:6px 9px;border-radius:7px;background:#123a4de8;border-right:3px solid #85acb6;color:#e6eee2;font:600 10px/1.35 var(--font);box-shadow:0 2px 8px #102e3b33;animation:battleNotice .18s ease-out both;text-align:right}
.battle-event.danger{color:#ffbcab;border-color:#ef8e72}.battle-event.victory{color:#ffdf85;border-color:#e9c16d}
.is-deploying .battle-feed{display:none}
@keyframes battleNotice{from{opacity:0;translate:5px 0}to{opacity:1;translate:0 0}}
sg-globe{position:relative;touch-action:manipulation}
sg-globe::after{content:'';position:absolute;inset:2px;border-radius:50%;box-shadow:0 0 8px 3px #fff3b1,0 0 20px 6px #ffd25f88;opacity:0;pointer-events:none;transition:opacity .35s}
sg-globe[data-conquest=victory]::after{opacity:1}
@media(max-width:900px){
 .empire-ranking{display:block;top:calc(157px + var(--app-safe-top, env(safe-area-inset-top)));left:10px;right:auto;width:156px;padding:5px 9px;border-radius:10px;background:#123a4de8}
 .standings-toggle{min-height:32px;padding:3px 0;font-size:10px}
 .empire-ranking .ranking-row{min-height:26px;padding:5px 0;gap:5px;font-size:10px}
 .empire-ranking .ranking-row small{display:none}.empire-ranking .ranking-row>strong{font-size:10px}
 .empire-ranking .ranking-row .rank{width:13px;font-size:9px}
 .empire-ranking.expanded #standings{max-height:calc(var(--app-height,100dvh) - 360px - var(--app-safe-top, env(safe-area-inset-top)) - var(--app-safe-bottom, env(safe-area-inset-bottom)))}
}
@media(max-width:700px) and (orientation:portrait){
 body[data-screen=arena] .arena-header{top:calc(6px + var(--app-safe-top, env(safe-area-inset-top)));left:8px;right:8px;gap:8px;align-items:center;margin:0}
 body[data-screen=arena] .arena-header h1{font-size:18px;margin:0;max-width:130px;line-height:1.05}
 body[data-screen=arena] .arena-header p{font-size:7px;margin-top:3px}
 .arena-header .arena-tools{flex-wrap:nowrap;max-width:none;gap:6px}
 body[data-screen=arena] .arena-header .arena-tools button{min-height:36px;font-size:10px;padding:6px 8px}
 .arena-header [data-action=fullscreen]{display:none}
 body[data-screen=arena] .game-hud{top:calc(50px + var(--app-safe-top, env(safe-area-inset-top)));left:8px;right:8px;width:auto;transform:none;grid-template-columns:1.35fr 1fr .85fr;gap:5px 9px;padding:7px 10px;border-radius:10px;border-bottom-width:2px;background:#123d4ef5}
 body[data-screen=arena] .game-hud strong{font-size:22px;text-shadow:none;line-height:1.05}
 .game-hud>div{gap:1px}.game-hud>div>span{font-size:7px;letter-spacing:.5px}
 .game-hud small{font-size:8px;line-height:1.1}
 .game-hud>.game-pot{padding-bottom:5px;margin:0;gap:8px}
 .game-hud>.game-pot>span{font-size:8px}.game-hud>.game-pot strong{font-size:13px!important}.game-hud>.game-pot small{font-size:8px}
 .game-hud #capacity-label,.game-hud #land-detail,.game-hud #cycle-label{display:none}
 .reserve-meter{height:3px;margin:3px 0 2px}
 .game-hud>.battle-presence{gap:12px;padding-top:2px;margin-top:0}.game-hud>.battle-presence>span{font-size:9px}
 .empire-ranking{top:calc(171px + var(--app-safe-top, env(safe-area-inset-top)));width:145px;padding:3px 8px 7px}
 .empire-ranking.expanded #standings{max-height:calc(var(--app-height,100dvh) - 440px - var(--app-safe-top, env(safe-area-inset-top)) - var(--app-safe-bottom, env(safe-area-inset-bottom)));min-height:90px}
 .empire-ranking.expanded .ranking-row small{display:block;font-size:8px}
 .land-distribution{padding-top:6px;margin-top:2px;font-size:8px;gap:6px}#land-chart{width:32px;height:32px}#land-chart-value{width:22px;height:22px;font-size:7px}.land-distribution>span small{font-size:7px}
 body[data-screen=arena] .map-help{top:calc(171px + var(--app-safe-top, env(safe-area-inset-top)));left:auto;right:8px;transform:none;max-width:calc(100% - 170px);font-size:9px;line-height:1.3;padding:5px 7px;text-align:right}
 body[data-screen=arena] .arena-side.frontier-command{left:8px!important;right:8px!important;width:auto;transform:none;bottom:calc(6px + var(--app-safe-bottom, env(safe-area-inset-bottom)))!important;padding:8px 10px!important;border-radius:12px;border-bottom-width:3px;max-height:none}
 body[data-screen=arena] .frontier-command .battle-actions-row{gap:8px;margin-bottom:5px}
 body[data-screen=arena] .frontier-command .neighbor-choices{margin:0;padding-bottom:3px;gap:7px}
 .frontier-command .neighbor-choices button,.frontier-command .sea-toggle{min-height:34px;font-size:10px;padding:5px 9px}
 body[data-screen=arena] .frontier-command .target-box{grid-template-columns:minmax(0,1fr) 85px;gap:4px 10px}
 body[data-screen=arena] .frontier-command .target-choice{grid-column:1;grid-row:1}
 .frontier-command .command-eyebrow{display:none}
 .frontier-command #target-name{font-size:17px;line-height:1.1}
 body[data-screen=arena] .frontier-command #target-info{font-size:9px;line-height:1.2;margin:3px 0 0}
 body[data-screen=arena] .frontier-command .power-control{grid-column:1;grid-row:2}
 body[data-screen=arena] .frontier-command .power-control label{font-size:10px}
 body[data-screen=arena] .frontier-command input[type=range]{height:32px;margin:0;touch-action:pan-x}
 .frontier-command .power-presets{gap:7px}.frontier-command .power-presets button{min-height:32px;padding:4px;font-size:10px}
 body[data-screen=arena] .frontier-command #attack-button{grid-column:2;grid-row:1/3;height:100%;min-height:78px;font-size:18px;flex-direction:column;gap:5px;padding:7px!important;border-radius:9px;box-shadow:0 3px 0 #a06d25}
 body[data-screen=arena] .frontier-command .battle-log{margin:6px 0 0;font-size:9px;min-height:12px}
 .frontier-command #active-orders{max-height:42px;margin-top:6px;gap:7px}
 .frontier-command .advance-chip{padding:3px 7px;gap:8px;min-width:160px}.frontier-command .advance-chip button{min-height:32px}
 body[data-screen=arena] .map-zoom{left:auto;right:8px;bottom:calc(var(--command-height,220px) + 17px + var(--app-safe-bottom, env(safe-area-inset-bottom)));gap:6px}
 body[data-screen=arena] .map-zoom button{width:38px;height:38px;min-height:38px;min-width:38px}
 body[data-screen=arena] .is-deploying .map-zoom{bottom:calc(125px + var(--app-safe-bottom, env(safe-area-inset-bottom)))}
 #deployment-panel{gap:12px}#deployment-panel h2{font-size:19px}#deployment-panel p{font-size:10px}
 #deploy-button{min-width:95px;min-height:46px;font-size:18px}
 .battle-feed{right:54px;bottom:calc(var(--command-height,220px) + 17px + var(--app-safe-bottom, env(safe-area-inset-bottom)));width:215px;max-width:calc(100% - 72px);gap:4px}.battle-event{font-size:9px;padding:4px 7px}.battle-event:nth-last-child(n+3){display:none}
 .guided-coach{top:auto;bottom:calc(var(--command-height,220px) + 18px + var(--app-safe-bottom, env(safe-area-inset-bottom)));left:8px;right:54px;font-size:10px}
 .guided-coach p{font-size:10px;line-height:1.4}.guided-coach h2{font-size:18px}
 .guided-game .is-deploying .guided-coach{top:118px;bottom:auto}
}
@media(max-width:900px) and (orientation:landscape){
 .empire-ranking{top:120px;left:8px;width:140px}.empire-ranking.expanded #standings{max-height:calc(var(--app-height,100dvh) - 175px)}
}
@media(prefers-reduced-motion:reduce){sg-globe::after,.standings-toggle span{transition:none}}

/* Phone command deck: a single compact status strip, with details on demand. */
@media(max-width:900px){
 body[data-screen=arena] .game-hud{top:calc(48px + var(--app-safe-top, env(safe-area-inset-top)));grid-template-columns:1fr auto;grid-template-rows:auto auto;gap:5px 14px;padding:8px 11px 4px;border:1px solid #7fa5ac;border-radius:9px;background:#133e50;box-shadow:0 2px 0 #092b3b}
 .game-hud>.balance-stat{grid-column:1;grid-row:1;display:grid;grid-template-columns:auto 1fr;gap:2px 7px;align-items:baseline}
 .game-hud>.balance-stat>span{grid-column:1/-1;font-size:7px;letter-spacing:1px}
 body[data-screen=arena] .game-hud #troop-count{font:900 23px/1 var(--font);letter-spacing:-.5px}
 .game-hud .reserve-meter{grid-column:1/-1;grid-row:3;height:2px;margin:3px 0 0;max-width:160px}
 .game-hud #income-label{font-size:8px;overflow:hidden;text-overflow:ellipsis;min-width:0;max-width:112px;grid-column:2;grid-row:2}
 .game-hud>.game-pot{grid-column:2;grid-row:1;display:flex;flex-direction:column;align-items:flex-end;justify-content:center;gap:3px;padding:0;margin:0;border:0}
 .game-hud>.game-pot>span{font-size:7px;letter-spacing:1px}.game-hud>.game-pot strong{font-size:14px!important}.game-hud #game-prize-note,.game-hud #capacity-label{display:none}
 .game-hud>div:nth-child(3),.game-hud>div:nth-child(4){display:none}
 .game-hud>.battle-presence{grid-row:2;margin:0;padding:1px 0 0;gap:12px;border-color:#698e9850}
 .game-hud>.battle-presence>span{font-size:9px}.battle-details summary{min-height:25px;padding:4px 0 4px 12px}
 .empire-ranking{top:calc(143px + var(--app-safe-top, env(safe-area-inset-top)));width:137px;left:8px;padding:2px 8px 5px;border-radius:8px;border-color:#71989e80;background:#133e50}
 .standings-toggle{min-height:27px;font-size:9px;letter-spacing:.2px}
 .empire-ranking .ranking-row{min-height:23px;font-size:9px;padding:4px 0;gap:5px}.empire-ranking .ranking-row>strong{font-size:9px}
 .empire-ranking:not(.expanded) .land-distribution{display:none}
 .empire-ranking.expanded{width:190px}.empire-ranking.expanded #standings{min-height:0;max-height:max(60px,calc(var(--app-height,100dvh) - var(--command-height,220px) - 238px - var(--app-safe-top, env(safe-area-inset-top)) - var(--app-safe-bottom, env(safe-area-inset-bottom))))}
 body[data-screen=arena] .map-help{display:none;top:calc(143px + var(--app-safe-top, env(safe-area-inset-top)))}.map-help[data-important=true]{display:block!important}
 body[data-screen=arena] .arena-side.frontier-command{padding:7px 9px 9px!important;border:1px solid #7fa5ac;border-radius:10px;background:#133e50;box-shadow:0 2px 0 #082b3b}
 body[data-screen=arena] .frontier-command .target-box{grid-template-columns:minmax(0,1fr) 83px;gap:3px 9px}
 body[data-screen=arena] .frontier-command .target-choice{grid-column:1/-1;display:flex;gap:8px;align-items:center}
 .frontier-command #target-name{font:800 12px/1.2 var(--font);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body[data-screen=arena] .frontier-command #target-info{font-size:8px;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 body[data-screen=arena] .frontier-command #attack-button{grid-column:2;grid-row:2;flex-direction:row;min-height:68px;height:100%;font:800 14px var(--font);padding:6px!important;gap:4px;border-radius:7px;box-shadow:0 2px 0 #a47734}
 body[data-screen=arena] .frontier-command #attack-button svg{display:none}
 .frontier-command .neighbor-choices button,.frontier-command .sea-toggle{min-height:32px;border-radius:6px;font-size:9px;padding:5px 9px;box-shadow:none}
 .frontier-command .power-presets button{min-height:30px;font-size:9px}
 body[data-screen=arena] .frontier-command .battle-log{display:none}
 body[data-screen=arena] .map-zoom button{width:36px;height:36px;min-width:36px;min-height:36px;border-radius:7px;font-size:19px;box-shadow:0 2px 0 #0b3445}
}

@media(max-width:900px) and (orientation:landscape){
 body[data-screen=arena] .game-hud{top:8px;left:158px;right:auto;width:280px;transform:none}
 .empire-ranking{top:105px;left:8px}
 body[data-screen=arena] .arena-side.frontier-command{top:auto!important;height:auto!important;bottom:10px}
 body[data-screen=arena] .frontier-command .target-box{display:grid;padding:0;margin:0}
 .frontier-command .command-eyebrow{display:none}
 body[data-screen=arena] .frontier-command .power-control{grid-row:2;grid-column:1}
 .frontier-command .power-control label{font-size:9px;gap:4px;flex-wrap:wrap}
 body[data-screen=arena] .frontier-command .power-presets{display:flex;gap:4px}
 .frontier-command .power-presets button{min-height:28px;min-width:0;padding:4px;font-size:8px}
 body[data-screen=arena] .frontier-command input[type=range]{height:30px;margin:0}
 body[data-screen=arena] .frontier-command #attack-button{min-height:60px;font-size:12px}
 .frontier-command #active-orders{max-height:45px;overflow:auto;margin-top:6px}
 .frontier-command .advance-chip{font-size:9px;padding:3px 6px;min-width:0}.advance-chip button{min-height:28px}
 .battle-feed{right:264px;bottom:62px;max-width:200px}.battle-event{font-size:9px}
}
/* A visible deployment clock, independent of the hidden combat log. */
body[data-screen=arena] .is-deploying .deployment-heading{top:76px;left:50%;width:max-content;max-width:calc(100% - 32px);min-width:0;transform:translateX(-50%);padding:12px 20px;border:1px solid #9db6ab;border-radius:12px;background:#123d4ef2;animation:none;text-align:center;box-shadow:0 3px 0 #082b3b}
.deployment-heading #deployment-stage{display:block;font:800 9px var(--font);letter-spacing:1.4px;color:#c0d6d4;padding:0;background:none}
.deployment-heading #deployment-countdown{font:800 23px/1.2 var(--font);letter-spacing:-.4px;color:#ffe29b;text-shadow:none;margin:4px 0;font-variant-numeric:tabular-nums}
.deployment-heading #deployment-ready-count{display:block;font:600 11px var(--font);color:#c3d8d9;margin:5px 0 0;text-shadow:none}
.deployment-heading #deployment-ready-count:empty{display:none}
body[data-screen=arena] .is-deploying .frontier-command{max-width:620px;width:calc(100% - 24px);left:50%!important;right:auto!important;transform:translateX(-50%);padding:14px 18px!important;overflow:visible}
body[data-screen=arena] #deployment-panel{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:14px;min-height:58px}
body[data-screen=arena] #deployment-panel[hidden]{display:none}
#deployment-panel #deployment-title{font:800 18px/1.2 var(--font);margin:0 0 5px;text-shadow:none}
#deployment-panel #deployment-hint{font:11px/1.45 var(--font);max-width:340px;margin:0;color:#c3d7d9}
#deployment-panel #deploy-button{min-height:44px;font:800 12px var(--font);padding:10px 16px;white-space:nowrap;gap:5px}
@media(max-width:700px){body[data-screen=arena] .is-deploying .deployment-heading{top:calc(57px + var(--app-safe-top, env(safe-area-inset-top)));padding:9px 17px}.deployment-heading #deployment-countdown{font-size:20px}.deployment-heading #deployment-ready-count{font-size:10px}body[data-screen=arena] .is-deploying .frontier-command{padding:11px!important;width:calc(100% - 16px)}#deployment-panel #deployment-title{font-size:14px}#deployment-panel #deployment-hint{font-size:10px}#deployment-panel #deploy-button{padding:9px 12px;font-size:11px}body[data-screen=arena] #deployment-panel{gap:10px;min-height:48px}}
@media(max-width:900px) and (orientation:landscape){body[data-screen=arena] .is-deploying .deployment-heading{top:8px;left:50%;padding:7px 14px}.deployment-heading #deployment-stage{display:none}.deployment-heading #deployment-countdown{font-size:18px}.deployment-heading #deployment-ready-count{font-size:9px;margin-top:2px}body[data-screen=arena] .is-deploying .frontier-command{bottom:8px!important;max-width:520px}}
body[data-screen=arena] .frontier-command[hidden]{display:none!important}
body[data-screen=arena] .is-deploying .frontier-command{width:calc(100% - 24px)!important;max-width:620px!important}
body[data-screen=arena] .is-deploying .map-help{display:none!important}
@media(max-width:700px){body[data-screen=arena] .is-deploying .frontier-command{left:8px!important;right:8px!important;width:auto!important;max-width:none!important;transform:none!important}}
.standings-header{display:flex;align-items:center;gap:4px}
.standings-header .standings-toggle{flex:1;min-width:0;min-height:32px;padding:3px 0;box-shadow:none;transform:none;animation:none}
.empire-ranking .standings-close{flex:none;display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:6px;background:transparent;color:#d6e5de;font:500 22px/1 var(--font);box-shadow:none;transform:none;animation:none}
.empire-ranking .standings-close:hover,.empire-ranking .standings-expand:hover{background:#315c6c;color:#fff0be}
.empire-ranking .standings-expand{width:100%;min-height:30px;margin-top:4px;padding:5px 8px;border:1px solid #71989e65;border-radius:6px;background:#214e60;color:#e5eee4;font:700 10px var(--font);box-shadow:none;transform:none;animation:none}
.empire-ranking [hidden]{display:none!important}
.empire-ranking.collapsed{width:132px!important;padding:2px 9px!important}
.empire-ranking.collapsed .standings-toggle{font-size:10px}
@media(max-width:700px){.standings-header .standings-toggle{font-size:9px}.empire-ranking:not(.expanded):not(.collapsed){width:150px}.empire-ranking.collapsed{width:126px!important}}
