/* Beta31: ONE CONTEXT FRAME, NO SIDEBAR SCROLL.
   Exactly one action set appears depending on the real selected entity. */
:root{--kd-rail:clamp(310px,28vw,420px);--kd-top:54px}
#stage{position:fixed!important;top:var(--kd-top)!important;bottom:0!important;
 left:var(--kd-rail)!important;right:0!important;width:auto!important;height:auto!important}
#stage canvas{width:100%!important;height:100%!important}
#vignette{left:var(--kd-rail);top:var(--kd-top)}
#selector{z-index:6}
#kd-reference-sidebar{width:var(--kd-rail);overflow:hidden!important;
 display:flex;flex-direction:column;gap:5px;padding:7px 7px 0 7px}
#kd-reference-sidebar>.kd-hud-block:first-child{flex:none;margin:0;min-height:0}
#kd-reference-sidebar .kd-map-wrap{height:clamp(155px,24vh,224px)}
#kd-map-hint{padding:3px 8px;min-height:16px;font:10px Georgia,serif}
#kd-reference-sidebar #kd-one-context{display:flex;flex:1;flex-direction:column;
 margin:0 0 7px;min-height:0;overflow:hidden;padding:0}
#kd-one-context .kd-hud-header{font-size:15px;flex:none}
#kd-context-heading{min-height:34px}
.kd-context-description{font:12px/1.35 Georgia,serif;
 padding:7px 11px;border-bottom:1px solid #513f30;color:#d3bea0;flex:none}
.kd-context-body{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;
 gap:6px;padding:8px 9px}
.kd-context-body #kd-selection-slot{min-height:0;overflow:hidden;flex:none}
#kd-one-context #unitPanel,#kd-one-context #buildingPanel{
 display:block;position:static!important;overflow:hidden;max-height:none;padding:7px 8px;
 border:1px solid #584738;background:#1217159e;font:12px Georgia,serif}
#kd-one-context #unitPanel[hidden],#kd-one-context #buildingPanel[hidden]{display:none!important}
#kd-one-context #squadGrid{max-height:120px;overflow:hidden;
 grid-template-columns:repeat(4,minmax(0,1fr));margin:5px 0}
#kd-one-context #squadGrid .squad-unit{min-height:67px}
#kd-one-context #kd-orders-slot{flex:none;min-height:0}
#kd-one-context #kd-orders-slot .panel{padding:0 1px}
#kd-one-context #kd-orders-slot .orders-buttons{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
#kd-one-context #kd-orders-slot button{min-height:79px;padding:4px 2px}
#kd-one-context #kd-build-grid{display:block;padding:0}
#kd-one-context .build-catalog{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
#kd-one-context .build-catalog button{min-height:81px;padding:3px}
#kd-one-context .kd-btn-icon{width:32px;height:32px}
#kd-one-context #kd-build-details{padding:0 3px}
#kd-one-context #kd-build-details label{display:none}
#kd-one-context #kd-build-details #buildInfo{color:#d5c29b;font-size:11px}
#kd-one-context #kd-build-details #cancelBuild{padding:5px;font:11px Georgia,serif}
#kd-one-context #workerChoice.kd-context-worker-select{display:none}
.kd-worker-actions{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.kd-mini-label{width:100%;font:12px Georgia,serif;color:#d9bd8a}
.kd-worker-actions>select{flex:1;min-width:70px;
 background:#171e1e;border:1px solid #765d43;color:#dfceb1;padding:8px 3px}
.kd-worker-actions>button{flex:1;min-width:110px;padding:8px 5px;
 font:11px Georgia,serif;letter-spacing:0}
.kd-hire-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
.kd-hire-actions>button{padding:7px 3px;min-height:43px;
 font:11px Georgia,serif;letter-spacing:0}
.kd-hire-actions>#deploy{grid-column:span 3;width:100%;margin:0}
.kd-build-progress-track{height:17px;border:2px ridge #92704c;background:#090e0e;overflow:hidden}
.kd-build-progress-fill{height:100%;width:0%;background:linear-gradient(90deg,#775b35,#d4af65);transition:width .18s}
.kd-worker-help{padding:9px;letter-spacing:.04em;font:bold 12px Georgia,serif}
.kd-job-status,.kd-worker-feedback{font:12px Georgia,serif;color:#ddcaa0;min-height:17px}
#kd-one-context .unit-info{font-size:12px;margin:3px 0!important}
#kd-one-context .stat{font-size:11px;padding:3px 0}
#kd-one-context #siteUpgrades{gap:4px}
#kd-one-context #siteUpgrades button{padding:7px 4px;min-height:30px;font-size:11px}
#kd-one-context #kd-empty-selection{font-size:12px;min-height:0;padding:6px}
#top .head h1{font-size:17px}
#statePill>div{min-width:0;padding:4px 9px}
#statePill b{font-size:17px}
#bottom{right:9px;max-width:calc(100vw - var(--kd-rail) - 18px);bottom:6px}
#bottom #help{max-height:38px;overflow:hidden;font-size:9px}
#hudlog{left:calc(var(--kd-rail) + 8px)!important;top:calc(var(--kd-top) + 8px)!important}
#kd-tooltip{bottom:58px;max-width:35vw}
@media(max-width:1100px){:root{--kd-rail:315px}#kd-one-context #kd-orders-slot button{min-height:67px}
#kd-one-context .build-catalog button{min-height:67px}#kd-one-context .kd-btn-icon{height:26px;width:26px}}
@media(max-height:740px){#kd-reference-sidebar .kd-map-wrap{height:150px}
#kd-one-context #squadGrid .squad-unit{min-height:53px}
#kd-one-context #kd-orders-slot button{min-height:60px}}

/* True square mini-map. No distortion between world X/Z. */
#kd-reference-sidebar .kd-map-wrap{height:244px!important;display:flex;align-items:center;justify-content:center}
#kd-reference-sidebar #mini{display:block;width:216px!important;height:216px!important;aspect-ratio:1/1;flex:none}
@media(max-height:830px){
 #kd-reference-sidebar .kd-map-wrap{height:172px!important}
 #kd-reference-sidebar #mini{width:149px!important;height:149px!important}
}

/* Author CSS must not override HTML hidden attributes used by authoritative game. */
#kd-one-context [hidden],#kd-one-context #buildingUpgrades[hidden],
#kd-one-context #siteUpgrades[hidden],#kd-one-context button[hidden]{display:none!important}
