:root {
  --command-accent: #4aaef7;
  --command-surface: rgba(248, 252, 255, .94);
  --command-text: #18334a;
  --command-muted: #6f8292;
  --command-border: rgba(73, 148, 202, .2);
}

#command-palette-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

#command-palette-button .command-key {
  padding: 1px 5px;
  border: 1px solid rgba(128, 144, 158, .38);
  border-radius: 5px;
  background: rgba(255, 255, 255, .14);
  font-size: 10px;
  line-height: 17px;
  opacity: .78;
}

#command-palette-button:hover {
  color: var(--command-accent);
}

.command-palette-overlay {
  position: fixed;
  z-index: 10010;
  inset: 0;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: min(13vh, 110px) 18px 24px;
  background: rgba(8, 18, 29, .48);
  opacity: 0;
  visibility: hidden;
  backdrop-filter: blur(10px) saturate(.85);
  transition: opacity .2s ease, visibility .2s ease;
}

.command-palette-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.command-palette {
  width: min(620px, 100%);
  overflow: hidden;
  border: 1px solid var(--command-border);
  border-radius: 20px;
  background: var(--command-surface);
  box-shadow: 0 30px 80px rgba(0, 22, 44, .3);
  color: var(--command-text);
  transform: translateY(-12px) scale(.985);
  transition: transform .22s ease;
}

.command-palette-overlay.is-open .command-palette {
  transform: translateY(0) scale(1);
}

.command-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--command-border);
}

.command-search-wrap > i {
  color: var(--command-accent);
  font-size: 17px;
}

#command-palette-input {
  min-width: 0;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-size: 16px;
}

#command-palette-input::placeholder {
  color: var(--command-muted);
}

.command-esc {
  padding: 3px 7px;
  border: 1px solid var(--command-border);
  border-radius: 6px;
  background: rgba(117, 164, 196, .08);
  color: var(--command-muted);
  font-size: 10px;
}

.command-results {
  max-height: min(57vh, 490px);
  overflow-y: auto;
  padding: 10px;
  overscroll-behavior: contain;
}

.command-section-label {
  padding: 9px 10px 6px;
  color: var(--command-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.command-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.command-item:hover,
.command-item.is-active,
.command-item:focus-visible {
  background: linear-gradient(90deg, rgba(64, 172, 246, .14), rgba(101, 117, 255, .08));
  outline: none;
}

.command-item-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid hsl(var(--command-hue, 205) 75% 65% / .22);
  border-radius: 10px;
  background: hsl(var(--command-hue, 205) 80% 60% / .1);
  color: hsl(var(--command-hue, 205) 62% 48%);
}

.command-item-copy {
  min-width: 0;
}

.command-item-title,
.command-item-description {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-item-title {
  font-size: 14px;
  font-weight: 650;
}

.command-item-description {
  margin-top: 2px;
  color: var(--command-muted);
  font-size: 11px;
}

.command-item-hint {
  color: var(--command-muted);
  font-size: 11px;
}

.command-empty {
  padding: 40px 20px;
  color: var(--command-muted);
  text-align: center;
}

.command-empty i {
  display: block;
  margin-bottom: 10px;
  color: var(--command-accent);
  font-size: 24px;
}

.command-footer {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--command-border);
  color: var(--command-muted);
  font-size: 10px;
}

.command-footer kbd {
  margin-right: 4px;
  padding: 1px 4px;
  border: 1px solid var(--command-border);
  border-radius: 4px;
  background: rgba(117, 164, 196, .08);
  font: inherit;
}

body.command-palette-open {
  overflow: hidden;
}

[data-theme='dark'] {
  --command-surface: rgba(7, 20, 34, .96);
  --command-text: #e8f6ff;
  --command-muted: #8ba4b7;
  --command-border: rgba(93, 192, 255, .2);
}

[data-theme='dark'] .command-palette {
  box-shadow: 0 32px 90px rgba(0, 0, 0, .58), inset 0 0 30px rgba(50, 174, 255, .035);
}

@media (max-width: 768px) {
  #command-palette-button {
    padding: 0 5px;
  }

  #command-palette-button .command-key {
    display: none;
  }

  .command-palette-overlay {
    align-items: end;
    padding: 12px;
  }

  .command-palette {
    border-radius: 20px 20px 14px 14px;
  }

  .command-results {
    max-height: 55vh;
  }

  .command-footer {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .command-palette-overlay,
  .command-palette {
    transition: none;
  }
}
