/* =============================================================================
   Research Tech Tree — Visual Tree View (AoE Mobile Style)
   ============================================================================= */

/* View toggle styles moved to tools-research.css (toolbar) */

/* ── Viewport (scroll container) ── */
.inv-tree-viewport {
	position: relative;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	flex: 1;
	border: none;
	border-radius: 0;
	background:
		radial-gradient(ellipse at 15% 40%, rgba(140, 25, 35, 0.3) 0%, transparent 50%),
		radial-gradient(ellipse at 75% 30%, rgba(120, 20, 30, 0.2) 0%, transparent 50%),
		radial-gradient(ellipse at 50% 80%, rgba(80, 15, 25, 0.15) 0%, transparent 55%),
		radial-gradient(ellipse at 90% 70%, rgba(60, 10, 20, 0.1) 0%, transparent 50%),
		linear-gradient(180deg, rgba(15, 5, 10, 0.98) 0%, rgba(8, 3, 8, 0.99) 100%);
	transition: background 0.5s;
}

/* Category-specific backgrounds */
.inv-tree-viewport--military {
	background:
		radial-gradient(ellipse at 15% 40%, rgba(140, 25, 35, 0.3) 0%, transparent 50%),
		radial-gradient(ellipse at 75% 30%, rgba(120, 20, 30, 0.2) 0%, transparent 50%),
		radial-gradient(ellipse at 50% 80%, rgba(80, 15, 25, 0.15) 0%, transparent 55%),
		radial-gradient(ellipse at 90% 70%, rgba(60, 10, 20, 0.1) 0%, transparent 50%),
		linear-gradient(180deg, rgba(15, 5, 10, 0.98) 0%, rgba(8, 3, 8, 0.99) 100%);
}

.inv-tree-viewport--economy {
	background:
		radial-gradient(ellipse at 15% 40%, rgba(140, 120, 25, 0.25) 0%, transparent 50%),
		radial-gradient(ellipse at 75% 30%, rgba(120, 100, 20, 0.18) 0%, transparent 50%),
		radial-gradient(ellipse at 50% 80%, rgba(80, 65, 15, 0.12) 0%, transparent 55%),
		radial-gradient(ellipse at 90% 70%, rgba(60, 50, 10, 0.08) 0%, transparent 50%),
		linear-gradient(180deg, rgba(15, 12, 5, 0.98) 0%, rgba(8, 6, 3, 0.99) 100%);
}

.inv-tree-viewport--castle {
	background:
		radial-gradient(ellipse at 15% 40%, rgba(100, 30, 140, 0.25) 0%, transparent 50%),
		radial-gradient(ellipse at 75% 30%, rgba(80, 25, 120, 0.18) 0%, transparent 50%),
		radial-gradient(ellipse at 50% 80%, rgba(60, 15, 90, 0.12) 0%, transparent 55%),
		radial-gradient(ellipse at 90% 70%, rgba(45, 10, 70, 0.08) 0%, transparent 50%),
		linear-gradient(180deg, rgba(12, 5, 18, 0.98) 0%, rgba(8, 3, 12, 0.99) 100%);
}

.inv-tree-viewport::-webkit-scrollbar {
	height: 8px;
	width: 8px;
}

.inv-tree-viewport::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.4);
	border-radius: 4px;
}

.inv-tree-viewport::-webkit-scrollbar-thumb {
	background: rgba(180, 100, 40, 0.35);
	border-radius: 4px;
}

.inv-tree-viewport::-webkit-scrollbar-thumb:hover {
	background: rgba(180, 100, 40, 0.55);
}

/* ── Canvas (full-size tree area) ── */
.inv-tree-canvas {
	position: relative;
	min-width: max-content;
	padding: 2.5rem 3rem;
}

/* ── SVG Lines ── */
.inv-tree-lines {
	position: absolute;
	top: 0;
	left: 0;
	pointer-events: none;
	z-index: 1;
}

.inv-tree-line {
	stroke: rgba(255, 255, 255, 0.55);
	stroke-width: 2.5;
	fill: none;
	stroke-linecap: square;
	stroke-linejoin: miter;
	transition: stroke 0.25s, stroke-width 0.25s;
}

.inv-tree-line--highlighted {
	stroke: rgba(245, 200, 80, 0.9);
	stroke-width: 3.5;
}

/* ── Lane Labels ── */
.inv-tree-lane-label {
	position: absolute;
	left: 0;
	z-index: 2;
	font-size: 0.55rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: rgba(200, 160, 80, 0.15);
	writing-mode: vertical-lr;
	transform: rotate(180deg);
	white-space: nowrap;
	pointer-events: none;
}

/* ── Node Base ── */
.inv-tree-node {
	position: absolute;
	z-index: 2;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	transition: transform 0.15s ease, filter 0.15s;
}

.inv-tree-node--research {
	width: 66px;
}

.inv-tree-node:hover {
	transform: scale(1.06);
	z-index: 5;
}

/* =============================================================================
   RESEARCH NODE — Circular with game-accurate PNG frame overlay
   ============================================================================= */

.inv-tree-node--research .inv-tree-node__circle {
	width: 66px;
	height: 66px;
	border-radius: 50%;
	border: none;
	background: radial-gradient(circle at 40% 35%, rgba(60, 15, 22, 0.95), rgba(18, 6, 10, 0.98));
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	position: relative;
	transition: filter 0.2s, box-shadow 0.2s;
}

/* PNG frame overlay — sits exactly on the circle edge */
.inv-tree-node--research .inv-tree-node__circle-deco {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: none;
	background: url('../images/research-frame.webp') center / contain no-repeat;
	pointer-events: none;
	z-index: 2;
}

.inv-tree-node--research .inv-tree-node__circle-deco::before {
	display: none;
}

/* Castle category uses a different (purple) frame + background */
.inv-tree-viewport--castle .inv-tree-node--research .inv-tree-node__circle-deco {
	background-image: url('../images/research-frame-castle.webp');
}
.inv-tree-viewport--castle .inv-tree-node--research .inv-tree-node__circle {
	background: radial-gradient(circle at 40% 35%, rgba(25, 15, 45, 0.95), rgba(10, 6, 18, 0.98));
}
.inv-tree-viewport--castle .inv-tree-node--research:hover .inv-tree-node__circle {
	box-shadow: 0 0 18px rgba(168, 85, 247, 0.25);
}
.inv-tree-viewport--castle .inv-tree-node--complete .inv-tree-node__circle {
	box-shadow: 0 0 16px rgba(168, 85, 247, 0.3), 0 0 6px rgba(168, 85, 247, 0.15);
}

.inv-tree-node--research:hover .inv-tree-node__circle {
	box-shadow: 0 0 18px rgba(200, 80, 90, 0.25);
}

/* Economy category — gold palette */
.inv-tree-viewport--economy .inv-tree-node--research .inv-tree-node__circle {
	background: radial-gradient(circle at 40% 35%, rgba(60, 42, 10, 0.95), rgba(22, 15, 5, 0.98));
}
.inv-tree-viewport--economy .inv-tree-node--research .inv-tree-node__circle-deco {
	background-image: url('../images/research-frame-economy.webp');
	border: none;
	box-shadow: none;
}
.inv-tree-viewport--economy .inv-tree-node--research .inv-tree-node__icon {
	filter: none;
}
.inv-tree-viewport--economy .inv-tree-node--research .inv-tree-node__icon--placeholder {
	color: rgba(245, 200, 80, 0.85);
}
.inv-tree-viewport--economy .inv-tree-node__label {
	max-width: 170px;
	-webkit-line-clamp: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.inv-tree-viewport--economy .inv-tree-node--research:hover .inv-tree-node__circle {
	box-shadow: 0 0 18px rgba(245, 158, 11, 0.35);
}
.inv-tree-viewport--economy .inv-tree-node--complete .inv-tree-node__circle {
	box-shadow: 0 0 16px rgba(245, 158, 11, 0.4), 0 0 6px rgba(245, 158, 11, 0.2);
}

.inv-tree-node--research .inv-tree-node__icon {
	width: 66px;
	height: 66px;
	object-fit: cover;
	object-position: center;
	filter: brightness(1.1);
	position: relative;
	z-index: 1;
}

.inv-tree-node--research .inv-tree-node__icon--placeholder {
	width: 46px;
	height: 46px;
	color: rgba(200, 140, 150, 0.5);
	position: relative;
	z-index: 1;
}

/* =============================================================================
   UNIT NODE — Horizontal card with portrait (game-accurate shield/badge shape)
   ============================================================================= */

.inv-tree-node--unit .inv-tree-node__card {
	width: 160px;
	height: 64px;
	display: flex;
	align-items: center;
	gap: 0;
	padding: 0;
	overflow: visible;
	position: relative;
	transition: border-color 0.2s, box-shadow 0.2s;
}

/* Oval background behind the card — separate layer so it doesn't clip the portrait */
.inv-tree-node--unit .inv-tree-node__card::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 32px;
	border: 2px solid rgba(180, 140, 60, 0.5);
	background:
		linear-gradient(135deg, rgba(70, 40, 20, 0.9) 0%, rgba(35, 18, 10, 0.95) 50%, rgba(50, 30, 15, 0.9) 100%);
	box-shadow:
		0 0 0 2px rgba(120, 80, 30, 0.15),
		inset 0 0 10px rgba(0, 0, 0, 0.3);
	z-index: 0;
}

/* Decorative background element — hidden when portrait present */
.inv-tree-node--unit .inv-tree-node__card-deco {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 24px;
	height: 24px;
	opacity: 0.12;
	pointer-events: none;
	z-index: 0;
}

.inv-tree-node--unit:hover .inv-tree-node__card::before {
	border-color: rgba(210, 170, 70, 0.7);
	box-shadow:
		0 0 0 2px rgba(160, 120, 40, 0.25),
		0 0 18px rgba(200, 150, 50, 0.12),
		inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.inv-tree-node--unit .inv-tree-node__portrait {
	height: 80px;
	width: auto;
	max-width: 164px;
	object-fit: contain;
	position: relative;
	z-index: 2;
	margin: -17px 3px -8px -4px;
	flex-shrink: 0;
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

/* Hide deco when portrait exists */
.inv-tree-node--unit .inv-tree-node__portrait ~ .inv-tree-node__card-deco,
.inv-tree-node--unit .inv-tree-node__card-deco:has(~ .inv-tree-node__portrait) {
	display: none;
}

.inv-tree-node--unit .inv-tree-node__portrait--placeholder {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	margin-left: 3px;
	background: rgba(80, 40, 20, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	border: 1.5px solid rgba(180, 140, 60, 0.25);
}

.inv-tree-node--unit .inv-tree-node__portrait--placeholder svg {
	width: 22px;
	height: 22px;
	color: rgba(180, 140, 60, 0.4);
}

/* Tier badge — Roman numeral in circle */
.inv-tree-node__tier-badge {
	position: absolute;
	bottom: -2px;
	left: 8px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: linear-gradient(135deg, rgba(160, 50, 50, 0.95), rgba(120, 30, 30, 0.95));
	border: 1.5px solid rgba(200, 80, 80, 0.6);
	color: #fff;
	font-size: 0.5rem;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	z-index: 2;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* =============================================================================
   NODE LABEL — Dark banner below node (game style)
   ============================================================================= */

.inv-tree-node__label {
	margin-top: 5px;
	font-size: 0.62rem;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.85);
	text-align: center;
	max-width: 120px;
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	background: rgba(0, 0, 0, 0.7);
	padding: 2px 8px;
	border-radius: 3px;
}

.inv-tree-node__level {
	font-size: 0.56rem;
	font-weight: 700;
	color: rgba(200, 160, 80, 0.8);
	margin-top: 2px;
}

/* =============================================================================
   NODE DETAIL PANEL
   ============================================================================= */

.inv-tree-detail {
	position: fixed;
	top: 0;
	right: 0;
	width: 380px;
	max-width: 100vw;
	height: 100vh;
	background:
		linear-gradient(180deg, rgba(20, 8, 12, 0.99) 0%, rgba(10, 4, 8, 0.99) 100%);
	border-left: 1px solid rgba(140, 60, 60, 0.2);
	z-index: 1000;
	transform: translateX(100%);
	transition: transform 0.3s ease;
	overflow-y: auto;
	padding: 1.5rem;
}

.inv-tree-detail--open {
	transform: translateX(0);
}

.inv-tree-detail__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 999;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s;
}

.inv-tree-detail__backdrop--open {
	opacity: 1;
	pointer-events: auto;
}

.inv-tree-detail__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 50%;
	color: rgba(255, 255, 255, 0.5);
	font-size: 1.1rem;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	line-height: 1;
	z-index: 10;
	-webkit-tap-highlight-color: transparent;
}

.inv-tree-detail__close:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.12);
}

.inv-tree-detail__header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
}

.inv-tree-detail__icon {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 2px solid rgba(160, 70, 80, 0.5);
	object-fit: contain;
	background: rgba(40, 15, 20, 0.6);
	box-shadow: 0 0 0 3px rgba(100, 30, 40, 0.2);
}

.inv-tree-detail__name {
	font-size: 1rem;
	font-weight: 700;
	color: #fff;
}

.inv-tree-detail__meta {
	font-size: 0.72rem;
	color: rgba(200, 160, 80, 0.6);
	margin-top: 0.15rem;
}

.inv-tree-detail__section {
	margin-top: 1.25rem;
}

.inv-tree-detail__section-title {
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: rgba(200, 160, 80, 0.5);
	margin-bottom: 0.5rem;
}

/* =============================================================================
   LOADING & EMPTY STATES
   ============================================================================= */

.inv-tree-viewport--loading {
	min-height: 300px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.inv-tree-viewport--loading::after {
	content: '';
	width: 32px;
	height: 32px;
	border: 3px solid rgba(160, 70, 80, 0.2);
	border-top-color: rgba(200, 100, 110, 0.8);
	border-radius: 50%;
	animation: inv-tree-spin 0.7s linear infinite;
}

@keyframes inv-tree-spin {
	to { transform: rotate(360deg); }
}

.inv-tree-empty {
	text-align: center;
	padding: 3rem 1rem;
	color: rgba(200, 160, 80, 0.4);
	font-size: 0.85rem;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
	.inv-tree-viewport {
		min-height: 55vh;
	}

	.inv-tree-canvas {
		padding: 1.5rem;
	}

	/* Mobile research nodes: same as desktop */

	.inv-tree-node--unit .inv-tree-node__card {
		width: 160px;
		height: 64px;
	}

	.inv-tree-node--unit .inv-tree-node__portrait {
		height: 80px;
		width: auto;
	}

	.inv-tree-node__label {
		font-size: 0.5rem;
		max-width: 90px;
		padding: 1px 5px;
	}

	.inv-tree-detail {
		width: 100vw;
		border-left: none;
		border-top: 1px solid rgba(140, 60, 60, 0.2);
	}
}

/* ── Progress States ── */
.inv-tree-node--complete .inv-tree-node__circle {
	box-shadow: 0 0 16px rgba(245, 158, 11, 0.3), 0 0 6px rgba(245, 158, 11, 0.15);
}

.inv-tree-node--complete .inv-tree-node__level {
	background: rgba(34, 197, 94, 0.2);
	color: #22c55e;
}

.inv-tree-node--in-progress .inv-tree-node__circle {
	box-shadow: none;
}

.inv-tree-node--in-progress .inv-tree-node__level {
	background: rgba(245, 158, 11, 0.2);
	color: #f59e0b;
}

.inv-tree-node--complete .inv-tree-node__card::before {
	box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
	border-color: rgba(245, 158, 11, 0.5);
}

/* ── Detail Panel — Level Picker ── */
.inv-tree-detail__progress {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
}

.inv-tree-detail__lvl-btn {
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.04);
	color: #c8cce8;
	font-size: 1rem;
	cursor: pointer;
	transition: all 0.15s;
}

.inv-tree-detail__lvl-btn:hover {
	background: rgba(245, 158, 11, 0.15);
	border-color: rgba(245, 158, 11, 0.4);
	color: #f59e0b;
}

.inv-tree-detail__lvl-val {
	font-family: 'Rajdhani', sans-serif;
	font-size: 1rem;
	font-weight: 700;
	color: #f59e0b;
	min-width: 20px;
	text-align: center;
}

/* ── Locked State ── */
.inv-tree-node--locked {
	opacity: 0.75;
	filter: saturate(0.15) brightness(0.75);
}

.inv-tree-node--locked:hover {
	opacity: 0.9;
	filter: saturate(0.3) brightness(0.85);
}

.inv-tree-node__lock {
	position: absolute;
	bottom: -6px;
	left: 50%;
	transform: translateX(-50%);
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(20, 12, 8, 0.95);
	border: 1.5px solid rgba(255, 255, 255, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, 0.6);
	z-index: 4;
	pointer-events: none;
}

.inv-tree-node--research .inv-tree-node__lock {
	bottom: auto;
	top: -2px;
	left: auto;
	right: -2px;
	transform: none;
}

/* Detail panel locked message */
.inv-tree-detail__locked {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin-top: 6px;
	padding: 6px 10px;
	border-radius: 6px;
	background: rgba(239, 68, 68, 0.08);
	border: 1px solid rgba(239, 68, 68, 0.15);
	color: rgba(239, 68, 68, 0.8);
	font-size: 0.7rem;
	font-weight: 500;
	line-height: 1.4;
}

.inv-tree-detail__locked svg {
	flex-shrink: 0;
	margin-top: 1px;
}

/* ── Detail Panel — Research Button ── */
.inv-tree-detail__progress {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
}

.inv-tree-detail__lvl-display {
	font-family: 'Rajdhani', sans-serif;
	font-size: 0.85rem;
	font-weight: 700;
	color: #f59e0b;
}

.inv-tree-detail__research-btn {
	background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
	color: #000;
	border: none;
	border-radius: 6px;
	padding: 4px 14px;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	cursor: pointer;
	transition: opacity 0.15s, transform 0.1s;
}

.inv-tree-detail__research-btn:hover {
	opacity: 0.85;
}

.inv-tree-detail__research-btn:active {
	transform: scale(0.96);
}

.inv-tree-detail__max-btn {
	background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.9));
	color: #000;
	border: none;
	border-radius: 6px;
	padding: 4px 10px;
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	cursor: pointer;
	transition: opacity 0.15s;
}
.inv-tree-detail__max-btn:hover { opacity: 0.85; }

.inv-tree-detail__undo-btn {
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 5px;
	background: rgba(255, 255, 255, 0.04);
	color: rgba(255, 255, 255, 0.4);
	font-size: 0.9rem;
	cursor: pointer;
	transition: all 0.15s;
	margin-left: auto;
}

.inv-tree-detail__undo-btn:hover {
	background: rgba(239, 68, 68, 0.1);
	border-color: rgba(239, 68, 68, 0.3);
	color: #ef4444;
}

.inv-tree-detail__maxed {
	font-size: 0.72rem;
	font-weight: 600;
	color: #22c55e;
}

/* ── Detail Panel — Game-style Level Info ── */

.inv-detail-next {
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 10px;
	padding: 12px 14px;
	margin-bottom: 12px;
}

.inv-detail-next__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 8px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	margin-bottom: 10px;
}

.inv-detail-next__label {
	font-size: 0.78rem;
	color: rgba(255, 255, 255, 0.5);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.inv-detail-next__lvl {
	font-size: 0.88rem;
	font-weight: 700;
}

.inv-detail-next__cur {
	color: rgba(255, 255, 255, 0.6);
}

.inv-detail-next__new {
	color: #22c55e;
}

.inv-detail-next__title {
	font-size: 0.72rem;
	color: #f59e0b;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin-bottom: 8px;
}

.inv-detail-next__resources {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.inv-detail-res {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.78rem;
}

.inv-detail-res--time {
	margin-top: 4px;
	padding-top: 6px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.inv-detail-res__label {
	color: rgba(255, 255, 255, 0.55);
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 4px;
}

.inv-detail-res__val { font-weight: 700; }
.inv-detail-res__val--food    { color: #a3e635; }
.inv-detail-res__val--wood    { color: #c08b5c; }
.inv-detail-res__val--stone   { color: #94a3b8; }
.inv-detail-res__val--gold    { color: #fbbf24; }
.inv-detail-res__val--torches { color: #fb923c; }
.inv-detail-res__val--time    { color: #60a5fa; }
.inv-detail-res__val--power   { color: #c084fc; }

.inv-detail-res-icon {
	width: 16px;
	height: 16px;
	object-fit: contain;
	vertical-align: middle;
}

.inv-detail-complete {
	text-align: center;
	color: #22c55e;
	font-weight: 700;
	font-size: 0.85rem;
	padding: 12px;
	background: rgba(34, 197, 94, 0.08);
	border: 1px solid rgba(34, 197, 94, 0.2);
	border-radius: 10px;
	margin-bottom: 12px;
}

/* Spent / Remaining summary cards */
.inv-detail-summary {
	border-radius: 8px;
	padding: 10px 12px;
	margin-bottom: 8px;
}

.inv-detail-summary--spent {
	background: rgba(34, 197, 94, 0.06);
	border: 1px solid rgba(34, 197, 94, 0.15);
}

.inv-detail-summary--remaining {
	background: rgba(251, 146, 60, 0.06);
	border: 1px solid rgba(251, 146, 60, 0.15);
}

.inv-detail-summary__title {
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 6px;
}

.inv-detail-summary--spent .inv-detail-summary__title    { color: #22c55e; }
.inv-detail-summary--remaining .inv-detail-summary__title { color: #fb923c; }

.inv-detail-summary__grid {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 12px;
	font-size: 0.74rem;
	font-weight: 600;
}

/* ── Target Badge on Tree Node ── */
.inv-tree-node--target {
	filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5)) drop-shadow(0 0 16px rgba(59, 130, 246, 0.25));
}

.inv-tree-node__target-badge {
	position: absolute;
	top: -8px;
	right: -8px;
	font-size: 16px;
	line-height: 1;
	z-index: 5;
	filter: drop-shadow(0 0 3px rgba(0,0,0,0.7));
}

/* ── Target / Goal Button ── */
.inv-target-btn {
	display: block;
	width: 100%;
	padding: 10px;
	margin-top: 12px;
	background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
	border: 1px solid rgba(59, 130, 246, 0.3);
	border-radius: 8px;
	color: #60a5fa;
	font-weight: 700;
	font-size: 0.82rem;
	cursor: pointer;
	transition: all 0.2s;
	text-align: center;
}
.inv-target-btn:hover {
	background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(139, 92, 246, 0.25));
	border-color: #3b82f6;
}

.inv-target-btn--active {
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.1));
	border-color: rgba(239, 68, 68, 0.3);
	color: #ef4444;
}
.inv-target-btn--active:hover {
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.15));
	border-color: #ef4444;
}

/* ── Target Summary ── */
.inv-target-summary {
	margin-top: 12px;
	border: 1px solid rgba(59, 130, 246, 0.25);
	border-radius: 10px;
	overflow: hidden;
}

.inv-target-summary__header {
	background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12));
	padding: 10px 14px;
	font-size: 0.82rem;
	font-weight: 700;
	color: #93c5fd;
}

.inv-target-warning {
	padding: 8px 14px;
	background: rgba(234, 179, 8, 0.08);
	border-bottom: 1px solid rgba(234, 179, 8, 0.15);
	color: #eab308;
	font-size: 0.72rem;
	font-weight: 600;
	line-height: 1.4;
}

.inv-target-warning__list {
	color: rgba(255, 255, 255, 0.45);
	font-weight: 400;
	font-size: 0.68rem;
}

.inv-target-summary__total {
	padding: 10px 14px;
	background: rgba(59, 130, 246, 0.06);
}

.inv-target-summary__total .inv-detail-summary__title {
	color: #60a5fa;
}

.inv-target-summary__steps {
	padding: 8px 14px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	max-height: 360px;
	overflow-y: auto;
}

.inv-target-step {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 4px 0;
	font-size: 0.72rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.inv-target-step:last-child { border-bottom: none; }

.inv-target-step__name {
	color: rgba(255, 255, 255, 0.7);
	font-weight: 500;
}

.inv-target-step__lvl {
	color: #f59e0b;
	font-weight: 700;
	font-size: 0.7rem;
}

.inv-target-step--missing {
	opacity: 0.5;
}
.inv-target-step--missing .inv-target-step__name {
	color: #eab308;
}

/* ══════════════════════════════════════════════════════════════════════
   Mercenary Training Tree — Radial Layout
   ══════════════════════════════════════════════════════════════════════ */

.inv-tree-viewport--mercenary {
	background:
		radial-gradient(ellipse at 50% 50%, rgba(16, 80, 60, 0.25) 0%, transparent 50%),
		radial-gradient(ellipse at 25% 35%, rgba(10, 60, 45, 0.18) 0%, transparent 50%),
		radial-gradient(ellipse at 75% 65%, rgba(8, 50, 35, 0.12) 0%, transparent 55%),
		linear-gradient(180deg, rgba(5, 12, 10, 0.98) 0%, rgba(3, 8, 6, 0.99) 100%);
}

/* SVG connection lines */
.inv-merc-line {
	stroke: rgba(200, 170, 80, 0.2);
	stroke-width: 2;
	fill: none;
}
.inv-merc-line--skill {
	stroke: rgba(200, 170, 80, 0.12);
	stroke-width: 1.5;
}

/* Stage toggle */
.inv-merc-stage-toggle {
	display: flex;
	gap: 0;
	background: rgba(0, 0, 0, 0.7);
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	overflow: hidden;
}
.inv-merc-stage-btn {
	padding: 8px 24px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #6b7494;
	background: transparent;
	border: none;
	cursor: pointer;
	transition: all 0.2s;
	display: inline-flex;
	align-items: center;
}
.inv-merc-stage-btn--active {
	color: #f0f4ff;
	background: linear-gradient(180deg, rgba(180, 140, 50, 0.3), rgba(120, 90, 30, 0.2));
	box-shadow: inset 0 -2px 0 #f59e0b;
}
.inv-merc-stage-btn--locked {
	opacity: 0.4;
	cursor: not-allowed;
}
.inv-merc-stage-btn:hover:not(.inv-merc-stage-btn--active):not(.inv-merc-stage-btn--locked) {
	color: #8b95b0;
	background: rgba(255, 255, 255, 0.03);
}

/* Skill nodes */
.inv-merc-skill {
	transition: transform 0.15s, filter 0.15s;
	z-index: 5;
}
.inv-merc-skill:hover {
	transform: scale(1.15);
	z-index: 10;
}
.inv-merc-skill--locked {
	opacity: 0.35;
	pointer-events: none;
}

/* Hub center */
.inv-merc-hub {
	z-index: 6;
	pointer-events: none;
}

/* Center node */
.inv-merc-center {
	z-index: 7;
}

/* Overview button hover */
.inv-merc-overview-btn:hover { color: #f59e0b; }
.inv-merc-overview-btn:hover img { filter: brightness(1.3); }

/* Overview Modal */
.inv-merc-overview-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}
.inv-merc-overview-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(4px);
}
.inv-merc-overview {
	position: relative;
	z-index: 1;
	width: 90%;
	max-width: 600px;
	max-height: 85vh;
	overflow-y: auto;
	background: linear-gradient(180deg, #0f1923 0%, #0a1118 100%);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	padding: 0;
}
.inv-merc-overview__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.inv-merc-overview__title {
	font-family: 'Rajdhani', sans-serif;
	font-size: 1.2rem;
	font-weight: 700;
	color: #f59e0b;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin: 0;
}
.inv-merc-overview__close {
	background: none;
	border: none;
	color: #6b7494;
	font-size: 24px;
	cursor: pointer;
	line-height: 1;
	padding: 0 4px;
}
.inv-merc-overview__close:hover { color: #f0f4ff; }

.inv-merc-overview__section {
	border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.inv-merc-overview__unit-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px 20px;
	background: rgba(255, 255, 255, 0.02);
	border: none;
	cursor: pointer;
	color: #d4c5a0;
	font-family: 'Rajdhani', sans-serif;
	font-size: 0.85rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	text-align: left;
	transition: background 0.15s;
}
.inv-merc-overview__unit-btn:hover { background: rgba(255, 255, 255, 0.04); }
.inv-merc-overview__unit-btn span:first-of-type { flex: 1; }
.inv-merc-overview__chevron {
	font-size: 10px;
	color: #6b7494;
}

.inv-merc-overview__skills {
	padding: 0 20px 12px;
}
.inv-merc-overview__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.inv-merc-overview__row:last-child { border-bottom: none; }
.inv-merc-overview__label {
	color: #8b95b0;
	font-size: 0.8rem;
}
.inv-merc-overview__value {
	color: #6b7494;
	font-size: 0.85rem;
	font-weight: 700;
	font-family: 'Rajdhani', sans-serif;
}
.inv-merc-overview__value--active {
	color: #f0f4ff;
}
