/* ============================================================
   文本内容对比 text-diff · zhandu.cn
   ============================================================ */

.td-card { padding: 18px 18px 14px; }

/* ---------- 工具栏 ---------- */
.td-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.td-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.td-btn {
    border: 0;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform .12s, box-shadow .15s, opacity .15s;
    white-space: nowrap;
}

.td-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, .3); }
.td-btn:active { transform: translateY(0); }

.td-btn.ghost {
    background: #fff;
    color: #3b5170;
    border: 1px solid #d8e2ee;
    box-shadow: none;
}

.td-btn.ghost:hover { border-color: #9db6d4; transform: none; }
.td-btn.ghost.small { padding: 5px 12px; font-size: 12.5px; }

.td-opts {
    display: flex;
    gap: 4px 16px;
    flex-wrap: wrap;
}

.td-opts label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #4a5c74;
    cursor: pointer;
    white-space: nowrap;
}

.td-opts input { accent-color: #2563eb; }

/* ---------- 编辑区 ---------- */
.td-editors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.td-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    overflow: hidden;
}

.td-pane-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 13px;
    font-size: 13.5px;
}

.td-pane-head i { font-style: normal; font-size: 11.5px; opacity: .65; }
.td-pane-head.old { background: #fdeeee; color: #a03030; }
.td-pane-head.new { background: #e9f7ef; color: #1e7a44; }

.td-pane textarea {
    border: 0;
    outline: none;
    resize: vertical;
    min-height: 230px;
    padding: 12px 13px;
    font-size: 13.5px;
    line-height: 1.7;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    color: #22374f;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}

/* ---------- 统计条 ---------- */
.td-statsbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2eaf4;
}

.td-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}

.td-chip {
    display: inline-block;
    font-size: 12.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

.td-chip.add { background: #e5f6ec; color: #15803d; }
.td-chip.del { background: #fdecec; color: #b3352f; }
.td-chip.mod { background: #fdf3e0; color: #b26a08; }
.td-chip.eq { background: #eef2f7; color: #7d90a6; }

.td-verdict { color: #55677c; }
.td-verdict b { color: #1d4ed8; }
.td-err { color: #b3352f; font-weight: 600; }

.td-viewtoggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.td-vbtn {
    border: 1px solid #d8e2ee;
    background: #fff;
    color: #55677c;
    font-size: 12.5px;
    padding: 5px 13px;
    border-radius: 999px;
    cursor: pointer;
}

.td-vbtn.on {
    background: #e3edff;
    border-color: #2563eb;
    color: #1d4ed8;
    font-weight: 600;
}

/* ---------- 结果区 ---------- */
.td-resultcard { padding: 16px 18px; }

.td-result-opts { margin-bottom: 10px; }

.td-result-opts label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #4a5c74;
    cursor: pointer;
}

.td-result-opts input { accent-color: #2563eb; }

.td-result {
    border: 1px solid #e2eaf4;
    border-radius: 10px;
    overflow: auto;
    max-height: 620px;
    font-size: 13px;
    line-height: 1.65;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    background: #fff;
}

.td-empty {
    padding: 34px 16px;
    text-align: center;
    color: #9db0c5;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 上下视图 */
.td-row {
    display: flex;
    align-items: baseline;
    border-bottom: 1px solid #f1f5fa;
    min-width: 0;
}

.td-row .td-no {
    flex: 0 0 52px;
    text-align: right;
    padding: 3px 9px 3px 4px;
    color: #9db0c5;
    font-size: 11.5px;
    user-select: none;
}

.td-row .td-txt {
    flex: 1 1 auto;
    min-width: 0;
    padding: 3px 10px 3px 4px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 并排视图 */
.td-srow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid #f1f5fa;
    min-width: 900px;
}

.td-cell {
    display: flex;
    align-items: baseline;
    min-width: 0;
    padding: 0;
}

.td-cell.a { border-right: 1px solid #e8eef6; }

.td-cell .td-no {
    flex: 0 0 52px;
    text-align: right;
    padding: 3px 9px 3px 4px;
    color: #9db0c5;
    font-size: 11.5px;
    font-style: normal;
    user-select: none;
}

.td-cell .td-txt {
    flex: 1 1 auto;
    min-width: 0;
    padding: 3px 10px 3px 4px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 行底色 */
.td-row.eq .td-txt, .td-srow.eq .td-txt { color: #55677c; }

.td-row.del, .td-srow.del .td-cell.a { background: #fdecec; }
.td-row.add, .td-srow.add .td-cell.b { background: #e9f7ef; }
.td-row.mod, .td-srow.mod .td-cell { background: #fff8e8; }
.td-srow.mod .td-cell.a { background: #fdecec; }
.td-srow.mod .td-cell.b { background: #e9f7ef; }

/* 词级高亮 */
.td-w-del {
    background: #f5b7b1;
    color: #7c1d1d;
    border-radius: 3px;
    padding: 0 1px;
}

.td-w-add {
    background: #a9dfbf;
    color: #14532d;
    border-radius: 3px;
    padding: 0 1px;
}

.td-arrow { font-style: normal; color: #b26a08; font-family: -apple-system, "PingFang SC", sans-serif; }

/* 折叠条 */
.td-collapse {
    padding: 6px 14px;
    background: #f6f9fc;
    color: #7d90a6;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    border-bottom: 1px solid #eef2f7;
}

.td-collapse:hover { background: #eef4fb; color: #2563eb; }

/* ---------- 说明 ---------- */
.td-notes h2 { font-size: 16px; color: #22374f; margin: 0 0 10px; }

.td-notes ul {
    margin: 0;
    padding-left: 18px;
    color: #55677c;
    font-size: 13.5px;
    line-height: 1.85;
}

.td-notes b { color: #2a3d55; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
    .td-card, .td-resultcard { padding: 14px 12px; }
    .td-editors { grid-template-columns: minmax(0, 1fr); }
    .td-pane textarea { min-height: 160px; }
    .td-toolbar { flex-direction: column; align-items: stretch; }
    .td-btns, .td-opts { justify-content: center; }
    .td-statsbar { flex-direction: column; align-items: stretch; }
    .td-viewtoggle { justify-content: center; }
}
