.app-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  min-height: 100dvh;
}

.app-shell.auth-hidden {
  display: none;
}

.main-canvas {
  width: auto;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(76px + env(safe-area-inset-top)) var(--page-x) calc(112px + env(safe-area-inset-bottom));
}

.screen {
  min-width: 0;
  display: none;
  animation: screen-in 360ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.screen.active {
  display: block;
}

.mobile-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 300;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  height: calc(64px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--page-x) 0;
  background: var(--surface);
  border-bottom: 1px solid rgba(195, 199, 205, 0.22);
  box-shadow: 0 8px 24px rgba(37, 52, 79, 0.04);
  backdrop-filter: none;
  isolation: isolate;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  contain: paint;
}

.mobile-topbar::before {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: -1;
  height: calc(64px + env(safe-area-inset-top));
  content: "";
  background: var(--surface);
}

.brand-word,
.brand-mark {
  font-family: var(--font-head);
  color: var(--primary);
  letter-spacing: -0.02em;
}

.brand-word {
  justify-self: center;
  min-width: 0;
  font-size: 31px;
  line-height: 1;
  font-weight: 700;
}

.desktop-nav {
  display: none;
}

.mobile-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 300;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: calc(74px + env(safe-area-inset-bottom));
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(195, 199, 205, 0.28);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(37, 52, 79, 0.05);
  backdrop-filter: blur(20px);
}

.mobile-nav-item {
  display: grid;
  place-items: center;
  gap: 5px;
  min-width: 0;
  padding: 8px 4px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 14px;
  transition: color 180ms ease, transform 180ms ease;
}

.mobile-nav-item span:last-child {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.mobile-nav-item.active {
  color: var(--primary);
  transform: translateY(-2px);
}

@media (min-width: 920px) {
  .app-shell {
    display: block;
  }

  .desktop-nav {
    position: fixed;
    inset: auto auto 24px 50%;
    z-index: 42;
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    max-width: calc(100vw - 48px);
    min-height: 72px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(195, 199, 205, 0.28);
    border-radius: 999px;
    box-shadow: 0 18px 55px rgba(37, 52, 79, 0.14);
    backdrop-filter: blur(22px);
    transform: translateX(-50%);
  }

  .brand-mark {
    display: none;
  }

  .nav-list {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    padding: 0 18px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
  }

  .nav-item.active {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.74);
    box-shadow: var(--shadow-tight);
  }

  .profile-pill {
    display: none;
  }

  .mobile-topbar,
  .mobile-nav {
    display: none;
  }

  .main-canvas {
    width: min(100%, 1480px);
    max-width: 1480px;
    margin: 0 auto;
    padding: 30px 44px 128px;
  }
}

@keyframes screen-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
