.search {
  position: relative;
  z-index: 20;
  width: min(420px, calc(100vw - 24px));
  margin-top: 14px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  color: #4d7c5e;
  pointer-events: none;
}
.search-icon svg { width: 16px; height: 16px; }
.search input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 36px;
  border-radius: 10px;
  border: 1px solid var(--search-border);
  background: rgba(5, 15, 10, 0.82);
  color: var(--text);
  font-size: 14px;
  user-select: text;
  -webkit-user-select: text;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.search input::placeholder { color: #6b8f78; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus {
  border-color: var(--search-focus);
  box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.35);
}
.search-kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid #1f5135;
  color: #6b8f78;
  font: 600 11px var(--font-mono);
  pointer-events: none;
}
.search input:focus ~ .search-kbd { display: none; }

.search-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: min(340px, 50vh);
  overflow-y: auto;
  list-style: none;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--search-border);
  background: rgba(8, 14, 26, 0.97);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: #1f5135 transparent;
}
.search-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.search-list li[aria-selected='true'] { background: rgba(22, 101, 52, 0.35); }
.search-list .s-icon { width: 28px; height: 28px; border-radius: 6px; font-size: 13px; }
.search-list .sr-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-list .sr-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-list .sr-empty { color: var(--muted); cursor: default; justify-content: center; padding: 10px; }

@media (pointer: coarse) {
  .search-kbd { display: none; }
  .search input { padding-right: 12px; }
}

@media (max-width: 820px) {
  .search { margin-top: 10px; }
  .search input {
    height: 40px;
    font-size: 16px;
  }
  .search-list {
    max-height: min(300px, 42dvh);
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }
  .search-list li {
    padding: 8px 10px;
    min-height: 42px;
  }
}
