/* ===== 容器 ===== */
.skill-tree {
    background: #f9fafb;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    max-width: 100%;
    overflow-x: auto;
}

/* ===== 树结构 ===== */
.tree,
.tree ul {
    list-style: none;
    margin: 0;
    padding-left: 0;
    position: relative;
}

.tree ul {
    padding-left: 20px;
}

.tree li {
    position: relative;
    padding-left: 20px;
}

/* ===== 竖线 ===== */
.tree ul::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 14px;
    bottom: 0;
    border-left: 2px solid #e5e7eb;
}

/* ===== 横线 ===== */
.tree ul>li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 10px;
    border-top: 2px solid #e5e7eb;
    transform: translateY(-50%);
}

.tree ul>li:last-child::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 50%;
    bottom: 0;
    width: 4px;
    background: #f9fafb;
}

/* ===== 分支：虚线 ===== */
.branch>ul::before {
    border-left-style: dashed;
}

/* ===== 节点 ===== */
.node {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    position: relative;
    z-index: 1;
}

/* 主节点 */
.node.main {
    background: #e0f2fe;
    border-color: #38bdf8;
    font-weight: 600;
}

/* 学习中 */
.node.learning {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* 叶子节点 */
.node.leaf {
    font-size: 12px;
}

.node::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

/* 已完成 */
.node.done::after {
    background: #22c55e;
}

/* 学习中 */
.node.learning::after {
    background: #f59e0b;
}

/* 计划中 */
.node.planned::after {
    background: #9ca3af;
}


.tree ul::before {
    top: 0;
}


.tree ul > li::before {
    top: 14px;
    transform: none;
}


.tree ul > li:last-child::after {
    top: 14px;
}


.node.learning + ul::before {
    border-left-style: dashed;
}


.tree ul ul {
    padding-left: 22px;
}


@media screen and (max-width: 768px) {
    .tree ul {
        padding-left: 18px;
    }

    .tree li {
        padding-left: 18px;
    }
}

.tree li:hover::before {
    border-top-color: #9ca3af;
}

.tree li:hover > ul::before {
    border-left-color: #9ca3af;
}
