.nav-lens { display: none; }
.nav-icon svg { width: 24px; height: 24px; display: block; }
.orientation-blocked { overflow: hidden; }
#orientationGuard {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0; padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(20px, var(--safe-bottom)) max(24px, env(safe-area-inset-left));
  border: 0; border-radius: 0; background: #f7f5f0ed; color: #353631;
  backdrop-filter: blur(30px) saturate(1.4); -webkit-backdrop-filter: blur(30px) saturate(1.4);
  outline: none; overscroll-behavior: none;
}
#orientationGuard[hidden] { display: none; }
.orientation-card { text-align: center; max-width: 430px; padding: 20px; }
.orientation-card svg { width: 70px; height: 70px; color: var(--action-primary); margin-bottom: 12px; }
.orientation-card h2 { margin: 0 0 10px; font-size: 22px; }
.orientation-card p { margin: 0; font-size: 14px; line-height: 1.8; color: #817972; }
@media (max-width: 720px) {
  .app { padding-bottom: calc(92px + var(--safe-bottom)); }
  .main { padding-top: calc(24px + env(safe-area-inset-top)); }
  .login-screen, .account-setup-screen { padding-top: env(safe-area-inset-top); padding-bottom: var(--safe-bottom); }
  .sidebar {
    left: 50%; right: auto; bottom: calc(10px + var(--safe-bottom)); top: auto;
    transform: translateX(-50%); width: calc(100% - 44px); max-width: 440px; height: 62px;
    padding: 0; border: 0; border-radius: 999px; background: transparent; z-index: 20;
    backdrop-filter: blur(12px) saturate(1.8); -webkit-backdrop-filter: blur(12px) saturate(1.8);
  }
  .main-nav {
    position: relative; isolation: isolate; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0; width: 100%; height: 100%; padding: 4px; border-radius: 999px;
    background: linear-gradient(125deg, #ffffff12, #ffffff00 48%, #ffffff0b), #17202080;
    border: 1px solid #ffffff46;
    box-shadow: 0 6px 22px #25221e20, inset 0 1px 1px #ffffff65, inset 0 -1px 1px #ffffff18;
  }
  .nav-lens {
    display: block; position: absolute; left: 4px; top: 4px; bottom: 4px; width: calc((100% - 8px) / 4);
    border-radius: 999px; background: linear-gradient(140deg, #ffffff09, #00000010), #10121266;
    box-shadow: inset 0 1px 1px #ffffff16, 0 2px 7px #00000018;
    transform: translateX(calc(var(--nav-index, 0) * 100%));
    transition: transform .36s cubic-bezier(.22, 1, .36, 1); pointer-events: none; z-index: -1;
  }
  .nav-item, .nav-item.active {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; width: 100%; min-width: 0; padding: 3px 2px; border-radius: 999px;
    background: transparent; color: #fffffff0; text-align: center; font-size: 10px; line-height: 1.3; text-shadow: 0 1px 3px #0009;
    -webkit-tap-highlight-color: transparent; transition: color .2s, transform .2s;
  }
  .nav-item.active { color: #fff; }
  .nav-item:hover { background: #ffffff08; }
  .nav-item:active { transform: scale(.94); }
  .nav-item:focus-visible { outline: 2px solid #ffd0b8; outline-offset: -3px; }
  .nav-icon { width: 23px; height: 23px; color: inherit; filter: drop-shadow(0 1px 2px #0005); }
  .nav-icon svg { width: 23px; height: 23px; }
  .nav-item.active .nav-icon { filter: drop-shadow(0 1px 4px #ffffff30); }
  .nav-label { white-space: nowrap; }
  .main-nav .badge { top: 1px; right: calc(50% - 28px); margin: 0; min-width: 17px; height: 16px; padding: 0 4px; font-size: 9px; background: #f34c60; box-shadow: 0 1px 3px #0003; border: 1px solid #ffffff26; }
  .chats-layout { height: calc(100dvh - 219px - env(safe-area-inset-top) - var(--safe-bottom)); }
  .chats-layout.show-list { height: calc(100dvh - 126px - env(safe-area-inset-top)); }
  .chats-layout.show-list .chat-list { padding-bottom: calc(86px + var(--safe-bottom)); }
  .app:has(.chats-layout.show-list), .main:has(.chats-layout.show-list) { padding-bottom: 0; }
  .toast:not(.in-modal), .upload-progress:not(.in-modal) { bottom: calc(90px + var(--safe-bottom)); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 720px) { .main-nav { background: #353737; } }
}
@media (prefers-reduced-motion: reduce) { .nav-lens, .nav-item { transition: none; } }

@media (max-width: 720px) {
  html.chat-open { height: 100%; max-height: 100%; overflow: hidden; overscroll-behavior: none; }
  .chat-open body { position: relative; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
  .chat-open .app { height: 100%; min-height: 0; overflow: hidden; padding-bottom: 0; }
  .chat-open .sidebar, .chat-open .topbar { display: none; }
  .chat-open .main { height: 100%; min-height: 0; overflow: hidden; padding: 0; }
  .chat-open .view { height: 100%; min-height: 0; overflow: hidden; }
  .chat-open .chats-layout {
    position: relative; top: var(--chat-viewport-top, 0px); width: 100%;
    height: var(--chat-viewport-height, 100dvh); min-height: 0; margin: 0;
    border: 0; border-radius: 0; box-shadow: none; background: #fff; z-index: 25;
  }
  .chat-open .chat-room { display: flex; height: 100%; min-height: 0; overflow: hidden; }
  .chat-open .room-header {
    flex-shrink: 0; gap: 10px; padding: calc(10px + env(safe-area-inset-top) + var(--chat-top-edge-clearance)) 14px 10px;
    background: #fbfaf8;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .chat-open .room-header > div { min-width: 0; flex: 1; }
  .chat-open .room-header strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-open .room-header small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-open .room-header .avatar { width: 34px; height: 34px; }
  .chat-open .mobile-back { min-width: 28px; min-height: 40px; padding: 0; font-size: 24px; }
  .chat-open .messages { flex: 1 1 0; min-height: 0; padding: 16px 12px; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
  .chat-open .message { max-width: 88%; }
  .chat-open .bubble { font-size: 14px; line-height: 1.6; padding: 9px 12px; }
  .chat-open .message-meta { font-size: 10px; }
  .chat-open .composer {
    flex-shrink: 0; align-items: center; gap: 3px; margin: 0;
    padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + var(--safe-bottom)) max(8px, env(safe-area-inset-left));
    background: #fbfaf8; border-top: 1px solid #eee9e3;
  }
  .chat-keyboard-open .composer { padding-bottom: 8px; }
  .chat-open .composer textarea { min-height: 40px; padding: 8px 12px; font-size: 16px; line-height: 1.4; border-radius: 22px; }
  .chat-open .composer .compose-icon { min-width: 25px; width: 25px; height: 40px; font-size: 20px; padding: 0; }
  .chat-open .composer .send-button { min-width: 38px; width: 38px; height: 38px; padding: 0; border-radius: 50%; font-size: 18px; }
  .chat-open .chat-tools, .chat-open .reply-composer, .chat-open .message-location { flex-shrink: 0; }
  .chat-open .reply-composer { max-height: 90px; overflow: hidden; }
  .chat-open .toast:not(.in-modal), .chat-open .upload-progress:not(.in-modal) {
    z-index: 80; top: auto; bottom: calc(100dvh - var(--chat-viewport-top, 0px) - var(--chat-viewport-height, 100dvh) + 70px + var(--safe-bottom));
  }
}

.message-recalled .bubble { background: transparent; border: 0; box-shadow: none; color: #929299; font-size: 12px; }

.swipe-back-enabled { touch-action: pan-y; overscroll-behavior-x: none; }
