
/* DMG Voice V3.3.0 - dedicated mobile rebuild
   This file is intentionally loaded AFTER app.css and games.css. */

.mobileOnly{display:none}

@media (max-width:980px){
  :root{--mobile-nav-h:64px;--mobile-gap:10px}
  *{min-width:0}
  html{
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
    -webkit-text-size-adjust:100%;
  }
  body{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    overflow-x:hidden!important;
    padding:0 0 calc(var(--mobile-nav-h) + 12px + env(safe-area-inset-bottom))!important;
    overscroll-behavior-x:none;
  }
  body.room-open,body.game-room-open{padding-bottom:0!important;overflow:hidden!important}
  .mobileOnly{display:initial}

  /* kill desktop shell geometry */
  .app{
    display:block!important;
    grid-template-columns:none!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow-x:hidden!important;
  }
  .sidebar{display:none!important}
  main{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    overflow-x:hidden!important;
  }

  /* top application bar */
  .topbar{
    position:sticky!important;
    top:0!important;
    left:0!important;
    right:0!important;
    z-index:80!important;
    width:100%!important;
    height:58px!important;
    min-height:58px!important;
    padding:7px 10px!important;
    border-bottom:1px solid rgba(255,255,255,.08)!important;
    background:rgba(8,11,17,.94)!important;
    backdrop-filter:blur(16px)!important;
    overflow:hidden!important;
  }
  .topbar>div:first-child{min-width:0!important;flex:1!important}
  .topbar h1{
    margin:0!important;
    font-size:16px!important;
    line-height:1.15!important;
    max-width:64vw!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .topbar p{display:none!important}
  .topActions{flex:0 0 auto!important;display:flex!important;gap:5px!important}
  #dailyRewardBtn,#testUserBtn{display:none!important}
  #topCreateRoom{
    width:39px!important;height:39px!important;padding:0!important;
    border-radius:12px!important;font-size:0!important;display:grid!important;place-items:center!important
  }
  #topCreateRoom:after{content:"+";font-size:24px;font-weight:500;line-height:1}

  /* pages */
  .page{
    display:none!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:10px 10px calc(var(--mobile-nav-h) + 18px + env(safe-area-inset-bottom))!important;
    overflow-x:hidden!important;
  }
  .page.active{display:block!important}
  .roomPage.active,.gameRoomPage.active{padding:0!important}

  .hero{
    display:block!important;
    width:100%!important;
    min-height:0!important;
    margin:0!important;
    padding:15px!important;
    border-radius:17px!important;
    overflow:hidden!important;
  }
  .hero>div:first-child>span{font-size:7px!important}
  .hero h2{font-size:19px!important;line-height:1.18!important;margin:7px 0!important}
  .hero p{font-size:9px!important;line-height:1.45!important;margin:0!important}
  .heroStats{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:6px!important;margin-top:12px!important
  }
  .heroStats div{padding:9px 4px!important;border-radius:12px!important}
  .heroStats strong{font-size:15px!important}
  .heroStats small{font-size:7px!important}

  .sectionHead{
    width:100%!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:9px!important;
    margin:18px 0 9px!important;
  }
  .sectionHead>div:first-child{width:100%!important}
  .sectionHead h3{font-size:15px!important;margin:0!important}
  .sectionHead p{font-size:8px!important;margin:3px 0 0!important}
  .searchRow{
    width:100%!important;
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr)!important;
    gap:7px!important;
    align-items:center!important;
  }
  #favoritesOnly{
    width:auto!important;max-width:none!important;height:42px!important;
    padding:0 13px!important;font-size:10px!important;white-space:nowrap!important
  }
  .search,#roomSearch{
    width:100%!important;max-width:100%!important;min-width:0!important;
    height:42px!important;padding:0 11px!important;font-size:16px!important
  }

  /* room cards */
  .roomGrid{
    width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    overflow:visible!important
  }
  .roomCard{
    width:100%!important;min-width:0!important;min-height:148px!important;
    padding:12px!important;border-radius:15px!important
  }
  .roomCard h4{font-size:12px!important;margin:11px 0 4px!important}
  .roomCard p{font-size:8px!important;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .roomOwner{font-size:7px!important}
  .roomFoot{left:12px!important;right:12px!important;bottom:10px!important;font-size:7px!important}
  .roomIcon{width:38px!important;height:38px!important;border-radius:12px!important}
  .pill{font-size:7px!important;padding:4px 6px!important}

  /* generic single-column mobile content */
  .eventList,.friendList,.messageList,.notificationList{width:100%!important}
  .eventRow{grid-template-columns:1fr!important;width:100%!important}
  .formGrid{grid-template-columns:1fr!important}
  .statusGrid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .panelTabs{overflow-x:auto!important;display:flex!important;scrollbar-width:none!important}
  .panelTabs::-webkit-scrollbar{display:none}
  .panelTabs button{flex:0 0 auto!important}
  .panelContent{width:100%!important;overflow:auto!important}
  .dataTable{min-width:680px!important}

  /* drawers are true viewport overlays */
  .drawer,.roomsDrawer{
    position:fixed!important;
    z-index:145!important;
    top:0!important;bottom:0!important;
    left:auto!important;right:0!important;
    width:min(92dvw,390px)!important;
    max-width:92dvw!important;
    height:100dvh!important;
    border-radius:0!important;
    transform:translateX(105%)!important;
    transition:transform .2s ease!important;
  }
  .drawer.open,.roomsDrawer.open{transform:translateX(0)!important}
  .drawerShade{position:fixed!important;inset:0!important;z-index:144!important}

  /* modals become proper mobile sheets */
  .modalBack{
    position:fixed!important;inset:0!important;z-index:180!important;
    padding:0!important;align-items:flex-end!important
  }
  .modal{
    width:100%!important;max-width:100%!important;
    max-height:92dvh!important;
    border-radius:22px 22px 0 0!important;
    margin:0!important;
    padding-bottom:env(safe-area-inset-bottom)!important;
    overflow:auto!important
  }
  .modalBody{padding:13px!important}
  .modalHead,.modalFoot{padding:11px 13px!important}
  .field input,.field select,.field textarea,input,select,textarea{font-size:16px!important}

  /* ----------------------------------------------------------------
     TOOL PANELS: the previous versions failed here.
     Mobile uses display:none/display:flex so CLOSED really means CLOSED.
     ---------------------------------------------------------------- */
  .toolPanel{
    display:none!important;
    position:fixed!important;
    z-index:170!important;
    left:6px!important;right:6px!important;
    top:auto!important;
    bottom:calc(6px + env(safe-area-inset-bottom))!important;
    width:auto!important;
    max-width:none!important;
    min-width:0!important;
    max-height:84dvh!important;
    border-radius:20px!important;
    overflow:hidden!important;
    transform:none!important;
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
    box-shadow:0 24px 70px rgba(0,0,0,.65)!important
  }
  .toolPanel.open{display:flex!important}
  #animationPanel{height:76dvh!important}
  #giftPanel{height:68dvh!important}
  #gamePanel{height:min(54dvh,480px)!important}
  .toolShade{
    display:none!important;
    position:fixed!important;inset:0!important;z-index:165!important;
    opacity:1!important;pointer-events:auto!important;
    background:rgba(0,0,0,.64)!important;backdrop-filter:blur(3px)!important
  }
  .toolShade.open{display:block!important}
  body.tool-open{overflow:hidden!important}
  body.tool-open .mobileBottomNav{display:none!important}
  .toolHead{height:50px!important;flex:0 0 50px!important;padding:0 12px!important}
  .toolHead b{font-size:14px!important}
  .toolHead button{width:36px!important;height:36px!important;font-size:22px!important}
  .toolSearch{padding:8px 10px!important;flex:0 0 auto!important}
  .toolSearch input{height:43px!important;width:100%!important;font-size:16px!important}
  .chipRow{
    width:100%!important;display:flex!important;overflow-x:auto!important;
    flex-wrap:nowrap!important;gap:5px!important;padding:0 10px 8px!important;
    scrollbar-width:none!important
  }
  .chipRow::-webkit-scrollbar{display:none}
  .chipRow button{flex:0 0 auto!important;font-size:8px!important;padding:6px 9px!important}
  .toolBalance,.giftTarget,.toolFoot{flex:0 0 auto!important;padding:9px 11px!important;font-size:9px!important}
  .toolPanel .tileGrid{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:7px!important;
    width:100%!important;
    min-height:0!important;
    flex:1 1 auto!important;
    padding:8px 9px 12px!important;
    overflow-y:auto!important;overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior:contain!important
  }
  .toolPanel .tile{
    width:100%!important;min-width:0!important;min-height:92px!important;
    padding:6px 3px!important;border-radius:14px!important;overflow:hidden!important
  }
  .toolPanel .tile img{
    width:58px!important;height:58px!important;
    max-width:58px!important;max-height:58px!important;object-fit:contain!important
  }
  .toolPanel .tile .asset{font-size:32px!important}
  .toolPanel .tile b{font-size:8px!important;max-width:100%!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .toolPanel .tile small{font-size:7px!important}

  /* fixed mobile bottom nav */
  .mobileBottomNav{
    display:grid!important;
    position:fixed!important;z-index:120!important;
    left:6px!important;right:6px!important;
    bottom:calc(6px + env(safe-area-inset-bottom))!important;
    width:auto!important;max-width:none!important;
    height:58px!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:3px!important;padding:4px!important;
    border-radius:18px!important;
    background:rgba(10,14,20,.97)!important
  }
  .mobileBottomNav button{min-width:0!important}
  .mobileBottomNav button>span{font-size:17px!important}
  .mobileBottomNav button>b{font-size:7px!important}
  body.room-open .mobileBottomNav,body.game-room-open .mobileBottomNav{display:none!important}

  /* social room is a separate full-screen mobile app */
  body.room-open .app,body.room-open main{height:100dvh!important;overflow:hidden!important}
  .roomPage.active,.socialRoomShell,.roomCanvas{
    width:100dvw!important;max-width:100dvw!important;
    height:100dvh!important;min-height:100dvh!important;
    margin:0!important
  }
  .socialRoomShell{display:block!important}
  .roomCanvas{overflow:hidden!important}
  .roomPeople{
    display:flex!important;position:fixed!important;z-index:190!important;
    left:0!important;top:0!important;bottom:0!important;
    width:min(86dvw,340px)!important;height:100dvh!important;
    transform:translateX(-105%)!important;transition:transform .2s ease!important
  }
  body.mobile-room-people-open .roomPeople{transform:translateX(0)!important}
  .roomPeopleMobileBtn{display:inline-flex!important}
  .roomPeopleMobileClose{display:grid!important}
  .roomHeaderFloating{
    height:54px!important;display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    padding:5px 6px!important
  }
  .roomHeaderCenter{display:none!important}
  .roomOwnerStrip{min-width:0!important;overflow:hidden!important}
  .roomOwnerStrip b{max-width:42dvw!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .roomHeaderActions{gap:3px!important}
  .roomHeaderActions .btn{padding:7px 8px!important;font-size:8px!important}
  .roomHeaderActions .btn span{display:none!important}
  .speakerZone{top:59px!important;width:96dvw!important;max-width:96dvw!important}
  .speakerLine{gap:7px!important;max-height:128px!important;overflow-y:auto!important}
  .speakerPod{width:49px!important}
  .speakerAvatar{width:37px!important;height:37px!important}
  .roomFeed{left:6px!important;top:148px!important;width:74dvw!important;max-width:74dvw!important}
  .rightRail{right:5px!important;padding:4px!important}
  .rightRail button{width:31px!important;height:31px!important}
  .bottomComposer{
    left:5px!important;right:5px!important;
    bottom:calc(5px + env(safe-area-inset-bottom))!important;
    height:48px!important;min-height:48px!important;padding:4px 5px!important;gap:3px!important
  }
  .chatPreview{display:none!important}
  .composerTools{gap:0!important}
  .composerTools button{width:26px!important;height:30px!important}
  .composerTools button:nth-child(n+4){display:none!important}
  .composerInput{min-width:0!important;flex:1!important}
  .composerInput input{font-size:16px!important;padding:7px!important}
  .floatingMic{right:7px!important;bottom:calc(61px + env(safe-area-inset-bottom))!important}
  .micMain{width:49px!important;height:49px!important}
  .videoDock{inset:58px 39px 62px 0!important;width:auto!important;height:auto!important}
  .videoTile{width:min(55dvw,218px)!important;max-width:218px!important}

  /* games hub */
  .gamesPage{width:100%!important}
  .gameHero{padding:14px!important;border-radius:16px!important}
  .gameHero h2{font-size:19px!important}
  .gameCatalogGrid,.activeGameRooms{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important
  }
  .gameCatalogCard,.gameLobbyCard{width:100%!important;min-width:0!important;padding:10px!important}
  .gameInviteRow{grid-template-columns:minmax(0,1fr) auto auto!important;gap:4px!important}

  /* game room: only one mobile pane at a time */
  .gameRoomPage.active{height:100dvh!important;overflow:hidden!important}
  .gameMobileTabs{
    display:grid!important;position:fixed!important;z-index:210!important;
    left:6px!important;right:6px!important;bottom:calc(6px + env(safe-area-inset-bottom))!important;
    width:auto!important;height:52px!important;padding:4px!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    border-radius:17px!important
  }
  .gameRoomShell{
    display:block!important;width:100dvw!important;height:100dvh!important;
    padding:0 0 calc(64px + env(safe-area-inset-bottom))!important;overflow:hidden!important
  }
  .gameRoomShell>.gameMembersPane,
  .gameRoomShell>.gameBoardPane,
  .gameRoomShell>.gameChatPane{
    display:none!important;position:relative!important;
    width:100%!important;height:100%!important;max-height:none!important;
    margin:0!important;border-radius:0!important;inset:auto!important
  }
  .gameRoomShell.mobile-view-members>.gameMembersPane{display:flex!important}
  .gameRoomShell.mobile-view-board>.gameBoardPane{display:flex!important}
  .gameRoomShell.mobile-view-chat>.gameChatPane{display:flex!important}
  .gameBoardPane{min-height:0!important}
  .gameBoardTop{height:54px!important;min-height:54px!important;padding:6px 7px!important}
  .gameTopBtns{max-width:60dvw!important;overflow-x:auto!important;display:flex!important;gap:3px!important}
  .gameTopBtns .btn{flex:0 0 auto!important;padding:6px 7px!important;font-size:7px!important}
  .gameBoard{padding:5px!important;overflow:auto!important}
  .gameMembersPane{overflow:auto!important}
  .gameChatPane{overflow:hidden!important}
  .gameChatLog{min-height:0!important;overflow:auto!important}
  .gameChatComposer input{font-size:16px!important}

  /* tavla scales to the phone instead of overflowing */
  .tavlaPro{width:100%!important;max-width:100%!important;margin:auto!important}
  .tvTable{grid-template-columns:27px minmax(0,1fr)!important;gap:3px!important;padding:3px!important}
  .tvWoodFrame{
    width:100%!important;max-width:100%!important;
    height:auto!important;aspect-ratio:1.58/1!important;
    min-width:0!important;border-width:5px!important
  }
  .tvHalf{grid-template-columns:repeat(6,minmax(0,1fr)) 26px repeat(6,minmax(0,1fr))!important;padding:0 1px!important}
  .tvCenterBar{width:26px!important;grid-template-rows:1fr 62px 1fr!important;padding:2px!important}
  .tvChecker{
    width:clamp(18px,5.7dvw,28px)!important;height:clamp(18px,5.7dvw,28px)!important;
    flex-basis:clamp(18px,5.7dvw,28px)!important;margin:-1px 0!important
  }
  .tvStack{width:clamp(19px,5.8dvw,29px)!important}
  .tvBarZone .tvChecker{width:clamp(17px,5.1dvw,24px)!important;height:clamp(17px,5.1dvw,24px)!important;flex-basis:clamp(17px,5.1dvw,24px)!important}
  .tvDie{width:23px!important;height:23px!important;padding:3px!important}
  .tvPlayerBar{height:44px!important;padding:5px 7px!important}
  .tvPlayerBar .avatar{width:31px!important;height:31px!important}
  .tvPlayerBar b{font-size:8px!important}.tvPlayerBar small{font-size:6px!important}
  .tvOffTray{border-width:2px!important}.tvOffTray small{display:none!important}
  .tvOffPile{height:45px!important}.tvOffPile i{width:16px!important;height:5px!important}
  .tvActionStrip{padding:5px!important;gap:4px!important}
  .tvStatus{font-size:7px!important}
  .tvActionStrip .btn{padding:6px 7px!important;font-size:7px!important}
}

/* narrow phones */
@media(max-width:480px){
  .roomGrid{grid-template-columns:1fr!important}
  .gameCatalogGrid,.activeGameRooms{grid-template-columns:1fr!important}
}
@media(max-width:390px){
  :root{--mobile-gap:6px}
  .page{padding-left:7px!important;padding-right:7px!important}
  .toolPanel{left:4px!important;right:4px!important;bottom:calc(4px + env(safe-area-inset-bottom))!important}
  .toolPanel .tileGrid{gap:6px!important;padding-left:7px!important;padding-right:7px!important}
  .toolPanel .tile img{width:54px!important;height:54px!important;max-width:54px!important;max-height:54px!important}
  .searchRow{grid-template-columns:108px minmax(0,1fr)!important}
  #favoritesOnly{padding:0 9px!important;font-size:9px!important}
}
@media(max-width:340px){
  .toolPanel .tileGrid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .searchRow{grid-template-columns:1fr!important}
}

/* phone landscape */
@media(max-width:980px) and (orientation:landscape) and (max-height:500px){
  body:not(.room-open):not(.game-room-open){--mobile-nav-h:50px}
  .mobileBottomNav{height:46px!important}
  .mobileBottomNav button{flex-direction:row!important;gap:4px!important}
  .mobileBottomNav button>span{font-size:14px!important}
  .toolPanel{max-height:92dvh!important}
  .gameMobileTabs{
    left:auto!important;right:5px!important;top:56px!important;bottom:auto!important;
    width:48px!important;height:auto!important;grid-template-columns:1fr!important
  }
  .gameRoomShell{padding:0 58px 0 0!important}
  .tvPlayerBar{height:36px!important}
  .tvWoodFrame{max-height:calc(100dvh - 122px)!important;aspect-ratio:1.82/1!important}
}
