/* ============================================================
   TiviLux 3.2.14.7 — Mobile UX Revamp
   Phone-only layout corrections. Desktop / laptop layout is unchanged.
   ============================================================ */

@media (max-width:760px){
  html{
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
    overflow-x:hidden;
  }
  body{
    width:100%;
    max-width:100vw;
    overflow-x:hidden!important;
  }
  #main{
    width:100%!important;
    max-width:100vw!important;
    overflow-x:clip!important;
  }

  /* ---------- Provider sign-in / first-run ---------- */
  body:has(#main.auth-page){
    padding-bottom:0!important;
    background:#07090d!important;
  }
  #main.auth-page{
    min-height:100dvh!important;
    padding:calc(24px + env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom))!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:flex-start!important;
    overflow:visible!important;
  }
  .auth-page .auth-wordmark{
    width:100%!important;
    margin:clamp(24px,7dvh,64px) auto 24px!important;
    text-align:center!important;
  }
  .auth-page .auth-wordmark .tivilux-wordmark,
  .auth-page .auth-wordmark .brand{
    font-size:34px!important;
  }
  .auth-page .auth-layout{
    display:block!important;
    width:100%!important;
    max-width:520px!important;
    margin:0 auto!important;
  }
  .auth-page .auth-story,
  .auth-page .auth-footer{
    display:none!important;
  }
  .auth-page .auth-card.provider-entry-card{
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    padding:22px 18px 24px!important;
    border-radius:22px!important;
    overflow:visible!important;
    background:linear-gradient(155deg,#171d26f2,#0e131bf5)!important;
    box-shadow:0 22px 70px #0008!important;
  }
  .provider-entry-card .dialog-heading{
    margin-bottom:18px!important;
  }
  .provider-entry-card .dialog-heading .eyebrow{
    font-size:10px!important;
    letter-spacing:.18em!important;
  }
  .provider-entry-card .dialog-heading h2{
    font-size:clamp(30px,9vw,42px)!important;
    line-height:1.02!important;
    letter-spacing:-.04em!important;
    margin:8px 0 10px!important;
  }
  .provider-entry-card .dialog-heading p{
    font-size:13px!important;
    line-height:1.5!important;
  }
  #provider-form{
    gap:14px!important;
  }
  #provider-form .provider-presets{
    gap:8px!important;
    margin:4px 0 2px!important;
  }
  #provider-form .provider-presets>.eyebrow{
    margin:3px 0 4px!important;
    font-size:9px!important;
  }
  #provider-form .provider-preset{
    width:100%!important;
    min-height:66px!important;
    display:grid!important;
    grid-template-columns:22px minmax(0,1fr)!important;
    align-items:center!important;
    gap:12px!important;
    padding:12px 13px!important;
    border-radius:15px!important;
    overflow:hidden!important;
  }
  /* Global input styling previously treated provider radios like text fields. */
  #provider-form .provider-preset input[type="radio"]{
    appearance:auto!important;
    -webkit-appearance:radio!important;
    width:19px!important;
    min-width:19px!important;
    height:19px!important;
    min-height:19px!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:50%!important;
    background:transparent!important;
    box-shadow:none!important;
    accent-color:var(--gold,#e8c38b)!important;
  }
  #provider-form .provider-preset span{
    min-width:0!important;
    display:grid!important;
    gap:2px!important;
  }
  #provider-form .provider-preset strong{
    font-size:15px!important;
    line-height:1.2!important;
    overflow-wrap:anywhere!important;
  }
  #provider-form .provider-preset small{
    font-size:10px!important;
    line-height:1.35!important;
  }
  #provider-form .form-row{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:14px!important;
  }
  #provider-form label{
    min-width:0!important;
    font-size:13px!important;
  }
  #provider-form input:not([type="checkbox"]):not([type="radio"]),
  #provider-form select{
    min-height:48px!important;
    font-size:16px!important; /* prevents iOS zoom-on-focus */
  }
  #provider-form .check{
    display:grid!important;
    grid-template-columns:22px minmax(0,1fr)!important;
    align-items:start!important;
    gap:10px!important;
    font-size:12px!important;
    line-height:1.45!important;
  }
  #provider-form .check input[type="checkbox"]{
    width:21px!important;
    height:21px!important;
    margin-top:1px!important;
  }
  #provider-form .actions{
    display:grid!important;
    grid-template-columns:1fr 1.25fr!important;
    gap:8px!important;
    width:100%!important;
  }
  #provider-form .actions button{
    width:100%!important;
    min-width:0!important;
    min-height:48px!important;
    padding:9px 10px!important;
    font-size:12px!important;
  }
  #provider-form .fine{
    font-size:10px!important;
    line-height:1.5!important;
    margin-top:2px!important;
  }

  /* ---------- System Control Center ---------- */
  #main:has(.system31){
    padding-left:10px!important;
    padding-right:10px!important;
    padding-bottom:calc(92px + env(safe-area-inset-bottom))!important;
    overflow:visible!important;
  }
  .system31{
    width:100%!important;
    max-width:none!important;
    margin:0!important;
    padding:0 0 24px!important;
    overflow:visible!important;
  }
  .system31 .sys-hero{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:start!important;
    gap:8px 10px!important;
    padding:8px 2px 12px!important;
  }
  .system31 .sys-hero>div{
    min-width:0!important;
  }
  .system31 .sys-hero .eyebrow{
    font-size:9px!important;
    letter-spacing:.16em!important;
  }
  .system31 .sys-hero h1{
    font-size:clamp(30px,9vw,40px)!important;
    line-height:1.02!important;
    letter-spacing:-.045em!important;
    margin:5px 0 7px!important;
  }
  .system31 .sys-hero p{
    max-width:100%!important;
    font-size:12px!important;
    line-height:1.45!important;
  }
  .system31 .sys-hero>button{
    align-self:start!important;
    min-height:38px!important;
    padding:7px 10px!important;
    border-radius:10px!important;
    font-size:11px!important;
    white-space:nowrap!important;
  }
  .system31 .sys-health{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
    overflow:visible!important;
    margin:0 0 9px!important;
    padding:7px!important;
    border-radius:14px!important;
  }
  .system31 .sys-health span{
    min-width:0!important;
    white-space:normal!important;
    padding:8px 9px!important;
    font-size:9px!important;
    line-height:1.3!important;
  }
  .system31 .sys-health b{
    display:inline!important;
    overflow-wrap:anywhere!important;
  }
  .system31 .sys-layout{
    display:block!important;
    width:100%!important;
    min-width:0!important;
  }
  .system31 .sys-nav{
    position:sticky!important;
    top:calc(58px + env(safe-area-inset-top))!important;
    z-index:70!important;
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    max-height:none!important;
    margin:0 0 9px!important;
    padding:7px!important;
    overflow:visible!important;
    border:1px solid #ffffff12!important;
    border-radius:15px!important;
    background:#080c12f2!important;
    backdrop-filter:blur(18px)!important;
    -webkit-backdrop-filter:blur(18px)!important;
    box-shadow:0 12px 30px #0005!important;
  }
  .system31 .sys-find{
    width:100%!important;
    min-width:0!important;
    margin:0 0 7px!important;
    padding:6px 9px!important;
    grid-template-columns:20px minmax(0,1fr)!important;
    border-radius:10px!important;
  }
  .system31 .sys-find span{
    font-size:15px!important;
  }
  .system31 .sys-find input{
    width:100%!important;
    min-width:0!important;
    min-height:30px!important;
    font-size:13px!important;
  }
  .system31 .sys-nav-list{
    display:flex!important;
    gap:6px!important;
    width:100%!important;
    min-width:0!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:0 0 2px!important;
    scroll-snap-type:x proximity!important;
    scrollbar-width:none!important;
    -webkit-overflow-scrolling:touch!important;
  }
  .system31 .sys-nav-list::-webkit-scrollbar{
    display:none!important;
  }
  .system31 .sys-nav-list button{
    flex:0 0 auto!important;
    width:auto!important;
    min-width:max-content!important;
    min-height:38px!important;
    display:flex!important;
    grid-template-columns:none!important;
    align-items:center!important;
    gap:5px!important;
    padding:7px 11px!important;
    border:1px solid #ffffff0c!important;
    border-radius:10px!important;
    font-size:11px!important;
    line-height:1!important;
    scroll-snap-align:center!important;
  }
  .system31 .sys-nav-list button i{
    display:none!important;
  }
  .system31 .sys-nav-list button b{
    min-width:17px!important;
    width:17px!important;
    height:17px!important;
    font-size:8px!important;
  }
  .system31 .sys-panel{
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    padding:15px 12px!important;
    border-radius:16px!important;
    overflow:hidden!important;
  }
  .system31 .sys-panel-head{
    margin-bottom:13px!important;
  }
  .system31 .sys-panel-head .eyebrow{
    font-size:9px!important;
  }
  .system31 .sys-panel-head h2{
    font-size:clamp(26px,8vw,34px)!important;
    line-height:1.05!important;
    margin:5px 0 7px!important;
    overflow-wrap:anywhere!important;
  }
  .system31 .sys-panel-head p{
    font-size:12px!important;
    line-height:1.5!important;
  }
  .system31 .sys-cards{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:9px!important;
  }
  .system31 .sys-card{
    width:100%!important;
    min-width:0!important;
    padding:14px 12px!important;
    border-radius:14px!important;
    overflow:hidden!important;
  }
  .system31 .sys-card .settings-kicker{
    font-size:8px!important;
    letter-spacing:.16em!important;
  }
  .system31 .sys-card h3{
    font-size:16px!important;
    line-height:1.25!important;
    margin:4px 0 9px!important;
    overflow-wrap:anywhere!important;
  }
  .system31 .sys-card p{
    font-size:11px!important;
    line-height:1.5!important;
  }
  .system31 .sys-big-value{
    font-size:21px!important;
    line-height:1.15!important;
    overflow-wrap:anywhere!important;
  }
  .system31 .sys-toggle,
  .system31 .sys-select,
  .system31 .sys-range,
  .system31 .sys-action-row{
    width:100%!important;
    min-width:0!important;
    gap:10px!important;
    padding:11px 0!important;
  }
  .system31 .sys-toggle{
    align-items:center!important;
  }
  .system31 .sys-toggle>span,
  .system31 .sys-select>span,
  .system31 .sys-range>span,
  .system31 .sys-action-row>div{
    flex:1 1 auto!important;
    min-width:0!important;
  }
  .system31 .sys-toggle strong,
  .system31 .sys-select strong,
  .system31 .sys-range strong,
  .system31 .sys-action-row strong{
    font-size:12px!important;
    line-height:1.25!important;
  }
  .system31 .sys-toggle small,
  .system31 .sys-select small,
  .system31 .sys-range small,
  .system31 .sys-action-row small{
    font-size:9px!important;
    line-height:1.4!important;
  }
  .system31 .sys-toggle i{
    width:44px!important;
    height:26px!important;
  }
  .system31 .sys-select,
  .system31 .sys-range,
  .system31 .sys-action-row,
  .system31 .sys-provider-row{
    align-items:stretch!important;
    flex-direction:column!important;
  }
  .system31 .sys-select select,
  .system31 .sys-range>div,
  .system31 .sys-provider-row>div{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
  }
  .system31 .sys-select select{
    min-height:44px!important;
    font-size:13px!important;
  }
  .system31 .sys-range>div{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:8px!important;
  }
  .system31 .sys-range input{
    width:100%!important;
    min-width:0!important;
  }
  .system31 .sys-range output{
    min-width:44px!important;
  }
  .system31 .sys-presets{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }
  .system31 .sys-presets button{
    min-height:58px!important;
    padding:11px!important;
    border-radius:13px!important;
  }
  .system31 .sys-dl div{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:start!important;
    gap:10px!important;
    font-size:11px!important;
  }
  .system31 .sys-dl dd{
    text-align:right!important;
    overflow-wrap:anywhere!important;
  }
  .system31 .sys-update-card{
    grid-template-columns:42px minmax(0,1fr)!important;
    gap:10px!important;
    padding:13px!important;
    border-radius:15px!important;
  }
  .system31 .sys-update-icon{
    width:42px!important;
    height:42px!important;
    border-radius:12px!important;
    font-size:21px!important;
  }
  .system31 .sys-update-card strong{
    font-size:18px!important;
    line-height:1.2!important;
  }
  .system31 .sys-update-card p,
  .system31 .sys-update-card small{
    font-size:10px!important;
    line-height:1.4!important;
  }
  .system31 .sys-update-actions{
    grid-column:1/-1!important;
  }
  .system31 .sys-update-actions button,
  .system31 .sys-provider-row button,
  .system31 .sys-card>.button,
  .system31 .sys-card>.actions button{
    min-height:44px!important;
  }
  .system31 .sys-provider-row>div{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
  }

  /* Theme studio is wide on desktop; stack it cleanly on phones. */
  .system31 .sys-theme-studio,
  .system31 .sys-theme-feature,
  .system31 .sys-theme-gallery,
  .system31 .sys-theme-tile,
  .system31 .sys-theme-preview>div{
    min-width:0!important;
    max-width:100%!important;
  }
  .system31 .sys-theme-feature,
  .system31 .sys-theme-tile,
  .system31 .sys-theme-preview>div{
    grid-template-columns:1fr!important;
  }
  .system31 .sys-theme-scene,
  .system31 .sys-theme-feature-preview .sys-theme-scene.large{
    width:100%!important;
    height:150px!important;
  }
  .system31 .sys-theme-filters{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
  }
  .system31 .sys-theme-filters button{
    min-width:0!important;
    font-size:10px!important;
    padding:7px 5px!important;
  }

  /* Keep the persistent phone nav from covering the final controls. */
  .system31 .sys-panel,
  .profiles-page,
  .v2-dashboard,
  .sports-v17,
  .guide-v22-body{
    scroll-margin-bottom:calc(94px + env(safe-area-inset-bottom));
  }
}

@media (max-width:390px){
  .auth-page .auth-card.provider-entry-card{
    padding:19px 15px 22px!important;
  }
  #provider-form .actions{
    grid-template-columns:1fr!important;
  }
  .system31 .sys-health{
    grid-template-columns:1fr!important;
  }
  .system31 .sys-hero{
    grid-template-columns:1fr!important;
  }
  .system31 .sys-hero>button{
    justify-self:start!important;
  }
}


/* ============================================================
   TiviLux 3.2.15.4 — MOBILE FIXED LIVE PLAYER
   Keep the Live TV preview stationary while the page/Guide scrolls
   underneath it. The existing mobileDock setting still disables it.
   ============================================================ */
@media (max-width:700px){
  body:not(.mobile-dock-off) .guide-v22-stage{display:contents!important;}
  body:not(.mobile-dock-off) .guide-v22-preview{
    position:fixed!important;
    top:calc(58px + env(safe-area-inset-top))!important;
    left:max(12px,env(safe-area-inset-left))!important;
    right:max(12px,env(safe-area-inset-right))!important;
    width:auto!important;
    max-width:none!important;
    aspect-ratio:16/9!important;
    margin:0!important;
    z-index:8500!important;
    border-radius:14px!important;
    overflow:hidden!important;
    background:#020407!important;
    box-shadow:0 14px 38px #000c!important;
    isolation:isolate!important;
    transform:translateZ(0)!important;
    -webkit-transform:translateZ(0)!important;
  }
  body:not(.mobile-dock-off) .guide-v22-preview .guide-v2-preview{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    aspect-ratio:auto!important;
    border-radius:inherit!important;
  }
  body:not(.mobile-dock-off) .guide-v22-now{
    margin-top:calc(56.25vw - 4px)!important;
  }
  body:not(.mobile-dock-off) .guide-v22-body,
  body:not(.mobile-dock-off) .guide-v22-now{
    position:relative!important;
    z-index:10!important;
  }
  body:not(.mobile-dock-off) #player-panel.guide-preview-player,
  body:not(.mobile-dock-off) #player-panel.guide-preview-player video{
    -webkit-transform:translateZ(0)!important;
    transform:translateZ(0)!important;
    backface-visibility:hidden!important;
  }
}
