
/* Matrix / Techtree Viewport & Canvas */
.full-height-tab {
    height: calc(100vh - 150px);
    position: relative;
    overflow: hidden;
}

.techtree-overlay-ui {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 50;
    pointer-events: none; /* Let clicks pass through to canvas */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.techtree-overlay-ui > * {
    pointer-events: auto; /* Re-enable for buttons */
}

.techtree-legend {
    font-size: 0.8rem;
    color: #888;
    background: rgba(0,0,0,0.8);
    border: 1px solid #333;
    padding: 5px 10px;
    border-radius: 4px;
}
.techtree-legend .dot { display: inline-block; width: 10px; height: 10px; margin-right: 5px; margin-left: 10px; }
.techtree-legend .dot.research { background: var(--magenta); }
.techtree-legend .dot.reward { background: var(--green); }
.techtree-legend .dot.punishment { background: var(--red); }

.techtree-zoom-controls {
    display: flex;
    gap: 5px;
    background: rgba(0,0,0,0.8);
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #333;
}
.techtree-zoom-controls button {
    background: #333;
    color: white;
    border: 1px solid #555;
    width: 30px; 
    height: 30px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.techtree-zoom-controls button:hover { background: #555; }

.techtree-viewport {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a001a 0%, #000 100%);
    overflow: hidden; /* Canvas handles scroll */
    cursor: grab;
    position: relative;
    border: 1px solid var(--border);
}
.techtree-viewport:active { cursor: grabbing; }

.techtree-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    transform-origin: 0 0;
}

#techtree-svg { 
    position: absolute; 
    top: 0; left: 0; 
    width: 5000px; height: 5000px; /* Large canvas area */
    pointer-events: none; 
    z-index: 1; 
}
.connector-line { stroke: var(--magenta-dim); stroke-width: 2; opacity: 0.5; fill: none; }

.tech-node {
    position: absolute;
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.85);
    border: 1px solid var(--magenta-dim);
    color: #fff;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    transition: box-shadow 0.2s, border-color 0.2s; /* No Transform transition for Drag perf */
    font-size: 0.8rem;
    clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%); 
    box-shadow: inset 0 0 10px rgba(255,0,255,0.1);
    padding: 10px 5px;
    user-select: none;
}
.tech-node:hover {
    z-index: 10;
    border-color: var(--orange);
    box-shadow: 0 0 15px var(--orange);
    color: var(--orange);
}
.tech-node.unlocked {
    border-color: var(--magenta);
    box-shadow: 0 0 15px var(--magenta), inset 0 0 20px rgba(255,0,255,0.2);
}
.tech-node.unlocked .title { color: var(--magenta); font-weight: bold; text-shadow: 0 0 5px var(--magenta); }
.tech-node.locked { opacity: 0.8; filter: grayscale(80%); }
.tech-node .cost { 
    color: var(--text-muted); 
    margin-top: 4px; 
    font-family: 'Courier New'; 
    font-size: 0.75rem; 
    font-weight:bold; 
    letter-spacing:1px;
}
.tech-node .title { 
    font-size: 0.75rem; 
    line-height: 1.1; 
    margin-bottom: 4px; 
    display:flex; 
    align-items:center; 
    justify-content:center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tech-node::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.95);
    border: 1px solid var(--orange);
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    width: 200px;
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0;
    transition: 0.2s;
    box-shadow: 0 0 10px var(--orange-dim);
    z-index: 20;
    white-space: normal;
}
.tech-node:hover::after { opacity: 1; bottom: 110%; }

.req-mini-list {
    font-size: 0.65rem;
    margin: 2px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: hidden;
    flex-grow: 1; 
    justify-content: center;
}

/* Modal Grid Layout */
.modal-node-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    text-align: left;
}
@media (max-width: 600px) {
    .modal-node-grid { grid-template-columns: 1fr; }
}

.parent-list-item {
    background: #222;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #444;
    margin-bottom: 5px;
}
