
.hq-shell .campaign-map-group{grid-area:map;min-width:0;min-height:0;display:flex;flex-direction:column;gap:5px}
#territories-open{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:7px;width:100%;min-height:30px;height:30px;margin:0;padding:3px 12px;border:1px solid #6e8b936b;border-radius:6px;background:linear-gradient(180deg,#2b4651,#18343f);box-shadow:inset 0 1px #c5d7d81a,0 2px 3px #0619234d;color:#e2e8d9;font:600 11px/1.2 system-ui;letter-spacing:.04em;cursor:pointer;position:relative}
#territories-open::after{content:'›';position:absolute;right:12px;color:#d8be82;font-size:18px;font-weight:400}
#territories-open svg{width:15px;height:15px;fill:none;stroke:#d8be82;stroke-width:1.5}
#territories-dialog{box-sizing:border-box;width:min(920px,94vw);max-width:94vw;max-height:90dvh;padding:0;border:1px solid #8da2a380;border-radius:13px;overflow:auto;color:#e7eee5;background:repeating-linear-gradient(104deg,#ffffff02 0 1px,transparent 1px 5px),radial-gradient(ellipse at 85% 0,#35556466,transparent 60%),linear-gradient(145deg,#1c3742,#102832 70%);box-shadow:inset 0 1px #d0e0d52b,inset 0 -2px #061d29b3,0 22px 70px #0009;scrollbar-width:thin;scrollbar-color:#536c73 #112b36}
#territories-dialog::backdrop{background:#071b27cf;backdrop-filter:blur(5px)}
.territories-header,.territories-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:13px 18px}
.territories-header{border-bottom:1px solid #7c95962b}
.territories-header h2{font:700 22px/1.15 system-ui;letter-spacing:-.025em;margin:3px 0;color:#f0f1e5}
.territories-header small{color:#d9bd80;font:600 10px/1.3 system-ui;letter-spacing:.08em}
.territories-header p{font:400 11px/1.4 system-ui;margin:4px 0 0;color:#aabec2}
.territories-header button{box-sizing:border-box;flex:0 0 32px;width:32px;height:32px;padding:0;border:1px solid #829aa075;border-radius:8px;background:linear-gradient(#2b4651,#1b333e);box-shadow:inset 0 1px #c5d4cd1c;color:#dce6de;font:400 23px/1 system-ui;cursor:pointer;position:relative}
.territories-header button::before{content:'';position:absolute;inset:-6px}
.territories-route,.territories-pins{position:absolute;inset:0}
.territories-route{background:linear-gradient(0deg,#061a2b30,transparent 60%);pointer-events:none}
.territories-route svg{width:100%;height:100%}
.territories-route polyline{fill:none;stroke:#f0d391b0;stroke-width:.28;stroke-dasharray:.5 1.4}
.territories-legend{display:flex;gap:12px;flex-wrap:wrap;padding:10px 18px 0;color:#a9bfc3;font:400 10px/1.4 system-ui}
.territories-legend span::before{content:'';display:inline-block;width:5px;height:5px;margin-right:5px;border:1px solid #bbd6ad;border-radius:2px;background:#68886655}
.territories-legend span:nth-child(2)::before{border-color:#d9b56f;background:#97703d77}
.territories-legend span:nth-child(3)::before{border-color:#79909b;background:#263e4b}
.territories-footer{margin-top:10px;border-top:1px solid #718d9638;background:linear-gradient(120deg,#223d47eb,#142e39f5);position:sticky;bottom:0;z-index:3;box-shadow:0 -5px 14px #0c243b33}
.territories-footer strong{min-width:0;font:600 12px/1.4 system-ui;color:#d5e0d7}
.territories-footer button{flex-shrink:0;max-width:50%;min-height:36px;padding:8px 14px;border:1px solid #d2ae68;border-bottom-color:#8f6c35;border-radius:6px;color:#fff0cb;background:linear-gradient(130deg,#b68232,#755324);box-shadow:inset 0 1px #ffe9a347,0 2px 0 #0a212b;font:600 12px/1.3 system-ui;cursor:pointer}
.territories-footer button:disabled{border-color:#657a7f;background:linear-gradient(#314851,#233c46);box-shadow:none;color:#8ea4ac;cursor:default}
#territories-open:focus-visible,#territories-dialog button:focus-visible{outline:2px solid #f4cf81;outline-offset:2px}
body.pointer-input #territories-dialog button:focus-visible{outline:none}
@media(max-width:700px){
/* Match the authored 4:3 map and its pin coordinates. Short screens scroll
   the HQ instead of cropping the world and leaving a large empty footer. */
.hq-screen .campaign-map-group{height:auto;display:grid;grid-template-rows:auto auto;gap:4px;align-self:start}
.hq-screen .campaign-map-group .campaign-map{width:100%;height:auto;min-height:0;max-height:none;aspect-ratio:4/3;align-self:start}
#territories-open{font-size:10px}
#territories-dialog{width:min(94vw,540px);max-height:90dvh;margin:auto;border-radius:11px}
.territories-header,.territories-footer{padding:11px 13px;gap:10px}
.territories-header h2{font-size:20px}
.territories-header small{font-size:9px}
.territories-header p{font-size:9px}
.territories-legend{padding:9px 13px 0;font-size:9px;gap:10px}
.territories-footer strong{font-size:11px}
.territories-footer button{font-size:11px;padding:7px 10px;min-height:35px}}
@media(max-width:350px){
.territories-header p{max-width:210px}
.territories-footer{gap:7px}
.territories-footer strong{font-size:10px}
.territories-footer button{padding:7px 8px;font-size:10px}}
.hq-shell .campaign-map-group>.campaign-map{grid-area:auto;min-width:0}
@media(max-width:700px){
.hq-screen .campaign-map-group{grid-template-columns:minmax(0,1fr)}
.hq-screen .campaign-map-group>.campaign-map{grid-area:1 / 1 / 2 / 2}
.hq-screen .campaign-map-group>#territories-open{grid-area:2 / 1 / 3 / 2}
}

/* Give the illustrated world more room on phones without stretching it. */
@media(max-width:700px){
 #territories-dialog{width:98vw;max-width:98vw;max-height:94dvh}
 #territories-dialog .world-overview{padding:8px 7px 0;gap:8px}
 #territories-dialog .territories-header,#territories-dialog .territories-footer{padding:9px 11px}
 #territories-dialog .world-scale{padding:7px 11px}
}

/* Region coordinates: external CSS for strict style-src-attr. */
#territories-pins .world-pin[data-region="1"]{left:18%;top:77%}
#territories-pins .world-pin[data-region="2"]{left:38%;top:70%}
#territories-pins .world-pin[data-region="3"]{left:56%;top:76%}
#territories-pins .world-pin[data-region="4"]{left:76%;top:65%}
#territories-pins .world-pin[data-region="5"]{left:73%;top:35%}
#territories-pins .world-pin[data-region="6"]{left:51%;top:25%}
#territories-pins .world-pin[data-region="7"]{left:35%;top:42%}
#territories-pins .world-pin[data-region="8"]{left:17%;top:49%}
