/* Mobile design (phones, up to 760px). Everything here is scoped to `body.m2`, which the server sets only for users who get the mobile design
   (setting mobile_ui: 'admin' = preview for the admin, 'all' = everybody; see web/deps.py page()). Desktop and the old mobile look are untouched.
   What it does: bottom tab bar instead of the burger, safe-area padding for the installed app, big touch targets, 16px inputs (iOS does not zoom),
   tables marked class="tcards" turn into cards (cells carry data-c="chance|match|pick|price|mkt|res|act"), two-column KPI tiles, scrolling segment bars. */

.btm{display:none}

@media (max-width:760px){
  /* ---- shell ---- */
  body.m2 .mtop{padding-top:calc(10px + env(safe-area-inset-top))}
  body.m2 .mtop .burger{display:none}
  body.m2 .main{padding:12px 14px calc(84px + env(safe-area-inset-bottom))}
  body.m2 .btm{display:grid;grid-template-columns:repeat(auto-fit,minmax(0,1fr));position:fixed;left:0;right:0;bottom:0;z-index:12;background:var(--side);
    border-top:1px solid var(--line);padding:6px 6px calc(6px + env(safe-area-inset-bottom))}
  body.m2 .btm a,body.m2 .btm button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:50px;color:var(--mute);
    font:inherit;font-size:11px;font-weight:600;background:none;border:0;border-radius:12px;cursor:pointer;-webkit-tap-highlight-color:transparent}
  body.m2 .btm .on{color:var(--accent);background:var(--chip)}
  body.m2 .btm .ic{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

  /* ---- touch targets and inputs ---- */
  body.m2 .btn{min-height:44px;display:inline-flex;align-items:center;justify-content:center}
  body.m2 .btn.small{min-height:40px;padding:0 14px;font-size:14px}
  body.m2 input,body.m2 select,body.m2 textarea{font-size:16px;min-height:44px}
  body.m2 .page-h h1{font-size:24px}
  body.m2 .page-h p{font-size:14px;line-height:1.45}

  /* ---- segment bars scroll sideways instead of being cut off ---- */
  body.m2 .seg{display:flex;max-width:100%;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  body.m2 .seg::-webkit-scrollbar{display:none}
  body.m2 .seg a{flex:none;white-space:nowrap;min-height:38px;display:inline-flex;align-items:center}
  body.m2 .toolbar{gap:8px}
  body.m2 .toolbar select{flex:1 1 140px}

  /* ---- KPI tiles: two per row, smaller ---- */
  body.m2 .kpis{grid-template-columns:1fr 1fr;gap:8px}
  body.m2 .kpi{padding:10px 12px}
  body.m2 .kpi b{font-size:20px}
  body.m2 .kpi small{font-size:12px}

  /* ---- row lists (home, MMA): pick text gets the full width, buttons sit under it ---- */
  body.m2 .mrow,body.m2 .mrow.mrow-res{grid-template-areas:"time odds" "teams teams" "pick pick" "act act" "why why"}
  body.m2 .mrow.mrow-mma{grid-template-areas:"time odds" "teams teams" "pick pick" "act act" "why why" "mine mine"}
  body.m2 .mt-act{width:100%}
  body.m2 .mt-act .btn,body.m2 .mt-act button{flex:1 1 0}

  /* ---- tables as cards ---- */
  body.m2 .table-wrap:has(.tcards){background:none;border:0;overflow:visible}
  body.m2 table.tcards,body.m2 .tcards tbody{display:block;width:100%}
  body.m2 .tcards thead{display:none}
  body.m2 .tcards tr{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"match chance" "pick pick" "price mkt" "res res" "act act";
    gap:6px 12px;align-items:start;background:var(--card);border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin:0 0 10px}
  body.m2 .tcards td{display:block;padding:0;border:0;text-align:left;white-space:normal;min-width:0}
  body.m2 .tcards td:empty{display:none}
  body.m2 .tcards td[data-c=match]{grid-area:match}
  body.m2 .tcards td[data-c=chance]{grid-area:chance}
  body.m2 .tcards td[data-c=pick]{grid-area:pick}
  body.m2 .tcards td[data-c=price]{grid-area:price}
  body.m2 .tcards td[data-c=mkt]{grid-area:mkt;text-align:right}
  body.m2 .tcards td[data-c=res]{grid-area:res;padding-top:6px;border-top:1px solid var(--line);display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
  body.m2 .tcards td[data-c=res] br{display:none}
  body.m2 .tcards td[data-c=act]{grid-area:act}
  body.m2 .tcards td[data-c=price]::before{content:"Кэф ";color:var(--mute);font-size:12px}
  body.m2 .tcards td[data-c=mkt]::before{content:"Рынок ";color:var(--mute);font-size:12px}
  body.m2 .tcards td[data-c=price] small{margin-left:6px}
  body.m2 .tcards td[data-c=price] br,body.m2 .tcards td[data-c=mkt] br{display:none}

  /* football list rows (columns: time, match, pick, chance, price, from, rate, act) */
  body.m2 .fc-list tr{grid-template-areas:"time chance" "match match" "pick pick" "price from" "rate rate" "act act";row-gap:8px}
  body.m2 .fc-list td[data-c=time]{grid-area:time;align-self:center}
  body.m2 .fc-list td[data-c=time] br{display:none}
  body.m2 .fc-list td[data-c=time] small{margin-left:8px}
  body.m2 .fc-list td[data-c=chance]{grid-area:chance}
  body.m2 .fc-list td[data-c=match]{grid-area:match;font-size:17px}
  body.m2 .fc-list td[data-c=pick]{grid-area:pick;padding:8px 0;border-top:1px solid var(--line)}
  body.m2 .fc-list td[data-c=pick] b{font-size:18px}
  body.m2 .fc-list td[data-c=price],body.m2 .fc-list td[data-c=from]{background:var(--chip);border-radius:12px;padding:8px 12px;text-align:left;font-size:20px}
  body.m2 .fc-list td[data-c=price]::before{content:"Кэф контор";display:block;font-size:11px;color:var(--mute);font-weight:400}
  body.m2 .fc-list td[data-c=from]{grid-area:from}
  body.m2 .fc-list td[data-c=from]::before{content:"Ставить от";display:block;font-size:11px;color:var(--mute);font-weight:400}
  body.m2 .fc-list td[data-c=rate]{grid-area:rate;display:block;border-top:0;padding-top:0}
  body.m2 .fc-list td[data-c=rate] br{display:block}
  body.m2 .tcards tr.why-row{display:block;background:none;border:0;padding:0;margin:-4px 0 10px}
  body.m2 .tcards tr.why-row td{display:block}
}
@media (max-width:760px){
  body.m2 .analysis .chain>div{flex:1 1 40%;min-width:0}
  body.m2 .analysis .chain i{display:none}
  body.m2 .an-heat td{width:38px}
}
