
/* V7.4 — EPL mobile UX
   Shared mobile layer + dedicated tuning for iPhone 16 Pro Max (~440 CSS px)
   and Samsung Galaxy S23 (~360 CSS px). Loaded LAST on purpose. */

@media (max-width: 480px) {
  html{
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
    scroll-padding-top:98px;
  }

  body{overflow-x:hidden}

  .wrap{
    width:100%;
    padding:16px 10px calc(44px + env(safe-area-inset-bottom)) !important;
  }

  /* EPL hero: much less wasted vertical space */
  #comp-pl .headline{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:10px !important;
    margin-bottom:14px !important;
  }
  #comp-pl .hero h1{
    font-size:34px !important;
    line-height:.95 !important;
    margin:4px 0 8px !important;
  }
  #comp-pl .kicker{
    font-size:11px !important;
  }

  /* EPL subnavigation stays reachable with the thumb */
  #plSubnav{
    position:sticky;
    top:0;
    z-index:115;
    background:rgba(25,4,34,.96);
    backdrop-filter:blur(14px);
    -webkit-backdrop-filter:blur(14px);
  }
  #plSubnav button{
    min-height:44px;
    padding:12px 0 9px !important;
    font-size:10px !important;
  }

  /* Season Control: teams remain side-by-side instead of becoming a giant vertical tower */

  /* Side statistics become compact, not another full screen */

  /* Section headers */
  #comp-pl .section-head{
    gap:10px !important;
    margin-bottom:10px !important;
  }
  #comp-pl .section-head h2{
    font-size:31px !important;
    line-height:.98 !important;
  }
  .mw-control{
    width:100%;
    display:grid !important;
    grid-template-columns:44px 1fr 44px;
    gap:7px !important;
  }
  .mw-control button,.mw-control select{
    width:100%;
    min-width:0;
    height:44px !important;
    padding:0 7px !important;
  }

  /* Calendar: compact 3-column match card */
  .club{
    min-width:0;
    font-size:12px !important;
  }
  .club.home,.club.away{
    align-self:start;
  }
  .club.home .team-line{
    flex-direction:row !important;
  }
  .club.away .team-line{
    flex-direction:row-reverse !important;
  }
  .club.away .team-name{text-align:right}
  .owner-select{
    width:100% !important;
    min-width:0;
    height:38px !important;
    padding:0 5px !important;
    font-size:12px !important;
  }
  .events{gap:8px !important}

  /* League table: scrollable, with position + club pinned */
  .table-scroll{
    max-width:100%;
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
  }
  #tableBox .table{
    min-width:720px !important;
    font-size:10px !important;
  }
  #tableBox .table th,#tableBox .table td{
    padding:10px 7px !important;
  }
  #tableBox .table td.team{
    font-size:12px !important;
  }
  #tableBox .table td.team .club-mark{
    width:34px !important;
    height:34px !important;
    flex-basis:34px !important;
  }
  #tableBox .table th:first-child,
  #tableBox .table td:first-child{
    position:sticky;
    left:0;
    z-index:4;
    background:#f7f5ef;
  }
  #tableBox .table th:nth-child(2),
  #tableBox .table td:nth-child(2){
    position:sticky;
    left:42px;
    z-index:3;
    background:#fbfaf7;
    min-width:165px;
  }
  #tableBox .table tr.champ td:nth-child(2){background:#fff8e4}
  #tableBox .table tr.ucl td:nth-child(2){background:#f2f5ff}
  #tableBox .table tr.euro td:nth-child(2){background:#f2faf7}
  #tableBox .table tr.relegation td:nth-child(2){background:#fff3ef}
  .table-note{
    padding:11px !important;
    font-size:10px !important;
  }

  /* Statistics pages */
  .stats-table{
    min-width:560px;
    font-size:11px;
  }
  .stats-table th,.stats-table td{
    padding:10px 9px !important;
  }
  .h2h-score{
    grid-template-columns:1fr 74px 1fr !important;
    gap:8px !important;
  }
  .person-card,.draw-card{
    padding:12px 8px !important;
    border-radius:14px !important;
  }
  .person-card b,.draw-card b{
    font-size:34px !important;
  }
  .h2h-meta{
    grid-template-columns:1fr 1fr !important;
    gap:8px !important;
  }
  .h2h-meta>div{padding:10px !important}
  .h2h-row{
    grid-template-columns:52px minmax(0,1fr) 48px minmax(0,1fr) !important;
    gap:5px !important;
    font-size:9px;
  }

  /* Match protocol remains a bottom sheet and gets room to breathe */
  .matchcard-sheet{
    max-height:92dvh !important;
    padding-left:12px !important;
    padding-right:12px !important;
  }
  .mc-scoreline{
    grid-template-columns:minmax(0,1fr) 54px minmax(0,1fr) !important;
  }
  .mc-scoreline .club-mark{
    width:40px !important;
    height:40px !important;
    flex-basis:40px !important;
  }
  .mc-scoreline .team-name{
    font-size:10px;
    line-height:1.05;
    white-space:normal;
  }
}

/* iPhone 16 Pro Max: ~440 CSS px. Give the side columns a little more room. */

/* Galaxy S23: around 360 CSS px. Tighter labels, but no vertical collapse. */
@media (min-width: 340px) and (max-width: 390px) {
  .wrap{padding-left:8px !important;padding-right:8px !important}
  .owner-select{font-size:10px !important;height:36px !important}
}
