/* Zensical 搜索弹层：圆角卡片结果 + 右侧 Tags */
.gps-search[hidden] {
  display: none !important;
}

.gps-search {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 1.25rem 2rem;
  font-family: var(--md-text-font-family, "Roboto", system-ui, sans-serif);
}

.gps-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gps-search__dialog {
  --gps-search-line: rgba(15, 23, 42, 0.08);
  --gps-search-muted: #8a9099;
  --gps-search-body: #5d636c;
  --gps-search-hover: #eef0f3;
  --gps-search-tag: #e7edff;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13.75rem;
  width: min(52.5rem, 100%);
  height: min(42rem, 80vh);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1rem;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 18px 48px rgba(15, 23, 42, 0.18);
  color: #1c1f24;
}

[data-md-color-scheme="slate"] .gps-search__dialog {
  --gps-search-line: rgba(255, 255, 255, 0.1);
  --gps-search-muted: #9aa3b2;
  --gps-search-body: #c5cbd4;
  --gps-search-hover: rgba(255, 255, 255, 0.08);
  --gps-search-tag: rgba(99, 140, 255, 0.22);
  background: #1c2128;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e8eaed;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.gps-search__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--gps-search-line);
}

.gps-search__bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 0 0 auto;
  height: 3.15rem;
  padding: 0 0.95rem 0 1.1rem;
}

.gps-search__icon {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  opacity: 0.38;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.gps-search__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.98rem;
}

.gps-search__input::placeholder {
  color: var(--gps-search-muted);
}

.gps-search__filter-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  margin-right: -0.15rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--gps-search-muted);
  cursor: pointer;
}

.gps-search__filter-toggle:hover {
  background: var(--gps-search-hover);
  color: inherit;
}

.gps-search__filter-icon {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.28rem auto 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h16l-6.2 7.4V19l-3.6 1.6v-8.2L4 5z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h16l-6.2 7.4V19l-3.6 1.6v-8.2L4 5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.gps-search__filter-badge {
  position: absolute;
  top: -0.05rem;
  right: -0.05rem;
  min-width: 0.85rem;
  height: 0.85rem;
  padding: 0 0.18rem;
  border-radius: 999px;
  background: #3b82f6;
  color: #fff;
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 0.85rem;
  text-align: center;
}

.gps-search__side-scrim {
  display: none;
}

.gps-search--side-collapsed .gps-search__dialog {
  grid-template-columns: 1fr;
}

.gps-search--side-collapsed .gps-search__side {
  display: none;
}

.gps-search--side-collapsed .gps-search__main {
  border-right: 0;
}

.gps-search__side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
}

.gps-search__side-head h2 {
  margin: 0;
}

.gps-search__meta {
  flex: 0 0 auto;
  min-height: 1.55rem;
  padding: 0 1.15rem 0.45rem;
  color: var(--gps-search-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.gps-search__results {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0 0.45rem 0.7rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.22) transparent;
}

.gps-search__results::-webkit-scrollbar {
  width: 0.45rem;
}

.gps-search__results::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.18);
}

.gps-search__item {
  display: block;
  margin: 0.08rem 0.2rem;
  padding: 0.72rem 0.85rem 0.78rem;
  border: 0;
  border-radius: 0.7rem;
  color: inherit;
  text-decoration: none;
  outline: none;
}

.gps-search__item:hover,
.gps-search__item:focus,
.gps-search__item.is-active {
  background: var(--gps-search-hover);
}

.gps-search__path {
  margin-bottom: 0.18rem;
  color: var(--gps-search-muted);
  font-size: 0.72rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gps-search__title {
  margin: 0 0 0.22rem;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.gps-search__snippet {
  display: -webkit-box;
  overflow: hidden;
  color: var(--gps-search-body);
  font-size: 0.78rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.gps-search__empty {
  margin: 1.4rem 1.1rem;
  color: var(--gps-search-muted);
  font-size: 0.78rem;
}

.gps-search__side {
  overflow: auto;
  padding: 0.95rem 0.7rem 1rem 0.8rem;
  background: #f6f7f9;
  scrollbar-width: thin;
}

[data-md-color-scheme="slate"] .gps-search__side {
  background: rgba(255, 255, 255, 0.035);
}

.gps-search__side h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.gps-search__side-label {
  margin: 0 0 0.35rem;
  color: var(--gps-search-muted);
  font-size: 0.7rem;
}

.gps-search__tags {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gps-search__tag {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.08rem 0;
  padding: 0.38rem 0.5rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.gps-search__tag-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gps-search__tag-count {
  flex: 0 0 auto;
  color: var(--gps-search-muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.gps-search__tag:hover {
  background: rgba(15, 23, 42, 0.05);
}

[data-md-color-scheme="slate"] .gps-search__tag:hover {
  background: rgba(255, 255, 255, 0.06);
}

.gps-search__tag.is-active {
  background: var(--gps-search-tag);
  color: inherit;
  font-weight: 500;
}

.gps-search__tag.is-active .gps-search__tag-count {
  color: #4f6bed;
}

[data-md-color-scheme="slate"] .gps-search__tag.is-active .gps-search__tag-count {
  color: #9db4ff;
}

html.gps-search-open,
html.gps-search-open body {
  overflow: hidden !important;
}

html.gps-search-open .md-search__output,
html.gps-search-open .md-search__overlay {
  display: none !important;
}

@media screen and (max-width: 44.984375em) {
  .gps-search {
    padding: 0;
    align-items: stretch;
  }

  .gps-search__dialog {
    position: relative;
    display: block;
    grid-template-columns: none;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }

  .gps-search__main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-right: 0;
    background: inherit;
  }

  .gps-search__bar {
    height: 3.25rem;
    padding: 0 0.85rem 0 1rem;
    border-bottom: 1px solid var(--gps-search-line);
  }

  .gps-search__meta {
    padding: 0.55rem 1rem 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: inherit;
  }

  .gps-search__results {
    padding: 0 0.35rem 1rem;
  }

  .gps-search__item {
    margin: 0.05rem 0.15rem;
    padding: 0.78rem 0.75rem;
    border-radius: 0.65rem;
  }

  .gps-search__side-scrim {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    border: 0;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .gps-search__side {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex !important;
    flex-direction: column;
    width: min(15.5rem, 56vw);
    max-height: none;
    padding: 0.95rem 0.75rem 1.1rem 0.9rem;
    background: #fff;
    border: 0;
    border-left: 1px solid var(--gps-search-line);
    box-shadow: -10px 0 28px rgba(15, 23, 42, 0.14);
    transform: translateX(104%);
    transition: transform 0.22s ease;
    overflow: auto;
    pointer-events: none;
  }

  [data-md-color-scheme="slate"] .gps-search__side {
    background: #1c2128;
    box-shadow: -10px 0 28px rgba(0, 0, 0, 0.4);
  }

  .gps-search--side-collapsed .gps-search__side {
    display: flex !important;
    transform: translateX(104%);
    pointer-events: none;
  }

  .gps-search--side-open .gps-search__side {
    transform: translateX(0);
    pointer-events: auto;
  }

  .gps-search--side-open .gps-search__side-scrim {
    display: block;
  }

  .gps-search--side-collapsed .gps-search__dialog,
  .gps-search--side-open .gps-search__dialog {
    grid-template-columns: none;
  }

  .gps-search--side-collapsed .gps-search__main,
  .gps-search--side-open .gps-search__main {
    border-right: 0;
  }

  .gps-search__side-head {
    margin-bottom: 0.75rem;
  }

  .gps-search__filter-toggle--side {
    margin-right: 0;
  }
}

@media screen and (min-width: 44.984375em) {
  .gps-search__filter-toggle--side {
    display: none;
  }
}
