.tree-body { min-height: 100vh; overflow-x: hidden; }
.tree-topbar {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px clamp(18px, 4vw, 52px);
    border-bottom: 1px solid var(--line);
    background: rgb(13 11 9 / 90%);
    backdrop-filter: blur(18px);
}
.tree-topbar nav { display: flex; align-items: center; gap: 22px; }
.tree-topbar nav a { font-size: .72rem; }
.tree-topbar nav > span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .64rem; }
.tree-topbar nav i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 9px var(--gold); }
.tree-workspace { width: min(1520px, 100%); max-width: 100%; min-width: 0; margin: auto; padding: clamp(28px, 5vw, 70px) clamp(14px, 4vw, 52px); }
.ancestry-guidance { margin: 24px 0 0; }
.tree-hero { display: grid; width: 100%; max-width: 100%; min-width: 0; grid-template-columns: minmax(0, 1.4fr) minmax(360px, .6fr); gap: 40px; align-items: end; overflow: hidden; padding: clamp(28px, 5vw, 58px); border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 85% 20%, rgb(197 155 82 / 13%), transparent 25rem), linear-gradient(140deg, #241b14, #120f0c); box-shadow: var(--shadow); }
.tree-hero > div { min-width: 0; }
.tree-hero h1 { font-size: clamp(2.1rem, 5vw, 4.4rem); }
.tree-hero h1 em { color: var(--gold-bright); font-weight: 400; }
.tree-hero p { max-width: 760px; margin-top: 18px; color: var(--ink-soft); }
.tree-hero__stats { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: rgb(0 0 0 / 14%); }
.tree-hero__stats article { display: grid; min-height: 105px; place-items: center; align-content: center; padding: 12px; border-left: 1px solid var(--line); text-align: center; }
.tree-hero__stats article:first-child { border-left: 0; }
.tree-hero__stats strong { color: var(--gold-bright); font: 600 1.5rem Cinzel, Georgia, serif; }
.tree-hero__stats span { color: var(--muted); font-size: .58rem; }

.tree-controls { position: sticky; z-index: 30; top: 72px; display: grid; gap: 8px; margin: 24px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgb(19 15 12 / 91%); backdrop-filter: blur(15px); }
.tree-tabs { display: grid; min-width: 0; grid-template-columns: repeat(10, minmax(105px, 1fr)); gap: 7px; overflow-x: auto; scrollbar-width: thin; }
.tree-tabs button { display: grid; min-width: 0; min-height: 58px; grid-template-columns: 27px minmax(0, 1fr); grid-template-rows: 1fr 1fr; column-gap: 7px; align-items: center; padding: 7px 8px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); text-align: left; background: transparent; cursor: pointer; }
.tree-tabs button > span { grid-row: 1 / 3; color: var(--gold); font: 1.2rem Georgia, serif; }
.tree-tabs button b { align-self: end; font: 600 .75rem Cinzel, Georgia, serif; }
.tree-tabs button small { align-self: start; font-size: .56rem; }
.tree-tabs button.is-active { border-color: #6a5231; color: var(--ink); background: rgb(197 155 82 / 8%); box-shadow: inset 2px 0 var(--gold); }
.tree-legend { display: flex; justify-content: flex-end; gap: 13px; padding-right: 8px; }
.tree-legend span { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .57rem; }
.node-state { width: 7px; height: 7px; border-radius: 50%; }
.node-state--owned { background: var(--green); box-shadow: 0 0 6px var(--green); }
.node-state--available { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.node-state--locked { border: 1px solid #756b60; }
.tree-legend__connection i { width: 18px; height: 0; border-top: 2px solid #8b714d; }

.class-tree-panel { width: 100%; max-width: 100%; min-width: 0; scroll-margin-top: 160px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgb(28 23 18 / 98%), rgb(16 13 11 / 99%)); box-shadow: 0 20px 60px rgb(0 0 0 / 15%); }
.class-tree-header { display: grid; grid-template-columns: 70px minmax(0, 1fr) minmax(280px, .45fr); gap: 20px; align-items: center; padding: clamp(22px, 4vw, 38px); border-bottom: 1px solid var(--line); background: radial-gradient(circle at 10% 50%, rgb(197 155 82 / 9%), transparent 20rem); }
.class-tree-header__icon { display: grid; width: 64px; height: 64px; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-bright); background: #15110e; font: 1.65rem Georgia, serif; box-shadow: 0 0 28px rgb(197 155 82 / 10%); }
.class-tree-header > div:nth-child(2) > span { color: var(--gold); font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.class-tree-header h2 { margin: 3px 0 5px; font-size: clamp(1.35rem, 3vw, 2rem); }
.class-tree-header p { font-size: .73rem; }
.class-tree-header dl { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.class-tree-header dl div { display: grid; min-height: 66px; place-items: center; align-content: center; padding: 8px; border-left: 1px solid var(--line); text-align: center; }
.class-tree-header dl div:first-child { border-left: 0; }
.class-tree-header dt { color: var(--muted); font-size: .5rem; }
.class-tree-header dd { margin: 0; color: var(--gold-bright); font: 600 .72rem Cinzel, Georgia, serif; }

.tree-layout { display: block; min-width: 0; }
.skill-map { position: relative; isolation: isolate; display: grid; min-width: 0; grid-template-columns: 210px 48px minmax(1000px, max-content); align-items: center; overflow-x: auto; padding: clamp(24px, 4vw, 46px); background: radial-gradient(circle at 25% 50%, rgb(197 155 82 / 6%), transparent 30rem); scrollbar-color: #6c5434 #15110e; scrollbar-width: thin; }
.skill-map__root { position: relative; z-index: 2; display: grid; grid-column: 1; grid-row: 1; justify-items: center; align-self: center; }
.skill-map__root .skill-node { width: 195px; min-height: 135px; }
.skill-map__trunk { width: 100%; grid-column: 2; grid-row: 1; }
.skill-branches { position: relative; z-index: 2; display: grid; min-width: 1000px; grid-column: 3; grid-row: 1; grid-template-columns: 1fr; gap: 24px; }
.skill-branch { position: relative; display: grid; grid-template-columns: 190px 42px 230px 42px 230px 42px 215px; align-items: center; gap: 0; padding-top: 62px; }
.skill-branch > header { position: absolute; top: 0; left: 0; width: 190px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; text-align: left; background: rgb(255 255 255 / 1.2%); }
.skill-branch > header span { color: var(--gold); font-size: .52rem; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
.skill-branch > header h3 { display: inline; margin-left: 7px; font-size: .78rem; }
.skill-branch > header p { margin-top: 2px; font-size: .54rem; }
.skill-branch > i { width: 100%; }
.skill-fork { position: relative; display: grid; grid-template-columns: 190px; justify-content: center; gap: 12px; }
.skill-connectors { position: absolute; z-index: 0; top: 0; left: 0; overflow: visible; pointer-events: none; }
.skill-connector { fill: none; stroke: #51483d; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; vector-effect: non-scaling-stroke; }
.skill-connector--owned { stroke: #66816c; filter: drop-shadow(0 0 3px rgb(102 129 108 / 45%)); }
.skill-connector--available { stroke: #a98046; filter: drop-shadow(0 0 3px rgb(197 155 82 / 38%)); }
.skill-connector--locked { stroke: #504a43; stroke-dasharray: 5 5; }
.skill-node { position: relative; display: grid; width: 100%; min-height: 108px; place-items: center; align-content: center; gap: 2px; padding: 13px; border: 1px solid #4c4135; border-radius: 9px; color: var(--ink-soft); text-align: center; background: linear-gradient(145deg, #211a14, #14110e); cursor: pointer; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.skill-node:hover { transform: translateY(-2px); border-color: #80633c; }
.skill-node > span { display: grid; width: 34px; height: 34px; place-items: center; margin-bottom: 6px; border: 1px solid #594932; border-radius: 50%; color: var(--gold-bright); background: #100d0b; font: 1rem Georgia, serif; }
.skill-node > b { font: 600 .7rem/1.25 Cinzel, Georgia, serif; }
.skill-node > small { color: var(--muted); font-size: .52rem; }
.skill-node::after { position: absolute; top: 8px; right: 9px; font-size: .58rem; }
.skill-node.is-owned { border-color: #526957; background: linear-gradient(145deg, rgb(55 78 60 / 30%), #14110e); }
.skill-node.is-owned::after { color: #9ebca4; content: "✓"; }
.skill-node.is-available { border-color: #8a683a; box-shadow: 0 0 22px rgb(197 155 82 / 7%); }
.skill-node.is-available::after { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 7px var(--gold); content: ""; }
.skill-node.is-locked { border-style: dashed; opacity: .66; filter: saturate(.55); }
.skill-node.is-locked::after { color: #8b8176; content: "◆"; }
.skill-node.is-master { min-height: 126px; border-color: #765733; background: radial-gradient(circle at 50% 20%, rgb(197 155 82 / 13%), transparent 75%), #17120e; }
.skill-node.is-selected { border-color: var(--gold-bright); outline: 2px solid rgb(197 155 82 / 15%); outline-offset: 2px; box-shadow: 0 0 28px rgb(197 155 82 / 13%); }
.skill-branch--guard > header, .skill-branch--growth > header { background: rgb(66 93 70 / 8%); }
.skill-branch--weapon > header, .skill-branch--curse > header { background: rgb(125 73 57 / 8%); }
.skill-branch--command > header, .skill-branch--fate > header { background: rgb(99 77 126 / 8%); }
.skill-branch--shadow > header { background: rgb(55 49 80 / 12%); }
.skill-branch--beast > header { background: rgb(115 88 49 / 8%); }
.skill-branch--elements > header { background: rgb(57 89 105 / 10%); }
.skill-branch--hunt > header, .skill-branch--companion > header, .skill-branch--trail > header,
.skill-branch--elixir > header { background: rgb(66 93 70 / 10%); }
.skill-branch--aegis > header, .skill-branch--radiance > header, .skill-branch--song > header,
.skill-branch--spirit > header { background: rgb(141 108 48 / 10%); }
.skill-branch--judgment > header, .skill-branch--blade > header, .skill-branch--flame > header,
.skill-branch--bomb > header { background: rgb(125 73 57 / 10%); }
.skill-branch--glamour > header, .skill-branch--arcane > header, .skill-branch--mutagen > header { background: rgb(99 77 126 / 11%); }
.skill-branch--lore > header, .skill-branch--ward > header, .skill-branch--wind > header { background: rgb(57 89 105 / 11%); }
.skill-branch--trick > header, .skill-branch--body > header { background: rgb(115 88 49 / 9%); }
.skill-branch--heritage > header, .skill-branch--community > header, .skill-branch--craft > header,
.skill-branch--luck > header, .skill-branch--curiosity > header { background: rgb(141 108 48 / 10%); }
.skill-branch--senses > header, .skill-branch--grace > header, .skill-branch--flow > header,
.skill-branch--depth > header { background: rgb(57 89 105 / 11%); }
.skill-branch--resolve > header, .skill-branch--stone > header, .skill-branch--endurance > header,
.skill-branch--ferocity > header { background: rgb(125 73 57 / 10%); }
.skill-branch--memory > header, .skill-branch--empathy > header, .skill-branch--illusion > header,
.skill-branch--instinct > header { background: rgb(99 77 126 / 11%); }
.skill-branch--kinship > header, .skill-branch--hearth > header, .skill-branch--tide > header,
.skill-branch--pack > header, .skill-branch--adaptation > header { background: rgb(66 93 70 / 10%); }

.node-inspector { display: none; }
.node-inspector__eyebrow { color: var(--gold); font-size: .56rem; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
.node-inspector h3 { font-size: 1.25rem; }
.node-inspector__meta { display: flex; flex-wrap: wrap; gap: 6px; }
.node-inspector__meta span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 100px; color: var(--ink-soft); font-size: .58rem; }
.node-inspector > p { font-size: .72rem; }
.node-inspector > div:not(.node-inspector__meta) { padding: 14px; border-left: 2px solid var(--gold); background: rgb(197 155 82 / 5%); }
.node-inspector > div small, .node-inspector > div strong { display: block; }
.node-inspector > div small { color: var(--muted); font-size: .54rem; text-transform: uppercase; letter-spacing: .09em; }
.node-inspector > div strong { margin-top: 4px; color: var(--gold-bright); font-size: .67rem; }
.node-inspector__hint { padding-top: 15px; border-top: 1px solid var(--line); color: #796f64 !important; font-size: .6rem !important; }

.ability-dialog { width: min(650px, calc(100% - 28px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid #765b38; border-radius: 13px; color: var(--ink); background: linear-gradient(145deg, #241c15, #14110e); box-shadow: 0 35px 110px rgb(0 0 0 / 65%); }
.ability-dialog::backdrop { background: rgb(0 0 0 / 73%); backdrop-filter: blur(7px); }
.ability-dialog__close { position: sticky; z-index: 2; top: 0; height: 0; padding: 0; text-align: right; }
.ability-dialog__close button { width: 42px; height: 42px; margin: 12px; border: 1px solid var(--line-bright); border-radius: 50%; color: var(--ink); background: #17120e; cursor: pointer; font-size: 1.2rem; }
.ability-dialog__heading { padding: 34px 64px 25px 30px; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 10% 10%, rgb(197 155 82 / 13%), transparent 18rem); }
.ability-dialog__heading > span { color: var(--gold); font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.ability-dialog__heading h2 { margin: 5px 0; font-size: clamp(1.45rem, 4vw, 2.15rem); }
.ability-dialog__heading p { color: #a9c4ad; font-size: .66rem; }
.ability-dialog__stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.ability-dialog__stats article { display: grid; min-height: 83px; place-items: center; align-content: center; padding: 10px; border-left: 1px solid var(--line); text-align: center; }
.ability-dialog__stats article:first-child { border-left: 0; }
.ability-dialog__stats small { color: var(--muted); font-size: .52rem; }
.ability-dialog__stats strong { color: var(--gold-bright); font: 600 .67rem Cinzel, Georgia, serif; }
.ability-dialog__parameters { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); background: rgb(0 0 0 / 10%); }
.ability-dialog__parameters article { min-height: 67px; padding: 12px 14px; border-left: 1px solid var(--line); }
.ability-dialog__parameters article:first-child { border-left: 0; }
.ability-dialog__parameters small, .ability-dialog__parameters strong { display: block; }
.ability-dialog__parameters small { color: var(--muted); font-size: .5rem; }
.ability-dialog__parameters strong { margin-top: 3px; color: var(--ink-soft); font-size: .63rem; }
.ability-dialog > section { padding: 22px 30px; border-bottom: 1px solid var(--line); }
.ability-dialog > section span { display: block; margin-bottom: 7px; color: var(--gold); font-size: .55rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.ability-dialog > section p { color: var(--ink-soft); font-size: .78rem; }
.ability-dialog > footer { padding: 18px 30px 25px; }
.ability-dialog > footer span, .ability-dialog > footer small { display: block; }
.ability-dialog > footer span { color: var(--ink-soft); font-size: .64rem; }
.ability-dialog > footer small { margin-top: 3px; color: var(--muted); font-size: .6rem; }

.future-trees { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, .8fr); gap: 35px; align-items: center; margin-top: 26px; padding: clamp(24px, 4vw, 40px); border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, #201912, #14110e); }
.future-trees h2 { font-size: clamp(1.2rem, 3vw, 1.8rem); }
.future-trees header p { margin-top: 8px; font-size: .72rem; }
.future-trees > div { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.future-trees > div span { padding: 9px 11px; border: 1px dashed var(--line-bright); border-radius: 6px; color: var(--muted); font-size: .63rem; }
.future-trees > div span::before { margin-right: 7px; color: #72695e; content: "○"; }
.future-trees > div span.is-ready { border-style: solid; color: var(--ink-soft); }
.future-trees > div span.is-ready::before { color: var(--green); content: "●"; }
.tree-footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px clamp(18px, 4vw, 52px); border-top: 1px solid var(--line); color: var(--muted); font-size: .64rem; }

@media (max-width: 1150px) {
    .tree-hero { grid-template-columns: minmax(0, 1fr); }
    .class-tree-header { grid-template-columns: 60px 1fr; }
    .class-tree-header dl { grid-column: 1 / -1; }
    .tree-tabs { grid-template-columns: repeat(10, 125px); }
}

@media (max-width: 800px) {
    html { scroll-padding-top: 125px; }
    .tree-topbar { min-height: 62px; padding: 8px 13px; }
    .tree-topbar .brand__sigil { width: 35px; height: 40px; font-size: 1rem; }
    .tree-topbar .brand strong { font-size: .86rem; }
    .tree-topbar nav > span { display: none; }
    .tree-topbar nav a { padding: 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 0; }
    .tree-topbar nav a::after { font-size: 1rem; content: "←"; }
    .tree-topbar nav a + a::after { content: "⇄"; }
    .tree-workspace { padding: 20px 10px 45px; }
    .tree-hero { padding: 28px 22px; border-radius: 11px; }
    .tree-hero h1, .tree-hero h1 em { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
    .tree-hero h1 { font-size: clamp(2rem, 10.5vw, 3rem); }
    .tree-hero__stats { grid-template-columns: 1fr; }
    .tree-hero__stats article { min-height: 66px; grid-template-columns: 45px 1fr; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
    .tree-hero__stats article:first-child { border-top: 0; }
    .tree-controls { top: 61px; display: grid; padding: 7px; }
    .tree-tabs { display: flex; }
    .tree-tabs button { min-width: 132px; }
    .tree-legend { justify-content: center; padding: 2px 0; }
    .class-tree-panel { scroll-margin-top: 144px; }
    .class-tree-header { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; padding: 22px 18px; }
    .class-tree-header__icon { width: 46px; height: 46px; font-size: 1.15rem; }
    .class-tree-header dl { grid-template-columns: 1fr; }
    .class-tree-header dl div { min-height: 48px; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
    .class-tree-header dl div:first-child { border-top: 0; }
    .tree-layout::before { display: block; padding: 9px 14px; border-bottom: 1px solid var(--line); color: var(--gold); text-align: center; background: rgb(197 155 82 / 5%); content: "← Baumkarte horizontal verschieben →"; font-size: .56rem; font-weight: 700; letter-spacing: .06em; }
    .skill-map { grid-template-columns: 170px 34px minmax(860px, max-content); padding: 22px 14px; }
    .skill-map__root .skill-node { width: 160px; }
    .skill-branches { min-width: 860px; gap: 20px; }
    .skill-branch { grid-template-columns: 165px 28px 200px 28px 200px 28px 190px; padding-top: 58px; }
    .skill-branch > header { width: 165px; min-height: 48px; }
    .skill-fork { grid-template-columns: 170px; }
    .skill-node { min-height: 96px; }
    .future-trees { grid-template-columns: 1fr; }
    .tree-footer { display: grid; }
    .ability-dialog__stats { grid-template-columns: repeat(2, 1fr); }
    .ability-dialog__stats article:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
    .ability-dialog__stats article:nth-child(4) { border-top: 1px solid var(--line); }
    .ability-dialog__parameters { grid-template-columns: repeat(2, 1fr); }
    .ability-dialog__parameters article:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
    .ability-dialog__parameters article:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 430px) {
    .tree-legend { gap: 8px; }
    .tree-legend span { font-size: .52rem; }
    .class-tree-header h2 { font-size: 1.25rem; }
    .future-trees > div { grid-template-columns: 1fr; }
}
