/* Command palette */
#command-menu {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100dvh - 64px);
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid #ffffff80;
  border-radius: 20px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow:
  0 28px 90px #10101038,
  0 4px 16px #1010101a;
  overflow: hidden;
}

#command-menu::backdrop {
  background: #10101052;
  backdrop-filter: blur(5px);
}

.command-search {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 22px;
  padding: 22px 0 17px;
  border-bottom: 1px solid var(--line);
  color: #777;
}

.command-search > svg {
  flex: none;
}

.command-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: var(--color-text);
}

.command-search input::placeholder {
  color: #969696;
}

.command-search input:focus-visible {
  outline: none;
}

#command-close {
  display: grid;
  place-items: center;
  flex: none;
  padding: 4px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  color: #777;
}

#command-menu kbd {
  font: 10px var(--font-app);
  line-height: 1;
  border: 1px solid #dedede;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 4px 5px;
  background: #fff;
  color: var(--color-muted);
}

.command-hint {
  padding: 12px 23px 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-muted);
}

#command-results {
  max-height: min(450px, calc(100dvh - 260px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 10px 10px;
  scroll-padding: 8px;
  transition: opacity 0.12s;
}

#command-results[aria-busy="true"] {
  opacity: 0.45;
}

.command-group {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #898989;
}

.command-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  transition:
  background 0.12s,
  border-color 0.12s;
}

.command-result[aria-selected="true"] {
  background: var(--color-surface-soft);
  border-color: #e5e5e5;
}

.command-result:active {
  background: var(--color-line);
}

.command-mark {
  width: 34px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--color-muted);
  flex: none;
}

.command-lesson .command-mark {
  background: var(--color-surface-soft);
  border: 1px solid var(--color-line);
}

.command-result[aria-selected="true"] .command-mark {
  color: var(--color-text);
}

.command-course-mark {
  font-size: 21px;
}

.command-copy {
  flex: 1;
  min-width: 0;
}

.command-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.command-copy small {
  display: block;
  font-size: 10px;
  line-height: 1.5;
  margin-top: 2px;
  color: #8a8a8a;
}

.command-copy .command-context {
  margin: 0 0 3px;
  color: var(--color-muted);
}

.command-context > span {
  white-space: nowrap;
}

.command-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.command-enter {
  flex: none;
  font-size: 15px;
  color: var(--color-muted);
  opacity: 0;
}

.command-result[aria-selected="true"] .command-enter {
  opacity: 1;
}

.command-type {
  font-size: 10px;
  color: #a0a0a0;
}

.command-page {
  padding-block: 7px;
}

.command-page .command-mark {
  height: 28px;
}

.command-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  background: #fafafa;
  border-top: 1px solid var(--color-line);
  font-size: 10px;
  color: #919191;
}

.command-footer > span:first-child {
  display: flex;
  align-items: center;
  gap: 5px;
}

.command-footer kbd:nth-of-type(3) {
  margin-left: 8px;
}

.command-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 36px 20px 40px;
  text-align: center;
  color: #939393;
  font-size: 12px;
  line-height: 1.7;
}

.command-empty strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
}

.command-empty p {
  max-width: 280px;
}

@media (max-width: 640px) {
  .command-search {
    margin-inline: 17px;
    padding-top: 18px;
    gap: 10px;
  }
  .command-search input {
    font-size: 16px;
  }
  .command-footer {
    padding-inline: 17px;
  }
  .command-footer {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .command-result,
  #command-results {
    transition: none;
  }
}

@media (max-width: 640px) {
  #command-input,
  #chat-input,
  .setting-field input,
  .setting-field select {
    font-size: 16px;
  }
  #command-menu {
    margin-top: calc(24px + env(safe-area-inset-top, 0px));
    max-height: calc(
    100dvh - 48px - env(safe-area-inset-top, 0px) -
    env(safe-area-inset-bottom, 0px)
    );
  }
  #command-results {
    max-height: min(450px, calc(100dvh - 240px));
  }
}

a.dock-item,
a.command-result,
a.date {
  text-decoration: none;
}

.command-result[hidden],
.command-empty[hidden] {
  display: none;
}
