.knowledge-tree { padding: 35px 0 60px; }
.tree-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; margin-bottom: 25px; }
.tree-heading h1 { font-size: clamp(1.9rem,4vw,3rem); }
.tree-heading p { color: var(--muted); line-height: 1.8; max-width: 740px; font-size: .92rem; }
.tree-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 15px; padding: 20px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 15px; }
.tree-toolbar label { display: grid; gap: 8px; font-size: .78rem; color: var(--muted); }
.tree-search { flex: 1 1 300px; }
.tree-filter { flex: 0 1 240px; }
.tree-search input { padding: 12px; min-height: 44px; font-size: .9rem; }
.tree-filter select { min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel-solid); font: inherit; width: 100%; }
.tree-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tree-actions button { min-height: 44px; }
.tree-root { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 24px 20px; margin: 25px 0 0; border: 1px solid rgba(var(--accent-rgb),.25); border-radius: 14px; background: var(--soft); }
.tree-root > span:first-child { color: var(--accent); font-size: 1.5rem; }
.tree-root > strong { font-size: 1.3rem; }
.tree-root > span:last-child { color: var(--muted); font-size: .78rem; }
.tree-branches,.tree-units,.tree-leaves { list-style: none; padding: 0; margin: 0; }
.tree-branches { border-left: 2px solid rgba(var(--accent-rgb),.22); margin-left: 28px; padding: 22px 0 0 26px; }
.tree-course { position: relative; margin-bottom: 14px; }
.tree-course::before { content: ''; position: absolute; top: 30px; left: -27px; width: 26px; border-top: 2px solid rgba(var(--accent-rgb),.22); }
.tree-course > details { border: 1px solid var(--line); border-radius: 14px; background: var(--panel-solid); overflow: hidden; }
.tree-course summary { cursor: pointer; min-height: 60px; padding: 14px 17px; color: var(--text); }
.tree-course summary::marker { color: var(--accent); }
.tree-course summary > span { display: inline-block; vertical-align: middle; }
.tree-node-icon { color: var(--accent-dark); font-size: 1.2rem; width: 32px; }
.tree-course summary strong { font-size: .95rem; }
.tree-course summary small { display: block; margin-top: 5px; color: var(--muted); font-size: .71rem; }
.tree-units { margin: 0 20px 20px 35px; padding: 0 0 0 20px; border-left: 1px solid rgba(var(--accent-rgb),.25); }
.tree-unit { position: relative; margin-bottom: 12px; }
.tree-unit::before { content: ''; position: absolute; left: -21px; top: 28px; width: 20px; border-top: 1px solid rgba(var(--accent-rgb),.25); }
.tree-unit > details { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.tree-unit summary strong { font-size: .85rem; }
.tree-leaves { padding: 0 14px 15px 24px; }
.tree-leaf { border-left: 1px dashed rgba(var(--accent-rgb),.3); padding: 4px 0 6px 16px; position: relative; }
.tree-leaf::before { content: ''; position: absolute; left: 0; top: 27px; width: 16px; border-top: 1px dashed rgba(var(--accent-rgb),.3); }
.tree-topic { width: 100%; min-height: 48px; padding: 11px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-solid); color: var(--text); font: inherit; font-size: .83rem; text-align: left; cursor: pointer; }
.tree-topic:hover { border-color: var(--accent); background: var(--soft); }
.tree-leaf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--secondary); flex-shrink: 0; }
.tree-topic-arrow { margin-left: auto; color: var(--accent-dark); }
.tree-prerequisites { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .68rem; color: var(--muted); margin: 8px 0 3px; }
.tree-prerequisites button { border: 1px dashed rgba(var(--accent-rgb),.3); border-radius: 7px; color: var(--accent-dark); background: var(--soft); padding: 8px; text-align: left; cursor: pointer; font: inherit; }
.tree-empty { padding: 24px; color: var(--muted); }
.tree-heading .secondary { min-height: 44px; flex-shrink: 0; }
#knowledgeTreeOpen::before { content: '⑂'; }
.tree-topic span,.tree-course summary strong,.tree-prerequisites button { overflow-wrap: anywhere; }
@media(max-width:680px) { .tree-heading { flex-direction: column; } .tree-toolbar { padding: 15px; } .tree-filter { flex: 1 1 100%; } .tree-branches { margin-left: 10px; padding-left: 15px; } .tree-course::before { left: -16px; width: 15px; } .tree-units { margin-left: 15px; margin-right: 9px; padding-left: 12px; } .tree-unit::before { left: -13px; width: 12px; } .tree-leaves { padding-left: 12px; padding-right: 8px; } .tree-course summary { padding: 12px 9px; } .tree-prerequisites button { min-height: 44px; } }
html.phone-viewport .tree-heading { flex-direction: column; }
html.phone-viewport .tree-filter { flex: 1 1 100%; }
html.phone-viewport .tree-branches { margin-left: 10px; padding-left: 15px; }
html.phone-viewport .tree-course::before { left: -16px; width: 15px; }
html.phone-viewport .tree-units { margin-left: 15px; margin-right: 9px; padding-left: 12px; }
html.phone-viewport .tree-unit::before { left: -13px; width: 12px; }
html.phone-viewport .tree-leaves { padding-left: 12px; padding-right: 8px; }

.tree-course summary > span:last-child { max-width: calc(100% - 55px); }
.tree-search input,.tree-search,.tree-filter { min-width: 0; }
.tree-topic > span:nth-child(2) { min-width: 0; }
