/* Royal atlas: presentation only. All research rules remain in tree.js. */
#tree-modal{width:98vw;max-width:1880px;height:96dvh;max-height:1200px;border:1px solid #8e7851;border-radius:16px;background:#101b2a;box-shadow:0 30px 120px #000c,0 0 0 4px #102132;color:#e9edf1}
#tree-modal::backdrop{background:#050a13df;backdrop-filter:blur(8px)}
#tree-modal .tree-header{height:96px;min-height:96px;padding:14px 24px;gap:16px;flex-wrap:nowrap;background:linear-gradient(110deg,#243347,#132234 70%);border-bottom:1px solid #a78b4b50}
#tree-modal .tree-header h2{font-size:32px;line-height:1.1;margin:4px 0 0;color:#fff1d1;letter-spacing:.2px}
#tree-modal .tree-header .eyebrow{font-size:9px;letter-spacing:2.5px;color:#c5a976}
#tree-modal .tree-header button{min-height:44px;padding:10px 16px;font-size:11px;border-radius:7px;background:#253b4c;border:1px solid #567080;color:#d7e5ee;white-space:nowrap}
#tree-modal #tree-next{background:linear-gradient(#c49a4d,#957037);border-color:#ecc67b;color:#171d29;box-shadow:0 4px 16px #e4b15320}
#tree-modal .tree-resources{display:grid;grid-template-columns:auto auto;gap:4px 16px;min-width:180px;margin-left:auto;position:relative;padding-bottom:9px}
#tree-modal .tree-resources strong{color:#f7cf77;font-size:17px}
#tree-modal #research-progress{color:#adc0cf;font-size:10px;text-align:right}
#tree-modal #tree-ready-count{grid-column:1/-1;font-size:10px;color:#a2d8cc}
#tree-completion{position:absolute;bottom:0;left:0;right:0;height:3px;border-radius:4px;background:#405063;overflow:hidden}
#tree-completion:after{content:'';display:block;width:var(--complete,0%);height:100%;background:linear-gradient(90deg,#568f8d,#c4e7ca);transition:width .5s ease}
#tree-modal .tree-layout{height:calc(100% - 96px)}
#tree-modal .tree-space{background-color:#0e1929;background-image:radial-gradient(ellipse at 50% 48%,#2e506b55,transparent 68%),radial-gradient(circle at 20% 20%,#c6b27e45 1px,transparent 1.6px),radial-gradient(circle at 65% 70%,#aac9e72b 1px,transparent 1.6px);background-size:100% 100%,143px 167px,89px 113px;isolation:isolate}
#tree-modal .branch-legend{padding:10px 16px;gap:8px 15px;background:#142234e8;border-bottom:1px solid #354859;min-height:44px;letter-spacing:.8px;font-size:10px;align-items:center}
#tree-modal .branch-legend>span{color:#d1a28b;white-space:nowrap}#tree-modal .branch-legend>span:nth-child(2){color:#bea8de}#tree-modal .branch-legend>span:nth-child(3){color:#a9cbb3}#tree-modal .branch-legend>span:nth-child(4){color:#d9c28f}
#tree-modal .research-state-legend{margin-left:auto;display:flex;gap:10px;font-size:8px;letter-spacing:.3px}
#tree-modal .research-state-legend i{font-style:normal;color:#93a5b4;background:none;padding:0;border:0}
#tree-modal .research-state-legend .owned{color:#8fdbbf}#tree-modal .research-state-legend .available{color:#eed08a}#tree-modal .research-state-legend .upgrade{color:#91c7ef}
#tree-modal #tree-viewport{padding:0;overflow:auto;min-height:100px}
#tree-modal .map-zone{display:none}
#tree-modal .tree-world,#tree-modal .tree-lines{width:2320px;height:1500px}
#tree-modal .tree-lines{z-index:0}#tree-modal .tree-world{z-index:1;pointer-events:none}
#tree-modal .tree-lines path{fill:none;stroke:#61718470;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;opacity:1;filter:none}
#tree-modal .tree-lines path.lit{stroke:var(--line-tone,#9fc6bd);opacity:.6;filter:drop-shadow(0 0 3px #96cbba50)}
#tree-modal .tree-lines path.focused{stroke:#e7cc8c;opacity:1;stroke-width:3;stroke-dasharray:7 10;animation:tree-flow 1.8s linear infinite;filter:drop-shadow(0 0 4px #e6bd6870)}
#tree-modal .tree-lines path.new-link{animation:tree-flow .6s linear infinite;stroke:#fff3b3;stroke-dasharray:9 7}
#tree-modal .research-node{width:196px;height:98px;min-height:0;position:absolute;display:grid;grid-template-columns:56px 1fr;grid-template-rows:1fr 25px;gap:0 9px;align-items:center;justify-items:start;text-align:left;padding:12px 13px 10px 9px;margin:0;border:1px solid #45596d;border-left:3px solid var(--node-tone,#b7bdc8);border-radius:9px;background:linear-gradient(125deg,#293747,#142235);box-shadow:inset 0 1px #ffffff0d,0 4px 10px #02091670;overflow:visible;opacity:1;filter:none;pointer-events:auto;transition:border-color .18s,box-shadow .18s,background .18s;transform:none!important;outline:none}
#tree-modal .research-node:before{inset:0;border:0;border-radius:inherit;pointer-events:none}
#tree-modal .research-node:after{position:absolute;top:-6px;right:-5px;width:18px;height:18px;border-radius:50%;display:grid;place-items:center;font:700 11px Arial;border:1px solid #627486;background:#26384a;color:#b8c9d5;box-shadow:0 2px 5px #0006}
#tree-modal .research-node.locked:after{content:'◇'}#tree-modal .research-node.available:after{content:'+';background:#d2ad62;border-color:#f8d991;color:#172032}#tree-modal .research-node.owned:after{content:'✓';background:#295a51;border-color:#75bea5;color:#d8f8e5}#tree-modal .research-node.upgrade-ready:after{content:'↑';background:#315d7c;border-color:#8bc8ee;color:#e0f2ff}
#tree-modal .research-node .node-art{position:relative;inset:auto;grid-column:1;grid-row:1/3;display:grid;place-items:center;width:54px;height:54px;background:#07132369;border:1px solid #ffffff10;border-radius:7px;font-size:28px;color:var(--node-tone,#d4bd82);text-shadow:none}
#tree-modal .node-art svg,#tree-modal .node-art img{width:42px;height:42px;object-fit:contain;image-rendering:pixelated;filter:none;margin:0;position:static}
#tree-modal .research-node b{position:static;inset:auto;width:auto;max-width:100%;grid-column:2;grid-row:1;align-self:end;font-size:15px;line-height:1.1;font-weight:650;letter-spacing:0;color:#e9eef3;text-align:left;pointer-events:none;white-space:normal}
#tree-modal .research-node small{position:static;inset:auto;width:auto;grid-column:2;grid-row:2;font-size:11px;color:#cfb67f;line-height:1.1;text-align:left;white-space:nowrap;pointer-events:none}
#tree-modal .research-node .node-level{position:absolute;inset:auto;top:auto;left:9px;bottom:9px;z-index:2;min-width:54px;padding:2px 4px;border-radius:3px;background:#0d1927;color:#c8d5df;border:1px solid #4c6174;font:700 9px Arial;text-align:center;box-shadow:none}
#tree-modal .research-node .node-meter{position:absolute;left:77px;right:12px;bottom:7px;height:3px;background:#ffffff13;border-radius:5px;overflow:hidden}
#tree-modal .node-meter:after{content:'';display:block;width:var(--level-fill);height:100%;background:var(--node-tone,#9cbfbb)}
#tree-modal .research-node.locked{opacity:1;background:linear-gradient(125deg,#1b2a3a,#121e2e);border-color:#3b4b5b;border-left-color:#58687a;box-shadow:0 3px 8px #0003}
#tree-modal .research-node.locked .node-art{filter:grayscale(.7);opacity:.6}#tree-modal .research-node.locked b{color:#9dabbc}#tree-modal .research-node.locked small{color:#8694a7}
#tree-modal .research-node.available{border-color:#b89a5c;background:linear-gradient(125deg,#3a3d35,#192735);box-shadow:inset 0 1px #ecd59b20,0 0 14px #d7b25514}
#tree-modal .research-node.owned{border-color:#4e9382;background:linear-gradient(125deg,#214438,#142a32)}#tree-modal .research-node.owned small{color:#8fc7b4}
#tree-modal .research-node.upgrade-ready{border-color:#6096bb;background:linear-gradient(125deg,#284358,#172c3d)}#tree-modal .research-node.upgrade-ready small{color:#a8d8fa}
#tree-modal .research-node.selected{border-color:#ffe3a4;outline:2px solid #f4d29280;outline-offset:3px;z-index:5;box-shadow:0 0 22px #eec36a30}
#tree-modal .research-node:hover,#tree-modal .research-node:focus-visible{border-color:#fff1c6;box-shadow:0 0 20px #c2d9ef30;z-index:6;filter:none}
#tree-modal .map-overview .research-node{padding:5px 8px 5px 5px;grid-template-columns:35px 1fr;grid-template-rows:1fr 20px;gap:0 6px;border-radius:7px}
#tree-modal .map-overview .node-art{width:34px;height:38px;border-radius:4px}#tree-modal .map-overview .node-art svg,#tree-modal .map-overview .node-art img{width:29px;height:29px}
#tree-modal .map-overview .research-node b{font-size:12px;line-height:1.05}#tree-modal .map-overview .research-node small{font-size:9px}
#tree-modal .map-overview .node-level{left:5px;bottom:5px;min-width:34px;font-size:8px;padding:1px 2px}#tree-modal .map-overview .node-meter{left:47px;bottom:5px;right:8px;height:2px}
#tree-modal .tree-toolbar{min-height:58px;padding:8px 14px;gap:8px;background:#142235;border-top:1px solid #384e61}
#tree-modal .tree-toolbar>span{font-size:10px;color:#9baec1}#tree-modal .tree-toolbar>div{gap:6px;flex-wrap:nowrap}
#tree-modal .tree-toolbar button{font-size:10px;min-height:40px;border:1px solid #476074;border-radius:6px;background:#23394a;color:#d7e3ec;padding:7px 12px}#tree-modal #tree-fit{border-color:#93815a;color:#ecd49e}#tree-modal #zoom-in,#tree-modal #zoom-out{font-size:23px;padding:0;min-width:40px}
#tree-modal #research-detail{padding:24px;border-color:#506276;background:linear-gradient(155deg,#26374b,#152333 65%);scrollbar-width:thin}
#tree-modal .research-emblem{width:76px;height:76px;margin:20px 0;border:1px solid #ab9568;border-radius:12px;background:radial-gradient(#4b5360,#1b2c3f);box-shadow:0 0 28px #d1af5e12;display:grid;place-items:center}
#tree-modal .research-emblem svg,#tree-modal .research-emblem img{width:52px;height:52px;object-fit:contain}
#tree-modal #research-detail h2{font-size:28px;color:#fff0ce;line-height:1.15}#tree-modal #research-detail p{font-size:13px;color:#b9c9d8;line-height:1.65}#tree-modal .research-level{font-size:10px;color:#a4cde6}
#tree-modal .prereqs button{border-radius:5px;font-size:11px;min-height:38px}#tree-modal #research-buy{min-height:48px;border-radius:7px;font-size:11px;box-shadow:0 4px 14px #0003}#tree-modal .research-note{font-size:10px}
#tree-modal .tree-entering .research-node{animation:none}#tree-modal.tree-entering .research-node{animation:tree-appear .3s both;animation-delay:calc(var(--node-order,0)*7ms)}
#tree-modal .research-node.just-researched{animation:tree-acquired 1.2s ease-out}
@keyframes tree-flow{to{stroke-dashoffset:-34}}@keyframes tree-appear{from{opacity:0;filter:brightness(1.8)}to{opacity:1;filter:brightness(1)}}@keyframes tree-acquired{0%,25%{box-shadow:0 0 0 5px #ffe8a360,0 0 45px #ffd57899;border-color:#fff1ba}100%{box-shadow:0 0 0 15px #ffe8a300,0 0 15px #ffd57800}}
@media(max-width:1100px){#tree-modal .tree-header{gap:10px;padding:12px 16px}#tree-modal .tree-header h2{font-size:28px}#tree-modal .branch-legend{gap:6px 12px;font-size:9px}#tree-modal .research-state-legend{width:100%;margin:0}#tree-modal .tree-toolbar>span{display:none}}
@media(max-width:650px){
#tree-modal{width:100vw;height:100dvh;max-height:none;border-radius:0;border:0;margin:0}
#tree-modal .tree-header{height:110px;min-height:110px;display:grid;grid-template-columns:1fr 1fr;padding:9px 12px;gap:6px 10px}
#tree-modal .tree-header h2{font-size:24px}#tree-modal .tree-header .eyebrow{font-size:8px;letter-spacing:1.4px}#tree-modal .tree-resources{min-width:0;margin:0;gap:3px 8px;align-self:center}#tree-modal .tree-resources strong{font-size:13px}#tree-modal #research-progress{font-size:8px}#tree-modal #tree-ready-count{font-size:8px;white-space:nowrap}#tree-modal .tree-header button{font-size:10px;min-height:40px;padding:7px 8px;width:100%;margin:0}#tree-modal #tree-next[hidden]{display:none}#tree-modal .tree-header:has(#tree-next[hidden]) #tree-close{grid-column:1/-1}
#tree-modal .tree-layout{height:calc(100% - 110px)}#tree-modal .branch-legend{padding:8px 10px;gap:5px 9px;font-size:8px;letter-spacing:.2px;min-height:62px}#tree-modal .research-state-legend{font-size:7px;gap:8px}
#tree-modal .map-overview .research-node{display:flex;flex-direction:column;justify-content:flex-start;align-items:center;gap:1px;padding:2px 1px;border-left-width:2px;border-radius:5px;text-align:center}
#tree-modal .map-overview .node-art{width:22px;height:21px;flex:none;border:0;background:none}#tree-modal .map-overview .node-art svg,#tree-modal .map-overview .node-art img{width:21px;height:21px}
#tree-modal .map-overview .research-node b{font-size:8.5px;line-height:1;min-height:17px;display:flex;align-items:center;justify-content:center;text-align:center;width:100%;overflow:hidden}#tree-modal .map-overview .research-node small{font-size:7px;line-height:1;text-align:center;max-width:100%}
#tree-modal .map-overview .node-level{min-width:0;left:auto;right:0;top:1px;bottom:auto;padding:1px;font-size:6px;border:0;background:#10202ee8;color:#e4d8b4}
#tree-modal .map-overview .research-node:after{width:11px;height:11px;top:-3px;right:-3px;font-size:8px}#tree-modal .map-overview .research-node:has(.node-level):after{right:auto;left:-3px}
#tree-modal .map-overview .node-meter{left:3px;right:3px;bottom:1px;height:1px}
#tree-modal .tree-toolbar{min-height:60px;padding:7px 8px;display:block}#tree-modal .tree-toolbar>div{display:grid;grid-template-columns:36px 28px 36px 1fr 1fr;gap:5px;width:100%}#tree-modal .tree-toolbar button{min-height:44px;font-size:8px;padding:5px 3px}#tree-modal #zoom-in,#tree-modal #zoom-out{min-width:0}#tree-modal #tree-actual{display:none}#tree-modal #zoom-label{font-size:9px;min-width:0}
#tree-modal #research-detail{height:238px;padding:14px 17px;border-top:1px solid #506276}#tree-modal .research-emblem{width:48px;height:48px;margin:0 12px 8px 0;float:left}#tree-modal .research-emblem svg,#tree-modal .research-emblem img{width:35px;height:35px}#tree-modal #research-detail h2{font-size:23px}#tree-modal #research-detail p{font-size:12px;line-height:1.5;margin:10px 0}#tree-modal .prereqs button{font-size:10px}#tree-modal #research-buy{font-size:10px}
}
@media(prefers-reduced-motion:reduce){#tree-modal *,#tree-modal *:before,#tree-modal *:after{animation:none!important;transition:none!important}}
/* Retire older map decorations without changing camera transforms. */
#tree-modal #tree-map .research-node:before{display:none!important}
#tree-modal #tree-map .research-node:after{right:-5px;left:auto;top:-6px}
#tree-modal #tree-map.map-overview .node-level{left:5px;right:auto;top:auto;bottom:5px;font-size:8px;padding:1px 2px}
#tree-modal:has(.map-overview){width:98vw;height:96dvh;max-width:1880px;max-height:1200px}
#tree-modal:has(.map-overview) .tree-header{min-height:96px;padding:14px 24px}
#tree-modal:has(.map-overview) .tree-header h2{font-size:32px}
#tree-modal .tree-world{pointer-events:none}#tree-modal .tree-world button{pointer-events:auto}
@media(max-width:650px){#tree-modal:has(.map-overview){width:100vw;height:100dvh;max-height:none}#tree-modal:has(.map-overview) .tree-header{min-height:110px;padding:9px 12px}#tree-modal:has(.map-overview) .tree-header h2{font-size:24px}#tree-modal #tree-map.map-overview .node-level{left:auto;right:0;top:1px;bottom:auto;font-size:6px;padding:1px}#tree-modal #tree-map.map-overview .research-node:after{right:-3px;top:-3px}#tree-modal #tree-map.map-overview .research-node:has(.node-level):after{right:auto;left:-3px}}
#tree-modal #research-tooltip{border:1px solid #8199ab;border-radius:10px;background:#152436;box-shadow:0 15px 50px #000a;color:#e5edf4}
#tree-modal .tip-title{background:linear-gradient(120deg,#2a3f52,#1a2b3f);border-color:#435a70}#tree-modal .tip-icon{border-radius:7px;background:#142334;border-color:#5d7487;color:#d1c396}#tree-modal .tip-icon svg{width:35px;height:35px}#tree-modal .tip-title strong{color:#fff0d0}#tree-modal .tip-body{background:#17283b}#tree-modal .tip-level b{border-radius:3px}#tree-modal .tip-level .filled{background:#8dc5b2}#tree-modal .tip-price.insufficient{background:#4b3940;border-color:#986c68}#tree-modal .tip-price.affordable{background:#314c43;border-color:#84a98a}
#tree-modal .research-node[data-node="root"]{border-color:#9e8959;background:radial-gradient(ellipse at 20% 50%,#6d694440,transparent 80%),#203744;box-shadow:0 0 24px #e4ba5517}
#tree-modal .research-node[data-node="root"] .node-art{background:none;border:0}#tree-modal .research-node[data-node="root"] .node-art svg{filter:drop-shadow(0 3px 5px #e4b76260)}
#tree-modal .research-node b{font-family:Inter,Arial,sans-serif;font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-width:0}
#tree-modal .map-overview .research-node b{font-size:11px;line-height:1.2}
@media(max-width:650px){#tree-modal .map-overview .research-node b{font-size:8px;line-height:1.05;min-height:17px}}
@media(max-width:650px){#tree-modal .tree-resources strong{grid-column:1/-1;font-size:13px;white-space:nowrap;text-align:left}#tree-modal #research-progress{position:absolute;right:0;top:23px;font-size:7px}#tree-modal #tree-ready-count{font-size:7px;max-width:70%}}
/* v85: keep long names and late-game prices inside compact atlas nodes. */
#tree-modal .node-price-compact{display:none}
#tree-modal .research-node b{overflow-wrap:anywhere}
#tree-modal .map-overview.map-narrow .research-node{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;padding:5px 3px;gap:2px;text-align:center;border-left-width:2px}
#tree-modal .map-overview.map-narrow .node-art{width:30px;height:28px;flex:none;border:0;background:none}
#tree-modal .map-overview.map-narrow .node-art svg,#tree-modal .map-overview.map-narrow .node-art img{width:27px;height:27px}
#tree-modal .map-overview.map-narrow .research-node b{width:100%;font-size:10px;line-height:1.1;min-height:22px;text-align:center}
#tree-modal .map-overview.map-narrow .research-node small{font-size:8px;line-height:1.1;text-align:center}
#tree-modal #tree-map.map-narrow .node-level{left:auto;right:3px;top:3px;bottom:auto;min-width:0;font-size:7px;padding:1px 2px}
#tree-modal #tree-map.map-narrow .node-meter{left:5px;right:5px;bottom:3px}
#tree-modal .map-overview.map-compact .node-price-full,#tree-modal .map-overview.map-narrow .node-price-full{display:none}
#tree-modal .map-overview.map-compact .node-price-compact,#tree-modal .map-overview.map-narrow .node-price-compact{display:inline}
@media(max-width:650px){#tree-modal .tree-header{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}#tree-modal .tree-header>div{min-width:0}#tree-modal .tree-header h2{white-space:normal}#tree-modal .tree-resources{width:100%;min-width:0}#tree-modal .tree-resources strong{font-size:12px}#tree-modal #research-progress{top:22px}#tree-modal #tree-ready-count{font-size:7px;max-width:none}#tree-modal #research-progress{font-size:6px}}
@media(max-width:360px){#tree-modal:has(.map-overview) .tree-header h2,#tree-modal .tree-header h2{font-size:21px}}
@media(max-width:650px){#tree-modal #tree-next{white-space:normal;font-size:9px;line-height:1.15}}
