.viewport-stage {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem;
}

.app-shell {
  position: relative;
  display: flex;
  width: 100%;
  max-width: var(--app-max-width);
  height: min(52.75rem, calc(100svh - 3rem));
  min-height: min(38rem, calc(100svh - 3rem));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgb(23 20 25 / 9%);
  border-radius: var(--radius-xl);
  background: var(--surface-soft);
  box-shadow: var(--shadow-shell);
}

.top-header {
  position: relative;
  z-index: 20;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand notification"
    "community community";
  gap: 0.55rem 0.75rem;
  align-items: center;
  padding: calc(0.6rem + env(safe-area-inset-top)) 0.9rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 98%);
}

.official-brand {
  display: flex;
  min-width: 0;
  grid-area: brand;
  align-items: center;
}

.official-brand__logo-window {
  position: relative;
  display: block;
  width: 7.2rem;
  height: 2.55rem;
  overflow: hidden;
}

.official-brand__logo-window img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  max-width: none;
  height: auto;
  pointer-events: none;
  transform: translate(-50%, -50%);
  user-select: none;
  -webkit-user-drag: none;
}

.community-control {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 3.25rem;
  grid-area: community;
  align-items: center;
  gap: 0.62rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.community-control:hover {
  border-color: var(--brand-pink-200);
  background: var(--brand-pink-050);
}

.community-logo {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
}

.community-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.community-control__copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 0.2rem;
}

.community-control__name-row {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 0.35rem;
}

.community-control__name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--charcoal-950);
  font-size: 0.8rem;
  font-weight: 780;
  letter-spacing: -0.012em;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.community-control__context {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.64rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.community-control__context > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-control__context > [data-community-context-separator] {
  flex: 0 0 auto;
  color: var(--charcoal-400);
}

.verified-mark {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  color: var(--brand-pink-600);
}

.verified-mark svg {
  width: 100%;
  height: 100%;
}

.community-control__chevron {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  color: var(--charcoal-500);
}

.notification-button {
  position: relative;
  grid-area: notification;
}

.notification-button__dot {
  position: absolute;
  top: 0.55rem;
  right: 0.52rem;
  width: 0.45rem;
  height: 0.45rem;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--brand-pink-600);
}

.visitor-join-cta {
  min-height: var(--tap-target);
  grid-column: 1 / -1;
  justify-self: end;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--brand-pink-100);
  border-radius: 999px;
  background: var(--brand-pink-050);
  color: var(--brand-pink-700);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 780;
  line-height: 1;
}

.visitor-join-cta:hover {
  border-color: var(--brand-pink-200);
  background: var(--brand-pink-100);
}

.app-main {
  --app-inline-padding: 0.9rem;
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.1rem 0.9rem 1.3rem;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.app-main::-webkit-scrollbar {
  display: none;
}

.app-view {
  display: grid;
  gap: 0.9rem;
  animation: view-enter 210ms var(--ease-out) both;
}

.page-heading {
  padding: 0.1rem 0.15rem 0.25rem;
}

.page-heading__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.page-heading h1 {
  margin-top: 0.38rem;
  color: var(--charcoal-950);
  font-size: var(--text-2xl);
  font-weight: 810;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.page-heading > p:last-child {
  max-width: 22rem;
  margin-top: 0.5rem;
  color: var(--ink-subtle);
  font-size: 0.82rem;
  line-height: 1.55;
}

.shell-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

.shell-status__avatar {
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-neutral);
  object-fit: cover;
}

.shell-status__copy {
  min-width: 0;
}

.shell-status__copy strong {
  color: var(--charcoal-900);
  font-size: 0.8rem;
  line-height: 1.3;
}

.shell-status__copy p {
  margin-top: 0.1rem;
  color: var(--ink-muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.placeholder-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-top: 1.65rem;
  padding-bottom: 1.65rem;
  text-align: center;
}

.placeholder-card__icon {
  display: grid;
  width: 3.6rem;
  height: 3.6rem;
  margin-bottom: 0.85rem;
  place-items: center;
  border: 1px solid var(--brand-pink-100);
  border-radius: var(--radius-lg);
  background: var(--brand-pink-050);
  color: var(--brand-pink-600);
}

.placeholder-card__icon svg {
  width: 1.7rem;
  height: 1.7rem;
}

.placeholder-card h2 {
  margin-top: 0.7rem;
  color: var(--charcoal-900);
  font-size: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.placeholder-card p {
  max-width: 17rem;
  margin-top: 0.38rem;
  color: var(--ink-subtle);
  font-size: 0.76rem;
  line-height: 1.5;
}

.placeholder-card__action {
  margin-top: 1rem;
}

.bottom-navigation {
  position: relative;
  z-index: 30;
  display: grid;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  flex: 0 0 auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 98%);
}

.nav-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 3.45rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.24rem;
  padding: 0.3rem 0.15rem;
  border-radius: 0.7rem;
  background: transparent;
  color: var(--charcoal-500);
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-item::before {
  position: absolute;
  top: 0.15rem;
  left: 50%;
  width: 1.15rem;
  height: 0.16rem;
  border-radius: 999px;
  background: transparent;
  content: "";
  transform: translateX(-50%);
}

.nav-item svg {
  width: 1.3rem;
  height: 1.3rem;
}

.nav-item span {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.64rem;
  font-weight: 680;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--brand-pink-050);
  color: var(--brand-pink-600);
}

.nav-item:active {
  transform: scale(0.97);
}

.nav-item[aria-current="page"] {
  background: var(--brand-pink-050);
  color: var(--brand-pink-600);
}

.nav-item[aria-current="page"]::before {
  background: var(--brand-pink-600);
}

.nav-item[aria-current="page"] span {
  font-weight: 800;
}

.app-shell[data-ready="true"] .top-header,
.app-shell[data-ready="true"] .bottom-navigation {
  opacity: 1;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 479px) {
  .viewport-stage {
    padding: 0;
  }

  .app-shell {
    max-width: none;
    height: 100vh;
    height: 100svh;
    min-height: 100vh;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 370px) {
  .top-header {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .official-brand__logo-window {
    width: 6.8rem;
  }

  .app-main {
    --app-inline-padding: 0.75rem;
    padding-right: var(--app-inline-padding);
    padding-left: var(--app-inline-padding);
  }
}

@media (max-width: 350px) {
  .community-logo {
    width: 2.4rem;
    height: 2.4rem;
  }

  .nav-item span {
    font-size: 0.57rem;
  }
}
