/* Chat behavior stays scoped to the existing original-design surfaces. */
.chat-thread-view, [data-mini-chat-thread] { position: relative; }
.chat-history-older { display: block; flex: 0 0 auto; margin: 8px auto 14px; min-height: 40px; }
.chat-history-older[hidden], .chat-new-messages[hidden] { display: none !important; }
.chat-new-messages { position: absolute; z-index: 4; left: 50%; bottom: calc(var(--chat-compose-height, 76px) + 12px); transform: translateX(-50%); max-width: calc(100% - 24px); min-height: 40px; white-space: normal; }
.chat-status { min-height: 0; margin: 0; color: var(--cb-muted, #aeb8c8); font-size: 12px; overflow-wrap: anywhere; }
.chat-status:not(:empty) { padding: 6px 10px; }
.chat-status:empty { display: none; }
.chat-page-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; }
.chat-page-compose textarea.input { width: 100%; min-width: 0; min-height: 44px; max-height: 160px; resize: none; margin: 0; line-height: 24px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-page-compose > .chat-status { grid-column: 1 / -1; }
.mini-chat-compose > .chat-status { grid-column: 1 / -1; flex-basis: 100%; }
@media (max-width: 760px), (max-width: 1024px) and (max-height: 520px) {
  .mini-messenger { display: none !important; }
  body.chat-mobile-page .app-sidebar,
  body.chat-mobile-page .app-rail,
  body.chat-mobile-page .messages-main > .surface-hero,
  body.chat-mobile-page .footer,
  body.chat-mobile-page .music-fab-shell,
  body.chat-mobile-page .chat-fab-shell { display: none !important; }
  body.chat-mobile-thread .topbar,
  body.chat-mobile-thread .site-status-banner { display: none !important; }
  body.chat-mobile-page .page-shell { padding-top: max(6px, env(safe-area-inset-top)); padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.chat-mobile-page .main-content { gap: 6px; }
  body.chat-mobile-page .chat-app-shell { display: block; margin: 0; }
  body.chat-mobile-page .messages-main { display: block; min-width: 0; min-height: 0; }
  body.chat-mobile-page .messages-main .chat-single-frame { height: var(--chat-frame-height, calc(100dvh - 170px)); min-height: 0; max-height: none; padding: 0; overflow: hidden; margin: 0; }
  body.chat-mobile-page .chat-friend-view { height: 100%; min-height: 0; overflow: hidden; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
  body.chat-mobile-page .chat-thread-view { height: 100%; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  body.chat-mobile-page .chat-single-frame.has-open-chat .chat-friend-view,
  body.chat-mobile-page .chat-single-frame:not(.has-open-chat) .chat-thread-view { display: none; }
  body.chat-mobile-page [data-live-friends] { min-height: 0; overflow: auto; overscroll-behavior: contain; }
  body.chat-mobile-page .chat-friend-list { min-height: 0; height: auto; max-height: none; }
  body.chat-mobile-page .chat-page-thread-head { flex: 0 0 auto; min-height: 58px; padding: 8px; gap: 8px; }
  body.chat-mobile-page .chat-page-thread-head .member-top { min-width: 0; flex: 1 1 auto; }
  body.chat-mobile-page .chat-page-thread-head .member-info { min-width: 0; }
  body.chat-mobile-page [data-page-chat-title] { overflow-wrap: anywhere; }
  body.chat-mobile-page .chat-page-messages { flex: 1 1 0; min-height: 0; height: auto; max-height: none; overflow: auto; overscroll-behavior: contain; overflow-anchor: none; padding: 10px; }
  body.chat-mobile-page .chat-page-compose { flex: 0 0 auto; padding: 8px; gap: 6px; border-top: 1px solid var(--cb-border, #354052); background: var(--cb-surface, #101721); }
  body.chat-mobile-page .chat-page-compose textarea.input { font-size: 16px; }
  body.chat-mobile-page .chat-page-compose > button { min-height: 44px; padding: 8px; }
  body.chat-mobile-keyboard .mobile-bottom-nav,
  body.chat-mobile-keyboard .music-fab-shell,
  body.chat-mobile-keyboard .chat-fab-shell { display: none !important; }
  body.chat-mobile-keyboard .page-shell { padding-bottom: 0; }
}
@media (min-width: 761px) and (max-width: 1024px) and (max-height: 520px) {
  body.chat-mobile-page .mobile-bottom-nav { position: fixed; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); bottom: calc(8px + env(safe-area-inset-bottom)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: rgba(8, 15, 27, 0.96); }
  body.chat-mobile-page .mobile-bottom-nav > :is(a, button) { display: flex; justify-content: center; align-items: center; min-width: 0; min-height: 44px; padding: 8px 2px; border: 0; border-radius: 6px; background: transparent; color: #dbe8ff; font: inherit; font-size: 12px; text-decoration: none; }
  body.chat-mobile-page .mobile-bottom-nav > :is(a, button).active { background: #6ea8fe29; color: #fff; }
}
@media (max-width: 360px) {
  body.chat-mobile-page .chat-page-compose { gap: 4px; padding: 6px; }
  body.chat-mobile-page .chat-page-compose > button { padding-inline: 7px; }
}
