#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: opacity .4s var(--ease);
}

#app.app-hidden {
  opacity: 0;
  pointer-events: none;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-main);
  transition: background var(--t) var(--ease);
  min-width: 0;
}

#topbar {
  display: flex;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 0;
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}

#chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#chat-area::-webkit-scrollbar { width: 5px; }
#chat-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }

#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 18px;
  animation: fadeUp .4s var(--ease);
  padding: 24px;
}

.empty-glyph {
  width: 100px;
  height: 100px;
  object-fit: contain;
  opacity: .9;
}

.empty-title {
  font-size: 26px;
  font-weight: 400;
  color: var(--text-2);
  letter-spacing: -.015em;
  text-align: center;
}

#messages {
  max-width: var(--msg-max);
  margin: 0 auto;
  padding: 36px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

#messages:empty { display: none; }

#mobile-sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 14px;
  z-index: 50;
  background: var(--bg-main);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  #mobile-sidebar-toggle {
    display: flex;
  }
}
