:root {
  --text: #e6e6e7;
  --muted: #9ea0a6;
  --pill: #1a1b1e;
  --hair: #ffffff14;
  --chip-border: #ffffff17;
  --chip-active: #ffffff2a;
  --pad-x: clamp(12px, 3.2vw, 24px);
  --radius: 14px;
  --header-height: 84px;
}

.search-page.page-content {
  margin: 0;
  padding: 0;
  color: var(--text);
}

.search-header {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 12px var(--pad-x) 10px;
  background: var(--bgc-app-app);
  border-bottom: 1px solid var(--hair);
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.search-bar__field {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--pill);
  border: 1px solid var(--hair);
  border-radius: 999px;
}

.search-bar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
  opacity: 0.9;
}

.search-bar__input {
  appearance: none;
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: 400 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, "Exo", sans-serif;
}

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

.search-chips {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px var(--pad-x);
  overflow-x: auto;
  overflow-y: hidden;
  background: transparent;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.search-chips::-webkit-scrollbar {
  height: 8px;
}

.search-chips::-webkit-scrollbar-thumb {
  background: transparent;
}

.search-chips::-webkit-scrollbar-track {
  background: transparent;
}

.search-chips::before,
.search-chips::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  pointer-events: none;
  z-index: 62;
}

.search-chips::before {
  left: 0;
  background: linear-gradient(90deg, var(--bgc-app) 0%, rgba(13, 13, 15, 0) 100%);
}

.search-chips::after {
  right: 0;
  background: linear-gradient(270deg, var(--bgc-app) 0%, rgba(13, 13, 15, 0) 100%);
}

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: var(--chip);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  scroll-snap-align: start;
  transition:
    color 0.12s ease,
    border-color 0.12s ease,
    background 0.12s ease;
}

.search-chip:focus,
.search-chip:focus-visible {
  outline: none;
  color: var(--text);
}

.search-chip.is-active {
  color: var(--text);
  border-color: var(--chip-active);
}

.search-results {
  padding: 8px 0 24px;
}

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

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 25vh;
  padding: 40px var(--pad-x);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.search-empty-lottie {
  width: 160px;
  height: 160px;
  display: block;
}

.search-empty p {
  margin: 0;
}

.search-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px var(--pad-x);
  border-top: 1px solid transparent;
}

.search-row +
.search-row {
  border-top-color: var(--hair);
}

.search-row:hover {
  background: #ffffff07;
}

.search-row:has(.search-link:focus-visible) {
  outline: none;
  background: #ffffff07;
}

.search-link {
  display: contents;
  color: inherit;
  text-decoration: none;
}

.search-left {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  background: var(--pill);
  border: 1px solid var(--hair);
  border-radius: 12px;
}

.search-left img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-left dotlottie-player {
  display: block;
  width: 100%;
  height: 100%;
}

.search-left--avatar {
  border-radius: 999px;
  background: linear-gradient(180deg, #2b2d31, #1e1f24);
}

.search-left--avatar span {
  color: #fff;
  font-weight: 700;
}

.search-main {
  min-width: 0;
}

.search-item-title {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.search-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-follow-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.search-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 10px;
}

.search-tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  background: var(--chip);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 560px) {
  :root {
    --pad-x: 14px;
    --header-height: 76px;
  }

  .search-header {
    padding: 10px var(--pad-x) 8px;
  }

  .search-bar__field {
    gap: 8px;
    padding: 9px 12px;
  }

  .search-chips {
    margin-top: 8px;
    padding: 6px var(--pad-x);
  }

  .search-row {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px var(--pad-x);
  }

  .search-left {
    width: 46px;
    height: 46px;
  }

  .search-item-title {
    font-size: 14px;
  }

  .search-meta {
    font-size: 12px;
  }

  .search-chip {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
  }

  .search-chips::before,
  .search-chips::after {
    display: none;
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .search-results {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .search-chips {
    padding-left: calc(var(--pad-x) + env(safe-area-inset-left));
    padding-right: calc(var(--pad-x) + env(safe-area-inset-right));
  }
}
