/* ===== Mobile fixes + performance (load LAST) ===== */

/* 1. Never allow sideways scroll / page widening */
html,body{max-width:100%;overflow-x:hidden}
@supports (overflow:clip){html,body{overflow-x:clip}}
img,svg,video,canvas,iframe{max-width:100%}
/* grid/flex children may shrink instead of pushing the page wider */
.wrap>*,.vtour>*,.px>*,.sk>*,.ic-grid>*,.hero .wrap>*,.offer .wrap>*,.cgrid>*,.mgrid>*{min-width:0}

/* 2. Layout rules that were overridden by later desktop CSS */
@media(max-width:860px){
  .vtour,.px,.mgrid:not(#mgrid),.f2,.ic-grid,.sk,.aq-w,.aq-duo,.mrgrid,.tm{grid-template-columns:minmax(0,1fr)!important}
  .vtour{gap:44px!important;text-align:center}
  .vt-t p{margin-inline:auto}
  .vt-vw{width:min(300px,76%)!important}
  .px{gap:40px!important}
  .stgrid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .sgrid{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}
  .wrap{padding-left:18px;padding-right:18px}

  /* decorative rings and floating badges must stay inside the screen */
  .vt-ring,.tour-ring,.mr-ring{inset:-14px!important}
  .px-stage::before{inset:-12px -10px -8px!important}
  .vf{padding:9px 13px;border-radius:14px}
  .vf b{font-size:1.1rem}
  .vf1{left:-6px!important}.vf2{right:-6px!important}.vf3{left:-6px!important}
  .rooms .rm.rv,.rooms .rm.rm-b2.rv{transform:translateY(40px)}
  .rooms .rm.rv.in,.rooms .rm.rm-b2.rv.in{transform:none}
}
@media(max-width:560px){
  .stgrid{grid-template-columns:minmax(0,1fr)!important}
  .big img{width:94%}
}

/* 3. The i Cafe perks: sizing that must never depend on cache */
.ic-perks{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.icp{background:#fff;border-radius:22px;padding:20px 18px;display:flex;flex-direction:column;gap:4px}
.icp i{display:grid;place-items:center;width:42px;height:42px;border-radius:14px;margin-bottom:8px;color:#fff;background:linear-gradient(135deg,#46b877,#2e7d4f)}
.icp svg{width:22px!important;height:22px!important;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.icp b{display:block;font-size:.98rem;color:#16402a}
.icp small{display:block;color:#5d7a69;font-size:.8rem;line-height:1.5}
@media(max-width:900px){.ic-perks{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.ic-perks{grid-template-columns:minmax(0,1fr)}}
/* same safety for other icon tiles */
.vk svg{width:24px;height:24px}

/* 4. Performance: animations off-screen are paused (class set by js/mobile.js) */
.off *,.off *::before,.off *::after{animation-play-state:paused!important}

/* 5. Performance on phones: no heavy blur, no glass effect, lighter scenes */
@media(max-width:860px),(hover:none){
  .blob,.vbg i,.pbg i{filter:none!important}
  .vbg,.pbg{display:none}
  *:not(#hd):not(.lb){-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
  .ic-vis svg *,.sk-scene svg .sk-stars .tw,.ic::before,.ic::after{animation:none!important}
  .ic-heart{opacity:0}
  .icp i,.ic-logo{animation:none!important}
  .ic-logo::after{animation:none}
  .vf,.tour-ring,.vt-ring,.mr-ring{animation:none!important}
  .rv{transition-duration:.5s}
  [class*="shadow"],.ic-vis,.sk-scene{box-shadow:0 10px 24px rgba(0,0,0,.12)}
}
@media(prefers-reduced-motion:reduce){.off *{animation:none!important}}

/* 6. Bigger tap targets on touch screens */
@media(hover:none) and (pointer:coarse){
  footer a,.nl button,.nl input{min-height:40px}
  footer a{display:inline-block;padding-block:6px}
}

/* 7. Desk Match: keep the full 5-column card grid on phones (never 1 column) */
.mstage .mgrid{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:6px}
@media(max-width:420px){
  .mstage{padding:8px;min-height:0}
  .mstage .mgrid{gap:5px}
  .mc .b{font-size:1rem;border-radius:10px}
  .mc .f{border-radius:10px;font-size:clamp(1.2rem,6.5vw,1.7rem)}
}

/* ===== Desk Match: whole game always fits inside the screen (phone / tablet / laptop) =====
   --mfix = height used by header + score row + banner + paddings + note. Grid gets whatever is left. */
.mpg{--mfix:232px}
.mpg .gbox{
  padding:10px;
  width:min(100%,460px,max(236px,calc((100dvh - var(--mfix)) / .92 + 40px)))!important;
  max-width:none!important;margin-inline:auto
}
.mpg .ghud{padding:2px 6px 6px}
.mpg .ghud b{font-size:1.1rem}
.mpg .mchance{margin:0 0 8px;padding:5px 8px;font-size:.72rem}
.mpg .mstage{padding:8px;min-height:0!important}
.mpg .mstage .mgrid{gap:6px}
.mpg .gnote{margin-top:6px;font-size:.72rem}
.mpg .gov{padding:12px;gap:8px;overflow:auto}
.mpg .gov:has(.gform) .ge,.mpg .gov:has(.gform) p:not(.gerr){display:none}
.mpg .gov:has(.gform) h3{margin:0}
.mpg .gov .gform input{padding:9px 12px}
@media(max-width:560px){
  .mpg .mstage{min-height:236px!important}
  .mpg .mstage .mgrid{gap:5px}
  .mpg .mstage .gov{background:color-mix(in srgb,var(--bg) 100%,transparent)}
}
@media(max-height:700px){.mpg .gov .ge{display:none}.mpg .mchance{font-size:.68rem;padding:4px 8px;margin-bottom:6px}}
/* landscape phones: very little height, so drop the banner + hint and shrink the board to fit */
@media(max-height:500px){
  .mpg{--mfix:176px}
  .mpg .gnote,.mpg .mchance{display:none}
  .mpg .gbox{width:min(100%,460px,max(190px,calc((100dvh - var(--mfix)) / .92 + 40px)))!important}
  .mpg .mstage{min-height:0!important}
}
/* Desk Match panels: opaque, compact title, hide fine print when space is tight */
.mpg .mstage .gov{background:color-mix(in srgb,var(--bg) 100%,transparent)}
.mpg .gov h3{font-size:1.1rem;line-height:1.2}
.mpg .gov:has(.gform) h3{font-size:1rem;white-space:nowrap}
@media(max-width:560px),(max-height:700px){
  .mpg .gov:has(.gform) small.mfine{display:none}
  .mpg .gov .gform{gap:6px}
}
