/* Prerequisite diagrams keep connections and cards in the same coordinate system. */
.tech-graph, .tech-graph-panel { min-width: 0; }
.treasury-label { font-size: 16px; color: var(--gold); }
.research-materials { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.research-materials>span { font-size: 14px; color: var(--resource-color); padding: 9px 12px; border: 1px solid var(--line); background: var(--surface); }
.research-materials b { font-weight: 400; margin-left: 6px; }
.tree-legend, .tree-status-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 0 0 14px; }
.tree-legend span { color: var(--branch-accent); border-bottom: 2px solid var(--branch-accent); padding-bottom: 5px; font-size: 14px; }
.tree-status-legend { gap: 18px; margin-bottom: 24px; color: var(--muted); font-size: 12px; }
.tree-status-legend span::before { content: ''; display: inline-block; width: 12px; height: 8px; border: 2px solid; margin-right: 7px; vertical-align: middle; }
.tree-status-legend .complete { color: var(--lime); }
.tree-status-legend .ready { color: var(--gold); }
.tree-status-legend .locked { color: var(--muted); }
.research-tree { border: 2px solid var(--line); background: var(--surface); box-shadow: 3px 3px var(--edge); margin-bottom: 24px; }
.tree-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px 0; }
.tree-toolbar h2 { font-size: 16px; margin: 0; line-height: 1.5; color: var(--text); }
.tree-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.tree-tools button, .tree-back { font: inherit; font-size: 14px; min-height: 40px; border: 1px solid var(--line); color: var(--text); background: var(--button); padding: 8px 10px; }
.tree-tools button:hover, .tree-back:hover { background: var(--surface-selected); border-color: var(--gold); }
.tree-tools button:disabled { opacity: .45; cursor: default; }
.tree-tools output { min-width: 45px; text-align: center; font-size: 12px; color: var(--muted); }
.tree-hint, .tree-aura-description { font-size: 16px; line-height: 1.65; color: var(--muted); margin: 10px 16px 14px; }
.tree-aura-description { margin: -10px 0 24px; }
.tree-viewport { height: 650px; max-height: 72vh; min-height: 300px; overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--line) var(--surface); cursor: grab; border-top: 1px solid var(--line); background-color: var(--surface-inset); background-image: radial-gradient(#57706433 1px, transparent 1px); background-size: 20px 20px; }
.tree-viewport-short { height: 310px; min-height: 230px; max-height: 55vh; }
.tree-viewport.dragging { cursor: grabbing; user-select: none; }
.tree-viewport:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.tree-world { position: relative; min-width: 1px; min-height: 1px; overflow: hidden; }
.tech-tree-scene { position: absolute; left: 0; top: 0; transform-origin: top left; }
.tree-connections { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.tree-connection { fill: none; stroke: var(--line); stroke-width: 2; }
.tree-connection[data-status=ready] { stroke: var(--branch-accent); stroke-dasharray: 5 5; }
.tree-connection[data-status=complete] { stroke: var(--branch-accent); stroke-width: 3; }
.tree-starting-link { stroke-dasharray: 3 5; }
.tree-connection[data-selected=true] { stroke: var(--branch-accent); stroke-width: 4; }
.tree-root { position: absolute; display: grid; place-items: center; font-size: 16px; font-weight: 700; border: 2px solid var(--line-strong); background: var(--surface-selected); color: var(--text); box-shadow: 3px 3px var(--edge); padding: 5px 12px; text-align: center; }
.tech-tree-scene .tech-node { position: absolute; display: flex; flex-direction: column; gap: 8px; padding: 12px; min-height: 0; border: 2px solid var(--line); background: var(--surface); box-shadow: 3px 3px var(--edge); cursor: pointer; }
.tech-tree-scene .tech-node::after { content: none; }
.tech-tree-scene .tech-node::before { content: ''; position: absolute; left: calc(50% - 4px); top: -5px; width: 6px; height: 6px; border: 1px solid var(--branch-accent); background: var(--surface); }
.tech-tree-scene .tech-node-top { flex-direction: row; align-items: center; gap: 8px; }
.tech-tree-scene .tech-symbol { font-size: 22px; }
.tech-tree-scene .tech-state { font-size: 12px; line-height: 1.3; text-align: right; }
.tech-tree-scene .tech-node b { font-size: 16px; line-height: 1.25; flex: 1; }
.tech-tree-scene .tech-cost { font-size: 14px; line-height: 1.2; padding-top: 7px; gap: 12px; flex-wrap: nowrap; }
.tech-tree-scene .tech-node[data-status=locked] { background: var(--surface); border-color: var(--line); color: var(--muted); }
.tech-tree-scene .tech-node[data-status=available] { border-color: var(--branch-accent); background: var(--surface-selected); }
.tech-tree-scene .tech-node[data-status=researched] { border-color: var(--lime); background: var(--success-bg); }
.tech-tree-scene .tech-node.selected { border-color: var(--gold); box-shadow: 0 0 0 2px #e7bf7b44, 4px 4px var(--edge); background: var(--surface-selected); }
.tech-tree-scene .tech-node:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.tech-detail { scroll-margin-top: 20px; }
.tech-detail .tree-back { display: none; }
@media(max-width:900px) {
 .tech-detail .tree-back { display: block; width: 100%; margin-top: 12px; }
 .tree-toolbar { padding: 12px 12px 0; }
 .tree-hint { margin-left: 12px; margin-right: 12px; }
 .tree-viewport { height: 560px; max-height: 68vh; }
 .tree-viewport-short { height: 300px; max-height: 50vh; }
}

.epoch-selector,.entry-page-tabs{display:flex;flex-wrap:wrap;gap:12px;margin:0 0 24px}
.epoch-tile,.entry-page-tabs button{background:var(--panel);border:2px solid var(--line);padding:14px 22px;color:var(--text);min-height:48px;box-shadow:3px 3px var(--edge)}
.epoch-tile.selected,.entry-page-tabs button.selected{border-color:var(--gold);color:var(--gold);background:var(--surface-selected)}
.entry-page-tabs{margin:20px 0}
.entry-page-tabs button{flex:1;padding:12px}
.unit-skills-page{min-width:0}
.unit-skills-page h3{font-size:18px}
.unit-skills-page .unit-skills-layout{grid-template-columns:minmax(0,1fr);margin-top:20px}
.unit-skills-page .tech-detail{position:static;min-width:0}
.unit-skills-page .tree-viewport{height:340px;min-height:280px}
.unit-skills-page .tree-legend{margin-top:18px}
.unit-skills-page .research-funding{flex-wrap:wrap}
.unit-skills-page .research-materials>span{font-size:12px;padding:6px}
.unit-skills-page progress{width:100%;accent-color:var(--gold);margin-bottom:16px}
.unit-skills-page .tech-detail .tree-back{display:block;width:100%;margin-top:12px}
