/* 达人对比：悬浮框 + 历史 + 结果页 */

.kc-tray {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 1200;
  width: 280px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  font-size: 13px;
  color: #0f172a;
}

.kc-tray.is-collapsed {
  width: auto;
  min-width: 120px;
}

.kc-tray.is-collapsed .kc-tray-body,
.kc-tray.is-collapsed .kc-tray-foot {
  display: none;
}

.kc-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid #e2e8f0;
}

.kc-tray-title {
  font-weight: 700;
  font-size: 13px;
}

.kc-tray-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kc-tray-link,
.kc-tray-toggle {
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}

.kc-tray-link:hover,
.kc-tray-toggle:hover {
  color: #0f766e;
}

.kc-tray-body {
  max-height: 320px;
  overflow: auto;
  padding: 8px 10px;
}

.kc-tray-empty {
  padding: 18px 8px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

.kc-tray-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 8px;
}

.kc-tray-item:hover {
  background: #f8fafc;
}

.kc-tray-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
  flex-shrink: 0;
}

.kc-tray-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 14px;
}

.kc-tray-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.kc-tray-remove {
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
}

.kc-tray-remove:hover {
  color: var(--bd-down, #f53f3f);
}

.kc-tray-foot {
  padding: 10px 12px 12px;
  border-top: 1px solid #e2e8f0;
}

.kc-tray-start {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.kc-tray-start:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.kc-tray-start:not(:disabled):hover {
  background: #0d9488;
}

/* 列表对比按钮 */
.ks-action-btn.is-compared {
  color: #0f766e;
  border-color: #99f6e4;
  background: #f0fdfa;
}

.kmd-action-btn.is-compared {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

/* 历史页 */
.kc-page {
  padding: 8px 4px 40px;
  color: #0f172a;
}

.kc-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.kc-page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.kc-page-sub {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.kc-hist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.kc-hist-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kc-hist-card:hover {
  border-color: #99f6e4;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.08);
}

.kc-hist-avatars {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.kc-hist-avatars img,
.kc-hist-avatars .kc-tray-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-left: -8px;
  object-fit: cover;
  background: #e2e8f0;
}

.kc-hist-avatars > :first-child {
  margin-left: 0;
}

.kc-hist-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 12px;
}

.kc-hist-names {
  margin: 6px 0 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kc-hist-del {
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 12px;
}

.kc-hist-del:hover {
  color: var(--bd-down, #f53f3f);
}

.kc-empty {
  padding: 64px 20px;
  text-align: center;
  color: #94a3b8;
}

.kc-empty h3 {
  margin: 0 0 8px;
  color: #64748b;
}

/* 结果页 */
.kc-result {
  padding: 4px 0 48px;
}

.kc-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.kc-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.kc-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #334155;
}

.kc-btn:hover {
  border-color: #99f6e4;
  color: #0f766e;
}

.kc-btn-primary {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.kc-btn-primary:hover {
  background: #0d9488;
  color: #fff;
}

.kc-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.kc-section h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
}

.kc-table-wrap {
  overflow-x: auto;
}

.kc-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 13px;
}

.kc-table th,
.kc-table td {
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
}

.kc-table th:first-child,
.kc-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  min-width: 110px;
  color: #64748b;
  font-weight: 600;
}

.kc-table thead th {
  background: #f8fafc;
  font-weight: 700;
}

.kc-kol-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 96px;
}

.kc-kol-cell img,
.kc-kol-cell .kc-tray-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

.kc-kol-cell-name {
  font-size: 12px;
  font-weight: 700;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kc-cell-best {
  color: #b45309;
  font-weight: 800;
  background: #fffbeb;
}

.kc-crown {
  display: inline-block;
  margin-right: 2px;
}

.kc-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.kc-toggle {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #64748b;
}

.kc-toggle.is-active {
  border-color: #0f766e;
  background: #f0fdfa;
  color: #0f766e;
  font-weight: 700;
}

.kc-chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.kc-chart {
  width: 100%;
  min-height: 240px;
  display: block;
}

.kc-chart-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.kc-chart-axis {
  fill: #94a3b8;
  font-size: 11px;
}

.kc-chart-line {
  fill: none;
  stroke-width: 2.2;
}

.kc-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: #475569;
}

.kc-chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.kc-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.kc-profile-card {
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 12px;
  background: #fafafa;
}

.kc-profile-card h4 {
  margin: 0 0 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kc-profile-card h4 img,
.kc-profile-card h4 .kc-tray-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

.kc-bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 42px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}

.kc-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.kc-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #0f766e;
}

.kc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.kc-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0e7490;
}

.kc-state {
  padding: 40px 16px;
  text-align: center;
  color: #94a3b8;
}

.kc-state.is-error {
  color: var(--bd-down, #f53f3f);
}

@media (max-width: 720px) {
  .kc-tray {
    right: 8px;
    bottom: 12px;
    width: min(280px, calc(100vw - 16px));
  }

  .kmd-compare-btn {
    right: 44px;
    padding: 3px 8px;
  }
}
