/* The app identifies itself before the first paint. Browser layouts stay independent. */
html.pixel-night-android,
html.pixel-night-android body { width: 100%; min-width: 0; min-height: 100%; background: #0c0b1d; }
html.pixel-night-android { --site-background: none !important; color-scheme: dark; }
html.pixel-night-android body { -webkit-tap-highlight-color: transparent; }
html.pixel-night-android body::before,
html.pixel-night-android body::after { display: none; }
html.pixel-night-android body.logged-in-page { overflow: hidden; }

html.pixel-night-android .welcome-screen {
  --app-nav-height: 72px;
  --mobile-nav-height: var(--app-nav-height);
  --mobile-nav-bottom: 0px;
  display: flex;
  flex-direction: column;
  top: var(--mobile-viewport-top, 0px);
  bottom: auto;
  width: 100%;
  max-width: none;
  left: 0;
  right: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  height: 100vh;
  height: var(--mobile-viewport-height, 100dvh);
  padding: 0 0 var(--app-nav-height);
  overflow: hidden;
  background: var(--theme-canvas, #0c0b1d);
  scroll-padding: 0;
}
html.pixel-night-android .profile-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  width: 100%;
  min-height: 0;
  margin: 0;
}
html.pixel-night-android .profile-topbar {
  position: static;
  display: flex;
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 58px;
  padding: 8px 16px;
  transform: none;
}
html.pixel-night-android .profile-brand { font-size: 22px; }
html.pixel-night-android .profile-brand-note { display: none; }
html.pixel-night-android .profile-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  gap: 0;
  margin: 0;
  overflow: hidden;
}
html.pixel-night-android .profile-layout > :is(section, article) {
  flex: 1 1 0;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--theme-panel, #0c0b1d);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
html.pixel-night-android .profile-layout > :is(.profile-card, .public-profile, .friends-card, .preferences-card, .developer-panel) { padding: 20px 16px; }
html.pixel-night-android .profile-layout > #chat-view { display: flex; padding: 0; overflow: hidden; }
html.pixel-night-android .messenger { flex: 1; width: 100%; height: 100%; min-height: 0; }
html.pixel-night-android .chat-list-panel { background: var(--theme-panel, #0c0b1d); }
html.pixel-night-android .conversation-panel { background: var(--theme-canvas, #0c0b1d); }

html.pixel-night-android .welcome-screen > .profile-nav {
  position: absolute;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 2px;
  width: 100%;
  max-width: none;
  height: var(--app-nav-height);
  margin: 0;
  padding: 4px 6px;
  border: 0;
  border-top: 1px solid var(--theme-border, #ffffff12);
  border-radius: 0;
  background: var(--theme-panel, #121022);
  box-shadow: none;
  backdrop-filter: none;
  transform: none;
}
html.pixel-night-android .profile-nav-button {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 4px;
  padding: 6px 1px;
  border: 0;
  border-radius: 16px;
  font-size: 11px;
}
html.pixel-night-android .profile-nav-icon { display: block; flex: 0 0 27px; width: 27px; height: 27px; }
html.pixel-night-android .profile-nav-badge { top: 2px; right: auto; left: calc(50% + 6px); }
html.pixel-night-android .profile-nav-button.active { background: var(--personal-soft); color: var(--personal-accent); box-shadow: none; }
@media (max-width: 700px) {
  html.pixel-night-android .welcome-screen.is-conversation-screen { padding-bottom: 0; }
  html.pixel-night-android .is-conversation-screen > .profile-nav,
  html.pixel-night-android .is-conversation-screen .profile-topbar { display: none; }
}
/* System bars, the keyboard and cutouts are inset by the native Android container. */
html.pixel-night-android main { padding: 0; }
html.pixel-night-android .auth-card { width: 100%; max-width: none; min-height: 100vh; min-height: 100dvh; margin: 0; padding: 48px 24px 24px; border: 0; border-radius: 0; background: #0c0b1d; box-shadow: none; }
html.pixel-night-android .session-loading { min-height: 100vh; min-height: 100dvh; background: #0c0b1d; }
html.pixel-night-android #preferences-account { min-height: 0; }
html.pixel-night-android .preferences-row:has(#preference-background) { display: none; }

/* Content screens stay flush to the app viewport, including secondary screens. */
html.pixel-night-android :is(.notifications-dialog, .wall-composer, .avatar-crop-dialog, .moderation-dialog) {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 20px 16px;
  border: 0;
  border-radius: 0;
  background: #0c0b1d;
  box-shadow: none;
  overflow: auto;
  overscroll-behavior: contain;
}
html.pixel-night-android .preferences-heading .chat-kicker,
html.pixel-night-android .preferences-card > .chat-card-note { display: none; }
html.pixel-night-android .preferences-title { margin-top: 0; }
html.pixel-night-android .public-profile-hero { background: none; }
html.pixel-night-android :is(input, textarea, select) { font-size: max(16px, 1em); }
html.pixel-night-android .chat-list-header { padding-top: 16px; }

/* The locally installed screen is visible while the account is verified. */
.app-start-preview { display: none; }
html[data-app-shell="bundled"] .session-loading {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  text-align: left;
}
html[data-app-shell="bundled"] .app-start-preview { display: block; width: 100%; }
.app-start-preview > strong { display: flex; align-items: center; min-height: 58px; padding: 8px 16px; color: #eee3ff; font-size: 22px; }
.app-start-preview h2 { margin: 16px 16px 26px; color: #f8f5ff; font-size: 22px; }
.app-start-row { display: flex; align-items: center; gap: 14px; height: 82px; padding: 12px 16px; }
.app-start-row i { flex: 0 0 50px; height: 50px; border-radius: 50%; background: #211b35; }
.app-start-row span { width: min(62%, 280px); height: 10px; border-radius: 5px; background: #211b35; box-shadow: 0 19px #181527; }
html[data-app-shell="bundled"] #session-loading-message { max-width: none; margin: 28px 16px 16px; color: #aca2bf; font-size: 13px; }
html[data-app-shell="bundled"] .session-retry { align-self: flex-start; margin: 0 16px; }
html.pixel-night-android #app-connection-status:not([hidden]) {
  position: fixed;
  z-index: 70;
  bottom: 84px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #c291f64d;
  border-radius: 14px;
  color: #e9dff7;
  background: #20192f;
  font-size: 13px;
}
html.pixel-night-android #app-connection-status button { flex-shrink: 0; padding: 8px; border: 0; background: none; color: #d4b0ff; font: inherit; font-weight: 600; }
html.pixel-night-android body:not(.logged-in-page) #app-connection-status { display: none; }

.android-download { display: none; }
@media (max-width: 900px), (pointer: coarse) {
  .android-download {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    margin-top: 24px;
    padding: 14px 16px;
    border: 1px solid #c291f65c;
    border-radius: 16px;
    background: #8f3de01c;
    color: #f2e7ff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    touch-action: manipulation;
  }
  .android-download svg { flex: 0 0 24px; width: 24px; height: 24px; fill: none; stroke: #c291f6; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .android-download small { display: block; margin-top: 3px; color: #b7abc8; font-size: 12px; font-weight: 400; }
  .android-download:hover { background: #8f3de033; }
  .android-download:focus-visible { outline: 2px solid var(--personal-accent); outline-offset: 3px; }
}
html.pixel-night-android .android-download { display: none; }

/* Full-width layout for desktop browsers. */
@media (min-width: 701px) {
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) body.logged-in-page { overflow: hidden; }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) body.logged-in-page::before,
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) body.logged-in-page::after { display: none; }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .welcome-screen {
    --desktop-nav-height: 76px;
    --desktop-nav-bottom: 0px;
    --desktop-header-top: 0px;
    --desktop-header-height: 68px;
    --desktop-content-width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 0 var(--desktop-nav-height);
    overflow: hidden;
    background: var(--theme-canvas, #0c0b1d);
    scroll-padding: 0;
  }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    width: 100%;
    min-height: 0;
    margin: 0;
  }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-topbar {
    position: static;
    flex: 0 0 var(--desktop-header-height);
    width: 100%;
    padding: 8px 24px;
    border-bottom: 1px solid var(--theme-border, #ffffff12);
    transform: none;
  }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-brand { font-size: 26px; }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-brand-note { display: none; }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    margin: 0;
    gap: 0;
    overflow: hidden;
  }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-layout > :is(section, article) {
    flex: 1 1 0;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--theme-panel, #0c0b1d);
    box-shadow: none;
    backdrop-filter: none;
    animation: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-layout > #chat-view { display: flex; padding: 0; overflow: hidden; }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .messenger { flex: 1; width: 100%; height: 100%; min-height: 0; }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .chat-list-panel { background: var(--theme-panel, #0c0b1d); }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .conversation-panel { background: var(--theme-canvas, #0c0b1d); }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-form { width: min(100%, 640px); margin-inline: auto; }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .welcome-screen > .profile-nav {
    position: absolute;
    inset: auto 0 0;
    width: 100%;
    margin: 0;
    padding: 6px 16px;
    border: 0;
    border-top: 1px solid var(--theme-border, #ffffff12);
    border-radius: 0;
    background: var(--theme-panel, #121022);
    box-shadow: none;
    transform: none;
  }
  html[data-desktop-layout="fullscreen"]:not(.pixel-night-android) .profile-nav-button { border-radius: 14px; }
}
