/* NEXT v86.2: Mobile nav + pass-header hotfix
   Goal: one expandable mobile nav, no duplicated start nav, and no overlap between Menu/Overview/Prev/Next in pass mode. */

@media(max-width:1059px){
  /* The start hero had its own nav. Hide it hard on mobile so only the real app topbar remains. */
  .home-topbar,
  .home-context-nav,
  .home-nav,
  .home-tools{
    display:none!important;
  }

  .app-topbar{
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:8px!important;
    padding:8px!important;
    border-radius:18px!important;
    z-index:150!important;
  }

  .app-location{
    min-width:0!important;
    display:grid!important;
    gap:2px!important;
    padding:2px 4px!important;
  }

  .app-location strong{
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .app-nav-toggle{
    display:inline-flex!important;
    width:auto!important;
    max-width:130px!important;
    justify-self:end!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:40px!important;
    padding:8px 12px!important;
    border-radius:15px!important;
    background:linear-gradient(180deg,rgba(255,255,255,.075),rgba(255,255,255,.035))!important;
    color:#f8fbff!important;
    border:1px solid rgba(170,205,255,.18)!important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.05)!important;
  }

  .app-tabs{
    grid-column:1/-1!important;
    display:none!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
    padding-top:4px!important;
  }

  .app-topbar.nav-open .app-tabs{
    display:grid!important;
  }

  .app-topbar.nav-open .app-nav-toggle{
    color:#fff!important;
    border-color:rgba(11,132,255,.60)!important;
    background:linear-gradient(90deg,rgba(11,132,255,.30),rgba(34,230,255,.10))!important;
  }

  .app-tab{
    min-height:44px!important;
    border-radius:15px!important;
    font-size:14px!important;
    line-height:1.05!important;
  }
}

@media(max-width:560px){
  .app-topbar{
    top:6px!important;
    margin-bottom:10px!important;
  }
  .app-nav-toggle{
    max-width:116px!important;
    min-height:38px!important;
    font-size:13px!important;
  }
  .app-tab{
    min-height:46px!important;
    font-size:14px!important;
  }
}

/* Active pass mode: the normal app topbar stays hidden, but pass controls must be usable. */
body.exercise-active .app-topbar,
body.tv-mode .app-topbar{
  display:none!important;
}

@media(max-width:760px) and (orientation:portrait){
  body.exercise-active .sticky-nav{
    position:sticky!important;
    top:0!important;
    left:0!important;
    right:0!important;
    z-index:220!important;
    padding:7px 8px 7px!important;
    background:rgba(3,7,17,.96)!important;
    border-bottom:1px solid rgba(170,205,255,.14)!important;
  }

  body.exercise-active .nav-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:6px!important;
  }

  body.exercise-active .nav-left{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    width:100%!important;
  }

  body.exercise-active .menu-wrap{
    position:static!important;
    width:100%!important;
    min-width:0!important;
  }

  body.exercise-active .menu-toggle,
  body.exercise-active .nav-left .ghost-btn{
    width:100%!important;
    min-width:0!important;
    height:40px!important;
    min-height:40px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:8px 10px!important;
    border-radius:14px!important;
    font-size:13px!important;
    line-height:1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    box-shadow:none!important;
  }

  body.exercise-active .menu-toggle{
    background:linear-gradient(180deg,rgba(255,255,255,.085),rgba(255,255,255,.04))!important;
    border:1px solid rgba(170,205,255,.18)!important;
    color:#f8fbff!important;
  }

  body.exercise-active .nav-left .ghost-btn{
    background:rgba(255,255,255,.045)!important;
    border:1px solid rgba(255,255,255,.12)!important;
    color:#eaf5ff!important;
  }

  /* Prev/Next belong to the bottom action bar in portrait. */
  body.exercise-active .nav-right{
    position:fixed!important;
    left:8px!important;
    right:8px!important;
    bottom:calc(8px + env(safe-area-inset-bottom))!important;
    z-index:210!important;
    display:grid!important;
    grid-template-columns:.95fr 1.15fr!important;
    gap:8px!important;
    padding:0!important;
  }

  body.exercise-active .nav-right .ghost-btn,
  body.exercise-active .nav-right .main-btn{
    min-width:0!important;
    width:100%!important;
    height:58px!important;
    min-height:58px!important;
    border-radius:18px!important;
    font-size:16px!important;
    line-height:1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    justify-content:center!important;
    box-shadow:0 18px 44px rgba(0,0,0,.42)!important;
  }

  body.exercise-active .progress-meta{
    margin-top:5px!important;
  }

  body.exercise-active .top-tools{
    position:fixed!important;
    left:8px!important;
    right:8px!important;
    top:58px!important;
    width:auto!important;
    max-height:46dvh!important;
    overflow:auto!important;
    z-index:260!important;
    display:none!important;
    padding:8px!important;
    border-radius:16px!important;
    background:rgba(6,12,22,.98)!important;
    border:1px solid rgba(170,205,255,.18)!important;
    box-shadow:0 22px 70px rgba(0,0,0,.56)!important;
  }

  body.exercise-active .top-tools.open{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
}

/* iPhone landscape / small-height pass mode: keep all controls in one compact, non-overlapping row. */
@media(max-width:900px) and (orientation:landscape){
  body.exercise-active .sticky-nav{
    position:sticky!important;
    top:0!important;
    z-index:220!important;
    padding:5px 8px 6px!important;
    margin:0!important;
    background:rgba(3,7,17,.96)!important;
    border-bottom:1px solid rgba(170,205,255,.14)!important;
  }

  body.exercise-active .nav-row{
    display:grid!important;
    gap:4px!important;
  }

  body.exercise-active .nav-actions{
    display:grid!important;
    grid-template-columns:minmax(0,.78fr) minmax(0,1.22fr)!important;
    gap:7px!important;
    align-items:center!important;
  }

  body.exercise-active .nav-left,
  body.exercise-active .nav-right{
    position:static!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;
    width:100%!important;
    min-width:0!important;
    padding:0!important;
  }

  body.exercise-active .menu-wrap{
    position:static!important;
    width:100%!important;
    min-width:0!important;
  }

  body.exercise-active .menu-toggle,
  body.exercise-active .nav-left .ghost-btn,
  body.exercise-active .nav-right .ghost-btn,
  body.exercise-active .nav-right .main-btn{
    width:100%!important;
    min-width:0!important;
    height:38px!important;
    min-height:38px!important;
    padding:6px 8px!important;
    border-radius:14px!important;
    font-size:13px!important;
    line-height:1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    box-shadow:none!important;
  }

  body.exercise-active .menu-toggle{
    background:linear-gradient(180deg,rgba(255,255,255,.08),rgba(255,255,255,.035))!important;
    border:1px solid rgba(170,205,255,.18)!important;
    color:#f8fbff!important;
  }

  body.exercise-active .nav-left .ghost-btn,
  body.exercise-active .nav-right .ghost-btn{
    background:rgba(255,255,255,.045)!important;
    border:1px solid rgba(255,255,255,.12)!important;
    color:#eaf5ff!important;
  }

  body.exercise-active .progress-meta{
    margin-top:3px!important;
  }

  body.exercise-active #exerciseMeta{
    font-size:11px!important;
    line-height:1.1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  body.exercise-active .progress-shell{
    height:4px!important;
    margin-top:2px!important;
  }

  body.exercise-active .top-tools{
    position:fixed!important;
    left:8px!important;
    right:8px!important;
    top:50px!important;
    width:auto!important;
    max-height:calc(100dvh - 62px)!important;
    overflow:auto!important;
    z-index:260!important;
    display:none!important;
    padding:8px!important;
    border-radius:16px!important;
    background:rgba(6,12,22,.98)!important;
    border:1px solid rgba(170,205,255,.18)!important;
    box-shadow:0 22px 70px rgba(0,0,0,.56)!important;
  }

  body.exercise-active .top-tools.open{
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:8px!important;
  }

  body.exercise-active .tool-btn{
    min-height:36px!important;
    border-radius:12px!important;
    padding:6px 8px!important;
    font-size:11px!important;
  }
}

@media(max-width:640px) and (orientation:landscape){
  body.exercise-active .nav-actions{
    grid-template-columns:1fr!important;
  }
  body.exercise-active .nav-left,
  body.exercise-active .nav-right{
    grid-template-columns:1fr 1fr!important;
  }
}
