/* 鱼骨图工具面板 */
.fishbone-tool-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 0;
}

.fb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-muted, #f9fafb);
    flex-shrink: 0;
}

.fb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fb-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.fb-title i { color: #7c3aed; }

.fb-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

.fb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fb-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.fb-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.fb-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border-color: transparent;
    color: #fff !important;
}

.fb-btn-primary:hover {
    opacity: 0.88;
    border-color: transparent !important;
}

.fb-canvas-wrap {
    flex: 1;
    overflow: auto;
    padding: 20px 16px;
    background-color: #f1f5f9;
    background-image: radial-gradient(circle, #cbd5e1 1px, transparent 1px);
    background-size: 22px 22px;
    min-height: 520px;
}

.fb-board {
    max-width: 1100px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    padding: 24px 20px 28px;
}

/* ─── 图表整体：上骨 / 主干 / 下骨 ─── */
.fb-chart {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 480px;
}

.fb-row-top,
.fb-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 12px;
    padding: 0 8px 0 48px;
}

.fb-row-top {
    flex: 1;
    min-height: 200px;
    padding-bottom: 4px;
}

.fb-row-bottom {
    flex: 1;
    min-height: 200px;
    padding-top: 4px;
    padding-left: 18%;
    padding-right: 12%;
    justify-content: space-around;
}

/* ─── 单支骨：原因 → 斜骨 → 分类圆 ─── */
.fb-branch {
    flex: 1;
    min-width: 0;
    max-width: 32%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fb-branch-up {
    justify-content: flex-end;
}

.fb-branch-down {
    justify-content: flex-start;
}

/* 原因列表 */
.fb-causes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 220px;
}

.fb-branch-up .fb-causes {
    margin-bottom: 6px;
}

.fb-branch-down .fb-causes {
    margin-top: 6px;
}

.fb-cause {
    font-size: 0.72rem;
    line-height: 1.45;
    color: #334155;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 9px;
    outline: none;
    cursor: text;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fb-cause:empty::before {
    content: '点击输入原因…';
    color: #94a3b8;
}

.fb-cause:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

/* 斜向主骨 */
.fb-bone {
    width: 3px;
    height: 52px;
    background: linear-gradient(180deg, #a78bfa, #7c3aed);
    border-radius: 2px;
    flex-shrink: 0;
    position: relative;
}

.fb-branch-up .fb-bone {
    transform: skewX(-12deg);
}

.fb-branch-down .fb-bone {
    transform: skewX(-12deg);
}

/* 次骨装饰线 */
.fb-bone::before,
.fb-bone::after {
    content: '';
    position: absolute;
    height: 2px;
    background: #c4b5fd;
    border-radius: 1px;
}

.fb-branch-up .fb-bone::before {
    width: 36px;
    top: 8px;
    left: -38px;
    transform: rotate(-8deg);
}

.fb-branch-up .fb-bone::after {
    width: 28px;
    top: 24px;
    left: -30px;
    transform: rotate(-5deg);
}

.fb-branch-down .fb-bone::before {
    width: 36px;
    bottom: 8px;
    left: -38px;
    transform: rotate(8deg);
}

.fb-branch-down .fb-bone::after {
    width: 28px;
    bottom: 24px;
    left: -30px;
    transform: rotate(5deg);
}

/* 分类圆 */
.fb-cat {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    padding: 6px;
    flex-shrink: 0;
    outline: none;
    cursor: text;
    word-break: break-all;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    z-index: 2;
}

.fb-cat:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6), 0 3px 10px rgba(0, 0, 0, 0.15);
}

.fb-cat-purple { background: #8b5cf6; }
.fb-cat-blue   { background: #3b82f6; }
.fb-cat-teal   { background: #14b8a6; }
.fb-cat-pink   { background: #ec4899; }
.fb-cat-sky    { background: #38bdf8; }

/* ─── 主干行 ─── */
.fb-row-spine {
    display: flex;
    align-items: center;
    height: 72px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.fb-spine-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    padding-left: 4px;
}

.fb-tail {
    display: block;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 22px solid #8b5cf6;
    flex-shrink: 0;
    margin-right: -2px;
}

.fb-spine-line {
    display: block;
    flex: 1;
    height: 10px;
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
    min-width: 120px;
}

/* 鱼头（右侧结果） */
.fb-head {
    flex-shrink: 0;
    min-width: 148px;
    max-width: 200px;
    padding: 12px 20px 12px 16px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
    margin-left: -2px;
}

.fb-effect {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
    color: #fff;
    text-align: center;
    outline: none;
    cursor: text;
    word-break: break-word;
}

.fb-effect:focus {
    text-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.fb-effect:empty::before {
    content: '点击输入问题';
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}
@media (max-width: 900px) {
    .fb-board {
        min-width: 720px;
    }

    .fb-row-top,
    .fb-row-bottom {
        padding-left: 24px;
        gap: 8px;
    }

    .fb-cat {
        width: 60px;
        height: 60px;
        font-size: 0.68rem;
    }

    .fb-causes {
        max-width: 180px;
    }

    .fb-cause {
        font-size: 0.68rem;
        padding: 5px 7px;
    }
}
