/* ======= 在线笔画计算器：仅补充 style.css 缺失的部件 ======= */

/* 工具卡标题（style.css 有 .tool-title，此处补图标+标题的横向组合） */
.tool-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.9rem;
    border-bottom: 2px solid var(--primary-light);
}

.tool-title-wrapper i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.tool-title-wrapper .tool-title {
    margin-bottom: 0;
}

/* 功能特点卡（style.css 有 .feature-grid，此处只补卡片容器） */
.feature-card {
    border-top: 3px solid var(--primary-color);
}

/* 模式面板 */
.bh-panel {
    animation: bhFadeIn 0.2s ease;
}

@keyframes bhFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* 表单提示与错误提示 */
.error-tip,
.bh-error {
    min-height: 20px;
    font-size: 0.9rem;
    color: #e74c3c;
    font-weight: 500;
    text-align: center;
}

/* 模式切换标签 */
.bh-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background: var(--bg-light);
    padding: 0.35rem;
    border-radius: var(--radius-md);
}

.bh-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bh-tab:hover {
    color: var(--primary-color);
}

.bh-tab.is-active {
    background: var(--bg-white);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* 输入区 */
.bh-field {
    margin-bottom: 1rem;
}

.bh-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
}

.bh-label-inline {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
}

.bh-input-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.bh-input,
.bh-textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease;
}

.bh-input:focus,
.bh-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.bh-char-input {
    flex: 1;
    min-width: 140px;
    max-width: 220px;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 0.1em;
}

.bh-textarea {
    min-height: 130px;
    line-height: 1.7;
    resize: vertical;
}

.bh-btn {
    padding: 0.65rem 1.2rem;
    font-size: 0.95rem;
}

.bh-hint {
    margin-top: 0.45rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.bh-hint-inline {
    margin-top: 0;
}

/* 单字结果 */
.bh-result {
    margin-top: 1.25rem;
}

.bh-char-show {
    font-size: 4.5rem;
    line-height: 1.1;
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.bh-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.bh-info-item {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.8rem;
    text-align: center;
}

.bh-info-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.bh-info-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.bh-info-value.bh-primary {
    color: var(--primary-color);
}

/* 康熙笔画用橙色标识区分 */
.bh-info-value.bh-kangxi {
    color: #fa8c16;
}

.bh-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1rem;
}

.bh-actions-left {
    justify-content: flex-start;
}

/* 批量统计汇总 */
.bh-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.bh-summary-item {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 0.8rem 0.6rem;
    text-align: center;
}

.bh-summary-main {
    background: var(--primary-light);
}

.bh-summary-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.bh-summary-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
}

.bh-summary-main .bh-summary-value {
    font-size: 1.6rem;
    color: var(--primary-hover);
}

/* 批量结果表 */
.bh-table-wrap {
    margin-top: 1.1rem;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.bh-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

.bh-table th {
    background: var(--bg-light);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.bh-table td {
    padding: 0.55rem 0.8rem;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.bh-table tr:last-child td {
    border-bottom: none;
}

.bh-table tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.015);
}

.bh-char-cell {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-color);
}

.bh-num {
    font-variant-numeric: tabular-nums;
}

/* 批量表格的康熙列与单字结果保持一致的橙色标识 */
.bh-kangxi-col {
    color: #fa8c16;
    font-weight: 600;
}

/* 笔画口径开关 */
.bh-option-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.bh-switch {
    display: inline-flex;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    gap: 0.25rem;
}

.bh-switch-btn {
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.bh-switch-btn.is-active {
    background: var(--primary-color);
    color: #fff;
}

.bh-switch-btn[data-mode="kangxi"].is-active {
    background: #fa8c16;
}

/* 查询历史 */
.bh-history {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.bh-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.bh-link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
}

.bh-link-btn:hover {
    text-decoration: underline;
}

.bh-history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bh-history-item {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bh-history-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 底部说明 */
.bh-tip {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* 当前口径主显示块：切换标准/康熙时数值随之变化 */
.bh-current {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0 auto 1.1rem;
    padding: 0.6rem 1rem;
    max-width: 420px;
    background: var(--primary-light);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.bh-current.is-kangxi {
    background: #fff7e6;
    border-color: #fa8c16;
}

.bh-current-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.bh-current-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.bh-current.is-kangxi .bh-current-value {
    color: #fa8c16;
}

.bh-current-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 当前生效口径的字段高亮 */
.bh-info-item.is-active {
    background: var(--primary-light);
    outline: 1px solid var(--primary-color);
}

.bh-info-item:has(#bhKxStroke).is-active {
    background: #fff7e6;
    outline-color: #fa8c16;
}

/* 批量表头与列的当前口径高亮 */
.bh-table th.is-active,
.bh-table th.is-active {
    color: var(--primary-color);
    font-weight: 700;
}

.bh-table td.is-active {
    font-weight: 700;
}

.bh-std-col.is-active {
    color: var(--primary-color);
}

.bh-kangxi-col.is-active {
    color: #fa8c16;
}

/* 表格内的「笔顺」按钮 */
.bh-stroke-link {
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
    color: var(--primary-color);
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.bh-stroke-link:hover {
    background: var(--primary-color);
    color: #fff;
}

/* 笔顺弹层 */
.bh-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.bh-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.bh-modal-box {
    position: relative;
    z-index: 1;
    width: min(92vw, 380px);
    margin: 8vh auto 0;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 1rem 1.1rem 1.2rem;
}

.bh-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.bh-modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bh-modal-title b {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-left: 0.2rem;
}

.bh-modal-close {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
}

.bh-modal-close:hover {
    color: var(--primary-color);
    background: var(--bg-light);
}

.bh-stroke-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.bh-stroke-canvas {
    line-height: 0;
}

.bh-stroke-canvas svg {
    max-width: 100%;
    height: auto;
}

.bh-modal-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .bh-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bh-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .bh-modal-box {
        margin-top: 4vh;
        padding: 0.9rem;
    }

    .bh-stroke-stage {
        min-height: 220px;
    }

    .bh-char-show {
        font-size: 3.5rem;
    }

    .bh-char-input {
        max-width: 100%;
    }

    .bh-actions,
    .bh-actions-left {
        justify-content: stretch;
    }

    .bh-option-row {
        align-items: flex-start;
    }

    .bh-hint-inline {
        width: 100%;
    }
}
