:root {
  --bg: #050505;
  --panel: #0f0f0f;
  --line: #242424;
  --text: #f4f4f4;
  --muted: #8f8f8f;
  --accent: #24a1de;
  --header-h: 72px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #050505;
  min-height: 100vh;
  min-height: 100svh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, #151515 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, #121212 0%, transparent 40%),
    var(--bg);
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
  z-index: 10;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  position: relative;
  padding-bottom: 26px;
}

.brand-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  top: 100%;
  width: 360px;
  height: 38px;
}

.brand {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.45px;
  color: #efefef;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 22px rgba(0, 0, 0, 0.38);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .brand {
  background: linear-gradient(90deg, #2a2a2a 0%, #f3f3f3 45%, #8e8e8e 65%, #2a2a2a 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: flowBW 2.4s linear infinite;
  }
}

.brand-btn {
  border: 0;
  background-color: transparent;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.brand-dropdown {
  position: absolute;
  top: calc(100% - 6px);
  left: 0;
  min-width: 290px;
  display: grid;
  gap: 8px;
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
  pointer-events: none;
  transition: opacity 0.26s ease, transform 0.26s ease;
  transition-delay: 0.75s;
  z-index: 20;
}

.brand-btn:hover + .telegram-link + .brand-dropdown,
.brand-btn:focus + .telegram-link + .brand-dropdown,
.brand-wrap:hover .brand-dropdown,
.brand-wrap.menu-open .brand-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition-delay: 0s;
}

.brand-dropdown .menu-item {
  opacity: 0;
  transform: translateY(8px);
}

.brand-btn:hover + .telegram-link + .brand-dropdown .menu-item,
.brand-btn:focus + .telegram-link + .brand-dropdown .menu-item,
.brand-wrap:hover .brand-dropdown .menu-item,
.brand-wrap.menu-open .brand-dropdown .menu-item {
  opacity: 1;
  transform: translateY(0);
}

.brand-btn:hover + .telegram-link + .brand-dropdown .menu-item:nth-child(1),
.brand-btn:focus + .telegram-link + .brand-dropdown .menu-item:nth-child(1),
.brand-wrap:hover .brand-dropdown .menu-item:nth-child(1),
.brand-wrap.menu-open .brand-dropdown .menu-item:nth-child(1) { transition-delay: 0.02s; }

.brand-btn:hover + .telegram-link + .brand-dropdown .menu-item:nth-child(2),
.brand-btn:focus + .telegram-link + .brand-dropdown .menu-item:nth-child(2),
.brand-wrap:hover .brand-dropdown .menu-item:nth-child(2),
.brand-wrap.menu-open .brand-dropdown .menu-item:nth-child(2) { transition-delay: 0.05s; }

.brand-btn:hover + .telegram-link + .brand-dropdown .menu-item:nth-child(3),
.brand-btn:focus + .telegram-link + .brand-dropdown .menu-item:nth-child(3),
.brand-wrap:hover .brand-dropdown .menu-item:nth-child(3),
.brand-wrap.menu-open .brand-dropdown .menu-item:nth-child(3) { transition-delay: 0.08s; }

.telegram-link {
  position: relative;
  display: inline-flex;
  border-radius: 50%;
  overflow: hidden;
}

.telegram-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
  transform: translateX(-130%);
  animation: tgSweep 2.6s linear infinite;
  pointer-events: none;
}

.telegram-link img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  filter: grayscale(1) contrast(1.1) brightness(0.95);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.telegram-link:hover img {
  transform: scale(1.06);
  filter: grayscale(1) contrast(1.15) brightness(1.05);
}

.layout {
  min-height: 100dvh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr;
}

.search-zone {
  min-height: 100dvh;
  min-height: 100svh;
  padding: calc(var(--header-h) + 28px) 20px 16px;
  display: grid;
  grid-template-rows: 1fr minmax(0, 0fr);
  overflow: hidden;
  transition: grid-template-rows 0.32s ease;
}

.search-main {
  width: min(780px, 94%);
  justify-self: center;
  align-self: center;
  z-index: 2;
}

.search-wrapper {
  position: relative;
  width: 100%;
  background: #090909;
  border: 1px solid #1f1f1f;
  border-radius: 999px;
  padding: 9px 10px;
  display: flex;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 20px 44px rgba(0, 0, 0, 0.42),
    0 6px 16px rgba(0, 0, 0, 0.35);
  animation: softPulse 2.6s ease-in-out infinite;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.search-wrapper:focus-within {
  border-color: #4a4a4a;
  box-shadow:
    0 20px 45px rgba(0, 0, 0, 0.48);
  opacity: 1;
}

#searchInput {
  position: relative;
  z-index: 2;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 18px;
  background: transparent;
  color: var(--text);
  outline: none;
}

#searchInput::placeholder {
  color: var(--muted);
}
.ghost-typing {
  position: absolute;
  left: 28px;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #8a8a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 3;
}
.ghost-typing.hidden {
  display: none;
}

.results {
  width: min(780px, 94%);
  justify-self: center;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  opacity: 0;
  overflow-y: auto;
  min-height: 0;
  max-height: 0;
  transition: opacity 0.24s ease;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  z-index: 1;
}
.results::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.results li {
  border: 1px solid var(--line);
  background: #111111;
  border-radius: 14px;
  padding: 12px 14px;
  color: #e3e3e3;
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.26s ease forwards;
}

.results li.is-typing {
  border-color: #2f2f2f;
}

.results li .cursor {
  display: inline-block;
  margin-left: 4px;
  opacity: 1;
  animation: blink 0.9s step-end infinite;
}

.search-zone.has-query {
  grid-template-rows: auto minmax(0, 1fr);
}

.search-zone.has-query .results {
  position: relative;
  left: auto;
  transform: none;
  top: auto;
  bottom: auto;
  width: min(780px, 94%);
  margin: 12px 0 0;
  max-height: calc(100svh - var(--header-h) - 190px);
  padding-right: 0;
  opacity: 1;
  z-index: 1;
}

.menu-item {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 26px;
  padding: 14px 12px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  background: rgba(10, 10, 10, 0.22);
  color: #e6e6e6;
  cursor: pointer;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.menu-item:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(15, 15, 15, 0.28);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .brand {
    color: #efefef !important;
    -webkit-text-fill-color: #efefef !important;
    background: none !important;
    animation: none !important;
  }
  .search-zone {
    padding-top: calc(var(--header-h) + 32px);
    padding-left: 14px;
    padding-right: 14px;
  }
  .search-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.12);
  }
  .search-zone.has-query .results {
    width: min(780px, 94%);
    max-height: calc(100svh - var(--header-h) - 170px);
  }
  .brand-dropdown {
    min-width: min(90vw, 320px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flowBW {
  0% { background-position: 200% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes tgSweep {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}

@keyframes softPulse {
  0%, 100% {
    border-color: #1e1e1e;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.03),
      0 16px 32px rgba(0, 0, 0, 0.35),
      0 6px 16px rgba(0, 0, 0, 0.3);
    opacity: 0.95;
  }
  50% {
    border-color: #333;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 22px 44px rgba(0, 0, 0, 0.45),
      0 8px 22px rgba(0, 0, 0, 0.35);
    opacity: 1;
  }
}
