/* Tablet proportions (José, 29 nov: «uso la tablet en vertical»). Loaded last. Sizes are layer px (the layer is scaled).
   fit() in ui.js sets: body.wide (tablet or PC layer), body.tab (touch tablet), body.land (landscape), and on #layer
   --lh / --lw (layer size in layer px) and --lk (scale). `calc(12px / var(--lk))` = 12 real px; 44px / --lk = a 44-px touch
   target. Measurements and screenshots: docs/TABLET_PROPORCIONES.md, docs/tablet/. */

/* ---------- 1. Menu: the fan of heroes (every device) ----------
   ui.js gives each card --i (its offset from the centre: -2.5 … 2.5 with six heroes) and --n (how many). The step between
   cards is what fits in the fan, so six heroes no longer run off the sides; a gentle arc instead of the old wide swing. */
#layer .screen.menu .mm-fan{container-type:inline-size;--cw:170px;--rot:4.5deg;--arc:5px;height:calc(var(--cw) * 1.4 + 62px)}
#layer .screen.menu .mm-card{--step:min(calc(var(--cw) * .62),calc((100cqw - var(--cw) - 116px) / max(1,var(--n,3) - 1)));
  width:var(--cw);height:calc(var(--cw) * 1.4);margin-left:calc(var(--cw) / -2);top:16px;z-index:auto;border-radius:calc(var(--cw) * .05);transform-origin:50% 100%;
  transform:translate(calc(var(--i,0) * var(--step)),calc(var(--i,0) * var(--i,0) * var(--arc))) rotate(calc(var(--i,0) * var(--rot)))}
@supports not (width:1cqw){#layer .screen.menu .mm-card{--step:calc(var(--cw) * .5)}}
/* tablets and PC have 1450 layer px of height: bigger heroes use the room that was empty above the bottom bar */
body.wide #layer .screen.menu .mm-fan{--cw:240px;--arc:6px}
body.wide #layer .screen.menu{padding-top:18px}
body.wide #layer .screen.menu .mm-logo{margin-top:-6px}
/* place names of the map: at least 12 real px */
body.wide .wm-name{font-size:max(19px,calc(12.3px / var(--lk,1)))}

/* ---------- 2. Full-window veil and map (the layer is narrower than the window in landscape / PC) ---------- */
/* the menu screen grows over the side bands (--bx) so the map of the worlds fills the window; its content keeps its column */
body.wide #layer #scr.menu:has(.wmap){left:calc(var(--bx,0px) * -1);right:calc(var(--bx,0px) * -1);width:calc(100% + var(--bx,0px) * 2);box-sizing:border-box;padding-left:calc(24px + var(--bx,0px));padding-right:calc(24px + var(--bx,0px))}
/* …and in landscape the map plane is sized for the window, not for the column, and tilts a little more so its near edge still fits */
@supports (width:1cqh){body.wide.land #scr.menu .wmap{--pw:max(46cqh,min(64cqw,104cqh));--rx:60deg}}
/* the sky ended in a hard line beside the (now narrower than the window) plane: fade its lower edge */
body.wide.land #scr.menu .wmap.ok .wm-cam::before{-webkit-mask-image:linear-gradient(#000 62%,transparent 96%);mask-image:linear-gradient(#000 62%,transparent 96%)}
body.wide #layer .overlay.dlg:not(.tuto),body.wide #layer .overlay.sheet3{box-shadow:0 0 0 200vmax #000000e6}
body.wide #layer .overlay:has(>.chestanim),body.wide #layer .overlay:has(>.chestgrid),body.wide #layer .overlay:has(>.ccout){box-shadow:0 0 0 200vmax #060403f5}
body.wide #layer #ov3.overlay.endwin,body.wide #layer #ov3.overlay.endlose{box-shadow:0 0 0 200vmax #000000f2}

/* ---------- 3. Chests ---------- */
/* the chest: 600 px was 52 % of an iPad's width (73 % on a phone) */
body.wide .chestanim{width:min(800px,80%)}
body.wide .chtap{font-size:max(28px,calc(14px / var(--lk,1)))}
/* one prize: bigger preview */
body.wide .ccout{padding:26px 30px;gap:14px}
body.wide .ccout .colprev{width:400px;height:400px}
body.wide .ccout .colprev.colTAP,body.wide .ccout .colprev.colREV,body.wide .ccout .colprev.colFUN{width:350px;height:490px}
body.wide .ccout b{font-size:38px}body.wide .ccout .qtag{font-size:24px}
body.wide .ccout em{font-size:max(20px,calc(12.3px / var(--lk,1)))}
/* several prizes: previews sized in % of their tile (they were fixed px: 68 px inside a 188-px tile) */
body.wide #layer .chestgrid{gap:12px}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit{padding:12px 8px 10px;gap:6px}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit .colprev{width:70%;height:auto;aspect-ratio:1}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit .colprev.colTAP{width:62%;aspect-ratio:2/3}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit .colprev.colREV,body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit .colprev.colFUN{width:64%;aspect-ratio:5/7}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit>img{width:46%}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit b{font-size:max(22px,calc(13px / var(--lk,1)));line-height:1.1}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit .qtag{font-size:max(18px,calc(12.3px / var(--lk,1)))}
body.wide #layer :is(.chestgrid,.chestgrid.many) .chestit em{font-size:max(16px,calc(12.3px / var(--lk,1)));top:4px;right:4px;padding:1px 7px}
/* ×10 in 5 + 5 (was 4 + 4 + 2) */
body.wide #layer .chestgrid.many{grid-template-columns:repeat(5,1fr)}
/* ×5 in 3 + 2 with the second row centred; ×3 keeps its row */
body.wide #layer .chestgrid:not(.many):has(.chestit:nth-child(4)){grid-template-columns:repeat(6,1fr)}
body.wide #layer .chestgrid:not(.many):has(.chestit:nth-child(4)) .chestit{grid-column:span 2}
body.wide #layer .chestgrid:not(.many):has(.chestit:nth-child(4)) .chestit:nth-child(4):nth-last-child(2){grid-column:2/span 2}
body.wide #layer .chestgrid:not(.many):has(.chestit:nth-child(4)) .chestit:nth-child(4):last-child{grid-column:3/span 2}

/* ---------- 4. Packs ---------- */
body.wide .sobre{width:min(48%,440px);margin-top:4%}
/* «Listo» / «Revelar todas» stay in view while the cards scroll (every device) */
#layer .screen.pkopen:has(.pack)>.row2{position:sticky;bottom:-40px;z-index:3;flex:none;padding:18px 0 46px;margin-bottom:-34px;width:100%;justify-content:center;
  background:linear-gradient(#0000,#0b0706f2 34%)}
/* tablets: 2–4 packs show 4 cards per row instead of 5 (bigger cards); labels at 12 real px or more */
body.tab:not(.land) #layer .screen.pkopen .pack:has(.pk-card:nth-child(6)):not(:has(.pk-card:nth-child(21))){grid-template-columns:repeat(4,1fr)}
body.wide #layer .screen.pkopen .pack:has(.pk-card:nth-child(6)) .pk-rar{font-size:max(15px,calc(12.3px / var(--lk,1)))}
body.wide #layer .screen.pkopen .pack:has(.pk-card:nth-child(6)) .pk-ess,body.wide #layer .screen.pkopen .pack:has(.pk-card:nth-child(6)) .pk-card .new{font-size:max(13px,calc(12.3px / var(--lk,1)))}

/* ---------- 5. Collection, deck builder and shop on tablets: more columns ---------- */
body.tab #layer #scr .cgrid:not(.draft):not(.search){grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}
body.tab .shopgrid:not(.kgrid){grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}

/* ---------- 6. Tablets: touch targets of 44 real px and text of 12 real px on the reviewed screens ---------- */
body.tab #layer{--t44:calc(44px / var(--lk,1));--t12:calc(12.3px / var(--lk,1))}
body.tab #layer #sback,body.tab #layer .esttabs button,body.tab #layer .wallet .wcell,body.tab #layer .cpacks,body.tab #layer .ftog,body.tab #layer .ftoggle,body.tab #layer .brules,body.tab #layer .fchip,
body.tab #layer #cpacks,body.tab #layer #brules,body.tab #layer #pcalgo,body.tab #layer #tovault2{min-height:var(--t44)}
body.tab #layer .vrep{min-height:var(--t44);min-width:var(--t44);padding:2px 14px}
body.tab #layer .bmini{width:var(--t44)}
body.tab #layer #brules{min-height:var(--t44)!important}   /* its inline style says 44 layer px (36 real) */
body.tab #layer .wallet .wcell span,body.tab #layer .wallet .wcell small,body.tab #layer .esttile .ptype,body.tab #layer .kshop .ribbon,body.tab #layer .bmini b,
body.tab #layer .vcard2 .lgpz .qtag,body.tab #layer .vcard2 .lgpz .lgpl,body.tab #layer .vcard2 .lgpz>b,body.tab #layer .pbadges em,body.tab #layer .pbadges small,body.tab #layer .vodds th,body.tab #layer .dk-seal small{font-size:max(14px,var(--t12))}
/* José, 30 nov (iPhone/iPad Safari): position:sticky inside the scaled #layer lands mid-screen (same bug as the deck bar):
   the pack buttons and the sheet buttons go back to the normal flow, right after the content */
#layer .screen.pkopen:has(.pack)>.row2{position:relative;bottom:auto;margin-bottom:0;padding:18px 0 24px}
