:root {
  --bottom-nav-height: 4.25rem;
  --mobile-top-bar-height: 3.5rem;
  --content-edge-gap: 2rem;
}


.bottom-nav,
.bottom-nav-sheet {
  display: none;
}

@media (max-width: 767px) {
  .has-bottom-nav {
    padding-top: calc(
      var(--mobile-top-bar-height) + env(safe-area-inset-top, 0px)
    );
    padding-bottom: calc(
      var(--bottom-nav-height) + var(--content-edge-gap) + env(safe-area-inset-bottom, 0px)
    );
  }

  header:has(.mobile-top-bar) {
    height: 0;
    overflow: visible;
  }

  .mobile-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding-top: env(safe-area-inset-top, 0px);
    min-height: calc(var(--mobile-top-bar-height) + env(safe-area-inset-top, 0px));
    box-sizing: border-box;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    align-items: stretch;
    justify-content: space-around;
    height: var(--bottom-nav-height);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid rgb(229 231 235);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  }

  .dark .bottom-nav {
    background: rgb(39 39 42);
    border-top-color: rgb(63 63 70);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
  }

  .bottom-nav-sheet:not(.hidden) {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 55;
    align-items: flex-end;
    justify-content: center;
  }
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.35rem 0.25rem;
  font-size: 0.65rem;
  line-height: 1.2;
  color: rgb(107 114 128);
  transition: color 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.dark .bottom-nav__item {
  color: rgb(161 161 170);
}

.bottom-nav__item:hover,
.bottom-nav__item--active {
  color: rgb(34 197 94);
}

.bottom-nav__icon {
  width: 1.35rem;
  height: 1.35rem;
}

.bottom-nav-sheet.hidden {
  display: none !important;
}

.bottom-nav-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.bottom-nav-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 28rem;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 1rem 1rem 0 0;
  padding: 0.75rem 1rem 1.5rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  animation: bottom-sheet-up 0.25s ease;
}

.dark .bottom-nav-sheet__panel {
  background: rgb(39 39 42);
}

@keyframes bottom-sheet-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.bottom-nav-sheet__handle {
  width: 2.5rem;
  height: 0.25rem;
  margin: 0 auto 1rem;
  border-radius: 9999px;
  background: rgb(209 213 219);
}

.dark .bottom-nav-sheet__handle {
  background: rgb(82 82 91);
}

.bottom-nav-sheet__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bottom-nav-sheet__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
}

.bottom-nav-sheet__link:hover {
  background: rgb(243 244 246);
}

.dark .bottom-nav-sheet__link:hover {
  background: rgb(63 63 70);
}

.bottom-nav-sheet__link--danger {
  color: rgb(239 68 68);
}

body.bottom-nav-sheet-open {
  overflow: hidden;
}
