/* ===== Shell (mobile first) ===== */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "cats" "main";
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}
.top {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  gap: 14px;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 14px;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.top__row { display: flex; align-items: center; justify-content: space-between; }
.cats {
  grid-area: cats;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 16px 6px;
  scrollbar-width: none;
}
.main { grid-area: main; width: 100%; max-width: 820px; padding: 8px 16px 0; }

/* ===== Mobile bottom nav ===== */
.seg {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
}

/* ===== Desktop ===== */
@media (min-width: 900px) {
  .app {
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    grid-template-areas: "top top" "cats main";
    padding-bottom: 48px;
  }
  .top { padding: 18px 32px; grid-template-columns: 220px minmax(0, 1fr); align-items: center; gap: 32px; }
  .cats {
    position: sticky;
    top: 110px;
    align-self: start;
    flex-direction: column;
    overflow: visible;
    padding: 20px 16px 0 24px;
  }
  .main { padding: 20px 32px 0; }
  .seg { position: static; transform: none; width: max-content; margin-bottom: 16px; }
}
