/* Vocation skills pages and build planner (js/skill-planner.js).
   Builds on css/thyranya.css tokens. Branch colour arrives as --c, set from the
   page data by script (planner) or a style attribute (static reference). */

.sp-page { --sp-card: #141a21; --sp-line: rgba(255, 255, 255, .08); }
.sp-offscreen { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sp-center-note { max-width: 70ch; margin: 0 auto; }

/* The planner is a collapsible section in the same .container as the rest of the
   page, so its edges line up with the reference sections at every width. */
.sp-planner-panel > summary h3 { color: var(--thy-gold-lit); }
/* Keep the reference sections' padding on phones too, so the planner's content
   starts at the same left edge as theirs. */
@media (max-width: 575.98px) {
  .sp-planner-panel > summary { gap: 8px; }
  .sp-planner-panel > summary h3 { flex: 1 1 auto; min-width: 0; font-size: 1.15rem; }
  .sp-planner-panel .sp-section-count { padding: 3px 8px; font-size: .72rem; }
}

/* ---------- hero ---------- */
.sp-voc-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 26px; }
.sp-hero-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }

/* ---------- how it works ---------- */
.sp-how { display: grid; gap: 36px; align-items: center; }
@media (min-width: 900px) { .sp-how { grid-template-columns: 300px minmax(0, 1fr); } }
.sp-portrait { margin: 0 auto; max-width: 300px; }
.sp-portrait img { width: 100%; height: auto; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .55)); }
.sp-how-body .subtitle { margin-bottom: 12px; }
.sp-trait { padding: 20px 22px; border: var(--thy-rule); border-radius: var(--thy-radius); background: radial-gradient(120% 120% at 0 0, rgba(201, 162, 39, .1), transparent 60%), var(--thy-slate); }
.sp-trait h3 { margin: 10px 0 6px; font-size: 1.45rem; }
.sp-trait p { margin: 0; color: var(--thy-parchment); line-height: 1.65; }
.sp-branch-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
@media (min-width: 640px) { .sp-branch-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sp-branch-list a { display: block; height: 100%; padding: 12px 16px; border-radius: 10px; background: var(--thy-slate); border: 1px solid var(--sp-line); border-left: 3px solid var(--c); text-decoration: none; transition: border-color .18s ease, background .18s ease; }
.sp-branch-list a:hover { background: var(--thy-slate-2); border-color: var(--c); }
.sp-branch-list strong { display: block; color: var(--c); font-family: "Cinzel", Georgia, serif; font-size: 1.05rem; }
.sp-branch-list span { color: var(--thy-muted); font-size: .86rem; }

.sp-basics { display: grid; gap: 16px; margin-top: 40px; }
@media (min-width: 640px) { .sp-basics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .sp-basics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sp-basics .thy-panel { padding: 22px; margin: 0; }
.sp-basics h4 { font-family: "Cinzel", Georgia, serif; color: var(--thy-gold-lit); margin: 0 0 8px; font-size: 1.05rem; }
.sp-basics p { margin: 0; color: var(--thy-muted); line-height: 1.65; font-size: .93rem; }
.sp-rules { margin-top: 16px; padding: 0; }
.sp-rules summary { cursor: pointer; padding: 18px 22px; font-family: "Cinzel", Georgia, serif; color: var(--thy-gold-lit); list-style: none; }
.sp-rules summary::-webkit-details-marker { display: none; }
.sp-rules summary::after { content: "+"; float: right; color: var(--thy-gold); }
.sp-rules[open] summary::after { content: "\2212"; }
.sp-rules ul { margin: 0; padding: 0 22px 20px 42px; color: var(--thy-parchment); }
.sp-rules li { margin: 8px 0; line-height: 1.6; font-size: .94rem; }

/* ---------- toolbar ---------- */
.sp-toolbar { display: grid; gap: 18px 28px; align-items: center; padding: 18px 22px; border: var(--thy-rule); border-radius: var(--thy-radius); background: linear-gradient(180deg, rgba(201, 162, 39, .06), transparent), var(--thy-slate); }
@media (min-width: 900px) { .sp-toolbar { grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 1fr) auto; } }
@media (min-width: 1300px) { .sp-toolbar { grid-template-columns: minmax(240px, 1.1fr) minmax(220px, 1fr) auto auto; } }
.sp-level label, .sp-counters span { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--thy-muted); margin-bottom: 6px; }
.sp-level-row { display: flex; align-items: center; gap: 12px; }
.sp-level input[type=range] { flex: 1; accent-color: var(--thy-gold); min-width: 0; }
.sp-level input[type=number] { width: 78px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--thy-gold-dim); background: #0c1015; color: #fff; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.sp-points-num strong { font-size: 1.9rem; color: var(--thy-gold-lit); font-variant-numeric: tabular-nums; font-family: "Cinzel", Georgia, serif; }
.sp-points-num span { color: var(--thy-muted); font-variant-numeric: tabular-nums; }
.sp-meter { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; margin: 6px 0 4px; }
.sp-meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--thy-gold), var(--thy-gold-lit)); border-radius: 4px; transition: width .25s ease; }
.sp-meter-fill.is-over { background: linear-gradient(90deg, #c25a35, #e0764e); }
.sp-points-sub { font-size: .8rem; color: var(--thy-muted); }
.sp-counters { display: flex; gap: 26px; }
.sp-counters strong { font-size: 1.35rem; color: #fff; font-variant-numeric: tabular-nums; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-actions select { padding: 9px 12px; border-radius: 8px; border: 1px solid var(--thy-gold-dim); background: #0c1015; color: var(--thy-parchment); max-width: 100%; }

.sp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--thy-gold-dim); background: rgba(255, 255, 255, .03); color: var(--thy-parchment); font-weight: 600; font-size: .86rem; line-height: 1.2; cursor: pointer; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.sp-btn:hover:not(:disabled) { border-color: var(--thy-gold); color: #fff; background: var(--thy-gold-faint); }
.sp-btn:disabled { opacity: .42; cursor: default; }
.sp-btn-gold { background: linear-gradient(180deg, #dcb54d, #a9851f); border-color: #e7c160; color: #17120a; }
.sp-btn-gold:hover:not(:disabled) { background: linear-gradient(180deg, #ecc862, #b8922a); color: #0d0a05; }
.sp-btn:focus-visible, .sp-node:focus-visible, .sp-textbtn:focus-visible, .sp-actions select:focus-visible, .sp-level input:focus-visible { outline: 2px solid var(--thy-gold-lit); outline-offset: 3px; }
.sp-textbtn { background: none; border: 0; padding: 0; color: var(--thy-gold-lit); cursor: pointer; font: inherit; text-decoration: underline dotted rgba(224, 180, 79, .55); text-underline-offset: 3px; }
.sp-textbtn:hover { color: #fff; }

.sp-warning { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-top: 12px; padding: 14px 18px; border-radius: 10px; border: 1px solid rgba(224, 118, 78, .5); background: rgba(180, 85, 45, .12); color: #f3d2c4; font-size: .9rem; }
.sp-warning[hidden] { display: none; }
.sp-warning ul { margin: 6px 0 0; padding-left: 18px; }
.sp-status { min-height: 1.5em; margin: 10px 2px 14px; color: var(--thy-gold-lit); font-size: .9rem; }

/* ---------- layout ---------- */
.sp-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1200px) { .sp-layout { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (min-width: 1400px) { .sp-layout { grid-template-columns: minmax(0, 1fr) 380px; } }
.sp-branches { display: grid; gap: 18px; align-items: start; }
@media (min-width: 760px) { .sp-branches { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- branch ---------- */
.sp-branch { position: relative; overflow: hidden; border-radius: 14px; border: 1px solid var(--sp-line); background: #0f1419; box-shadow: inset 0 3px 0 var(--c), 0 14px 30px rgba(0, 0, 0, .35); }
.sp-branch-art { position: absolute; inset: 0; background-size: cover; background-position: center 35%; opacity: .3; -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .6) 40%, rgba(0, 0, 0, .15) 100%); mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .6) 40%, rgba(0, 0, 0, .15) 100%); pointer-events: none; }
.sp-branch::after { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 60% at 50% 0%, transparent, rgba(8, 11, 15, .55)); pointer-events: none; }
.sp-branch-head { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 0; }
.sp-branch-head h3 { margin: 0; font-size: 1.3rem; color: var(--c); text-shadow: 0 2px 8px rgba(0, 0, 0, .8); }
.sp-branch-head p { margin: 2px 0 0; color: #c3c9cf; font-size: .8rem; line-height: 1.4; text-shadow: 0 1px 4px #000; }
.sp-branch-sp { text-align: right; line-height: 1; }
.sp-branch-sp strong { display: block; font-size: 1.5rem; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 2px 6px #000; }
.sp-branch-sp span { font-size: .7rem; letter-spacing: .14em; color: var(--thy-muted); }

.sp-tree { position: relative; z-index: 2; height: 600px; margin: 4px 6px 8px; }
.sp-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sp-edges line { stroke: rgba(255, 255, 255, .13); stroke-width: 2; vector-effect: non-scaling-stroke; }
.sp-edges line.ready { stroke: var(--c); stroke-opacity: .5; stroke-dasharray: 5 5; }
.sp-edges line.on { stroke: var(--c); stroke-width: 3; stroke-opacity: .95; }

/* ---------- node ---------- */
/* Nodes sit 32% of the tree width apart; capping their width at 31% keeps
   neighbouring names from touching in narrow trees. */
.sp-node { position: absolute; width: min(112px, 31%); transform: translate(-50%, -28px); display: flex; flex-direction: column; align-items: center; padding: 0; margin: 0; border: 0; background: none; color: #cfd6dd; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.sp-node-icon { position: relative; display: block; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255, 255, 255, .22); background: #0a0d11; box-shadow: 0 0 0 3px rgba(0, 0, 0, .55), 0 8px 16px rgba(0, 0, 0, .55); transition: transform .15s ease, border-color .15s ease, box-shadow .2s ease; }
.sp-node-icon img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter .2s ease; }
.sp-kind-passive .sp-node-icon, .sp-node-icon.sp-kind-passive { border-radius: 14px; }
.sp-slot-ultimate { transform: translate(-50%, -36px); }
.sp-slot-ultimate .sp-node-icon { width: 72px; height: 72px; border-width: 3px; border-color: rgba(224, 180, 79, .55); box-shadow: 0 0 0 3px rgba(0, 0, 0, .6), 0 0 0 5px rgba(201, 162, 39, .28), 0 10px 22px rgba(0, 0, 0, .6); }
.sp-node-pips { display: flex; gap: 3px; margin-top: 7px; }
.sp-node-pips i { width: 13px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); box-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.sp-node-pips i.on { background: var(--c); box-shadow: 0 0 6px var(--c); }
.sp-node-name { margin-top: 4px; font-size: .76rem; font-weight: 600; line-height: 1.2; text-align: center; text-shadow: 0 1px 3px #000, 0 0 8px #000; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-node:hover .sp-node-icon { transform: scale(1.07); }

.sp-node.is-locked .sp-node-icon img { filter: grayscale(1) brightness(.5); }
.sp-node.is-locked .sp-node-name { color: #8a939c; }
.sp-node.is-available .sp-node-icon { border-color: var(--c); }
.sp-node.is-available::after { content: "+"; position: absolute; top: -5px; left: calc(50% + 17px); width: 19px; height: 19px; border-radius: 50%; background: var(--thy-gold-lit); color: #15110a; font-weight: 800; font-size: 15px; line-height: 19px; text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .6); pointer-events: none; }
.sp-slot-ultimate.is-available::after { top: -2px; left: calc(50% + 24px); }
.sp-node.is-learned .sp-node-icon { border-color: var(--c); box-shadow: 0 0 0 3px rgba(0, 0, 0, .55), 0 0 20px -2px var(--c), 0 8px 16px rgba(0, 0, 0, .55); }
.sp-node.is-learned .sp-node-name { color: #fff; }
.sp-slot-ultimate.is-learned .sp-node-icon { border-color: var(--thy-gold-lit); box-shadow: 0 0 0 3px rgba(0, 0, 0, .6), 0 0 0 5px rgba(224, 180, 79, .6), 0 0 28px 2px rgba(224, 180, 79, .55); }
.sp-node.is-invalid .sp-node-icon { border-color: #e0764e; box-shadow: 0 0 0 3px rgba(0, 0, 0, .55), 0 0 16px rgba(224, 118, 78, .8); }
.sp-node.is-selected .sp-node-icon { outline: 2px solid #fff; outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .sp-node.is-available .sp-node-icon { animation: sp-ready 2.4s ease-in-out infinite; }
}
@keyframes sp-ready { 50% { box-shadow: 0 0 0 3px rgba(0, 0, 0, .55), 0 0 14px -3px var(--c), 0 8px 16px rgba(0, 0, 0, .55); } }

/* ---------- detail panel ---------- */
.sp-detail { position: relative; border-radius: 14px; border: var(--thy-rule); background: radial-gradient(120% 60% at 50% 0%, rgba(201, 162, 39, .08), transparent 60%), var(--thy-slate); box-shadow: 0 14px 30px rgba(0, 0, 0, .35); }
#sp-detail-body { padding: 20px; }
@media (min-width: 1200px) {
  .sp-detail { position: sticky; top: 96px; max-height: calc(100vh - 110px); overflow: auto; }
  .sp-detail-close { display: none; }
}
.sp-detail-close { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--sp-line); background: rgba(0, 0, 0, .35); color: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; z-index: 2; }
.sp-d-head { display: flex; gap: 14px; align-items: center; padding-right: 30px; }
.sp-d-icon { flex: 0 0 auto; width: 64px; height: 64px; border-color: var(--c, var(--thy-gold)); }
.sp-d-branch { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c, var(--thy-gold-lit)); }
.sp-d-head h3 { margin: 2px 0; font-size: 1.35rem; }
.sp-d-rank { color: var(--thy-muted); font-size: .86rem; font-variant-numeric: tabular-nums; }
.sp-desc { color: var(--thy-parchment); line-height: 1.65; margin: 14px 0 8px; }
.sp-note { color: var(--thy-muted); font-size: .88rem; line-height: 1.55; border-left: 2px solid var(--thy-gold-dim); padding-left: 10px; margin: 8px 0; }
.sp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sp-tags span { font-size: .74rem; padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(154, 164, 176, .35); color: #c8d0d8; }
.sp-d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.sp-d-reqs { list-style: none; padding: 0; margin: 0 0 14px; font-size: .86rem; }
.sp-d-reqs li { display: flex; gap: 8px; padding: 3px 0; color: #c8d0d8; }
.sp-d-reqs li span[aria-hidden] { width: 16px; flex: 0 0 auto; font-weight: 800; }
.sp-d-reqs li.ok span[aria-hidden] { color: var(--thy-online); }
.sp-d-reqs li.no { color: #f0c4b3; }
.sp-d-reqs li.no span[aria-hidden] { color: #e0764e; }
.sp-d-links { margin-top: 16px; }
.sp-d-links h4 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--thy-muted); margin: 0 0 8px; font-family: inherit; }
.sp-d-link { padding: 8px 0 8px 12px; border-left: 2px solid var(--sp-line); margin-bottom: 8px; }
.sp-d-link.is-on { border-left-color: var(--thy-gold-lit); }
.sp-d-link strong { color: #fff; }
.sp-d-link span { color: var(--thy-muted); font-size: .85rem; }
.sp-d-link p { margin: 4px 0 0; color: #bfc7cf; font-size: .85rem; line-height: 1.5; }

/* rank tables (planner and reference) */
.sp-table-wrap { overflow-x: auto; margin: 10px 0; }
.sp-ranks { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
.sp-ranks th, .sp-ranks td { padding: 6px 8px; border-bottom: 1px solid var(--sp-line); text-align: center; white-space: nowrap; }
.sp-ranks thead th { color: var(--thy-muted); font-weight: 600; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.sp-ranks tbody th { text-align: left; color: #c3cad1; font-weight: 500; white-space: normal; min-width: 130px; }
.sp-ranks td { color: #e7e9eb; }
.sp-ranks td strong { color: #fff; }
.sp-ranks .sp-row-req td { color: var(--thy-muted); }
.sp-ranks .cur { background: rgba(201, 162, 39, .13); color: var(--thy-gold-lit); }
.sp-ranks thead th.cur { color: var(--thy-gold-lit); }
.sp-detail .sp-ranks { font-size: .78rem; }
.sp-detail .sp-ranks th, .sp-detail .sp-ranks td { padding: 6px 4px; white-space: normal; }
.sp-detail .sp-ranks tbody th { min-width: 88px; }

/* ---------- synergies ---------- */
.sp-links { margin-top: 34px; }
.sp-links-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin-bottom: 14px; }
.sp-links-head h3 { margin: 0; }
.sp-links-head p { margin: 0; color: var(--thy-muted); }
.sp-link-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.sp-link { display: flex; flex-direction: column; padding: 16px; border-radius: 12px; border: 1px solid var(--sp-line); background: var(--sp-card); transition: border-color .18s ease, box-shadow .18s ease; }
.sp-link.is-on { border-color: var(--thy-gold); box-shadow: 0 0 0 1px rgba(201, 162, 39, .35), 0 0 24px -6px rgba(224, 180, 79, .5); }
.sp-link-top { display: flex; align-items: center; gap: 12px; }
.sp-link-top h4 { margin: 0; font-size: 1.02rem; }
.sp-link-icons { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.sp-link-icons img { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); }
.sp-link-icons span { color: var(--thy-gold); font-weight: 700; }
.sp-link.is-locked .sp-link-icons img { filter: grayscale(1) brightness(.6); }
.sp-link-ends { margin: 10px 0 6px; font-size: .84rem; color: var(--thy-muted); }
.sp-link-ends .sp-textbtn { color: #b9c1c9; }
.sp-link-ends .sp-textbtn.ok { color: var(--thy-online); }
.sp-link-desc { margin: 0 0 12px; color: #c9d0d7; font-size: .88rem; line-height: 1.55; flex: 1; }
.sp-link-foot { display: flex; align-items: center; gap: 10px; }
.sp-link-foot span { font-size: .78rem; color: var(--thy-muted); line-height: 1.4; }

/* ---------- utilities ---------- */
.sp-utils { margin-top: 26px; }
.sp-utils h4 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--thy-muted); font-family: inherit; }
.sp-utils ul, .sp-ref-utils ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sp-utils li, .sp-ref-utils li { display: flex; gap: 8px; align-items: baseline; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--sp-line); background: var(--sp-card); font-size: .84rem; }
.sp-utils li strong, .sp-ref-utils li strong { color: #d8dde2; font-weight: 600; }
.sp-utils li span, .sp-ref-utils li span { color: var(--thy-muted); font-size: .78rem; }
.sp-utils li.on { border-color: var(--thy-gold-dim); }
.sp-utils li.on strong { color: var(--thy-gold-lit); }
.sp-utility-icon { width: 28px; height: 28px; object-fit: cover; border-radius: 50%; flex: 0 0 auto; align-self: center; }
.sp-utils ul, .sp-ref-utils ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.sp-utils li, .sp-ref-utils li { flex-wrap: wrap; align-content: flex-start; align-items: center; border-radius: 12px; padding: 14px; min-width: 0; }
.sp-utils li p, .sp-ref-utils li p { width: 100%; margin: 0; color: var(--thy-muted); font-size: .84rem; line-height: 1.5; }
.sp-utility-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }

/* ---------- small screens: the detail panel becomes a bottom sheet ---------- */
@media (max-width: 1199.98px) {
  .sp-detail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1060; max-height: 74vh; overflow: auto; border-radius: 18px 18px 0 0; transform: translateY(105%); transition: transform .25s ease; box-shadow: 0 -18px 40px rgba(0, 0, 0, .6); }
  .sp-detail.is-open { transform: none; }
}
@media (max-width: 759.98px) {
  .sp-node { width: min(96px, 31%); }
  .sp-node-name { font-size: .72rem; }
  .sp-counters { gap: 18px; }
}
@media (max-width: 380px) {
  .sp-node { width: min(84px, 31%); }
  .sp-node-icon { width: 48px; height: 48px; }
  .sp-node { transform: translate(-50%, -24px); }
  .sp-slot-ultimate .sp-node-icon { width: 60px; height: 60px; }
  .sp-slot-ultimate { transform: translate(-50%, -30px); }
}

/* ---------- reference ---------- */
/* Collapsible sections: reference groups are <details class="sp-section">,
   planner panels are .sp-fold with a .sp-fold-head toggle. */
.sp-section { margin-top: 18px; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--sp-line); background: rgba(255, 255, 255, .015); scroll-margin-top: 110px; }
.sp-section > summary { display: flex; align-items: center; gap: 18px; cursor: pointer; list-style: none; }
.sp-section > summary::-webkit-details-marker { display: none; }
.sp-section > summary::after { content: ""; width: 10px; height: 10px; margin: 0 6px 0 4px; border-right: 2px solid var(--thy-gold); border-bottom: 2px solid var(--thy-gold); transform: rotate(45deg) translate(-3px, -3px); transition: transform .2s ease; flex: 0 0 auto; }
.sp-section:not([open]) > summary::after { transform: rotate(-45deg) translate(-1px, -1px); }
.sp-section > summary:hover h3 { color: #fff; }
.sp-section > summary:focus-visible { outline: 2px solid var(--thy-gold-lit); outline-offset: 4px; border-radius: 10px; }
.sp-section[open] > summary { margin-bottom: 12px; }
.sp-section-sum h3 { margin: 0; }
.sp-section-count { margin-left: auto; font-size: .78rem; color: var(--thy-muted); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--sp-line); white-space: nowrap; }
.sp-ref-tools { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.sp-ref-tools[hidden] { display: none; }

.sp-fold-head { cursor: pointer; }
.sp-fold-toggle { display: inline-flex; align-items: center; gap: 10px; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; cursor: pointer; }
.sp-fold-toggle:focus-visible { outline: 2px solid var(--thy-gold-lit); outline-offset: 4px; border-radius: 6px; }
.sp-chev { display: inline-block; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s ease; opacity: .8; }
.sp-fold.is-collapsed .sp-chev { transform: rotate(-45deg) translate(-1px, -1px); }
.sp-fold.is-collapsed > .sp-fold-body { display: none; }
.sp-branch.is-collapsed .sp-branch-head { padding-bottom: 16px; }
.sp-branch.is-collapsed .sp-branch-art { opacity: .18; }
.sp-links.is-collapsed .sp-links-head { margin-bottom: 0; }

.sp-ref-banner { display: flex; align-items: center; gap: 18px; }
.sp-ref-banner img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; border: 2px solid var(--c); box-shadow: 0 10px 22px rgba(0, 0, 0, .5); flex: 0 0 auto; }
.sp-ref-banner h3 { margin: 0; color: var(--c); }
.sp-ref-banner p { margin: 2px 0 0; color: var(--thy-muted); }
.sp-ref-skill { margin: 8px 0; border-radius: 12px; border: 1px solid var(--sp-line); background: var(--sp-card); scroll-margin-top: 110px; }
.sp-ref-skill[open] { border-color: rgba(201, 162, 39, .3); }
.sp-ref-skill summary { display: flex; align-items: center; gap: 14px; padding: 10px 16px; cursor: pointer; list-style: none; }
.sp-ref-skill summary::-webkit-details-marker { display: none; }
.sp-ref-skill summary::after { content: "+"; margin-left: auto; color: var(--thy-gold); font-size: 1.2rem; }
.sp-ref-skill[open] summary::after { content: "\2212"; }
.sp-ref-skill summary img { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--c); flex: 0 0 auto; }
.sp-ref-skill.sp-kind-passive summary img { border-radius: 12px; }
.sp-ref-skill.sp-kind-ultimate summary img { border-color: var(--thy-gold-lit); box-shadow: 0 0 0 2px rgba(201, 162, 39, .3); }
.sp-ref-title strong { display: block; color: #fff; font-size: 1rem; }
.sp-ref-title span { color: var(--thy-muted); font-size: .8rem; }
.sp-ref-body { padding: 0 18px 16px 78px; }
@media (max-width: 640px) { .sp-ref-body { padding: 0 14px 14px; } }
.sp-ref-body .sp-desc { margin-top: 0; }
.sp-ref-body .sp-table-wrap { max-width: 760px; }
.sp-req, .sp-rel, .sp-open { font-size: .86rem; color: #c3cad1; margin: 6px 0; }
.sp-req strong, .sp-rel strong { color: #e1e5e9; }
.sp-open a, .sp-rel a, .sp-link-ends a { color: var(--thy-gold-lit); }
.sp-ref-links { margin-top: 18px; }
.sp-ref-link-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 16px; }
.sp-ref-link { padding: 16px; border-radius: 12px; border: 1px solid var(--sp-line); background: var(--sp-card); scroll-margin-top: 110px; }
.sp-ref-link h4 { margin: 10px 0 4px; font-size: 1.02rem; }
.sp-ref-link p { margin: 6px 0 0; color: #c9d0d7; font-size: .88rem; line-height: 1.55; }
.sp-ref-link .sp-link-ends { color: var(--thy-muted); }
.sp-ref-utils { margin-top: 18px; }
.sp-disclaimer { margin-top: 40px; text-align: center; font-size: .84rem; }
