/* Game page, phone and tablet layout. Loaded after each page's inline styles.
   Desktop (above 860px) is unchanged. */
.m-viewsbar, .m-more, .m-bfilter { display:none; }

@media (max-width: 860px) {
  /* Top bar: sections stay one tap away from anywhere on the page. */
  .bar .in { gap:6px; padding:0 6px 0 4px; }
  .bar .back { width:40px; height:44px; margin:0; padding:0; justify-content:center; font-size:0; }
  .bar .back .ic { width:20px; height:20px; }
  .brand { font-size:0; gap:0; height:44px; }
  .bar nav { display:flex; gap:0; margin-left:auto; }
  .bar nav a { padding:12px 8px; font-size:14px; line-height:20px; color:var(--muted); white-space:nowrap; }
  .bar nav a[aria-current="location"] { color:var(--text); box-shadow:inset 0 -2px 0 var(--accent); }

  /* Lists flow with the page, so a swipe always scrolls the page. */
  .baskets, .pbp { max-height:none; overflow:visible; }
  .m-over, .m-qoff { display:none !important; }
  .m-bfilter { display:flex; }
  .pbp-filter button { min-height:40px; padding:0 14px; font-size:13px; }
  .seg button { min-height:40px; }
  .m-more { display:block; width:calc(100% - 20px); min-height:46px; margin:8px 10px 10px; padding:0 16px; border:0;
    border-radius:var(--radius-control); background:var(--raised); color:var(--text);
    font:inherit; font-weight:500; cursor:pointer; }
  .m-more[aria-expanded="true"] { position:sticky; bottom:calc(10px + env(safe-area-inset-bottom)); z-index:2;
    box-shadow:0 6px 18px rgba(0,0,0,.45); }

  /* Box score: one stat group at a time, every player on one row. */
  .m-viewsbar { display:block; position:sticky; top:48px; z-index:4; padding:4px 0 10px; background:var(--ground); }
  .m-viewsbar .seg { display:flex; width:100%; }
  .m-viewsbar button { flex:1 1 0; min-width:0; padding:0 4px; min-height:40px; }
  .box-panel { padding:14px 12px 8px; }
  .box-panel h3 { margin-bottom:10px; }
  /* Only once game.js has added the tabs. Without them the table keeps its own sideways scroll. */
  #box[data-view] .tablewrap { overflow:visible; margin:0; }
  #box:not([data-view]) .box th { position:static; }
  #box[data-view="main"] .box [data-g]:not([data-g~="main"]),
  #box[data-view="shooting"] .box [data-g]:not([data-g~="shooting"]),
  #box[data-view="hustle"] .box [data-g]:not([data-g~="hustle"]),
  #box[data-view="tracking"] .box [data-g]:not([data-g~="tracking"]) { display:none; }
  .box th, .box td { padding-left:5px; padding-right:5px; }
  .box th { white-space:normal; vertical-align:bottom; line-height:1.2; position:sticky; top:108px; z-index:2;
    background:var(--surface); padding-top:6px; }
  .box th:first-child, .box td:first-child { position:static; padding-left:0; }
  .box th:first-child { position:sticky; }
  .box td { padding-top:7px; padding-bottom:7px; font-size:15px; }
  .box td.who { width:100%; min-width:0; white-space:normal; font-size:14px; }
  .box td.who a, .box td.who .in { position:relative; gap:9px; min-height:44px; line-height:1.25; }
  .box td.who a::after { display:none; }
  .box .nm { max-width:none; font-weight:500; overflow:visible; text-decoration:underline;
    text-decoration-color:var(--control); text-underline-offset:3px; }
  .box tr.unnamed .nm { text-decoration:none; }
  .box img, .nothumb { width:36px; height:36px; }
  .box .jersey { position:absolute; left:0; bottom:-3px; min-width:20px; height:16px; padding:0 4px;
    font-size:11px; border-radius:5px; box-shadow:0 0 0 1.5px var(--surface); }
  .box .faces, .box .nothumb { margin-right:0; }
  .box .jersey + .nm, .box .faces + .jersey + .nm { margin-left:0; }
  .box td.pts { font-size:16px; }
  .box td:last-child .chk { padding:2px 5px; min-width:0; }
  .box td i { white-space:nowrap; }
}

/* Video filter on phones: "Both" takes only what it needs, and team names wrap instead of being cut. */
@media (max-width: 560px) {
  .m-both-rest { display:none; }
  .team-seg button { padding:4px 8px; gap:6px; min-height:44px; white-space:normal; line-height:1.15; font-size:13px; }
  .team-seg button:first-child { flex:0 0 auto; padding:4px 12px; }
  .team-seg .tn { overflow:visible; text-overflow:clip; }
}
@media (max-width: 360px) {
  .player .ctl { padding-left:10px; padding-right:10px; }
  .team-seg button { padding:4px 6px; gap:5px; }
  .team-seg button:first-child { padding:4px 9px; }
}

.m-unit { display:none; }
/* Phones: the distance unit moves to the column header so names keep their width. */
@media (max-width: 430px) {
  .box td i { display:none; }
  .m-unit { display:inline; }
  .box .chk.none { display:inline-block; max-width:40px; padding:0; white-space:normal; line-height:1.15; font-size:11px; }
}
@media (max-width: 400px) {
  .box th, .box td { padding-left:3px; padding-right:3px; }
  .box td { font-size:14px; }
  .box td.who { font-size:13px; }
  .box td.who a, .box td.who .in { gap:7px; }
  .box img, .nothumb { width:32px; height:32px; }
}
/* Smallest phones: the jersey number replaces the photo, so long surnames still fit whole. */
@media (max-width: 355px) {
  .box .faces, .box .nothumb { display:none; }
  .box td.who a, .box td.who .in { flex-direction:column; align-items:flex-start; justify-content:center; gap:3px; }
  .box .jersey { position:static; box-shadow:none; }
}

/* Keep the video on screen while picking clips. Portrait only: in landscape it would fill the screen. */
@media (max-width: 700px) and (orientation: portrait) {
  .video { display:block; }
  .player { display:contents; }
  .player video { border-radius:var(--radius-card) var(--radius-card) 0 0; }
  .player .ctl { background:var(--surface); border-radius:0 0 var(--radius-card) var(--radius-card); }
  .video .list { margin-top:var(--gap); }
  .video.m-stick .player video { position:sticky; top:48px; z-index:4; border-radius:0; }
}
