/* CBSS command palette (lane "palette"). Tokens follow
   DESIGN_DIRECTION_20261013: neutral surfaces, one accent (focus + active),
   Inter, 12/13/14 scale, 150-200ms motion, shadows only on floating layers. */
.cbssp-root {
  --p-bg: #111317;
  --p-elev: #16181d;
  --p-border: rgba(255, 255, 255, 0.08);
  --p-text: #e8e9ec;
  --p-muted: #8b8f98;
  --p-hover: rgba(255, 255, 255, 0.05);
  --p-active: rgba(255, 255, 255, 0.08);
  --p-accent: var(--accent, #3b82f6);
  --p-scrim: rgba(5, 6, 8, 0.6);
  --p-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --p-ease: cubic-bezier(.2, .8, .2, 1);
  position: fixed;
  inset: 0;
  z-index: 10050;
  font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--p-text);
}
[data-theme="light"] .cbssp-root {
  --p-bg: #ffffff;
  --p-elev: #fafafa;
  --p-border: #e6e6e6;
  --p-text: #16181d;
  --p-muted: #6b6f78;
  --p-hover: rgba(0, 0, 0, 0.035);
  --p-active: rgba(0, 0, 0, 0.06);
  --p-scrim: rgba(20, 22, 26, 0.28);
  --p-shadow: 0 24px 64px rgba(16, 18, 24, 0.18), 0 2px 8px rgba(16, 18, 24, 0.08);
}
.cbssp-root[hidden] { display: none; }
.cbssp-root [lang="zh"] { font-family: 'Noto Sans SC', 'Inter', system-ui, sans-serif; }

/* One language at a time. html[data-lang] is the shell lane's switch;
   until it exists the palette shows English. */
html:not([data-lang="zh"]) .cbssp-root span[lang="zh"],
html[data-lang="zh"] .cbssp-root span[lang="en"] { display: none; }

.cbssp-scrim {
  position: absolute;
  inset: 0;
  background: var(--p-scrim);
  animation: cbssp-fade 150ms var(--p-ease);
}
.cbssp-dialog {
  position: relative;
  margin: min(14vh, 120px) auto 0;
  width: min(640px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 160px));
  display: flex;
  flex-direction: column;
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  border-radius: 12px;
  box-shadow: var(--p-shadow);
  overflow: hidden;
  animation: cbssp-in 180ms var(--p-ease);
}
.cbssp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--p-border);
  flex: none;
}
.cbssp-search-icon {
  width: 16px;
  height: 16px;
  flex: none;
  border: 1.6px solid var(--p-muted);
  border-radius: 50%;
  position: relative;
  transform: translate(-1px, -1px);
}
.cbssp-search-icon::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 1.6px;
  background: var(--p-muted);
  right: -5px;
  bottom: -2px;
  transform: rotate(45deg);
  border-radius: 1px;
}
.cbssp-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--p-text);
  font: inherit;
  font-size: 15px;
}
.cbssp-input::placeholder { color: var(--p-muted); }
.cbssp-close {
  flex: none;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--p-border);
  background: var(--p-elev);
  color: var(--p-muted);
  font: 500 12px/1 'Inter', system-ui, sans-serif;
  cursor: pointer;
}
.cbssp-close:hover { color: var(--p-text); }
/* The app's global :focus-visible paints a brand ring on every focusable.
   The combobox is auto-focused the moment the dialog opens, so that ring is
   permanent chrome: the dialog itself is the focus indicator here. The close
   button keeps a real accent ring. */
.cbssp-input:focus,
.cbssp-input:focus-visible { outline: none; box-shadow: none; }
.cbssp-close:focus-visible { outline: 2px solid var(--p-accent); outline-offset: 2px; box-shadow: none; }

.cbssp-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 8px;
  flex: 1 1 auto;
  scroll-padding: 32px 0 8px;
}
.cbssp-list[hidden] { display: none; }
.cbssp-group + .cbssp-group { margin-top: 4px; }
.cbssp-group-label {
  padding: 10px 8px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--p-muted);
}
.cbssp-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--p-text);
  transition: background-color 120ms var(--p-ease);
}
.cbssp-opt:hover { background: var(--p-hover); }
.cbssp-opt.is-active { background: var(--p-active); }
.cbssp-opt.is-active .cbssp-opt-mark { border-color: var(--p-accent); }
.cbssp-opt-mark {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1.5px solid var(--p-muted);
  opacity: .9;
}
.cbssp-opt-mark.cbssp-k-act { border-radius: 50%; }
.cbssp-opt-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}
.cbssp-hit {
  background: transparent;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--p-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.cbssp-opt-kind {
  flex: none;
  font-size: 12px;
  color: var(--p-muted);
}
.cbssp-opt-hint {
  flex: none;
  min-width: 36px;
  display: flex;
  justify-content: flex-end;
}
.cbssp-kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid var(--p-border);
  background: var(--p-elev);
  color: var(--p-muted);
  font: 500 11px/1 'Inter', system-ui, sans-serif;
  font-feature-settings: "tnum";
}
.cbssp-empty { padding: 40px 24px 44px; text-align: center; }
.cbssp-empty[hidden] { display: none; }
.cbssp-empty-title { font-size: 14px; font-weight: 500; }
.cbssp-empty-sub { margin-top: 6px; font-size: 13px; color: var(--p-muted); }
.cbssp-foot {
  flex: none;
  display: flex;
  gap: 16px;
  padding: 0 16px;
  height: 36px;
  align-items: center;
  border-top: 1px solid var(--p-border);
  background: var(--p-elev);
  font-size: 12px;
  color: var(--p-muted);
}
.cbssp-foot-item { display: inline-flex; align-items: center; gap: 6px; }
.cbssp-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@keyframes cbssp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cbssp-in {
  from { opacity: 0; transform: translateY(-6px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes cbssp-sheet { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Mobile: full-width bottom sheet, 44px tap targets, no footer hints. */
@media (max-width: 768px) {
  .cbssp-dialog {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    width: 100%;
    max-height: calc(100dvh - 48px);
    height: calc(100dvh - 48px);
    border-radius: 14px 14px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    animation-name: cbssp-sheet;
  }
  .cbssp-head { height: 56px; }
  .cbssp-input { font-size: 16px; } /* no iOS zoom-on-focus */
  .cbssp-close { height: 32px; min-width: 44px; }
  .cbssp-opt { min-height: 44px; }
  .cbssp-opt-hint, .cbssp-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cbssp-scrim, .cbssp-dialog { animation: none; }
  .cbssp-opt { transition: none; }
}
html[data-reduce-motion="on"] .cbssp-scrim,
html[data-reduce-motion="on"] .cbssp-dialog { animation: none; }
html[data-reduce-motion="on"] .cbssp-opt { transition: none; }
