/* ==========================================================================
   Калькулятор талантов (inc/talent-calc.php, assets/js/talent-calc.js)
   ========================================================================== */

/* ---------- Хаб: карточки классов ---------- */
.tc-hub {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 14px;
	margin: 1.5em 0;
}
.tc-hub__card {
	display: grid;
	grid-template-columns: 56px 1fr;
	gap: 6px 14px;
	align-items: center;
	padding: 14px 16px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 3px solid var(--cc);
	border-radius: var(--radius);
	color: var(--text);
	text-decoration: none;
	transition: border-color .15s, transform .15s, background .15s;
}
.entry-content a.tc-hub__card,
.entry-content a.tc-classes__item { text-decoration: none; }
.tc-hub__card:hover { background: var(--surface-2); border-color: var(--cc); transform: translateY(-2px); color: var(--text); }
.entry-content .tc-hub__icon { grid-row: span 2; border-radius: 50%; box-shadow: 0 0 0 2px var(--cc); }
.tc-hub__name { font: 22px/1.1 var(--font-head); color: var(--cc); }
.entry-content .tc-hub__specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.entry-content .tc-hub__specs li { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; }
.entry-content .tc-hub__specs li::before { display: none; }
.entry-content .tc-hub__specs img { width: 20px; height: 20px; border-radius: 4px; }

/* ---------- Калькулятор ---------- */
.tc {
	--cell: 42px;
	--gx: 16px;
	--gy: 14px;
	--ok: #4fc35a;
	--off: #3a4252;
	--bad: #ff5a4f;
	margin: 1.5em 0 2em;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
}
.tc img { border-radius: 0; }

/* Переключатель классов */
.tc-classes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}
.tc-classes__item {
	display: block;
	width: 40px;
	height: 40px;
	padding: 2px;
	border-radius: 50%;
	border: 2px solid transparent;
	opacity: .55;
	transition: opacity .15s, border-color .15s;
}
.tc-classes__item img { display: block; width: 100%; height: 100%; border-radius: 50% !important; }
.tc-classes__item:hover, .tc-classes__item:focus-visible { opacity: 1; }
.tc-classes__item.is-current { opacity: 1; border-color: var(--cc); }

/* Сводка и кнопки */
.tc-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	padding: 10px 14px;
	margin-bottom: 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.tc-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; font-size: 14px; color: var(--text-2); }
.tc-summary__class { font: 20px/1.2 var(--font-head); color: var(--cc); }
.tc-summary__split { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tc-summary b { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.tc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tc-btn,
.tc-lang button {
	padding: 7px 12px;
	border: 1px solid var(--border-2);
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-2);
	font: 600 13px/1.2 var(--font-body);
	cursor: pointer;
	transition: color .15s, border-color .15s, background .15s;
}
.tc-btn:hover:not(:disabled) { color: #fff; border-color: var(--gold); }
.tc-btn:disabled { opacity: .45; cursor: default; }
.tc-btn.is-done { color: var(--ok); border-color: var(--ok); }
.tc-lang { display: inline-flex; }
.tc-lang button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.tc-lang button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.tc-lang button[aria-pressed="true"] { background: var(--gold-dim); border-color: var(--gold); color: var(--gold-2); position: relative; }

/* Вкладки веток (только на узких экранах) */
.tc-tabs { display: none; }

/* Ветки */
.tc-trees {
	display: flex;
	justify-content: center;
	gap: 10px;
}
.tc-tree {
	flex: 0 0 auto;
	background: var(--bg-2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}
.tc-tree__head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}
.tc-tree__head img { width: 26px; height: 26px; border-radius: 50% !important; flex: none; }
.entry-content .tc-tree__name {
	flex: 1;
	margin: 0;
	padding: 0;
	border: 0;
	font: 17px/1.2 var(--font-head);
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tc-tree-pts { font-variant-numeric: tabular-nums; color: var(--gold-2); }
.tc-tree__reset {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 1px solid var(--border-2);
	border-radius: 50%;
	background: transparent;
	color: var(--muted);
	font: 16px/1 var(--font-body);
	cursor: pointer;
}
.tc-tree__reset:hover { color: var(--bad); border-color: var(--bad); }

.tc-grid {
	position: relative;
	display: grid;
	grid-template-columns: repeat(4, var(--cell));
	grid-template-rows: repeat(7, var(--cell));
	gap: var(--gy) var(--gx);
	padding: 14px 10px 16px;
	box-sizing: content-box;
	isolation: isolate;
}
.tc-grid::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--bg) center / cover no-repeat;
	opacity: .22;
}

/* Таланты */
.tc-t {
	position: relative;
	z-index: 2;
	width: var(--cell);
	height: var(--cell);
	padding: 0;
	border: 2px solid var(--off);
	border-radius: 6px;
	background: #000;
	cursor: pointer;
	transition: border-color .12s, box-shadow .12s;
}
.tc-t img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 4px !important;
	pointer-events: none;
	filter: grayscale(1) brightness(.5);
	transition: filter .12s;
}
.tc-t__pts {
	position: absolute;
	right: -7px;
	bottom: -7px;
	min-width: 26px;
	padding: 1px 4px;
	border: 1px solid var(--off);
	border-radius: 5px;
	background: #0a0d12;
	color: var(--muted);
	font: 700 11px/1.3 var(--font-body);
	text-align: center;
	font-variant-numeric: tabular-nums;
	pointer-events: none;
	visibility: hidden;
}
.tc-t[data-state="open"],
.tc-t[data-state="part"] { border-color: var(--ok); }
.tc-t[data-state="max"] { border-color: var(--gold); box-shadow: 0 0 10px rgba(233, 201, 119, .35); }
.tc-t:not([data-state="locked"]) img { filter: none; }
.tc-t:not([data-state="locked"]) .tc-t__pts { visibility: visible; }
.tc-t[data-state="open"] .tc-t__pts,
.tc-t[data-state="part"] .tc-t__pts { color: var(--ok); border-color: var(--ok); }
.tc-t[data-state="max"] .tc-t__pts { color: var(--gold-2); border-color: var(--gold); }
.tc-t:hover, .tc-t:focus-visible, .tc-t.is-selected { outline: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .75); }

/* Стрелки требований */
.tc-arrow {
	position: absolute;
	z-index: 1;
	background: var(--off);
	pointer-events: none;
}
.tc-arrow::after {
	content: "";
	position: absolute;
	border: 6px solid transparent;
}
.tc-arrow.is-on { background: var(--gold); }
.tc-arrow--down {
	width: 4px;
	left: calc(10px + var(--c) * (var(--cell) + var(--gx)) + var(--cell) / 2 - 2px);
	top: calc(14px + var(--r1) * (var(--cell) + var(--gy)) + var(--cell));
	height: calc((var(--r2) - var(--r1)) * (var(--cell) + var(--gy)) - var(--cell) - 6px);
}
.tc-arrow--down::after { left: -4px; bottom: -10px; border-top-color: var(--off); }
.tc-arrow--down.is-on::after { border-top-color: var(--gold); }
.tc-arrow--right,
.tc-arrow--left {
	height: 4px;
	top: calc(14px + var(--r) * (var(--cell) + var(--gy)) + var(--cell) / 2 - 2px);
	left: calc(10px + var(--c1) * (var(--cell) + var(--gx)) + var(--cell));
	width: calc((var(--c2) - var(--c1)) * (var(--cell) + var(--gx)) - var(--cell) - 6px);
}
.tc-arrow--left { left: calc(10px + var(--c1) * (var(--cell) + var(--gx)) + var(--cell) + 6px); }
.tc-arrow--right::after { right: -10px; top: -4px; border-left-color: var(--off); }
.tc-arrow--left::after { left: -10px; top: -4px; border-right-color: var(--off); }
.tc-arrow--right.is-on::after { border-left-color: var(--gold); }
.tc-arrow--left.is-on::after { border-right-color: var(--gold); }

/* Подписи */
.entry-content .tc-help,
.entry-content .tc-source { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.entry-content .tc-source { margin-top: 4px; font-size: 12px; }
.entry-content .tc-guides { margin: 22px 0 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.entry-content .tc-guides__title { margin: 0 0 10px; font-weight: 600; color: var(--text); }
.entry-content .tc-guides__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.entry-content .tc-guides__list li { margin: 0; padding: 0; }
.entry-content .tc-guides__list li::before { content: none; }
.entry-content .tc-guides__list a { --c: var(--gold); display: inline-block; padding: 6px 12px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 999px; color: color-mix(in srgb, var(--c) 45%, #f3ead6); text-decoration: none; font-size: 14px; }
.entry-content .tc-guides__list a:hover { border-color: var(--c); color: var(--c); }
.entry-content .tc-guides__all { margin: 10px 0 0; font-size: 14px; }
.tc-help--touch { display: none; }
@media (hover: none), (pointer: coarse) {
	.tc-help--mouse { display: none; }
	.tc-help--touch { display: inline; }
}

/* Подсказка */
.tc-tip {
	position: fixed;
	z-index: 1000;
	left: 0;
	top: 0;
	width: max-content;
	max-width: min(340px, calc(100vw - 16px));
	padding: 12px 14px;
	background: rgba(9, 12, 18, .97);
	border: 1px solid var(--border-2);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow);
	color: var(--text-2);
	font: 14px/1.45 var(--font-body);
	pointer-events: none;
	user-select: text;
}
.tc-tip[hidden] { display: none; }
.tc-tip__name { margin: 0 0 2px; font: 19px/1.2 var(--font-head); color: var(--gold-2); }
.tc-tip__rank { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.tc-tip__req { margin: 0 0 6px; color: var(--bad); font-size: 13px; }
.tc-tip__desc { margin: 0; color: var(--text); }
.tc-tip__next { margin: 10px 0 2px; font-size: 13px; color: var(--muted); }
.tc-tip__note { margin: 10px 0 0; font-size: 12px; color: var(--muted); font-style: italic; }
.tc-tip .q { color: #ffd100; }
.tc-tip .q2 { color: #1eff00; }
.tc-tip .q9 { color: #71d5ff; }
.tc-tip__btns { display: none; }

/* Подсказка-шторка на сенсорных экранах */
.tc-tip.is-sheet {
	left: 8px !important;
	right: 8px;
	top: auto !important;
	bottom: calc(8px + env(safe-area-inset-bottom, 0px));
	width: auto;
	max-width: 520px;
	margin: 0 auto;
	max-height: 60vh;
	overflow-y: auto;
	padding-right: 44px;
	pointer-events: auto;
}
.tc-tip.is-sheet .tc-tip__btns { display: flex; gap: 10px; margin-top: 12px; }
.tc-tip__btns button {
	flex: 1;
	height: 44px;
	border: 1px solid var(--border-2);
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	color: var(--text);
	font: 700 22px/1 var(--font-body);
	cursor: pointer;
}
.tc-tip__btns button:disabled { opacity: .35; }
.tc-tip__btns .tc-plus:not(:disabled) { border-color: var(--ok); color: var(--ok); }
.tc-tip__close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 34px;
	height: 34px;
	border: 0;
	background: transparent;
	color: var(--muted);
	font: 22px/1 var(--font-body);
	cursor: pointer;
}
.tc-tip:not(.is-sheet) .tc-tip__close { display: none; }

/* ---------- Билд в статье ([talent_build]) ---------- */
.tb { margin: 1.25em 0 1.75em; }
.tb .tc-trees { flex-wrap: wrap; }
.tb .tc-t { cursor: help; }
.tb .tc-t[data-state="locked"] { border-color: var(--off); }
.entry-content a.tc-btn { text-decoration: none; display: inline-block; }
.tb .tc-actions .tc-btn { color: var(--gold-2); border-color: var(--gold); }
.tb .tc-actions .tc-btn:hover { background: var(--gold-dim); color: #fff; }

/* ---------- Узкие экраны: одна ветка + вкладки ---------- */
@media (max-width: 759px) {
	.tc {
		--gx: 18px;
		--gy: 16px;
		--cell: min(56px, calc((100vw - 2 * var(--gutter) - 22px - 3 * var(--gx)) / 4));
	}
	.tc-tabs {
		display: flex;
		gap: 6px;
		margin-bottom: 10px;
	}
	.tc-tabs__tab {
		flex: 1 1 0;
		min-width: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 3px;
		padding: 8px 4px;
		background: var(--surface);
		border: 1px solid var(--border);
		border-radius: var(--radius-sm);
		color: var(--text-2);
		font: 12px/1.2 var(--font-body);
		cursor: pointer;
	}
	.tc-tabs__tab img { border-radius: 50% !important; }
	.tc-tabs__tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.tc-tabs__tab[aria-selected="true"] { border-color: var(--gold); background: var(--gold-dim); color: var(--text); }
	.tc-tree { display: none; width: 100%; }
	.tc-tree.is-active,
	.tb .tc-tree { display: block; }
	.tc-grid { justify-content: center; padding-left: 0; padding-right: 0; }
	/* Отступ сетки по центру — стрелки считаем от её левого края. */
	.tc-grid { --pad: calc((100% - 4 * var(--cell) - 3 * var(--gx)) / 2); }
	.tc-arrow--down { left: calc(var(--pad) + var(--c) * (var(--cell) + var(--gx)) + var(--cell) / 2 - 2px); }
	.tc-arrow--right { left: calc(var(--pad) + var(--c1) * (var(--cell) + var(--gx)) + var(--cell)); }
	.tc-arrow--left { left: calc(var(--pad) + var(--c1) * (var(--cell) + var(--gx)) + var(--cell) + 6px); }
	.tc-classes { flex-wrap: nowrap; gap: 4px; justify-content: space-between; }
	.tc-classes__item { flex: 1 1 0; max-width: 34px; height: auto; aspect-ratio: 1; padding: 1px; }
	.tc-bar { padding: 10px 12px; }
	.tc-actions { width: 100%; flex-wrap: nowrap; gap: 6px; }
	.tc-actions .tc-btn { flex: 1; padding: 7px 6px; white-space: nowrap; }
}
@media (max-width: 379px) {
	.tc-actions { flex-wrap: wrap; }
	.tc-lang { flex: 1 0 100%; }
	.tc-lang button { flex: 1; }
}
