/* /keys toolbar "客户端下载" card. Surfaces follow the native outline button (查看), so light/dark follow the console theme. */
.ht-client-downloads {
  --ht-client-radius: var(--radius, 1rem);
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 3px 0 10px;
  border: 1px solid var(--border, #e8e8e8);
  border-radius: var(--ht-client-radius);
  background: var(--background, #fff);
  color: var(--foreground, #0a0a0a);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  animation: ht-client-arrive .32s cubic-bezier(.2, .8, .2, 1) both;
}

.dark .ht-client-downloads {
  border-color: var(--input, #3a3a3a);
  background: color-mix(in oklch, var(--input, #3a3a3a) 30%, transparent);
}

.ht-client-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-right: 8px;
  border-right: 1px solid var(--border, #e8e8e8);
  color: var(--muted-foreground, #606060);
  font-size: 12px;
  font-weight: 500;
}

.dark .ht-client-title { border-right-color: var(--input, #3a3a3a); }

.ht-client-title-icon svg { display: block; width: 13px; height: 13px; }

.ht-client-list { display: inline-flex; align-items: center; gap: 2px; }

.ht-client-link {
  --ht-client-accent: var(--primary, #3ea4ec);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 7px;
  border-radius: calc(var(--ht-client-radius) - 6px);
  color: inherit;
  font-weight: 500;
  text-decoration: none;
  outline: none;
  transition: background-color .18s ease, color .18s ease, transform .16s cubic-bezier(.2, .8, .2, 1);
}

.ht-client-link[data-client="chatgpt"] { --ht-client-accent: #10a37f; }
.ht-client-link[data-client="claude"] { --ht-client-accent: #d97757; }
.ht-client-link[data-client="deepseek"] { --ht-client-accent: #4d6bfe; }
.dark .ht-client-link[data-client="deepseek"] { --ht-client-accent: #7d93ff; }
.dark .ht-client-link[data-client="ccswitch"] { --ht-client-accent: color-mix(in oklch, var(--primary, #0e72bc) 62%, #fff); }

.ht-client-mark,
.ht-client-arrow { display: inline-flex; flex: none; }

.ht-client-mark svg {
  display: block;
  width: 14px;
  height: 14px;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), color .18s ease;
}

.ht-client-mark { color: var(--muted-foreground, #606060); }
.ht-client-link[data-client="claude"] .ht-client-mark { color: #d97757; }
.ht-client-link[data-client="deepseek"] .ht-client-mark { color: #4d6bfe; }
.ht-client-link[data-client="deepseek"] .ht-client-mark svg { width: 17px; }
.ht-client-eye { fill: var(--background, #fff); }

/* The external-link arrow floats in the padding so hovering never reflows (and wraps) the toolbar. */
.ht-client-link { padding-right: 12px; }

.ht-client-arrow {
  position: absolute;
  top: 3px;
  right: 2px;
  opacity: 0;
  transition: opacity .2s ease;
}

.ht-client-arrow svg {
  display: block;
  width: 9px;
  height: 9px;
  transform: translate(-3px, 3px);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}

.ht-client-link:hover,
.ht-client-link:focus-visible {
  color: var(--ht-client-accent);
  background-color: color-mix(in oklch, var(--ht-client-accent) 11%, transparent);
}

.dark .ht-client-link:hover,
.dark .ht-client-link:focus-visible { background-color: color-mix(in oklch, var(--ht-client-accent) 20%, transparent); }

.ht-client-link:focus-visible { box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring, #42a6ff) 55%, transparent); }

.ht-client-link:hover .ht-client-mark,
.ht-client-link:focus-visible .ht-client-mark { color: var(--ht-client-accent); }

.ht-client-link:hover .ht-client-mark svg,
.ht-client-link:focus-visible .ht-client-mark svg { transform: scale(1.14) rotate(-8deg); }

.ht-client-link[data-client="claude"]:hover .ht-client-mark svg { transform: scale(1.12) rotate(30deg); }

.ht-client-link:hover .ht-client-arrow,
.ht-client-link:focus-visible .ht-client-arrow { opacity: 1; }

.ht-client-link:hover .ht-client-arrow svg,
.ht-client-link:focus-visible .ht-client-arrow svg { transform: translate(0, 0); }

.ht-client-link:active { transform: scale(.94); }

/* Click: a ring expands from the pressed item. */
.ht-client-link::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
}

.ht-client-link.is-pressed::after { animation: ht-client-ripple .5s ease-out; }

.ht-client-tip {
  position: fixed;
  z-index: 60;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--foreground, #0a0a0a);
  color: var(--background, #fff);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px) scale(.96);
  transform-origin: 50% 0;
  transition: opacity .12s ease, transform .12s ease;
}

.ht-client-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}

.ht-client-tip[data-open="true"] { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Set by the script when full names would push the toolbar onto a second row; names stay in the tooltip and aria-label. */
.ht-client-downloads.is-compact .ht-client-name,
.ht-client-downloads.is-compact .ht-client-arrow { display: none; }
.ht-client-downloads.is-compact .ht-client-link { gap: 0; padding: 0 7px; }

@media (max-width: 639px) {
  .ht-client-title { padding-right: 6px; }
  .ht-client-downloads.is-compact .ht-client-link { padding: 0 5px; }
}

@keyframes ht-client-ripple {
  0% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in oklch, var(--ht-client-accent) 45%, transparent); }
  100% { opacity: 0; box-shadow: 0 0 0 8px color-mix(in oklch, var(--ht-client-accent) 0%, transparent); }
}

@keyframes ht-client-arrive {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ht-client-downloads,
  .ht-client-downloads *,
  .ht-client-link::after,
  .ht-client-tip {
    animation: none !important;
    transition: none !important;
  }
}
