.home-header-search {
  width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: color-mix(in srgb, var(--dim, #65675f) 86%, var(--gold-deep, #92703b));
  background: transparent;
  box-shadow: none;
  appearance: none;
  cursor: pointer;
}

.home-header-search-label { display: none; }

.home-header-search[hidden] { display: none !important; }

.home-header-search:hover,
.home-header-search[aria-expanded='true'] {
  color: var(--gold-deep, #92703b);
  background: transparent;
  transform: none;
}

.home-header-search:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--gold, #a98a55) 58%, transparent);
  outline-offset: -5px;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.home-header-search svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.65;
}

/* 桌面顶部统一采用紧凑圆角矩形；搜索与个人中心保持同一层级。 */
@media (min-width: 981px) {
  .home-site-nav-bar {
    min-height: 72px;
    gap: 12px;
  }

  .home-site-nav-bar .site-nav-panel { gap: 0; }
  .home-site-nav-bar .site-nav-links { gap: 4px; }

  .home-site-nav-bar .site-nav-link {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
  }

  .home-site-nav-bar .site-nav-link[aria-current='page'] {
    border-color: color-mix(in srgb, var(--primary-start, #6858c7) 20%, var(--line, rgba(116, 93, 55, .16)));
    background: color-mix(in srgb, var(--surface-lavender, #f0edff) 68%, var(--paper-strong, #fffdf8));
    box-shadow: 0 3px 12px rgba(71, 58, 139, .08);
  }

  .home-header-actions {
    gap: 10px;
    margin-left: 4px;
  }

  .home-header-search {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    gap: 0;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--primary-start, #6858c7) 18%, var(--line, rgba(116, 93, 55, .16)));
    border-radius: 12px;
    background: color-mix(in srgb, var(--paper-strong, #fffdf8) 88%, var(--surface-lavender, #f0edff));
  }

  .home-header-search:hover,
  .home-header-search[aria-expanded='true'] {
    border-color: color-mix(in srgb, var(--primary-start, #6858c7) 38%, var(--line, rgba(116, 93, 55, .16)));
    background: color-mix(in srgb, var(--surface-lavender, #f0edff) 72%, var(--paper-strong, #fffdf8));
  }

  .home-personal-center {
    width: auto;
    height: 44px;
    min-width: 112px;
    min-height: 44px;
    flex-basis: auto;
    justify-content: flex-start;
    gap: 8px;
    padding: 5px 14px 5px 6px;
    border-radius: 13px;
    border-color: color-mix(in srgb, var(--primary-start, #6858c7) 22%, var(--line, rgba(116, 93, 55, .16)));
    color: var(--ink, #2e2b44);
    background: color-mix(in srgb, var(--paper-strong, #fffdf8) 90%, var(--surface-lavender, #f0edff));
    box-shadow: 0 5px 14px rgba(71, 58, 139, .07);
    font-size: 13px;
    font-weight: 700;
  }

  .home-personal-center .personal-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-color: color-mix(in srgb, var(--primary-start, #6858c7) 24%, transparent);
    color: var(--primary-end, #4d429d);
    background: color-mix(in srgb, var(--surface-lavender, #f0edff) 82%, var(--paper-strong, #fffdf8));
    font-family: var(--sans, system-ui, sans-serif);
  }

  .home-personal-center:hover,
  .home-personal-center:focus-visible {
    border-color: color-mix(in srgb, var(--primary-start, #6858c7) 42%, var(--line, rgba(116, 93, 55, .16)));
    color: var(--primary-end, #4d429d);
    background: color-mix(in srgb, var(--surface-lavender, #f0edff) 68%, var(--paper-strong, #fffdf8));
    box-shadow: 0 7px 18px rgba(71, 58, 139, .11);
  }
}

.home-search-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 10px);
  right: clamp(20px, 3vw, 54px);
  width: min(420px, calc(100vw - 32px));
  max-height: min(610px, calc(100vh - 94px));
  max-height: min(610px, calc(100dvh - 94px));
  max-height: min(610px, calc(var(--tianji-visual-viewport-height, 100dvh) - 94px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line, rgba(116, 93, 55, .16)) 86%, #fff);
  border-radius: 18px;
  color: var(--ink, #242724);
  background: color-mix(in srgb, var(--paper-strong, #fffdf8) 96%, transparent);
  box-shadow: 0 22px 60px rgba(47, 41, 109, .18), inset 0 1px rgba(255, 255, 255, .8);
  backdrop-filter: blur(20px) saturate(118%);
  -webkit-backdrop-filter: blur(20px) saturate(118%);
}

.home-search-panel[hidden] { display: none; }

.home-search-field {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid color-mix(in srgb, var(--primary-start, #6858c7) 22%, var(--line, rgba(116, 93, 55, .16)));
  border-radius: 13px;
  color: var(--primary-start, #6858c7);
  background: color-mix(in srgb, var(--paper-strong, #fffdf8) 88%, var(--surface-lavender, #f0edff));
}

.home-search-field:focus-within {
  border-color: color-mix(in srgb, var(--primary-start, #6858c7) 56%, transparent);
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(104, 88, 199, .24));
}

.home-search-field svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.home-search-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink, #242724);
  background: transparent;
  font: 500 15px/1.4 var(--sans, system-ui, sans-serif);
}

.home-search-field input::placeholder { color: var(--faint, #68647a); }
.home-search-field input::-webkit-search-cancel-button { opacity: .48; }

.home-search-status {
  min-height: 20px;
  margin: 0;
  padding: 0 2px;
  color: var(--dim, #6f6b82);
  font: 500 11.5px/1.6 var(--sans, system-ui, sans-serif);
}

.home-search-results {
  min-height: 0;
  max-height: 408px;
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.home-search-result {
  min-height: 62px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: color .16s ease, background .16s ease;
}

.home-search-result:hover,
.home-search-result:focus-visible {
  color: var(--primary-end, #4d429d);
  background: color-mix(in srgb, var(--surface-lavender, #f0edff) 72%, transparent);
  outline: 0;
}

.home-search-result-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--primary-end, #4d429d);
  background: color-mix(in srgb, var(--surface-lavender, #f0edff) 86%, var(--paper-strong, #fffdf8));
  font: 700 16px/1 var(--serif, serif);
}

.home-search-result[data-kind='yaogua'] .home-search-result-mark { color: #347a69; background: #e8f7f2; }
.home-search-result[data-kind='ziwei'] .home-search-result-mark { color: #496fa5; background: #eaf3fc; }
.home-search-result[data-kind='dream'] .home-search-result-mark { color: #9a7321; background: #fff4d9; }
.home-search-result[data-kind='profile'] .home-search-result-mark { color: #a45170; background: #fceff2; }

.home-search-result-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.home-search-result-copy strong,
.home-search-result-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-search-result-copy strong { font: 600 14px/1.35 var(--serif, serif); }
.home-search-result-copy small { color: var(--dim, #6f6b82); font: 400 11.5px/1.4 var(--sans, system-ui, sans-serif); }
.home-search-result > i { color: currentColor; font: 400 22px/1 var(--sans, system-ui, sans-serif); opacity: .62; }

.home-search-empty {
  min-height: 94px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  color: var(--dim, #6f6b82);
  background: color-mix(in srgb, var(--paper-subtle, #f1ece2) 52%, transparent);
  font: 400 13px/1.7 var(--sans, system-ui, sans-serif);
  text-align: center;
}

.home-search-footer {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 2px 0;
  border-top: 1px solid color-mix(in srgb, var(--line, rgba(116, 93, 55, .16)) 76%, transparent);
}

.home-search-footer span { color: var(--faint, #68647a); font-size: 11.5px; }
.home-search-footer a { min-height: 44px; display: inline-flex; align-items: center; gap: 4px; color: var(--primary-end, #4d429d); font-size: 12px; font-weight: 600; text-decoration: none; }
.home-search-footer a:hover,
.home-search-footer a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.home-search-footer i { font-style: normal; font-size: 18px; }

@media (max-width: 980px) {
  .home-personal-center { display: none; }

  @supports selector(.site-header:has(.home-search-panel:not([hidden]))) {
    .site-header:has(.home-search-panel:not([hidden])) { z-index: 34; }
  }

  .home-search-panel {
    top: calc(100% + 8px);
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 130px - var(--mobile-shell-height, 64px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 130px - var(--mobile-shell-height, 64px) - env(safe-area-inset-bottom, 0px));
    max-height: calc(var(--tianji-visual-viewport-height, 100dvh) - 130px - var(--mobile-shell-height, 64px) - env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 520px) {
  .home-search-panel { padding: 12px; border-radius: 16px; }
  .home-search-field input { font-size: 16px; }
  .home-search-results { max-height: calc(100vh - 264px - var(--mobile-shell-height, 64px) - env(safe-area-inset-bottom, 0px)); }
  .home-search-results { max-height: calc(100dvh - 264px - var(--mobile-shell-height, 64px) - env(safe-area-inset-bottom, 0px)); }
  .home-search-results { max-height: calc(var(--tianji-visual-viewport-height, 100dvh) - 264px - var(--mobile-shell-height, 64px) - env(safe-area-inset-bottom, 0px)); }
  .home-search-footer span { display: none; }
  .home-search-footer { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .home-search-result { transition: none; }
}
