/* Compare Two Lists（ct-）：两个列表 = 两条线路。A 线橙、B 线石油蓝；两边都有 = 换乘站（墨色）；全部 = 灰线。结果里每一项是线上的一个站 */
.ct-list .textarea, .ct-split .ct-custom-sep { box-sizing: border-box; }
.ct-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ct-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

[data-list="a"], [data-result="onlyInListA"] { --ct-tone: var(--line-a, var(--primary)); --ct-tone-soft: var(--line-a-soft, var(--primary-soft)); }
[data-list="b"], [data-result="onlyInListB"] { --ct-tone: var(--line-b, var(--accent)); --ct-tone-soft: var(--line-b-soft, var(--accent-soft)); }
[data-result="inBothLists"] { --ct-tone: var(--text); --ct-tone-soft: var(--soft); }
[data-result="allItems"] { --ct-tone: var(--line-x, var(--muted)); --ct-tone-soft: var(--soft); }

.ct-section-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.2; color: var(--text); }
.ct-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* 输入：两个面板并排，标题前是线路圆标 */
.ct-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.ct-list { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ct-list.card-body, .ct-result.card-body { padding: 16px; }
.ct-list-head, .ct-result-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ct-list-title, .ct-result-title { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.ct-list-title, .ct-count, .ct-result-title, .ct-result-count { flex: none; white-space: nowrap; }
.ct-list-title::before, .ct-result-head::before, [data-result] .ct-result-title::before {
  display: inline-flex; flex: none; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ct-tone); color: #fff; font-size: 14px; font-weight: 700; line-height: 1; padding-top: 2px; box-sizing: border-box;
}
[data-list="a"] .ct-list-title::before, [data-result="onlyInListA"] .ct-result-title::before, [data-result="inBothLists"] .ct-result-head::before, [data-result="allItems"] .ct-result-head::before { content: "A"; content: "A" / ""; }
[data-list="b"] .ct-list-title::before, [data-result="onlyInListB"] .ct-result-title::before, [data-result="inBothLists"] .ct-result-title::before, [data-result="allItems"] .ct-result-title::before { content: "B"; content: "B" / ""; }
/* 两边都有 / 全部：A、B 两个圆标叠在一起 */
[data-result="inBothLists"] .ct-result-title::before, [data-result="allItems"] .ct-result-title::before { margin-left: -13px; box-shadow: 0 0 0 2px var(--card); }
[data-result="inBothLists"] .ct-result-head::before { background: var(--line-a, var(--primary)); }
[data-result="inBothLists"] .ct-result-title::before { background: var(--line-b, var(--accent)); }
[data-result="allItems"] .ct-result-head::before, [data-result="allItems"] .ct-result-title::before { background: var(--line-x, var(--muted)); }
.ct-count { padding: 0; background: none; color: var(--muted); font-family: "Overpass Mono", ui-monospace, monospace; font-size: 12px; }
.ct-file { display: inline-flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); }
.ct-file .ct-ico { width: 12px; height: 12px; }
.ct-file-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn.ct-icon-btn { position: relative; flex: none; width: 40px; padding: 0; }
.ct-upload-btn { margin-left: auto; }
.btn.ct-upload-btn:hover:not(:disabled) { color: var(--ct-tone); }
.btn.ct-clear-btn:hover:not(:disabled) { color: var(--danger); }
.ct-spinner { width: 16px; height: 16px; border: 2px solid var(--ct-tone); border-top-color: transparent; border-radius: 50%; animation: ct-spin .8s linear infinite; }
@keyframes ct-spin { to { transform: rotate(360deg); } }
.ct-list .textarea { min-height: 160px; caret-color: var(--ct-tone); }
.ct-list .textarea:focus { border-color: var(--ct-tone); box-shadow: 0 0 0 3px var(--ct-tone-soft); }

.ct-split { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ct-split-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ct-split .ct-split-select { width: 160px; }
.ct-split .ct-custom-sep { flex: 1 1 120px; width: auto; min-width: 0; }

/* 选项：一行 */
.ct-options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 32px; }
.ct-options.card-body { padding: 12px 16px; }
.ct-options-title { font-size: 14px; }

/* 结果：2×2，每一项是线上的一个站 */
.ct-results-title { margin-bottom: 16px; }
.ct-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ct-result { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ct-result-head .ct-result-count { min-width: 28px; justify-content: center; background: var(--soft); color: var(--text); font-family: "Overpass Mono", ui-monospace, monospace; font-size: 14px; }
.ct-sort-btn { margin-left: auto; }
.btn.ct-sort-btn.is-active { background: var(--ct-tone-soft); color: var(--ct-tone); }
.ct-copied-ico { color: var(--ok); }

.ct-result-list, .ct-empty { box-sizing: border-box; flex: 1; margin: 0; min-height: 120px; border-radius: var(--radius-sm); background: var(--bg); }
.ct-result-list {
  max-height: 300px; overflow-y: auto; padding: 12px 12px 12px 48px; list-style: none;
  font-family: "Overpass Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.ct-result-list li { position: relative; }
.ct-result-list li + li { margin-top: 4px; }
.ct-result-list li::before { content: ""; position: absolute; top: 6px; left: -26px; z-index: 1; box-sizing: border-box; width: 11px; height: 11px; border: 3px solid var(--ct-tone); border-radius: 50%; background: var(--card); }
.ct-result-list li:not(:last-child)::after { content: ""; position: absolute; top: 11px; bottom: -15px; left: -22px; width: 3px; background: var(--ct-tone); }
/* 两边都有：A、B 两条线并排经过换乘站 */
[data-result="inBothLists"] .ct-result-list li:not(:last-child)::after { left: -24px; width: 7px; background: linear-gradient(90deg, var(--line-a, var(--primary)) 0 3px, transparent 3px 4px, var(--line-b, var(--accent)) 4px 7px); }
[data-result="inBothLists"] .ct-result-list li::before { top: 4px; left: -28px; width: 15px; height: 15px; }
.ct-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.ct-empty .ct-ico { display: none; }
.ct-empty::before {
  content: ""; width: 88px; height: 14px; opacity: .6;
  background:
    radial-gradient(circle, var(--bg) 0 3px, var(--ct-tone) 3.5px 6px, transparent 6.5px) 0 50% / 14px 14px no-repeat,
    radial-gradient(circle, var(--bg) 0 3px, var(--ct-tone) 3.5px 6px, transparent 6.5px) 50% 50% / 14px 14px no-repeat,
    radial-gradient(circle, var(--bg) 0 3px, var(--ct-tone) 3.5px 6px, transparent 6.5px) 100% 50% / 14px 14px no-repeat,
    linear-gradient(var(--ct-tone), var(--ct-tone)) 50% 50% / calc(100% - 14px) 3px no-repeat;
}

@media (max-width: 640px) {
  .ct-lists, .ct-results { grid-template-columns: minmax(0, 1fr); }
  .ct-head { margin-bottom: 12px; }
  .ct-options { margin-bottom: 24px; }
  .btn.ct-icon-btn { width: 36px; }
  .ct-options-title { flex-basis: 100%; }
}