/* ============================================================
   Toca no celular: a mesma interface do PC, reorganizada em duas telas
   (lista de grupos/conversas  ⇄  conversa aberta), como o Discord no celular.
   Só é carregado no app Android (html.mobile).
   ============================================================ */
html.mobile,
html.mobile body {
  height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
html.mobile body {
  padding: env(safe-area-inset-top) 0 0;
  background: var(--bg-rail);
}
html.mobile #titlebar {
  display: none;
}
html.mobile #app {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
}

/* ---------- tela 1: lista (barra de grupos + conversas/canais) ---------- */
html.mobile #rail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 72px;
}
html.mobile #side {
  position: absolute;
  left: 72px;
  right: 0;
  top: 0;
  bottom: 0;
  width: auto;
  border-radius: 14px 0 0 0;
}
html.mobile #user-panel {
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

/* ---------- tela 2: conversa aberta (desliza por cima da lista) ---------- */
html.mobile #center {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: var(--bg-main);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}
html.mobile body.m-content #center {
  transform: none;
}
html.mobile body.m-content #side,
html.mobile body.m-content #rail {
  pointer-events: none;
}
html.mobile #main {
  flex: 1;
  min-height: 0;
}
html.mobile #main {
  position: relative;
}
html.mobile .main-head {
  padding-left: 48px !important;
  gap: 2px;
}
html.mobile #main > .m-back {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 4;
  background: var(--bg-main);
}
html.mobile .m-back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  color: var(--text);
}
html.mobile .m-back:active {
  background: var(--bg-active);
}
html.mobile .main-head .head-search {
  display: none;
}
html.mobile .main-head .head-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* caixa de mensagem acima da barra de gestos do Android */
html.mobile .composer,
html.mobile .chat-input,
html.mobile .comp {
  margin-bottom: env(safe-area-inset-bottom);
}

/* ---------- membros: gaveta pela direita ---------- */
html.mobile #members {
  position: fixed;
  top: env(safe-area-inset-top);
  right: 0;
  bottom: 0;
  width: min(84vw, 320px);
  z-index: 60;
  box-shadow: -14px 0 40px rgba(0, 0, 0, 0.5);
  animation: m-drawer 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
html.mobile #members.hidden {
  display: none;
}
html.mobile .m-shade {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.45);
  animation: m-fade 0.2s ease-out;
}
@keyframes m-drawer {
  from {
    transform: translateX(100%);
  }
}
@keyframes m-fade {
  from {
    opacity: 0;
  }
}

/* ---------- toques: alvos maiores, sem efeitos de "passar o mouse" ---------- */
html.mobile .side-item,
html.mobile .ch-row,
html.mobile .member {
  min-height: 44px;
}
html.mobile input,
html.mobile textarea,
html.mobile select {
  font-size: 16px;
}
html.mobile .tilt-glare {
  display: none;
}

/* ---------- menus e pop-ups ---------- */
html.mobile .ctxmenu {
  max-width: calc(100vw - 16px);
}
html.mobile .popout,
html.mobile .popout .pcard {
  width: min(320px, calc(100vw - 24px));
}
html.mobile .modal {
  width: calc(100vw - 20px) !important;
  max-width: calc(100vw - 20px) !important;
  max-height: calc(100vh - 40px - env(safe-area-inset-top));
}
html.mobile .modal-body {
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}
html.mobile #toasts {
  left: 10px;
  right: 10px;
  bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ---------- configurações: menu em cima (rolando de lado), conteúdo embaixo ---------- */
html.mobile .settings {
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
html.mobile .settings .set-side {
  width: 100%;
  max-width: none;
  flex: none;
  padding: 8px 52px 8px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  justify-content: flex-start;
}
html.mobile .settings .set-side > * {
  display: flex;
  flex-direction: row;
  gap: 4px;
  width: max-content;
  padding: 0;
}
html.mobile .settings .set-side .set-cat,
html.mobile .settings .set-side .set-ver,
html.mobile .settings .set-side .set-sep {
  display: none;
}
html.mobile .settings .set-main {
  flex: 1;
  min-height: 0;
  padding: 14px 12px calc(24px + env(safe-area-inset-bottom));
}
html.mobile .settings .set-main > * {
  max-width: none;
}
html.mobile .set-close {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  right: 8px;
  z-index: 5;
}
html.mobile .set-close span {
  display: none;
}
html.mobile .acc-grid,
html.mobile .row2,
html.mobile .info-grid,
html.mobile .cam-grid,
html.mobile .rl-wrap {
  grid-template-columns: 1fr !important;
  display: grid;
}
html.mobile .profile-preview {
  width: 100%;
}

/* ---------- tela de entrar / criar conta ---------- */
html.mobile #auth {
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
}
html.mobile #auth .auth-card,
html.mobile #auth > div {
  max-width: 100%;
}

/* ---------- Amigos: lista em tela cheia (a coluna "Ativo agora" é do PC) ---------- */
html.mobile .active-now {
  display: none;
}
html.mobile .friends-body,
html.mobile .friends-list {
  width: 100%;
  max-width: none;
  flex: 1;
}
html.mobile #main .main-head {
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
html.mobile #main .main-head::-webkit-scrollbar {
  display: none;
}
html.mobile #main .main-head .tab {
  flex: none;
}

/* ---------- Configurações: abas compactas em cima, página inteira embaixo ---------- */
html.mobile .settings,
html.mobile .settings-back {
  top: 0 !important;
  inset: 0 !important;
}
html.mobile .set-fx {
  display: none;
}
html.mobile .set-side {
  padding: calc(8px + env(safe-area-inset-top)) 60px 8px 8px !important;
  height: auto !important;
  border-bottom: 1px solid var(--border);
  background: var(--bg-side);
}
html.mobile .set-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  width: max-content;
  overflow: visible;
}
html.mobile .set-nav-label,
html.mobile .set-nav-sep,
html.mobile .set-version,
html.mobile .set-nav .glider {
  display: none !important;
}
html.mobile .set-nav-item {
  flex: none;
  height: 38px !important;
  padding: 0 12px !important;
  border-radius: 19px !important;
  white-space: nowrap;
  background: var(--bg-elev);
  font-size: 14px;
}
html.mobile .set-nav-item span:not(.icw) {
  white-space: nowrap;
}
html.mobile .set-nav-item.active {
  background: var(--accent) !important;
  color: #fff !important;
}
html.mobile .set-main {
  padding: 0 !important;
}
html.mobile .set-content {
  padding: 14px 12px calc(28px + env(safe-area-inset-bottom)) !important;
}
html.mobile .set-content > div {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}
html.mobile .set-content h2 {
  font-size: 20px;
}
html.mobile .set-close {
  top: calc(10px + env(safe-area-inset-top)) !important;
  width: 40px;
  height: 40px;
}
html.mobile .set-row {
  gap: 10px;
}
html.mobile .acc-side {
  order: -1;
}

/* ---------- Social: perfil no estilo do Discord (foto, nome, depois os botões) ---------- */
html.mobile .so-phead {
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}
html.mobile .so-phead > .avatar,
html.mobile .so-phead > .av-frame {
  width: 92px !important;
  height: 92px !important;
  flex: none;
}
html.mobile .so-phead > .avatar > * {
  width: 100% !important;
  height: 100% !important;
}
html.mobile .so-pinfo {
  order: 2;
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
}
html.mobile .so-pinfo h1 {
  font-size: 24px;
  word-break: break-word;
}
html.mobile .so-pbtns {
  order: 3;
  flex: 1 1 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
html.mobile .so-pbtns > * {
  flex: 1 1 0;
  justify-content: center;
  min-height: 40px;
}
html.mobile .so-stats {
  grid-template-columns: repeat(3, 1fr) !important;
}
html.mobile .add-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
html.mobile .add-row input {
  width: 100%;
  min-height: 44px;
}
html.mobile .add-row .btn {
  min-height: 44px;
  justify-content: center;
}
html.mobile .so-stats {
  display: grid !important;
  gap: 8px;
}
html.mobile .so-stats .so-stat {
  min-width: 0;
}
html.mobile .set-close {
  background: var(--bg-side);
}

/* ---------- caixa de mensagem: botão de enviar ---------- */
html.mobile .comp-row {
  align-items: flex-end;
}
html.mobile .m-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0 2px 3px 4px;
  border-radius: 50%;
  background: var(--bg-active);
  color: var(--muted);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
html.mobile .comp-row.m-has-text .m-send {
  background: var(--accent);
  color: #fff;
}
html.mobile .m-send:active {
  transform: scale(0.9);
}

/* ---------- nada pode empurrar a tela para o lado ---------- */
html.mobile,
html.mobile body,
html.mobile #app,
html.mobile #center,
html.mobile #main {
  overflow: clip !important;
}
html.mobile #main .main-body,
html.mobile .chat,
html.mobile .chat-scroll,
html.mobile .msgs {
  overflow-x: clip;
  max-width: 100vw;
}
html.mobile .msg,
html.mobile .msg-body,
html.mobile .invite-card,
html.mobile .inv-card,
html.mobile .embed,
html.mobile .lp-card {
  max-width: 100%;
  min-width: 0;
}
html.mobile .invite-card {
  width: 100%;
  box-sizing: border-box;
}
html.mobile .inv-row {
  flex-wrap: wrap;
  min-width: 0;
}
html.mobile .inv-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
