/* ═══════════════════════════════════════════════════════════
   Kaviro — mobile UX layer
   Fixed bottom tab bar, "more" sheet and touch-friendly sizing.
   Loaded after every page stylesheet + motion.css.
   ═══════════════════════════════════════════════════════════ */

/* hidden on desktop — everything here is scoped to small screens */
.tabbar,.tabsheet{display:none}
.toTop{display:none}

@media(max-width:860px){
  /* leave room for the fixed tab bar (and the iPhone home bar) */
  body{padding-bottom:calc(62px + env(safe-area-inset-bottom))}

  /* ---------- bottom tab bar ---------- */
  .tabbar{
    display:grid;grid-template-columns:repeat(5,minmax(0,1fr));
    position:fixed;inset-inline:0;inset-block-end:0;z-index:80;
    background:rgba(9,12,16,.94);
    backdrop-filter:blur(18px) saturate(140%);
    -webkit-backdrop-filter:blur(18px) saturate(140%);
    border-top:1px solid var(--line);
    padding-bottom:env(safe-area-inset-bottom);
    box-shadow:0 -18px 40px -30px rgba(0,0,0,.95)
  }
  :root[data-theme="light"] .tabbar{background:rgba(246,248,250,.95)}

  .tabbar__i{position:relative;display:flex;flex-direction:column;align-items:center;
    justify-content:center;gap:3px;min-height:56px;padding:6px 2px;
    font-family:inherit;font-size:10px;font-weight:700;letter-spacing:.01em;
    color:var(--tx3);background:none;border:0;cursor:pointer;text-decoration:none;
    transition:color .16s ease,transform .16s ease;-webkit-tap-highlight-color:transparent}
  .tabbar__i svg{width:21px;height:21px;stroke-width:1.9;transition:transform .18s var(--ease-out,ease)}
  .tabbar__i:active{transform:scale(.94)}
  .tabbar__i.is-on{color:var(--brand)}
  .tabbar__i.is-on svg{transform:translateY(-1px) scale(1.06)}
  .tabbar__i.is-on::before{content:"";position:absolute;inset-block-start:0;inset-inline:22%;
    height:2px;border-radius:0 0 3px 3px;
    background:linear-gradient(90deg,transparent,var(--brand),transparent);
    box-shadow:0 0 12px var(--brand)}
  .tabbar__i span{line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}

  /* ---------- "more" sheet ---------- */
  .tabsheet:not([hidden]){display:block}
  .tabsheet{position:fixed;inset:0;z-index:95}
  .tabsheet__mask{position:absolute;inset:0;background:rgba(4,7,10,.62);
    backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);
    animation:fadeIn .18s ease}
  .tabsheet__p{position:absolute;inset-inline:0;inset-block-end:0;
    background:var(--surf);border-top:1px solid var(--line2);
    border-radius:20px 20px 0 0;padding:9px 16px calc(18px + env(safe-area-inset-bottom));
    box-shadow:0 -30px 60px -30px rgba(0,0,0,.9);
    animation:sheetUp .3s var(--ease-out,ease);max-height:82dvh;overflow-y:auto}
  .tabsheet__g{display:block;width:38px;height:4px;border-radius:99px;
    background:var(--line2);margin:2px auto 12px}
  .tabsheet__h{font-size:11px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;
    color:var(--tx3);margin:2px 2px 9px}
  .tabsheet__links{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
  .tabsheet__lnk{display:flex;flex-direction:column;gap:2px;padding:11px 12px;
    border-radius:var(--r2);background:var(--surf2);border:1px solid var(--line);
    color:var(--tx);font-size:13px;font-weight:700;text-decoration:none;
    transition:.15s;min-height:56px;justify-content:center}
  .tabsheet__lnk small{font-size:10.5px;font-weight:600;color:var(--tx3);line-height:1.4}
  .tabsheet__lnk:hover{border-color:var(--ring);background:var(--surf3)}
  .tabsheet__lnk:active{transform:scale(.98)}

  /* ---------- touch targets & readable controls ---------- */
  .btn,.tab,.chip,.day,.nwTab,.langopt,.tabsheet__lnk{min-height:44px}
  .btn--sm{min-height:40px;padding-inline:14px}
  .chip,.day,.tab,.nwTab{padding-block:9px}
  .tgl{width:40px;height:40px;border-radius:9px}
  .tgl svg{width:18px;height:18px}
  .burger{width:40px;height:40px;align-items:center;justify-content:center}
  .burger span{width:19px}

  /* no iOS zoom-on-focus */
  input,select,textarea{font-size:16px}
  .fld input,.fld select,.leg input{padding-block:10px;font-size:16px}
  .nwSearch input{font-size:16px;padding-block:10px}

  /* scrollable strips: snap and hide the scrollbar */
  .sportstrip,.lgstrip,.railTabs,.tabs,.daynav{
    scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;
    scrollbar-width:none;padding-bottom:4px}
  .sportstrip>*,.lgstrip>*,.railTabs>*{scroll-snap-align:start}
  .sportstrip::-webkit-scrollbar,.lgstrip::-webkit-scrollbar,
  .railTabs::-webkit-scrollbar,.tabs::-webkit-scrollbar,.daynav::-webkit-scrollbar{display:none}

  /* mobile menu: bigger rows */
  .nav-m a{padding:15px 4px;font-size:15.5px}
  .langmenu{max-height:min(62vh,420px);overflow-y:auto;overscroll-behavior:contain}
  .langopt{min-height:44px;font-size:13.5px}

  /* slightly tighter gutters, more content */
  .wrap{padding-inline:14px}

  /* footer breathing room above the bar */
  .foot{margin-top:22px}

  /* ---------- back to top ---------- */
  .toTop{display:grid;place-items:center;position:fixed;
    inset-inline-end:14px;inset-block-end:calc(70px + env(safe-area-inset-bottom));
    z-index:70;width:42px;height:42px;border-radius:50%;padding:0;
    background:var(--surf2);border:1px solid var(--line2);color:var(--tx);
    cursor:pointer;box-shadow:0 12px 26px -14px rgba(0,0,0,.85);
    opacity:0;transform:translateY(10px) scale(.9);pointer-events:none;
    transition:opacity .2s ease,transform .2s var(--ease-out,ease),background .15s;
    -webkit-tap-highlight-color:transparent}
  .toTop.is-on{opacity:1;transform:none;pointer-events:auto}
  .toTop:active{transform:scale(.94)}
  .toTop svg{width:19px;height:19px;stroke-width:2.2}
}

/* very narrow phones: keep the header uncluttered */
@media(max-width:430px){
  .hdr__act .btn--pri{display:none}
  .hdr__act{gap:6px}
  .brand__tx{font-size:15.5px}
  .nwTop__stats .hstat{padding:5px 9px}
  .tabsheet__links{grid-template-columns:1fr}
}

@media(max-width:360px){
  .tabbar__i{font-size:9px}
  .tabbar__i svg{width:19px;height:19px}
}

@keyframes sheetUp{from{transform:translateY(100%)}to{transform:translateY(0)}}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

@media(prefers-reduced-motion:reduce){
  .tabsheet__p,.tabsheet__mask,.tabbar__i,.tabbar__i svg{animation:none;transition:none}
}
