.search { cursor: pointer; }
.search input { cursor: pointer; }
.search input:focus { outline: none; }
.search:focus-within { border-radius: 12px; box-shadow: 0 0 0 1px var(--muted); }
.search kbd { font: 11px system-ui; white-space: nowrap; color: var(--muted); }
#search-dialog {
  width: min(720px, calc(100% - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 0; border-radius: 20px; margin: 8vh auto auto;
  box-shadow: 0 24px 90px #0004; overflow: auto;
}
#search-dialog::backdrop {
  background: rgb(16 28 44 / 35%);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
:root[data-theme="dark"] #search-dialog::backdrop { background: rgb(3 10 20 / 60%); }
.search-dialog-head { display: flex; gap: 12px; padding: 20px; align-items: center; }
.search-field {
  position: relative; isolation: isolate;
  display: flex; gap: 10px; align-items: center; flex: 1; min-width: 0;
  padding: 0 8px 0 16px; border-radius: 28px; background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 180ms;
}
.search-field:focus-within {
  box-shadow: inset 0 0 0 1px var(--muted);
}
.search-field > .search-flow {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: hidden; border-radius: inherit; z-index: 2;
  filter: blur(.3px);
}
.search-flow rect {
  fill: none; stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 1.6 98.4; stroke-dashoffset: var(--flow-offset);
  animation: search-water-flow 5s linear infinite; animation-play-state: paused;
}
#search-dialog[open] .search-flow rect { animation-play-state: running; }
@keyframes search-water-flow {
  from { stroke-dashoffset: var(--flow-offset); }
  to { stroke-dashoffset: calc(var(--flow-offset) - 100px); }
}
@media(prefers-reduced-motion: reduce) {
  .search-flow rect { animation: none; }
}
.search-field input {
  width: 100%; min-width: 0; height: 48px; border: 0; padding: 0;
  background: transparent; color: var(--ink); font-size: 15px;
}
.search-field input:focus { outline: none; }
#search-dialog button { min-width: 40px; min-height: 40px; border-radius: 20px; }
#search-dialog button[hidden] { display: none; }
#search-dialog [aria-pressed="true"] { background: var(--tint); }
.search-dialog-body { padding: 0 24px 24px; }
.search-section-title {
  font: 500 12px/1.5 system-ui; letter-spacing: 0;
  color: var(--muted); margin: 20px 0 12px;
}
.search-shortcuts { display: flex; gap: 8px; flex-wrap: wrap; }
#search-dialog .search-shortcuts a, #search-dialog .search-shortcuts button {
  padding: 6px 12px; min-height: 32px; background: var(--soft);
  border-radius: 10px; font-size: 12px;
}
.search-category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search-category-grid a {
  display: flex; gap: 12px; align-items: center; padding: 14px;
  background: var(--soft); border-radius: 12px; font-size: 13px;
}
.search-category-grid svg { color: var(--accent); }
.search-result { display: flex; align-items: center; gap: 14px; padding: 14px 8px; }
.search-result:hover, .search-category-grid a:hover { background: var(--hover); }
.search-result strong { display: block; font-size: 14px; font-weight: 500; }
.search-result small { color: var(--muted); }
.search-result > svg { color: var(--accent); }
.search-result div { min-width: 0; overflow-wrap: anywhere; }
.search-footer { color: var(--muted); font-size: 11px; margin-top: 18px; }
#search-status { color: var(--muted); font-size: 12px; padding: 0 24px; }
@media(max-width:540px) {
  .search kbd { display: none; }
  #search-dialog { margin-top: 16px; max-height: calc(100dvh - 32px); }
  .search-dialog-head { padding: 16px; gap: 4px; }
  .search-dialog-body { padding: 0 16px 20px; }
  .search-field { gap: 6px; padding-left: 12px; }
  .search-field input { font-size: 14px; }
  .search-category-grid { grid-template-columns: 1fr; }
}
