/* NEXT v86.3: remove duplicated mobile menu and keep pass controls apart.
   - Mobile uses the app-topbar only; legacy v84 rail stays desktop-only.
   - Back buttons on content pages are removed in HTML; empty action slots are hidden.
   - Active pass mode separates menu/overview at top from prev/next at bottom on all phone/tablet widths. */

/* Kill duplicate legacy rail on mobile/tablet. Desktop keeps the rail. */
@media(max-width:1059px){
  .v84-rail{display:none!important;}
  .wrap{width:min(100vw - 18px,1220px)!important;margin:0 auto!important;padding-top:8px!important;}
}

/* Do not show empty action wrappers after back-buttons were removed. */
.page-actions:empty{display:none!important;}
.overview-head .page-actions:empty{display:none!important;}

/* Non-pass pages: let header text use the space previously taken by back buttons. */
@media(max-width:760px){
  .overview-head{display:grid!important;grid-template-columns:1fr!important;gap:12px!important;}
  .overview-head .page-actions:not(:empty){display:grid!important;grid-template-columns:1fr!important;width:100%!important;}
  .overview-head .page-actions:not(:empty) > *{width:100%!important;justify-content:center!important;}
}

/* Active pass: top row contains only menu + overview. Prev/next is a separate bottom action bar. */
@media(max-width:1059px){
  body.exercise-active .sticky-nav{
    position:sticky!important;
    top:0!important;
    left:0!important;
    right:0!important;
    z-index:220!important;
    margin:0 0 8px!important;
    padding:7px 8px 7px!important;
    background:rgba(3,7,17,.97)!important;
    border-bottom:1px solid rgba(170,205,255,.14)!important;
    border-radius:0!important;
  }

  body.exercise-active .nav-row{display:grid!important;gap:5px!important;}
  body.exercise-active .nav-actions{display:block!important;position:relative!important;}

  body.exercise-active .nav-left{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
    width:100%!important;
    max-width:none!important;
    align-items:center!important;
    position:static!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:42px!important;
    min-height:42px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:8px 10px!important;
    border-radius:16px!important;
    font-size:14px!important;
    line-height:1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    box-shadow:0 10px 28px rgba(0,0,0,.22)!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;
  }

  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:260!important;
    display:grid!important;
    grid-template-columns:.95fr 1.15fr!important;
    gap:8px!important;
    padding:0!important;
    width:auto!important;
    max-width:none!important;
    pointer-events:auto!important;
  }

  body.exercise-active .nav-right .ghost-btn,
  body.exercise-active .nav-right .main-btn{
    min-width:0!important;
    width:100%!important;
    height:56px!important;
    min-height:56px!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,.44)!important;
  }

  body.exercise-active .progress-meta{margin-top:4px!important;}
  body.exercise-active #exerciseMeta{
    font-size:12px!important;
    line-height:1.12!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  body.exercise-active .progress-shell{height:5px!important;margin-top:2px!important;}

  body.exercise-active .top-tools{
    position:fixed!important;
    left:8px!important;
    right:8px!important;
    top:56px!important;
    width:auto!important;
    max-height:calc(100dvh - 122px)!important;
    overflow:auto!important;
    z-index:280!important;
    display:none!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!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;}

  body.exercise-active .stage-layout{padding-bottom:74px!important;}
}

/* Landscape gets slightly lower buttons so the video remains the hero. */
@media(max-width:1059px) and (orientation:landscape){
  body.exercise-active .sticky-nav{padding:5px 8px!important;margin-bottom:6px!important;}
  body.exercise-active .menu-toggle,
  body.exercise-active .nav-left .ghost-btn{height:38px!important;min-height:38px!important;font-size:13px!important;border-radius:14px!important;}
  body.exercise-active .nav-right .ghost-btn,
  body.exercise-active .nav-right .main-btn{height:46px!important;min-height:46px!important;font-size:14px!important;border-radius:15px!important;}
  body.exercise-active .top-tools{top:48px!important;max-height:calc(100dvh - 106px)!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;}
  body.exercise-active .tool-btn{min-height:36px!important;border-radius:12px!important;padding:6px 8px!important;font-size:11px!important;}
  body.exercise-active .stage-layout{padding-bottom:58px!important;}
}

@media(max-width:420px){
  body.exercise-active .nav-right .ghost-btn,
  body.exercise-active .nav-right .main-btn{font-size:14px!important;}
}
