/* Rotatify app shell for phones and portrait tablets (<1024px): sticky app bar, bottom tab bar,
   segmented panels instead of one long page. Desktop (≥1024px) is desktop.css; .mtab/.m-only are hidden there. */
.mtab[hidden]{display:none!important}

@media (max-width:1023.98px){
:root{--bar-h:56px; --tab-h:60px; --r:14px}

/* ---------- app feel ---------- */
html{-webkit-text-size-adjust:100%}
button,.chip,.btn,.mtab a,.tabs a{-webkit-user-select:none;user-select:none;touch-action:manipulation}
.btn,.chip,.iconbtn,.bp,.mtab a,.mtab button,.pb-toggle,.ptabs button{transition:transform .08s ease,background .15s,color .15s}
.btn:active,.chip:active,.iconbtn:active,.bp:active,.pb-toggle:active{transform:scale(.97)}
@media (display-mode:standalone){html,body{overscroll-behavior-y:none}}
/* paint behind the iOS status bar so content never shows through it */
body::before{content:"";position:fixed;inset:0 0 auto 0;height:env(safe-area-inset-top,0px);background:var(--bg);z-index:16}

/* ---------- shell ---------- */
.wrap#app{gap:12px;padding-block:0 calc(var(--tab-h) + 20px + env(safe-area-inset-bottom,0px))}
header.top{position:sticky;top:env(safe-area-inset-top,0px);z-index:15;align-items:center;flex-wrap:nowrap;
  margin-inline:calc(-1 * max(16px,env(safe-area-inset-left,0px))) calc(-1 * max(16px,env(safe-area-inset-right,0px)));
  padding:10px max(16px,env(safe-area-inset-right,0px)) 10px max(16px,env(safe-area-inset-left,0px));min-height:var(--bar-h);
  background:color-mix(in srgb,var(--bg) 94%,transparent);-webkit-backdrop-filter:saturate(1.6) blur(16px);backdrop-filter:saturate(1.6) blur(16px);
  border-bottom:1px solid color-mix(in srgb,var(--line) 70%,transparent)}
header.top>div:first-child{min-width:0}
header.top .eyebrow{font-size:11px;margin:0 0 1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
header.top h1{font-size:24px;line-height:1.05;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
header.top .topright{display:none}

/* ---------- bottom tab bar ---------- */
.mtab{position:fixed;left:0;right:0;bottom:0;z-index:12;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));
  padding:6px max(8px,env(safe-area-inset-right,0px)) calc(6px + env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));
  background:color-mix(in srgb,var(--surface) 97%,transparent);-webkit-backdrop-filter:saturate(1.6) blur(18px);backdrop-filter:saturate(1.6) blur(18px);
  border-top:1px solid color-mix(in srgb,var(--line) 80%,transparent);box-shadow:0 -6px 24px rgba(10,30,18,.06)}
.mtab a,.mtab button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:48px;border:0;background:none;
  color:var(--muted);text-decoration:none;font:600 11px/1.1 var(--f-body);letter-spacing:.01em;padding:4px 2px;border-radius:12px}
.mtab .ico{width:44px;height:28px;padding:4px 12px;border-radius:999px;transition:background .18s,color .18s}
.mtab a[aria-current="page"]{color:var(--ink)}
.mtab a[aria-current="page"] .ico{background:color-mix(in srgb,var(--accent) 16%,transparent);color:var(--accent)}
.mtab span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------- sections, cards ---------- */
@media (prefers-reduced-motion:no-preference){section[id^="view-"]:not([hidden]){animation:rt-in .18s ease-out}}
@keyframes rt-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.card,.planbar,.live-start{border-radius:16px}

/* match header: plan picker stays, size + formation fold behind one summary row */
.planbar{gap:10px}
.pb-toggle{display:flex;align-items:center;gap:10px;width:100%;border:1px solid var(--line);background:var(--surface-2);border-radius:12px;padding:10px 12px;color:var(--ink);text-align:left}
.pb-toggle .eyebrow{margin:0;flex:none}
.pb-toggle b{flex:1 1 auto;min-width:0;font-family:var(--f-display);font-size:17px;letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pb-chev{flex:none;color:var(--muted);transition:transform .18s}
.pb-toggle[aria-expanded="true"] .pb-chev{transform:rotate(180deg)}
.pb-more{display:none}
.pb-more.open{display:grid;gap:10px}
.planbar .chips{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.planbar .chips::-webkit-scrollbar{display:none}

.planbar .field>label{display:none}
.planbar>.row.spread>.row{gap:8px}
.planbar>.row.spread>.row .btn{min-height:36px;padding:6px 14px;font-size:14px}

/* "playing this match?" becomes a compact one-line call to action */
.live-start{display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px 10px 14px;border-style:solid}
.live-start>div{min-width:0}
.live-start b{font-size:14px;line-height:1.25}
.live-start .muted{display:none}
.live-start .btn{flex:none;min-height:38px;padding:7px 14px;font-size:14px}

/* players: two cards per row like a native collection view */
.cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 12px}

/* side panel → segmented control; bench stays pinned above it */
.panel.tabbed>.d-off{display:none}
.ptabs{display:flex;gap:2px;padding:3px;background:var(--surface-2);border-radius:12px;overflow-x:auto;scrollbar-width:none}
.ptabs::-webkit-scrollbar{display:none}
.ptabs button{flex:1 0 auto;border:0;background:none;border-radius:9px;padding:8px 12px;font-weight:600;font-size:13px;color:var(--muted);white-space:nowrap}
.ptabs button[aria-selected="true"]{background:var(--surface);color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.12)}

/* primary actions under the pitch: full-width first, the rest side by side */
.pitchcol>.row:last-child{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.pitchcol>.row:last-child>.btn.primary:first-child{grid-column:1/-1}
.pitchcol>.row:last-child>.btn{min-height:44px;justify-content:center}

/* ---------- bottom sheets & toast clear the tab bar ---------- */
.sheet{z-index:20}
.sheet .box{border-radius:20px 20px 0 0;padding-top:22px;position:relative}
.sheet .box::before{content:"";position:absolute;top:8px;left:50%;width:36px;height:4px;margin-left:-18px;border-radius:2px;background:var(--line)}
.toast{bottom:calc(var(--tab-h) + 18px + env(safe-area-inset-bottom,0px))}
}
