/* Diablo 4: доски совершенствования и дерево умений — inc/d4-paragon.php */
.d4p {
	--d4p-bg: #120c0b; --d4p-line: #3b2722; --d4p-bronze: #7a5a3a; --d4p-taken: #e2412f;
	--d4p-common: #b3a99a; --d4p-magic: #5c8bff; --d4p-rare: #f2d04b; --d4p-legendary: #f58228; --d4p-glyph: #d57bff; --d4p-gate: #4fd1a5; --d4p-start: #4fd1a5;
	margin: 24px 0; padding: 14px; background: var(--d4p-bg); border: 1px solid var(--d4p-line); border-radius: 6px;
}
.d4p:not(.is-js) .d4p__app { display: none; }
.d4p__bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.d4p__btn, .d4p__tool {
	cursor: pointer; color: #c9bfb2; background: #1d1412; border: 1px solid var(--d4p-line); border-radius: 3px;
	font: 500 14px/1.25 var(--font-body);
}
.d4p__btn { min-height: 40px; padding: 6px 12px; }
.d4p__btn:hover, .d4p__tool:hover { border-color: var(--d4p-bronze); color: #f1e6d4; }
.d4p__btn[aria-pressed="true"], .d4p__tool[aria-pressed="true"] { color: #f1e6d4; background: #3a201a; border-color: #c25a3a; }
.d4p__btn small { color: #9d9186; margin-left: 4px; }
.d4p__btn b { color: var(--d4p-legendary); font-weight: 600; }

/* ---------- поле ---------- */
.d4p__view {
	position: relative; overflow: hidden; height: clamp(440px, 74vh, 660px);
	background: radial-gradient(ellipse at 50% 40%, #1c1412, #070505 80%);
	border: 1px solid var(--d4p-line); border-radius: 4px;
	cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.d4p__view.is-drag { cursor: grabbing; }
.d4p__stage { position: absolute; inset: 0; }
.d4p__svg { display: block; width: 100%; height: 100%; }
.d4p__loading { display: grid; place-items: center; height: 100%; color: #9d9186; font-size: 14px; }
.d4p__tools { position: absolute; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: calc(100% - 16px); cursor: default; }
.d4p__tool { min-width: 40px; height: 40px; padding: 0 10px; font-size: 20px; background: rgba(29, 20, 18, .94); }
.d4p__tool--wide { font-size: 13px; }

.d4p__board-bg { fill: rgba(30, 21, 19, .55); stroke: #7c2a20; stroke-width: .8; }
.d4p__links { fill: none; stroke: var(--d4p-taken); stroke-width: 2.2; }
.d4p__label { pointer-events: none; }
.d4p__label text { font: 600 8px var(--font-body); fill: #f1e6d4; paint-order: stroke; stroke: #0c0807; stroke-width: 2px; }
.d4p__label .d4p__label-glyph { font-size: 6.4px; font-weight: 500; fill: var(--d4p-glyph); }
.d4p__label .d4p__label-turn { font-size: 5.6px; font-weight: 400; fill: #9d9186; }

/* ---------- клетки ---------- */
.d4p-t { --k: var(--d4p-common); cursor: pointer; }
.d4p-t--magic { --k: var(--d4p-magic); }
.d4p-t--rare { --k: var(--d4p-rare); }
.d4p-t--legendary { --k: var(--d4p-legendary); }
.d4p-t--glyph { --k: var(--d4p-glyph); }
.d4p-t--gate { --k: var(--d4p-gate); }
.d4p-t--start { --k: var(--d4p-start); }
.d4p-t__bg { fill: color-mix(in srgb, var(--k) 8%, #100b0a); stroke: color-mix(in srgb, var(--k) 38%, #100b0a); stroke-width: .6; }
.d4p-t image { opacity: .3; }
.d4p-t.is-on .d4p-t__bg { fill: color-mix(in srgb, var(--k) 58%, #140c0a); stroke: var(--d4p-taken); stroke-width: 1.1; }
.d4p-t--common.is-on .d4p-t__bg { fill: #3a2a24; }
.d4p-t.is-on image { opacity: 1; }
.d4p-t--legendary .d4p-t__bg { stroke-width: 1; }
.d4p-t--glyph .d4p-t__bg { stroke: var(--k); }
.d4p-t--glyph.is-on .d4p-t__bg { stroke: var(--k); stroke-width: 1.4; }
.d4p-t--glyph image { opacity: 1; }
.d4p-t:hover .d4p-t__bg, .d4p-t.is-picked .d4p-t__bg { stroke: #fff; stroke-width: 1.3; }
.d4p-t.is-picked image { opacity: 1; }
.d4p__board.show-radius .d4p-t.in-radius .d4p-t__bg,
.d4p.all-radius .d4p-t.in-radius .d4p-t__bg { stroke: var(--d4p-glyph); stroke-width: 1.3; }
.d4p__board.show-radius .d4p-t.in-radius:not(.is-on) .d4p-t__bg,
.d4p.all-radius .d4p-t.in-radius:not(.is-on) .d4p-t__bg { fill: #2a1830; stroke-width: .8; }

/* ---------- дерево умений ---------- */
.d4t-line { fill: none; stroke: #3a3230; stroke-width: 5; stroke-linecap: round; }
.d4t-line.is-on { stroke: var(--d4p-taken); stroke-width: 6; }
.d4t-joint { fill: #1b1514; stroke: #4a403c; stroke-width: 2; }
.d4t-joint.is-on { fill: #5a1d16; stroke: var(--d4p-taken); }
.d4t-cat circle { fill: #170f0e; stroke: var(--d4p-bronze); stroke-width: 3; }
.d4t-cat text { font: 400 30px var(--font-head); fill: #f1e6d4; text-anchor: middle; paint-order: stroke; stroke: #0c0807; stroke-width: 7px; }
.d4t { --k: #8a7f74; }
.d4t--skill { --k: var(--d4p-legendary); }
.d4t--variant { --k: var(--d4p-glyph); }
.d4t .d4p-t__bg { fill: #15100f; stroke: #4a403c; stroke-width: 3; }
.d4t--skill .d4p-t__bg { stroke: var(--d4p-bronze); }
.d4t image { opacity: .38; }
.d4t--skill image { opacity: .6; clip-path: circle(50%); }
.d4t--passive image { clip-path: circle(50%); }
.d4t--variant image { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.d4t.is-on .d4p-t__bg { fill: color-mix(in srgb, var(--k) 30%, #140c0a); stroke: var(--d4p-taken); stroke-width: 4.5; }
.d4t.is-on image, .d4t.is-picked image { opacity: 1; }
.d4t:hover .d4p-t__bg, .d4t.is-picked .d4p-t__bg { stroke: #fff; stroke-width: 4; }
.d4t-rank { fill: #160d0b; stroke: var(--d4p-taken); stroke-width: 2; }
.d4t-rank-text { font: 600 16px var(--font-body); fill: #fff; text-anchor: middle; }
.d4t-name { font: 600 17px var(--font-body); fill: #cfc4b6; text-anchor: middle; paint-order: stroke; stroke: #0c0807; stroke-width: 5px; pointer-events: none; }
.d4t-name.is-on { fill: #fff; }
.d4p__tip--skill { --k: var(--d4p-legendary); }
.d4p__tip--variant { --k: var(--d4p-glyph); }
.d4p__key--skill { --k: var(--d4p-legendary); }
.d4p__key--passive { --k: var(--d4p-common); }
.d4p__key--variant { --k: var(--d4p-glyph); }
.d4p ul.d4p__legend li.d4p__key--skill::before, .d4p ul.d4p__legend li.d4p__key--passive::before { border-radius: 50%; }
.d4p ul.d4p__legend li.d4p__key--variant::before { transform: rotate(45deg); border-radius: 0; }

.d4t-step { pointer-events: none; }
.d4t-step circle { fill: #f2d04b; stroke: #160d0b; stroke-width: 2.5; }
.d4t-step text { font: 700 14px var(--font-body); fill: #160d0b; text-anchor: middle; }

/* ---------- порядок прокачки [d4_skillorder] ---------- */
.d4t-order { margin: 16px 0 24px; }
.d4t-order ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: none; }
.d4t-order li { margin: 0; padding: 0; }
.d4t-order li::before, .d4t-order li::marker { content: none; display: none; }
.d4t-order button {
	display: grid; grid-template-columns: 52px 36px 1fr; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 6px 10px 6px 6px;
	text-align: left; cursor: pointer; color: #d6ccbe; background: #191110; border: 1px solid #3b2722; border-radius: 3px; font: 400 14px/1.3 var(--font-body);
}
.d4t-order button:hover, .d4t-order button:focus-visible { border-color: #c25a3a; background: #23160f; }
.d4t-order__n { font: 700 14px var(--font-body); color: #f2d04b; text-align: center; white-space: nowrap; }
.d4t-order img { width: 36px; height: 36px; margin: 0; border-radius: 50%; border: 1px solid #7a5a3a; background: #100b0a; }
.d4t-order__mod img { border-radius: 6px; }
.d4t-order b { display: block; font-weight: 600; color: #f1e6d4; }
.d4t-order small { display: block; font-size: 12px; color: #9d9186; }
.d4t-order__hint { margin: 8px 0 0; font-size: 13px; color: #9d9186; }

/* ---------- всплывающее окно ---------- */
.d4p__tip {
	--k: var(--d4p-common);
	position: absolute; z-index: 2; width: 290px; padding: 12px; cursor: default; pointer-events: none;
	background: rgba(14, 10, 9, .97); border: 1px solid color-mix(in srgb, var(--k) 55%, var(--d4p-line)); border-top: 2px solid var(--k); border-radius: 4px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.d4p__tip[hidden] { display: none; }
.d4p__tip--magic { --k: var(--d4p-magic); }
.d4p__tip--rare { --k: var(--d4p-rare); }
.d4p__tip--legendary { --k: var(--d4p-legendary); }
.d4p__tip--glyph { --k: var(--d4p-glyph); }
.d4p__tip--gate, .d4p__tip--start { --k: var(--d4p-gate); }
.d4p__tip.is-docked { left: 8px; right: 8px; width: auto; }
.d4p__tip-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--d4p-line); }
.d4p .d4p__tip-head img { flex: none; width: 44px; height: 44px; margin: 0; padding: 2px; border: 1px solid var(--k); border-radius: 4px; background: color-mix(in srgb, var(--k) 18%, #100b0a); }
.d4p__tip-kind { font-size: 12px; color: var(--k); }
.d4p__tip-name { font: 400 1.15rem/1.2 var(--font-head); color: #f1e6d4; }
.d4p .d4p__tip ul { margin: 8px 0; padding: 0 0 0 16px; font-size: 13px; line-height: 1.45; color: #d6ccbe; }
.d4p .d4p__tip li { margin: 0 0 4px; }
.d4p__tip-state { font-size: 12px; color: #8b8077; }
.d4p__tip-state.is-on { color: #ff8a73; }

.d4p p.d4p__hint { margin: 8px 0; font-size: 13px; line-height: 1.5; color: #9d9186; }
.d4p ul.d4p__legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; color: #9d9186; }
.d4p ul.d4p__legend li { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; }
.d4p ul.d4p__legend li::before { content: ""; position: static; width: 10px; height: 10px; border-radius: 2px; background: var(--k); }
.d4p__key--common { --k: var(--d4p-common); }
.d4p__key--magic { --k: var(--d4p-magic); }
.d4p__key--rare { --k: var(--d4p-rare); }
.d4p__key--legendary { --k: var(--d4p-legendary); }
.d4p__key--glyph { --k: var(--d4p-glyph); }
.d4p ul.d4p__legend li.d4p__key--glyph::before { border-radius: 50%; }
.d4p__key--gate { --k: var(--d4p-gate); }
.d4p ul.d4p__legend li.d4p__key--taken::before { background: transparent; border: 2px solid var(--d4p-taken); }

.d4p details.d4p__summary { margin: 0; padding: 0; background: transparent; border: 0; }
.d4p__summary > summary { padding: 8px 0; cursor: pointer; font-size: 14px; color: #c9bfb2; }
.d4p__summary p { margin: 12px 0 4px; font-size: 14px; color: #f1e6d4; }
.d4p .d4p__summary ul { margin: 0; font-size: 13px; line-height: 1.55; color: #c9bfb2; }

/* ---------- на весь экран ---------- */
html.d4p-lock, html.d4p-lock body { overflow: hidden; }
.d4p.is-full { position: fixed; inset: 0; z-index: 100000; margin: 0; padding: 8px; border: 0; border-radius: 0; }
.d4p.is-full .d4p__app { display: flex; flex-direction: column; height: 100%; }
.d4p.is-full .d4p__view { flex: 1; height: auto; min-height: 0; }
.d4p.is-full .d4p__bar { margin-bottom: 6px; }
.d4p.is-full .d4p__hint, .d4p.is-full .d4p__legend, .d4p.is-full .d4p__summary { display: none; }

@media (max-width: 640px) {
	.d4p { margin-left: -8px; margin-right: -8px; padding: 10px 8px; }
	.d4p__tabs .d4p__btn[data-board] span { display: none; }
	.d4p__tabs .d4p__btn { min-width: 40px; }
	.d4p__variants .d4p__btn { flex: 1; padding: 6px 4px; }
	.d4p__variants .d4p__btn small { display: block; margin: 0; }
	.d4p__view { height: min(110vw, 70vh); min-height: 360px; }
	.d4p__tool--wide { font-size: 12px; padding: 0 8px; }
}
