/* mobile.css — phone and tablet layout for the Linkup app (loaded last). */

/* ---------- tablets (iPad portrait / small laptops) ---------- */
@media (max-width: 1100px) and (min-width: 761px) {
  /* give the channel name room: search and less-used buttons step aside */
  .app .top .search { display: none !important; }
  .app .top .tb[aria-label="Threads"],
  .app .top .tb[data-act="saved"] { display: none !important; }
  .app .top .title { min-width: 0; flex: 1 1 auto; }
  .app .top .topic { display: none !important; }
  /* channel list a little narrower so the chat gets more space */
  .app { --side-w: 220px; }
  .app > .side { width: 220px !important; min-width: 220px !important; }
  /* member list opens as a panel over the chat instead of squeezing it */
  .members.force, .app .right.force { position: absolute !important; right: 0; top: 48px; bottom: 0; z-index: 30; width: 260px !important; box-shadow: -8px 0 24px rgba(0,0,0,.35) !important; }
  .modal { max-width: min(560px, calc(100vw - 48px)) !important; }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  html, body { overscroll-behavior: none; }
  .app { padding-bottom: env(safe-area-inset-bottom); }

  /* top bar: menu, channel name, members, inbox. Everything else lives in menus. */
  .app .top { padding: 0 6px 0 4px !important; gap: 2px !important; height: 52px !important; min-height: 52px !important; }
  .app .top .tb { width: 40px !important; height: 40px !important; flex: none; }
  .app .top .tb[aria-label="Threads"],
  .app .top .tb[data-act="pins"],
  .app .top .tb[data-act="saved"],
  .app .top .search,
  .app .top .topic { display: none !important; }
  .app .top .title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px !important; }
  .app .top .title > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

  /* home tabs scroll sideways instead of being cut off */
  .app .top .tabs { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; scrollbar-width: none; gap: 4px; min-width: 0; flex: 1 1 auto; mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .app .top .tabs::-webkit-scrollbar { display: none; }
  .app .top .tabs > * { flex: none; }
  .app .top .tabs .sepv { display: none; }

  /* drawer: servers + channels slide in, wide enough to read */
  .app .rail { width: 72px !important; }
  .app .side { width: min(300px, calc(100vw - 72px - 44px)) !important; }
  .app.drawer .scrim { background: rgba(0,0,0,.6) !important; }
  .app:not(.drawer) .rail, .app:not(.drawer) .side { transform: translateX(-120vw) !important; }
  .app.drawer .rail, .app.drawer .side { transform: none !important; }
  .app .rail, .app .side { transition: transform .22s cubic-bezier(.2,.8,.2,1) !important; }

  /* messages: tighter gutters, bigger tap targets */
  .msgs .msg { padding-left: 12px !important; padding-right: 10px !important; gap: 10px !important; }
  .msg .acts { right: 6px !important; }

  /* composer: keep plus, emoji and send; GIF / big emoji / gift / schedule move off the bar */
  .composer { padding: 0 8px 8px !important; }
  .composer .cb[data-act="gift"],
  .composer .cb.f3-gifbtn,
  .composer .cb[aria-label="Send a big emoji"],
  .composer .cb.fx-sched,
  .composer .cb[data-act="apps"] { display: none !important; }
  .composer .rinput, .composer textarea { font-size: 16px !important; } /* 16px stops iOS from zooming in */

  /* member list: full-screen sheet */
  .members.force, .app .right.force { position: fixed !important; inset: 0 !important; width: 100% !important; z-index: 60; }

  /* dialogs become bottom sheets */
  .backdrop { align-items: flex-end !important; padding: 0 !important; }
  .backdrop > .modal { width: 100% !important; max-width: 100% !important; max-height: 92vh !important; border-radius: 16px 16px 0 0 !important; margin: 0 !important; padding-bottom: env(safe-area-inset-bottom); overflow: auto; }
  .backdrop > .modal .mf { position: sticky; bottom: 0; }
  .modal input, .modal textarea, .modal select { font-size: 16px !important; }

  /* menus and popovers never run off screen */
  .menu-pop, .pop, .popover { max-width: calc(100vw - 16px) !important; }
  .inbox { width: calc(100vw - 16px) !important; max-width: 420px; }

  /* settings: full screen with a scrolling tab strip */
  .settings nav > div::-webkit-scrollbar { display: none; }
  .settings nav > div { scrollbar-width: none; }
  .settings .pane { padding: 16px 14px 80px !important; }

  /* lobby page */
  .lb-stats { flex-wrap: wrap; justify-content: center; }
  .f7-embed, .f7-dd { max-width: 100% !important; }
}

/* very small phones */
@media (max-width: 380px) {
  .app .top .tb { width: 36px !important; }
  .msgs .msg { padding-left: 8px !important; }
}

/* Friends tabs: their own scrollable row on phones, scrollable on tablets */
@media (max-width: 1100px) {
  .app .top .tabs { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
  .app .top .tabs::-webkit-scrollbar { display: none; }
  .app .top .tabs > * { flex: none; }
}
@media (max-width: 760px) {
  .app .top:has(.tabs) { height: auto !important; min-height: 52px !important; flex-wrap: wrap !important; padding-bottom: 8px !important; row-gap: 4px !important; }
  .app .top:has(.tabs) .tabs { order: 10; flex: 0 0 100% !important; width: 100%; padding: 0 6px; mask-image: none; }
  .app .top:has(.tabs) .title { flex: 1 1 auto; }
}

/* settings on phones: full-width menu on top (max 40% of the screen), content below, floating close button */
@media (max-width: 760px) {
  .settings { display: flex !important; flex-direction: column !important; }
  .settings > nav { width: 100% !important; max-height: 40vh; overflow-y: auto !important; padding: 12px 10px 8px !important; flex: none; border-bottom: 1px solid rgba(255,255,255,.06) !important; }
  .settings > nav > div { width: 100% !important; max-width: none !important; }
  .settings .pane, .settings > :not(nav):not(.close) { flex: 1 1 auto; min-height: 0; width: 100% !important; overflow-y: auto; }
  .settings .close { position: fixed !important; top: 10px !important; right: 10px !important; width: auto !important; height: auto !important; padding: 0 !important; z-index: 5; background: transparent !important; }
  .settings .close > * { transform: scale(.85); }
}

/* tablets: channel column matches the narrower list; compact user card */
@media (max-width: 1100px) and (min-width: 761px) {
  html:not(#_) .app { grid-template-columns: 72px 220px minmax(0, 1fr) !important; }
  html:not(#_) .me-bar .mb-chev, html:not(#_) .me-bar .mb-grp > :not(:first-child) { display: none !important; }
  html:not(#_) .me-bar .mb-grp { width: 32px !important; }
}

/* shop / quests top bar on tablets and phones: tabs get their own scrollable row, search steps aside */
@media (max-width: 1100px) {
  html:not(#_) .app .top.ps-top { height: auto !important; min-height: 52px !important; flex-wrap: wrap !important; row-gap: 6px !important; padding-top: 8px !important; padding-bottom: 8px !important; }
  html:not(#_) .ps-top .ps-search { display: none !important; }
  html:not(#_) .ps-top .ps-tabs { order: 10; flex: 0 0 100% !important; display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; scrollbar-width: none; gap: 4px; margin: 0 !important; padding: 0 4px; }
  html:not(#_) .ps-top .ps-tabs::-webkit-scrollbar { display: none; }
  html:not(#_) .ps-top .ps-tabs > * { flex: none; }
  html:not(#_) .ps-top .sp { flex: 1 1 auto; }
}
@media (max-width: 760px) {
  html:not(#_) .ps-in { padding-left: 12px !important; padding-right: 12px !important; }
  html:not(#_) .vroom .ctrl.vpill { bottom: 12px !important; max-width: calc(100% - 16px); overflow-x: auto; }
  html:not(#_) .vroom .vpill button { width: 42px !important; height: 42px !important; }
}

/* Discover banner on phones */
@media (max-width: 760px) {
  html:not(#_) .discover .hero { padding: 24px 20px !important; border-radius: 18px !important; }
  html:not(#_) .discover .hero h2 { font-size: 26px !important; }
}
