/* ==========================================================================
   LUME — DEDICATED MOBILE-FIRST NATIVE APP ARCHITECTURE (<= 860px)
   Projetado exclusivamente para telas móveis (Instagram + TikTok + Orkut App)
   ========================================================================== */

@media (max-width: 860px) {
  :root {
    --mobile-header-h: 56px;
    --mobile-tabbar-h: 64px;
  }

  body {
    background: var(--surface);
    overscroll-behavior-y: contain;
  }

  .desktop-only,
  .topbar,
  .left-rail,
  .right-rail {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  /* ------------------------------------------------------------------
     1. NATIVE MOBILE HEADER (56px Frosted App Bar)
     ------------------------------------------------------------------ */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 75;
    height: var(--mobile-header-h);
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
  }

  .mobile-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mobile-header-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .m-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--text);
    position: relative;
    transition: background var(--transition);
  }

  .m-icon-btn:active {
    background: var(--bg);
    transform: scale(0.92);
  }

  /* ------------------------------------------------------------------
     2. NATIVE MOBILE BOTTOM TAB BAR + CENTER FLOATING CREATE BUTTON
     ------------------------------------------------------------------ */
  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    height: calc(var(--mobile-tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 4px 6px env(safe-area-inset-bottom, 0px);
    background: var(--surface-glass);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-top: 1px solid var(--border);
  }

  .m-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 6px 2px;
    position: relative;
    transition: color var(--transition), transform var(--transition);
  }

  .m-tab-btn i {
    font-size: 1.18rem;
  }

  .m-tab-btn.active {
    color: var(--brand);
  }

  .m-tab-btn.active .m-tab-avatar-ring {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
  }

  .m-tab-avatar-ring {
    border-radius: 50%;
    transition: box-shadow var(--transition);
  }

  .m-tab-create {
    display: grid;
    place-items: center;
  }

  .m-tab-create-fab {
    width: 46px;
    height: 36px;
    border-radius: 13px;
    background: var(--brand-gradient);
    color: #fff;
    font-size: 1.1rem;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 18px rgba(225, 45, 117, 0.36);
    transition: transform var(--transition);
  }

  .m-tab-create:active .m-tab-create-fab {
    transform: scale(0.9);
  }

  .m-tab-dot {
    position: absolute;
    top: 2px;
    right: calc(50% - 17px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid var(--surface);
  }

  /* ------------------------------------------------------------------
     3. EDGE-TO-EDGE MOBILE STAGE & FEED EXPERIENCE
     ------------------------------------------------------------------ */
  .app-grid,
  .app-grid.wide-center {
    display: block;
    padding: 0 0 calc(var(--mobile-tabbar-h) + 18px);
    max-width: 100%;
  }

  .center-stage {
    gap: 0;
  }

  /* Stories full-bleed strip com folga vertical para nunca cortar anéis */
  .stories-card {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    padding: 8px 0 10px 14px;
    background: var(--surface);
  }

  .stories-strip {
    gap: 12px;
    padding: 8px 14px 6px 2px;
  }

  .story-ring {
    width: 68px;
    height: 68px;
  }

  /* Exclusive Mobile Orkut Highlights Strip (Sorte do Dia + Pendências + Visitantes) */
  .mobile-orkut-strip {
    display: flex !important;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
  }

  .mobile-orkut-strip::-webkit-scrollbar {
    display: none;
  }

  .m-highlight-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    max-width: 280px;
  }

  .m-highlight-pill i {
    color: var(--brand);
    font-size: 0.9rem;
  }

  .m-highlight-pill.alert-pill {
    background: var(--amber-soft);
    border-color: rgba(245, 158, 11, 0.35);
    color: var(--text);
  }

  .m-highlight-pill.alert-pill i {
    color: var(--amber);
  }

  /* Mobile Compact Quick Composer Trigger (instead of huge desktop box) */
  .desktop-composer-wrap {
    display: none !important;
  }

  .mobile-quick-composer {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .m-composer-trigger {
    flex: 1;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: left;
  }

  /* Filter tabs full-bleed on mobile */
  .mobile-padded-tabs,
  .pill-tabs {
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  /* Edge-to-Edge Instagram-like Feed Cards */
  #posts-stream {
    gap: 8px !important;
    background: var(--bg);
  }

  .post-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }

  .post-header {
    padding: 12px 14px 8px;
  }

  .post-text {
    padding: 0 14px 10px;
    font-size: 0.94rem;
  }

  .post-media-wrap img {
    max-height: 72vh;
  }

  .poll-list {
    padding: 4px 14px 12px;
  }

  .post-actions {
    padding: 8px 10px;
  }

  .action-btn {
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  .action-btn .action-label-hide-mobile {
    display: none;
  }

  .post-comments {
    padding: 10px 14px 14px;
  }

  /* ------------------------------------------------------------------
     4. TRUE FULLSCREEN TIKTOK / REELS MODE FOR PULSOS ON MOBILE
     ------------------------------------------------------------------ */
  body.mobile-pulsos-mode {
    background: #000;
  }

  body.mobile-pulsos-mode .mobile-header {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.68) 0%, transparent 100%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    color: #fff;
  }

  body.mobile-pulsos-mode .mobile-header .m-icon-btn,
  body.mobile-pulsos-mode .mobile-header-title {
    color: #fff;
  }

  body.mobile-pulsos-mode .mobile-tabbar {
    background: rgba(10, 12, 18, 0.92);
    border-top-color: rgba(255, 255, 255, 0.12);
  }

  body.mobile-pulsos-mode .m-tab-btn {
    color: rgba(255, 255, 255, 0.65);
  }

  body.mobile-pulsos-mode .m-tab-btn.active {
    color: #FF4D8D;
  }

  body.mobile-pulsos-mode .app-grid {
    padding: 0;
  }

  .pulsos-shell {
    gap: 0;
  }

  .pulsos-topbar {
    display: none;
  }

  .pulsos-feed {
    height: calc(100dvh - var(--mobile-tabbar-h));
    max-height: none;
    min-height: 0;
    gap: 0;
    padding: 0;
    background: #000;
  }

  .pulso-slide {
    max-width: 100%;
    height: calc(100dvh - var(--mobile-tabbar-h));
    min-height: calc(100dvh - var(--mobile-tabbar-h));
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .pulso-top-bar {
    top: calc(var(--mobile-header-h) + 8px);
  }

  .pulso-rail {
    right: 12px;
    bottom: 24px;
    gap: 16px;
  }

  .pulso-info {
    bottom: 20px;
    left: 14px;
    right: 74px;
  }

  /* ------------------------------------------------------------------
     5. MOBILE COMMUNITIES & FORUM LAYOUT
     ------------------------------------------------------------------ */
  .mobile-section-pad {
    padding: 14px;
  }

  .communities-header-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    padding: 14px !important;
  }

  .communities-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
  }

  .comm-card-banner {
    height: 76px;
  }

  .topic-card,
  .forum-toolbar,
  .reddit-card,
  .thread-breadcrumb,
  .thread-detail-card,
  .thread-composer-card,
  .thread-comments-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }

  .reddit-stream {
    gap: 8px;
    background: var(--bg);
  }

  .reddit-card,
  .thread-detail-card {
    grid-template-columns: 1fr;
  }

  .reddit-card .vote-rail,
  .thread-detail-card .vote-rail {
    display: none;
  }

  .vote-pill-mobile {
    display: inline-flex;
  }

  .reddit-card-main {
    padding: 12px 14px;
  }

  .reddit-title {
    font-size: 1.01rem;
  }

  .forum-toolbar {
    padding: 11px 14px;
  }

  .thread-comments-card {
    padding: 12px 14px 20px;
  }

  .thread-node-body-wrap {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 6px;
  }

  .thread-collapsed-pill {
    margin-left: 24px;
  }

  /* Evita esmagamento horizontal em threads muito profundas no mobile */
  .thread-node[data-depth="4"] .thread-node-body-wrap,
  .thread-node[data-depth="5"] .thread-node-body-wrap {
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 4px;
  }

  /* Mobile Institutional Pages & Feedback */
  .doc-nav-strip {
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .doc-hero-card,
  .doc-article-card,
  .doc-feedback-card,
  .doc-cta-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    padding: 16px 14px;
  }

  .doc-hero-title {
    font-size: 1.32rem;
  }

  .guest-doc-main {
    margin: 0 auto 24px;
    padding: 0;
    gap: 8px;
  }

  /* ------------------------------------------------------------------
     6. DEDICATED MOBILE PROFILE LAYOUT
     ------------------------------------------------------------------ */
  .profile-hero-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }

  .profile-banner {
    height: 118px;
    border-radius: 0;
  }

  .profile-head-body {
    padding: 0 14px 16px;
  }

  .profile-top-row {
    margin-top: -38px;
    margin-bottom: 10px;
    align-items: flex-end;
  }

  .profile-avatar-lg {
    width: 78px !important;
    height: 78px !important;
    font-size: 1.6rem !important;
    border-width: 4px;
  }

  .profile-actions-row {
    width: 100%;
    padding-top: 6px;
  }

  /* Split-view Lightbox adaptado para mobile (Foto no topo + Comentários roláveis abaixo) */
  .lightbox-split {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(42vh, 48vh) minmax(0, 1fr);
  }

  .lb-media-col .lightbox-stage {
    padding: 50px 10px 10px;
  }

  .lb-side-col {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .lb-side-form {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .repost-embed {
    margin: 0 14px 12px;
  }

  .profile-actions-row .btn {
    flex: 1;
    min-width: 110px;
  }

  .seals-cards-grid {
    gap: 7px;
  }

  .seal-tile {
    padding: 9px 8px;
  }

  .seal-pip {
    font-size: 0.85rem;
  }

  #profile-tab-content {
    padding: 12px 14px 18px;
    background: var(--bg);
    gap: 12px !important;
  }

  #profile-tab-content .post-card {
    margin: 0 -14px;
  }

  /* ------------------------------------------------------------------
     7. MOBILE DIRECT MESSAGES — TRUE 2-SCREEN DRILL-DOWN
     ------------------------------------------------------------------ */
  .messages-layout {
    display: block;
    height: calc(100dvh - var(--mobile-header-h) - var(--mobile-tabbar-h));
    min-height: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .messages-layout.m-dm-inbox .dm-sidebar {
    display: flex;
    height: 100%;
    max-height: none;
    border-right: none;
    border-bottom: none;
  }

  .messages-layout.m-dm-inbox .dm-chat {
    display: none;
  }

  .messages-layout.m-dm-thread .dm-sidebar {
    display: none;
  }

  .messages-layout.m-dm-thread .dm-chat {
    display: flex;
    height: 100%;
    min-height: 0;
  }

  .dm-chat-header {
    padding: 10px 12px;
  }

  .dm-messages {
    padding: 14px 12px;
  }

  .dm-bubble {
    max-width: 82%;
  }

  .dm-input-bar {
    padding: 10px 12px;
    background: var(--surface);
  }

  /* ------------------------------------------------------------------
     8. MOBILE NATIVE BOTTOM SHEETS & FULLSCREEN STORY VIEWER
     ------------------------------------------------------------------ */
  .modal-backdrop.sheet-on-mobile {
    align-items: flex-end;
    padding: 0;
  }

  .modal-backdrop.sheet-on-mobile .modal-box {
    max-width: 100%;
    max-height: 88dvh;
    border-radius: 24px 24px 0 0;
    padding: 12px 18px calc(22px + env(safe-area-inset-bottom, 0px));
    border-bottom: none;
    border-left: none;
    border-right: none;
    animation: sheetRise 240ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes sheetRise {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-backdrop.sheet-on-mobile .sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 99px;
    background: var(--border-strong);
    margin: 0 auto 14px;
  }

  .story-viewer-box {
    max-width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .modal-backdrop:has(.story-viewer-box) {
    padding: 0;
  }

  .notif-popover {
    top: var(--mobile-header-h);
    right: 0;
    left: 0;
    width: 100%;
    max-height: calc(100dvh - var(--mobile-header-h) - var(--mobile-tabbar-h));
    border-radius: 0 0 20px 20px;
    border-top: none;
  }

  /* ------------------------------------------------------------------
     9. MOBILE-FIRST AUTH SCREEN (Clean App Onboarding Above the Fold)
     ------------------------------------------------------------------ */
  .auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    background: linear-gradient(170deg, #160A24 0%, #3E1454 34%, var(--bg) 34.1%);
  }

  .auth-hero {
    padding: 26px 20px 20px;
    background: transparent;
  }

  .auth-hero::before,
  .auth-hero p,
  .auth-pillars,
  .auth-hero-footer {
    display: none;
  }

  .auth-hero h1 {
    font-size: 1.45rem;
    margin: 14px 0 0;
    line-height: 1.22;
  }

  .auth-panel {
    padding: 8px 14px 32px;
    flex: 1;
    align-items: flex-start;
  }

  .auth-card {
    padding: 22px 18px;
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
  }

  /* Toasts docked cleanly above mobile bottom bar */
  #toast-root {
    bottom: calc(var(--mobile-tabbar-h) + 14px);
    left: 14px;
    right: 14px;
    align-items: center;
  }

  /* Chat Popup Dock é exclusivo para Desktop; no Mobile usa a tela cheia #/messages */
  .chat-dock {
    display: none !important;
  }

  .dm-bubble-del {
    opacity: 0.75;
  }

  .connections-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .archived-stories-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .feed-tabs-bar {
    padding: 0 12px;
    gap: 8px;
  }

  .algo-mode-pills {
    width: 100%;
    justify-content: space-between;
  }

  .algo-mode-btn {
    flex: 1;
    justify-content: center;
  }

  .feed-discovery-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* No mobile o carrossel funciona com o deslizar dos dedos; setas e máscaras desktop ocultas */
  .lume-carousel-arrow {
    display: none !important;
  }

  .lume-carousel-wrap.is-tabs-carousel > .lume-carousel-track {
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  .feed-discovery-fortune {
    padding: 14px;
    gap: 12px;
  }

  .disc-fortune-emblem {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.05rem;
  }

  .disc-tags-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .games-catalog-grid,
  .game-arena-grid {
    grid-template-columns: 1fr;
  }

  .games-hero-stats {
    width: 100%;
  }

  .comm-mod-toggles-grid {
    grid-template-columns: 1fr;
  }

  .dm-ref-card {
    min-width: 185px;
    max-width: 245px;
  }

  .frg-main {
    flex-wrap: wrap;
  }

  .frg-score-box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
  }

  .frc-body {
    flex-wrap: wrap;
  }

  /* Salas de comunidade empilhadas no mobile */
  .comm-rooms-shell {
    grid-template-columns: 1fr;
    max-height: none;
    min-height: 440px;
  }

  .comm-rooms-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .comm-rooms-list {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 10px;
  }

  .comm-room-channel {
    width: auto;
    flex-shrink: 0;
  }
}
