.nav-wrapper {
  position: fixed;
  bottom: 50px;
  pointer-events: none;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 2px;
  perspective: 1200px;
}

.nav-wrapper.is-on {
  pointer-events: auto;
}

.nav {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 900px;
  height: 67px;
  padding: 0 14px;
  cursor: pointer;
  overflow: visible;
  will-change: width;
  position: relative;
  transition: background 0.35s ease, color 0.35s ease;
}

.nav__logo {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -7px;
  background: none;
  padding: 4px;
  box-sizing: border-box;
  position: relative;
}

.nav__logo img,
.nav__logo svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: none;
}

.nav__logo-on-dark {
  display: none;
}

.nav__buy {
  position: relative;
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #1e1e1e;
  color: #f9f9f9;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.14px;
  line-height: 1.45;
  height: 52px;
  border-radius: 900px;
  margin-left: 6px;
  white-space: nowrap;
  border: 2px solid #1e1e1e;
  overflow: hidden;
  isolation: isolate;
  min-width: 98px;
  padding: 0 20px;
  transition: background 0.35s ease, color 0.35s ease;
}

.nav--has-buy .nav__buy { display: flex; }

.nav__burger {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  margin-left: 30px;
  border-radius: 50%;
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  outline: none;
}

.nav__burger-line {
  display: block;
  height: 2px;
  background: #1e1e1e;
  border-radius: 2px;
  transition: background 0.35s ease, width 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.nav__burger-line:nth-child(1),
.nav__burger-line:nth-child(2) { width: 24px; }
.nav__burger-line:nth-child(3) { width: 12px; }

.nav__burger.is-x .nav__burger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  width: 18px;
}
.nav__burger.is-x .nav__burger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav__burger.is-x .nav__burger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  width: 18px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 35px;
  width: 0;
}

.nav__link {
  display: block;
  padding: 8px 14px;
  color: #171717;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.14px;
  line-height: 1.45;
  border-radius: 100px;
  opacity: 0;
  transform: translateY(4px);
  white-space: nowrap;
  transition: color 0.35s ease, background 0.2s;
}

.nav__link:hover { background: rgba(0, 0, 0, 0.06); }
.nav__link--label { pointer-events: none; }

.nav__more-btn {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #1e1e1e;
  font-family: "Inter Tight", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.14px;
  line-height: 1.45;
  width: 84px;
  height: 52px;
  border-radius: 900px;
  cursor: pointer;
  border: 2px solid #e0e0e0;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  overflow: hidden;
  isolation: isolate;
  margin-left: 35px;
}

.nav-dropdown {
  background: #ffffff;
  border-radius: 40px;
  padding: 36px 28px;
  display: none;
  flex-direction: column;
  gap: 0;
  opacity: 0;
  pointer-events: none;
}

.nav-dropdown--desktop {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 0;
  width: 100%;
  transform: rotateX(-70deg);
  transform-origin: center bottom;
  backface-visibility: hidden;
}

.nav-dropdown.is-visible {
  display: flex;
  pointer-events: auto;
}

.nav-dropdown__grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0;
}

.nav-dropdown__col {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-dropdown__col:first-child { padding-left: 0; }
.nav-dropdown__col:last-child { padding-right: 0; border-right: none; }

.nav-dropdown__col-label {
  font-size: 11px;
  font-weight: 600;
  color: #171717;
  opacity: 0.4;
  letter-spacing: -0.14px;
  line-height: 1.45;
  padding: 0 0 20px;
}

.nav-dropdown__col-link {
  display: inline-block;
  width: fit-content;
  color: #171717;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.14px;
  line-height: 1.45;
  opacity: 0.9;
  padding: 10px 0;
}

.nav-dropdown__col-link:hover { opacity: 1; }

.nav--dark { background: #1e1e1e; }
.nav--dark .nav__burger-line { background: #f9f9f9; }
.nav--dark .nav__logo {
  background: none;
}
.nav--dark .nav__logo img,
.nav--dark .nav__logo svg { filter: none; }
.nav--dark .nav__logo-on-light { display: none; }
.nav--dark .nav__logo-on-dark { display: block; }
.nav--dark .nav__link { color: #f0f0f0; }
.nav--dark .nav__link:hover { background: rgba(255, 255, 255, 0.1); }
.nav--dark .nav__buy {
  background: #f9f9f9;
  color: #1e1e1e;
  border-color: #f9f9f9;
}
.nav--dark .nav__more-btn {
  background: #333;
  color: #f0f0f0;
  border-color: #666;
}
.nav--dark ~ .nav-dropdown { background: #1e1e1e; }
.nav--dark ~ .nav-dropdown .nav-dropdown__col-label,
.nav--dark ~ .nav-dropdown .nav-dropdown__col-link { color: #f0f0f0; }
.nav--dark ~ .nav-dropdown .nav-dropdown__col { border-color: rgba(255, 255, 255, 0.1); }

@media (max-width: 768px) {
  .nav-wrapper {
    bottom: auto;
    top: max(16px, env(safe-area-inset-top));
    left: 16px;
    right: 16px;
    width: auto;
    max-width: 500px;
    transform: translateX(0) translateY(-20px);
    flex-direction: column;
    align-items: stretch;
  }

  .nav {
    width: 100%;
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(20px);
  }

  .nav--dark { background: rgba(30, 30, 30, 0.4) !important; }

  .nav__links,
  .nav__more-btn,
  .nav-dropdown--desktop { display: none !important; }

  .nav__burger { margin-left: auto !important; }

  .nav-dropdown--mobile {
    display: none;
    width: 100%;
    padding: 32px 28px 36px;
    border-radius: 32px;
  }

  .nav-dropdown--mobile.is-visible { display: flex; }

  .nav-dropdown--mobile .nav-dropdown__grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px 32px;
  }

  .nav-dropdown--mobile .nav-dropdown__col {
    padding: 0;
    border-right: none;
  }
}
