.alliance-relay-hub {
 display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);align-items:center;
 gap:clamp(12px,2.5cqw,32px);min-height:85%;padding:clamp(8px,1.5cqw,20px) 0;
}
.alliance-relay-overview,.alliance-relay-section {
 min-width:0;padding:clamp(10px,1.4cqw,18px);
 border:1px solid #648ba2ad;border-radius:8px;background:#081d2cce;
}
.alliance-relay-overview h2,.alliance-relay-section h2{margin:0 0 10px}
.alliance-relay-overview .client-benefit{font-size:clamp(16px,1.8cqw,22px)}
.alliance-relay-overview > button{margin-top:10px;padding:7px 12px}
.alliance-relay-links {
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;
}
.alliance-relay-links button {
 display:flex;align-items:center;gap:8px;min-width:0;min-height:54px;
 padding:7px;text-align:left;font-size:clamp(15px,1.75cqw,21px);
}
.alliance-relay-hub .alliance-relay-links button > span {font-size:22px;line-height:1.15}
.alliance-relay-links .source-icon{width:1.5em;height:1.5em;flex:none}

/* Building cards retain the fixed stage and pin their actions outside both scroll areas. */
.building-main#overlay{padding:100px 20px 14px}
.building-main #panel{height:100%;max-height:100%;overflow:hidden}
.building-main #panelBody{display:flex;flex-direction:column;min-height:0;overflow:hidden}
.client-native-building {
 display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);
 gap:23px;width:100%;height:100%;min-height:0;flex:1;
}
.client-native-left,.client-native-right {
 display:flex;flex-direction:column;gap:8px;min-width:0;min-height:0;
}
.client-native-name{display:none}
.client-native-upgrade,.client-native-right {
 min-height:0;padding:clamp(8px,1.25cqw,16px);
 border:1px solid #8eb6c24d;border-radius:8px;
}
.client-native-upgrade {
 display:flex;flex-direction:column;gap:8px;flex:1;
 background:linear-gradient(160deg,#081b2cdb,#081b2c80 72%,#081b2c8c);
}
.client-native-right{background:#0a1f32e8;border-color:#345974}
.client-native-next {
 display:flex;flex:none;align-items:center;justify-content:space-between;
 gap:8px;min-height:46px;padding:4px 8px;
 border:1px solid #3e7293;border-radius:5px;
 background:linear-gradient(90deg,#174d70db,#0a2339dc);
}
.client-native-next h2,.client-native-right>h2 {
 margin:0;color:#d3e9fa;font-size:clamp(17px,1.9cqw,24px);font-weight:600;line-height:1.15;
}
.client-native-right>h2{flex:none}
.client-native-next .client-level-change{flex:none;gap:6px;margin:0;padding:0;white-space:nowrap}
.client-native-next .client-level-change b{width:30px;height:30px;font-size:18px}
.client-native-next .client-level-change>span{color:var(--positive)}

.client-native-stats,.client-native-requirements {
 flex:1;min-width:0;min-height:0;overflow:auto;
 scrollbar-gutter:stable;overscroll-behavior:contain;touch-action:pan-y;
}
.client-native-benefits {
 width:100%;border-collapse:collapse;
 font-size:clamp(16px,1.5cqw,19px);font-variant-numeric:tabular-nums;line-height:1.2;
}
.client-native-benefits :is(th,td) {
 padding:clamp(4px,.55cqw,8px);border-bottom:1px solid #537c9159;
 text-align:right;white-space:nowrap;overflow-wrap:normal;word-break:normal;
}
.client-native-benefits th:first-child{text-align:left}
.client-native-benefits thead{background:#123046bc;color:#c1e2f4}
.client-native-benefits tbody tr{background:#0b263b70}
.client-native-benefits tbody th{white-space:normal;color:#d8e9f5;font-weight:600}
.client-native-benefits tbody td:nth-child(n+3){color:#a5f4cf}
.client-native-description {
 margin:8px 0 0;color:#d3e5f0;font-size:clamp(15px,1.4cqw,19px);
 line-height:1.3;overflow-wrap:normal;
}
.client-native-unlocks {
 display:flex;flex-wrap:wrap;gap:4px;
}
.client-native-unlocks:not(:empty) {
 margin-top:6px;padding:3px;border:1px solid #2aa76d;border-radius:4px;background:#02432180;
}
.client-native-unlocks .client-unlock {
 display:flex;align-items:center;gap:6px;
 min-width:44px;min-height:44px;padding:4px;background:none;text-align:left;
}
.client-native-unlocks .client-unlock img{width:32px;height:32px;margin:0;flex:none}

.client-native-tools {
 display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);
 grid-auto-rows:1fr;gap:4px;flex:none;
}
.client-native-tools:has(> :nth-child(5)) {
 grid-auto-flow:row;grid-template-columns:repeat(3,minmax(0,1fr));
}
#gameSurface #panel .client-native-tools > .client-menu-button {
 display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
 min-width:0;min-height:62px;width:auto;height:auto;
 padding:4px clamp(5px,.65cqw,10px);font-size:clamp(11px,1.3cqw,16px);
 line-height:1.12;text-align:center;
}
.client-native-tools > .client-menu-button > img {
 width:clamp(22px,2.4cqw,30px);height:clamp(22px,2.4cqw,30px);margin:0;flex-shrink:0;
}
.client-native-tools > .client-menu-button > span {
 min-width:0;max-width:100%;overflow-wrap:anywhere;white-space:normal;flex-shrink:0;
}
.client-native-resource {
 display:grid;grid-template-columns:28px minmax(0,1fr) 44px 15px;
 gap:6px;align-items:center;min-height:48px;padding:0 5px;
 background:#011629ca;border-bottom:1px solid #16415f;
}
.client-native-resource>img{width:28px;height:28px;object-fit:contain}
.client-native-resource>div{font-size:clamp(16px,1.5cqw,20px);font-variant-numeric:tabular-nums}
.client-native-resource small{font-size:.95em;font-weight:700;color:#8cb9d9}
.client-native-resource>div>span{color:#7da4bf}
.client-native-resource .client-resource-add{width:44px;height:44px;padding:0;font-size:20px}
.client-native-resource>[data-requirement-mark]{font-size:16px;font-weight:700}
.client-native-resource.met>[data-requirement-mark]{color:#65e2a5}
.client-native-resource.missing>[data-requirement-mark]{color:#ffaead}

.client-building-prereqs{display:flex;flex-direction:column;gap:4px;margin-top:8px}
.client-building-prereqs h3{margin:0;font-size:16px;color:#ffd297}
#buildingPrerequisiteList{display:grid;gap:4px;padding:2px}
#buildingPrerequisiteList button {
 display:flex;justify-content:space-between;align-items:center;gap:6px;
 padding:5px 8px;min-width:0;min-height:40px;
 text-align:left;font-size:16px;line-height:1.15;white-space:normal;overflow-wrap:normal;
}
#buildingPrerequisiteList b{flex:none;color:#ffd297;white-space:nowrap}
.client-native-blockers{display:grid;gap:4px;margin-top:4px}
.client-native-blockers .client-building-blocker{margin:0;padding:3px 5px;font-size:14px}
.client-native-blockers .client-building-blocker>span{min-width:0}
.client-native-blockers .back-link{margin:0;padding:4px}

.client-native-bottom{display:flex;gap:8px;flex:none}
.client-native-process {
 flex:1;min-width:0;padding:6px;display:grid;grid-template-columns:minmax(0,1fr) auto;
 gap:4px;align-items:center;background:#06223ce3;
}
.client-native-process h3{font-size:14px;margin:0;color:#a6e6be;line-height:1.15}
.client-native-process>b{font-size:18px;color:#dceef9;font-variant-numeric:tabular-nums}
.client-native-process .bar{grid-column:1/-1;height:4px;margin:0;background:#01101e}
.client-native-process .bar>div{height:100%;background:#58b676}
.client-native-actions {
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));flex:1;min-width:0;
 margin:0;padding:4px;gap:6px;background:#022447d9;border:1px solid #1c5a87;border-radius:4px;
}
.client-native-actions>button {
 display:flex;flex-direction:column;justify-content:center;align-items:center;
 min-height:52px;min-width:0;padding:4px;gap:2px;
 font-size:clamp(14px,1.35cqw,19px);line-height:1.15;overflow-wrap:normal;
}
.client-native-actions small{display:flex;align-items:center;gap:4px;font-size:.9em;white-space:nowrap}
.client-native-actions img{width:16px;height:16px;object-fit:contain}
.client-native-actions .auto-speedup{font-size:clamp(11px,1.25cqw,16px);grid-column:1/-1}
@container game-frame (max-height:450px) {
 .building-main#overlay{padding:70px 8px 6px;background:#03162cf2}
 .building-main .close{top:10px;left:8px;width:44px;height:44px}
 .client-native-base-return{top:10px;right:8px;width:70px;height:44px;font-size:13px}
 .client-native-building{gap:10px}
 .client-native-resource{min-height:44px}
 #gameSurface #panel .client-native-tools > .client-menu-button,.client-native-actions>button{min-height:44px}
}

/* Production retains fixed tabs and an order pane, with scroll inside the catalogue. */
.production-screen#overlay{padding:70px 8px 6px}
.production-screen #panel{height:100%;max-height:100%;width:min(1440px,100%);display:flex;flex-direction:column;overflow:hidden}
.production-screen .panel-head{position:static;flex:none;min-height:48px;padding:2px 12px}
.production-screen .panel-head h1{font-size:16px}
.production-screen .panel-head .close{height:44px;width:44px}
.production-screen #panelBody{padding:6px;flex:1;min-height:0;overflow:hidden}
.production-screen .client-production-layout{grid-template-columns:minmax(0,.25fr) minmax(0,.38fr) minmax(0,.37fr);gap:8px;height:100%;margin:0;min-height:0}
.production-screen .client-unit-list,.production-screen .client-unit-details,.production-screen .client-production-action-pane{display:flex;flex-direction:column;min-width:0;min-height:0;gap:4px}
.production-screen .client-unit-list>.back-link{flex:none;min-height:44px;padding:4px;margin:0;font-size:11px}
.production-screen #panelBody .client-tabs{flex:none;margin:0;gap:3px;display:flex}
.production-screen #panelBody .client-tabs button{min-height:44px;flex:1;min-width:0;padding:3px;font-size:11px}
.production-screen .client-unit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:auto;min-height:0;gap:4px;padding:0;scrollbar-gutter:stable;overscroll-behavior:contain}
.production-screen .client-unit-choice{min-height:80px;min-width:0;max-width:none;padding:4px;font-size:10px}
.production-screen .client-unit-choice img,.source-skin .production-screen .client-unit-choice>img{width:44px;height:44px}
.production-screen .client-unit-heading{grid-template-columns:50px minmax(0,1fr);gap:4px;flex:none}
.production-screen .client-unit-heading>img,.source-skin .production-screen .client-unit-heading>.source-unit-art{width:50px;height:50px}
.production-screen .client-unit-heading h2{font-size:14px;margin:0}
.production-screen .client-unit-heading p{display:none}
.production-screen .client-unit-heading .stat{margin:2px 0;font-size:10px}
.production-screen .client-unit-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;flex:none;margin:0}
.production-screen .client-unit-stats>div{padding:3px;min-width:0}
.production-screen .client-unit-stats small{font-size:9px}
.production-screen .client-unit-stats b{font-size:12px}
.production-screen .client-info-tabs{display:flex;flex:none;gap:2px;margin:0}
.source-skin .production-screen #panelBody .client-info-tabs button{min-height:44px;padding:2px;flex:1;font-size:9px;gap:2px;min-width:0}
.production-screen .client-info-tabs img{display:none}
.production-screen .client-unit-information{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain}
.production-screen .client-unit-bonuses{font-size:10px}
.production-screen .client-unit-bonuses td,.production-screen .client-unit-bonuses th{padding:4px}
.production-screen .client-balance-note{display:none}
.production-screen .client-production-order{display:flex;flex-direction:column;flex:1;min-height:0;gap:4px;margin:0;padding:4px}
.production-screen .client-production-order>h3{display:none}
.production-screen .client-order-capacity{margin:0;padding:0;font-size:10px;flex:none;min-height:18px}
.production-screen .client-order-capacity img{display:none}
.production-screen .client-order-selector{gap:3px;flex:none}
.production-screen .client-order-selector>button{width:44px;height:44px;flex:none}
.production-screen .item-quantity{min-width:0;padding:0;gap:2px}
.production-screen .item-quantity label{font-size:10px}
.production-screen .item-quantity input{width:100%;min-width:0;height:44px}
.production-screen .field-error:empty{display:none}
.production-screen #production-range{min-height:20px;width:100%;margin:0;flex:none}
.production-screen #productionQuote{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain}
.production-screen .quote-status{min-height:16px;font-size:10px;line-height:1.2;margin:0}
.production-screen .client-resource-requirements{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px;margin:0}
.production-screen .client-resource-requirements>div{display:grid;grid-template-columns:minmax(0,1fr) 20px;gap:1px;padding:2px;min-height:44px;font-size:10px}
.production-screen .client-resource-requirements img{width:16px;height:16px}
.production-screen .client-resource-requirements small,.production-screen .client-resource-requirements>[data-cost-index]>span{display:none}
.production-screen .client-resource-requirements .client-resource-add{grid-column:2;grid-row:1/3;min-height:44px;width:44px;justify-self:end}
.production-screen #productionQuote .client-benefit{padding:2px;margin:0;font-size:10px;min-height:18px}
.production-screen #productionCommit{min-height:44px;flex:none;padding:4px;font-size:12px}
.production-screen .client-locked-requirements,.production-screen .client-process-state{overflow:auto;min-height:0;flex:1;padding:6px;font-size:11px}
.production-screen .defense-placement{margin:0;padding:3px;font-size:10px;flex:none}
@container game-frame (min-height:451px){
 .production-screen#overlay{padding-top:100px}
 .production-screen .client-unit-choice{min-height:110px;font-size:12px}
 .production-screen .client-unit-heading h2{font-size:18px}
 .production-screen .client-unit-heading>img,.source-skin .production-screen .client-unit-heading>.source-unit-art{width:70px;height:70px}
 .production-screen .client-unit-heading{grid-template-columns:70px 1fr}
 .production-screen .client-unit-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* The science viewport owns tree/list scrolling, while its heading remains fixed. */
.research-screen#overlay:has(.research-heading){padding:70px 8px 6px}
.research-screen:has(.research-heading) #panel{height:100%;max-height:100%;display:flex;flex-direction:column;overflow:hidden;width:min(1440px,100%)}
.research-screen:has(.research-heading) .panel-head{position:static;flex:none;min-height:48px;padding:2px 12px}
.research-screen:has(.research-heading) .panel-head .close{width:44px;height:44px}
.research-screen:has(.research-heading) #panelBody{padding:4px 8px;display:flex;flex-direction:column;min-height:0;flex:1;overflow:hidden;gap:3px}
.research-screen .research-heading{flex:none;flex-wrap:nowrap;gap:4px;margin:0;min-height:44px}
.research-screen .research-heading .back-link{font-size:11px;padding:4px;min-width:0}
.research-screen .research-view-switch{flex-wrap:nowrap;gap:3px}
.research-screen .research-view-switch button{font-size:10px;padding:3px;min-height:44px}
.research-screen .research-progress{flex:none;min-height:24px;font-size:11px;margin:0;padding:2px 6px}
.research-screen .research-controls{flex:none;min-height:44px;font-size:11px;margin:0}
.research-screen .research-controls[open]{max-height:132px;overflow:auto;overscroll-behavior:contain}
.research-screen .research-tools{margin:0;gap:4px;flex-wrap:nowrap}
.research-screen .research-tools input{height:44px}
.research-screen .research-filters{flex-wrap:nowrap;overflow:auto;margin:0}
.research-screen .research-filters button{flex:none}
.research-screen .research-controls .research-source-note{margin:0}
.research-screen .research-viewport{height:auto;min-height:0;flex:1;scrollbar-gutter:stable}
.research-screen .research-list,.research-screen #panelBody>.cards{overflow:auto;min-height:0;flex:1;overscroll-behavior:contain}
.research-screen .research-caption{display:none}
@container game-frame (min-height:451px){.research-screen#overlay:has(.research-heading){padding-top:100px}}
.production-screen .defense-placement .client-benefit{min-height:0;margin:0;padding:2px;display:block;font-size:10px}
.production-screen .defense-placement .client-benefit b{display:block}
.production-screen .defense-placement p{font-size:10px;line-height:1.1;margin:2px 0}
.production-screen .client-production-order>.client-green{margin-top:0}
.production-screen#overlay{padding-top:64px;padding-bottom:4px}
.production-screen .panel-head{min-height:44px;padding:0 8px}
.production-screen #panelBody{padding:4px}
.production-screen .client-production-order{padding:2px;gap:2px}
.production-screen .item-quantity>label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.production-screen .item-quantity>small{display:none}
.production-screen .quote-status:empty{display:none}
.production-screen .client-resource-requirements>div{padding:0;border:0;grid-template-columns:minmax(0,1fr) 44px}
@container game-frame (min-height:451px){.production-screen#overlay{padding-top:100px}}
.production-screen .client-resource-requirements .client-resource-add{position:static}
.production-screen .client-resource-requirements img{grid-column:1}
.production-screen .client-resource-requirements b{grid-column:1;margin:0;font-size:11px;line-height:1.1;justify-self:start}
.production-screen .client-unit-grid{grid-auto-rows:max-content}
.production-screen .client-unit-choice{gap:2px;flex-shrink:0}
.production-screen .client-unit-choice>img,.production-screen .client-unit-choice>span,.production-screen .client-unit-choice>b{flex:none}
.production-screen .client-unit-choice>span{font-size:10px;line-height:1.1}
