.ui-layer #research{width:1240px;height:min(790px,calc(100dvh - 28px));max-height:min(790px,calc(100dvh - 28px));overflow:hidden;padding:20px;display:none}
.ui-layer #research[open]{display:flex;flex-direction:column}
.ui-layer #research .dialog-header{margin-bottom:10px;padding-bottom:10px;flex-shrink:0}
.ui-layer #research .dialog-header h2{font:600 26px/1.2 'Segoe UI',sans-serif}
.ui-layer #research .dialog-header .micro{margin:4px 0 0;color:#b6c8b4;font-size:12px}
.ui-layer #researchBody.has-research-tree{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
.research-layout{display:grid;grid-template-columns:minmax(0,1fr) 280px;grid-template-rows:minmax(0,1fr);gap:20px;min-height:0;flex:1;height:100%}
.tech-scroll{min-width:0;min-height:0;overflow:auto;scrollbar-width:thin;overscroll-behavior:contain}
.tech-map{min-width:0;padding:0 2px 10px}
.tech-eras{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:25px;margin-bottom:22px}
.tech-era{border-top:2px solid #60735b66;padding-top:9px;color:#aebfaa}
.tech-era span{display:block;font:11px/1.3 'Segoe UI',sans-serif;letter-spacing:1px}
.tech-era strong{display:block;font-size:15px;font-weight:600;margin-top:3px;color:#d4d9c7}
.tech-era.era-reached{border-color:#d4ba76}.tech-era.era-reached span{color:#e0c889}
.tech-board{position:relative;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(3,132px);gap:30px 25px}
.tech-lines{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}
.tech-lines path{fill:none;stroke:#7f92746e;stroke-width:1.5;vector-effect:non-scaling-stroke;stroke-linejoin:round}
.tech-lines .edge-ready{stroke:#b4c78f}.tech-lines .edge-selected{stroke:#e9cc83;stroke-width:2}
.ui-layer #research .tech-node{grid-column:var(--tech-col);grid-row:var(--tech-row);position:relative;display:flex;flex-direction:column;align-items:stretch;gap:5px;text-align:left;min-width:0;min-height:0;border:1px solid #6d816173;border-radius:5px;background:#1b3028;color:#e4e6d8;padding:10px 11px;box-shadow:0 3px 9px #06170d26;cursor:pointer;overflow:hidden;transition:background .12s,border-color .12s}
.ui-layer #research .tech-node:hover{background:#2c4231;border-color:#b7bc91}
.ui-layer #research .tech-node[aria-pressed=true]{outline:2px solid #ebcf8b;outline-offset:3px;background:#304234}
.ui-layer #research .tech-node:focus-visible,.ui-layer #research button:focus-visible{outline:2px solid #fff0b3;outline-offset:3px}
.tech-node-top{display:flex;align-items:center;justify-content:space-between;gap:5px}
.tech-glyph{height:20px;color:#c6cdad}.tech-glyph svg{width:20px;height:20px}
.tech-status{font:11px/1.2 'Segoe UI',sans-serif;color:#b1c1ab;white-space:nowrap}
.tech-name{font:600 14px/1.25 'Segoe UI',sans-serif;overflow-wrap:normal}
.tech-hint{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font:11px/1.35 'Segoe UI',sans-serif;color:#b6c6ae;min-height:15px}
.tech-node[data-state=available]{border-color:#c7b36e;background:#30412e}.tech-node[data-state=available] .tech-status{color:#f2d486}
.tech-node[data-state=done]{border-color:#87a982;background:#243e30}.tech-node[data-state=done] .tech-status{color:#c7e8b8}
.tech-node[data-state=active]{border-color:#e3c582;background:#403e2c}.tech-node[data-state=active] .tech-status{color:#ffe4a3}
.tech-node[data-state=locked] .tech-glyph{color:#93a58d}
.tech-node-cost{display:flex;align-items:center;gap:7px;font-size:11px;line-height:16px;margin-top:auto;color:#d5c598}
.tech-cost-item{display:inline-flex;align-items:center;gap:3px;white-space:nowrap}
.tech-cost-item svg{width:13px;height:13px;flex-shrink:0}.tech-cost-item.short{color:#eead96}.tech-time{margin-left:auto;color:#afbfaa;white-space:nowrap}
.tech-node-progress{position:absolute;bottom:0;left:0;height:3px;background:#edcf80;pointer-events:none}
.tech-detail{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;border-left:1px solid #71846455;padding-left:20px}
.tech-detail-content{flex:1;min-height:0;overflow:auto;scrollbar-width:thin}
.tech-detail-tag{font:11px/1.3 'Segoe UI',sans-serif;letter-spacing:.7px;color:#d9c285;margin:2px 0 8px}
.ui-layer #research .tech-detail h3{font-size:21px;line-height:1.2;margin:0 0 9px;color:#f4ecd7}
.ui-layer #research .tech-description{font-size:13px;line-height:1.5;margin:0 0 12px;color:#c6d3bf}
.tech-detail h4{font-size:10px;letter-spacing:1px;color:#aabea1;margin:10px 0 7px;font-weight:600}
.tech-unlocks,.tech-requirements{list-style:none;padding:0;margin:0;font-size:12px;line-height:1.4;display:grid;gap:6px}
.tech-unlocks li{display:flex;align-items:center;gap:7px}.tech-unlocks svg{width:17px;height:17px;flex-shrink:0;color:#d4c58e}
.tech-requirements li{display:flex;gap:7px;align-items:baseline;color:#e1b59a}.tech-requirements li[data-met=true]{color:#c1d5b4}.tech-check{width:12px;flex-shrink:0}
.ui-layer #research .tech-prerequisite{font:inherit;text-align:left;line-height:1.4;background:none;border:0;border-bottom:1px dotted #a3b38c88;padding:0;min-height:0;color:inherit;cursor:pointer}
.tech-detail-cost{display:flex;flex-wrap:wrap;gap:12px;border-top:1px solid #71846455;padding-top:12px;margin-top:15px;font-size:15px;color:#e3d09a}.tech-detail-cost svg{width:17px;height:17px}
.tech-detail-footer{margin-top:auto;padding-top:10px;flex-shrink:0}.ui-layer #research .tech-reason{font-size:12px;line-height:1.4;color:#c4cbb4;margin:5px 0 9px;min-height:34px}
.ui-layer #research .tech-start{width:100%;min-height:43px;border:1px solid #d3bd77;background:#d5c18a;color:#1c2c22;font:600 14px 'Segoe UI',sans-serif;border-radius:3px;cursor:pointer}
.ui-layer #research .tech-start:disabled{background:#24392c;border-color:#7d8b6e55;color:#b1bea6;cursor:default;opacity:1}
.research-live{display:flex;gap:14px;align-items:center;border-top:1px solid #71846455;margin-top:14px;padding-top:12px;flex-shrink:0;min-height:43px}
#researchLive{flex:1;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 10px;align-items:center}
#researchLive strong{font-size:13px;font-weight:600}#researchLive span{font-size:12px;color:#bdcdb3}#researchLive progress{grid-column:1/-1;width:100%;height:5px;accent-color:#dcc181}
.ui-layer #research #cancelResearchButton{font:12px 'Segoe UI',sans-serif;padding:7px 10px;border:1px solid #97816a99;background:transparent;color:#e3cbb2;border-radius:3px;white-space:nowrap}
.ui-layer #research #cancelResearchButton:disabled{opacity:.45}.research-legend{display:flex;gap:15px;margin:14px 0 0;font-size:11px;color:#b3c4a9}.research-legend span{display:flex;gap:5px;align-items:center}.research-legend i{width:7px;height:7px;border-radius:50%;background:#798570}.research-legend .available{background:#e3c06c}.research-legend .done{background:#9bc68c}
@media(max-width:1000px){.research-layout{grid-template-columns:minmax(0,1fr) 250px;gap:14px}.tech-detail{padding-left:14px}.tech-board{gap:26px 19px;grid-template-rows:repeat(3,142px)}.tech-eras{gap:19px}.ui-layer #research .tech-node{padding:9px}.tech-status{font-size:10px}.tech-name{font-size:13px}.tech-node-cost{gap:5px;font-size:10px}.tech-hint{font-size:10px}}
@media(max-width:800px){.ui-layer #research{max-height:calc(100dvh - 16px);padding:15px}.research-layout{grid-template-columns:minmax(0,1fr) 245px}.tech-eras{display:none}.tech-map{padding-left:23px}.tech-board{display:flex;flex-direction:column;gap:17px}.ui-layer #research .tech-node{min-height:104px;margin-left:calc((var(--tech-depth) - 1)*8px);flex-shrink:0}.tech-hint{-webkit-line-clamp:1}.tech-name{font-size:14px}.tech-node-cost{font-size:12px}.tech-status{font-size:11px}.tech-scroll{max-height:calc(100dvh - 212px)}.tech-detail{min-height:430px}.tech-detail h3{min-height:0}.ui-layer #research .tech-description{min-height:0}}
@media(max-width:560px){.ui-layer #research{width:calc(100vw - 12px);max-width:calc(100vw - 12px);height:calc(100dvh - 12px);max-height:calc(100dvh - 12px);padding:12px}.ui-layer #research .dialog-header{margin-bottom:9px;padding-bottom:8px}.ui-layer #research .dialog-header h2{font-size:22px}.ui-layer #research .dialog-header .eyebrow{display:none}.ui-layer #research .dialog-header .micro{font-size:11px}.ui-layer #researchBody.has-research-tree{flex:1;min-height:0}.research-layout{display:flex;flex-direction:column;gap:10px;height:100%}.tech-scroll{flex:1;min-height:110px;max-height:none;padding:4px 5px 5px 0}.tech-map{padding-bottom:4px}.tech-detail{flex:0 0 auto;min-height:0;max-height:46dvh;overflow:auto;border-left:0;border-top:1px solid #71846455;padding:10px 2px 2px;scrollbar-width:thin}.tech-detail-tag{font-size:10px;margin:0 0 4px}.ui-layer #research .tech-detail h3{font-size:18px;min-height:0;margin-bottom:5px}.ui-layer #research .tech-description{font-size:12px;line-height:1.4;margin-bottom:6px}.tech-detail h4{margin:7px 0 4px}.tech-unlocks{gap:3px}.tech-unlocks li,.tech-requirements li{font-size:11px}.tech-requirements{gap:3px}.tech-detail-cost{margin-top:8px;padding-top:7px;gap:12px;font-size:13px}.tech-detail-footer{position:sticky;bottom:-2px;background:#182f26;padding:5px 0 2px}.ui-layer #research .tech-reason{min-height:0;font-size:11px;margin:3px 0 5px}.ui-layer #research .tech-start{min-height:41px}.research-live{margin-top:8px;padding-top:8px;gap:8px;min-height:36px}#researchLive{grid-template-columns:1fr;gap:2px}#researchLive strong{font-size:11px}#researchLive span{font-size:10px}.ui-layer #research #cancelResearchButton{font-size:11px;padding:6px}.research-legend{display:none}}
@media(prefers-reduced-motion:reduce){.ui-layer #research .tech-node{transition:none}}
/* Compact desktop windows keep every branch and the action visible. */
@media(min-width:801px) and (max-height:760px){.tech-board{grid-template-rows:repeat(3,100px);gap:18px}.tech-eras{margin-bottom:14px;gap:18px}.ui-layer #research .tech-node{padding:8px 10px;gap:3px}.tech-hint{-webkit-line-clamp:1;font-size:10px}.tech-name{font-size:13px}.tech-node-top{min-height:18px}.tech-node-top svg{width:18px;height:18px}.tech-node-cost{font-size:10px}.research-legend{margin-top:9px}.research-live{margin-top:9px;padding-top:9px}}
@media(min-width:561px) and (max-width:800px){.tech-detail{min-height:0;max-height:calc(100dvh - 205px)}}
@media(max-width:560px){.tech-detail{height:43dvh;overflow:hidden}.tech-detail-content{flex:1;min-height:0;overflow:auto}.tech-detail-footer{position:static;flex-shrink:0}.ui-layer #research .tech-reason{min-height:0}}

/* Extra support branches keep their own columns inside centre II. */
@media(min-width:801px) and (max-width:1100px){.tech-eras{display:none}.tech-map{padding-left:23px}.tech-board{display:flex;flex-direction:column;gap:17px}.ui-layer #research .tech-node{min-height:104px;margin-left:calc((var(--tech-depth) - 1)*8px);flex-shrink:0}.tech-name{font-size:14px}.tech-hint{-webkit-line-clamp:1}.tech-node-cost{font-size:12px}.tech-scroll{max-height:none}.tech-detail{min-height:0}}
