/* Only the vertical channel shelf changes. Coordinates use the live stage,
   which already excludes the browser chrome; keep the tile nodes for flight. */
@media (orientation:portrait) and (max-width:600px){
 html body #channel.mobile-portrait[data-system-view="channels"]{
  --gutter:max(12px,3.8vw,env(safe-area-inset-left),env(safe-area-inset-right));
  --footer:clamp(94px,26vw,132px);
  --dock-y:calc(100% - var(--footer) - env(safe-area-inset-bottom,0px));
  --row-gap:clamp(46px,6.6dvh,64px);
  --shelf:min(calc(102vw + 3 * var(--row-gap)),calc(var(--dock-y) - 26px - env(safe-area-inset-top,0px)));
  --shell-top:calc((var(--dock-y) - var(--shelf) + env(safe-area-inset-top,0px)) * .5);
 }
 html body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] .wii-channels-page{
  grid-template:repeat(4,minmax(0,1fr))/repeat(3,minmax(0,1fr))!important;
  gap:var(--row-gap) clamp(5px,1.65vw,9px)!important;
 }
 /* The side arrows borrow the middle row gap, not a column of artwork.
    Each 44px hit area stays off both rows, including on the smallest phone. */
 html body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] ~ :is(#previous,#next){top:calc(var(--shell-top) + var(--shelf) * .5 - 22px)!important;width:44px;height:44px;padding:0 4px;}
 html body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] ~ #previous{left:env(safe-area-inset-left,0px);justify-items:start}
 html body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] ~ #next{right:env(safe-area-inset-right,0px);justify-items:end}
}
/* Separate Safari study: keep native chrome; only paint document content. */
@media (orientation:portrait) and (max-width:600px){
html[data-filas]{--n:4;--gap:6px;--tail:radial-gradient(ellipse at 12% 88%,#acd4df 0,transparent 42%),radial-gradient(ellipse at 85% 68%,#d2cbdc 0,transparent 47%),linear-gradient(120deg,#d2d9e1,#e9edef 48%,#c3dce2)}
html[data-filas="5"]{--n:5}
html[data-filas][data-dock="natural"],html[data-filas][data-dock="natural"] body{min-height:calc(100lvh + 94px)!important;touch-action:pan-y pinch-zoom!important}
html[data-filas]:has(#channel[data-system-view="channels"]):not([data-channel-presentation="active"]),html[data-filas]:has(#channel[data-system-view="channels"]):not([data-channel-presentation="active"]) body{background:var(--tail)!important}
html[data-filas] body #channel.mobile-portrait[data-system-view="channels"]{--footer:clamp(88px,24vw,114px);--dock-y:calc(100% - var(--footer) - env(safe-area-inset-bottom,0px));--tile:min(24vw,calc((100svh - var(--footer) - 98px - env(safe-area-inset-bottom,0px) - env(safe-area-inset-top,0px)) / 5));--shelf:calc(var(--tile)*var(--n) + var(--gap)*var(--n) + 44px);--shell-top:calc(var(--dock-y) - var(--shelf) - 8px);touch-action:pan-y pinch-zoom!important}
html[data-filas] body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] .wii-channels-page{grid-template:repeat(2,minmax(0,1fr)) 44px repeat(2,minmax(0,1fr))/repeat(3,minmax(0,1fr))!important;gap:var(--gap)!important;padding:0!important}
html[data-filas="5"] body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] .wii-channels-page{grid-template-rows:repeat(2,minmax(0,1fr)) 44px repeat(3,minmax(0,1fr))!important}
html[data-filas] .wii-channels-page::before{content:'';grid-column:1/-1;grid-row:3;pointer-events:none}
html[data-filas] body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] ~ :is(#previous,#next){top:calc(var(--shell-top) + 2 * (var(--tile) + var(--gap)))!important}
html[data-filas] body #channel.mobile-portrait[data-system-view="channels"]::before{height:calc(var(--footer) + env(safe-area-inset-bottom,0px) + 120px)!important;mask-image:none!important;-webkit-mask-image:none!important;background:url(assets/maqueta-shell.svg) center top/100% var(--footer) no-repeat,var(--tail)!important;clip-path:polygon(0 0,15% 0,21% 3%,28% 12%,35% calc(var(--footer)*.37),65% calc(var(--footer)*.37),72% 12%,79% 3%,85% 0,100% 0,100% 100%,0 100%)}
}

@media (orientation:portrait) and (max-width:600px){
html[data-filas="5"] body #channel.mobile-portrait[data-system-view="channels"]{--gutter:max(45px,env(safe-area-inset-left),env(safe-area-inset-right));--tile:min(calc((100vw - 2 * var(--gutter) - 12px)*.28),calc((100svh - var(--footer) - 56px - env(safe-area-inset-bottom,0px))/5));--shelf:calc(5 * var(--tile) + 4 * var(--gap));--shell-top:calc(var(--dock-y) - var(--shelf) - 8px)}
html[data-filas="5"] body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] .wii-channels-page{grid-template-rows:repeat(5,minmax(0,1fr))!important}
html[data-filas="5"] .wii-channels-page::before{content:none!important}
html[data-filas="5"] body #channel.mobile-portrait[data-system-view="channels"] #library[data-view="channels"] ~ :is(#previous,#next){top:calc(var(--shell-top) + var(--shelf)*.5 - 22px)!important;justify-items:center}
html[data-filas="5"] body #channel.mobile-portrait[data-system-view="channels"] #library .wii-static-slot{position:relative;overflow:hidden;isolation:isolate;background:radial-gradient(ellipse,#e7ebec,#d2d8db)!important}
html[data-filas="5"] #library .wii-static-slot::before,html[data-filas="5"] #library .wii-static-slot::after{content:''!important;display:block!important;position:absolute;inset:0;pointer-events:none;transform:none;filter:none;mask:none}
html[data-filas="5"] #library .wii-static-slot::before{background:transparent url(assets/marca-senal.png) center/auto 51% no-repeat!important;opacity:.5;z-index:1}
html[data-filas="5"] #library .wii-static-slot::after{background:url(assets/senal-grano.png) 0 0/62px 62px;opacity:.074;z-index:2;animation:senal-fina 3.2s steps(1,end) infinite!important}
html[data-filas="5"] #library .wii-static-slot:nth-child(3n+2)::after{animation-delay:-.55s!important}
@keyframes senal-fina{25%{background-position:0 0,8px 11px}50%{background-position:0 0,21px 4px}75%{background-position:0 0,3px 27px}}
html[data-filas="5"] body #channel.mobile-portrait[data-system-view="channels"]::before{clip-path:none!important;background:url(assets/pie-continuo.svg) top center/100% var(--footer) no-repeat,linear-gradient(to bottom,transparent 0 var(--footer),#c9dce3 var(--footer),#d5e2e6)!important}
html[data-filas="5"]{--tail:linear-gradient(106deg,#c6dce2,#dbe4e8 55%,#c7dbe2)}
html[data-wii-motion="reduce"][data-filas="5"] #library .wii-static-slot::after{animation:none!important}
}
#giro-aviso{display:none}
html[data-filas][data-dock="natural"],html[data-filas][data-dock="natural"] body{position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;min-height:0!important;overflow:hidden!important;overscroll-behavior:none!important}
@media(orientation:portrait) and (max-width:600px){html:not([data-channel-presentation="active"]) #channel[data-system-view="channels"]:not(.case-open) #giro-aviso{display:block;pointer-events:none;position:absolute;inset:max(9px,env(safe-area-inset-top)) 12px auto;text-align:center;color:#485e69;font:15px/1.35 system-ui}}
@media(orientation:landscape){html[data-filas] #library .wii-static-slot{isolation:isolate;overflow:hidden;position:relative}html[data-filas="5"] #library .wii-static-slot::before,html[data-filas="5"] #library .wii-static-slot::after{content:''!important;display:block!important;position:absolute;inset:0;pointer-events:none;transform:none;filter:none;mask:none}
html[data-filas="5"] #library .wii-static-slot::before{background:transparent url(assets/marca-senal.png) center/auto 51% no-repeat!important;opacity:.5;z-index:1}
html[data-filas="5"] #library .wii-static-slot::after{background:url(assets/senal-grano.png) 0 0/62px 62px;opacity:.074;z-index:2;animation:senal-fina 3.2s steps(1,end) infinite!important}
html[data-filas="5"] #library .wii-static-slot:nth-child(3n+2)::after{animation-delay:-.55s!important}
@keyframes senal-fina{25%{background-position:0 0,8px 11px}50%{background-position:0 0,21px 4px}75%{background-position:0 0,3px 27px}}
}
html[data-filas="5"] #library .wii-static-slot::before,html[data-filas="5"] #library .wii-static-slot::after{inset:0!important;height:100%!important;width:100%!important;box-sizing:border-box}
html[data-wii-motion="reduce"][data-filas="5"] #library .wii-static-slot::after{animation:none!important}

#gesto-aviso{display:none}
@media(orientation:landscape) and (pointer:coarse){
 html[data-filas][data-dock="natural"][data-gesto]{position:static!important;inset:auto!important;height:auto!important;min-height:calc(100lvh + 88px)!important;overflow-x:clip!important;overflow-y:auto!important;overscroll-behavior-y:auto!important;touch-action:pan-y pinch-zoom!important}
 html[data-gesto] body{overscroll-behavior:auto!important;touch-action:pan-y pinch-zoom!important}
 html[data-gesto] #gesto-aviso:not([hidden]){display:block;position:fixed;top:max(2px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);margin:0;z-index:10;border-radius:1em;background:#e9f0f4ed;color:#324958;padding:2px 10px;font:500 13px/1.3 system-ui;pointer-events:none;white-space:nowrap}
}
@media(prefers-reduced-motion:reduce){html[data-filas="5"] #library .wii-static-slot::after{animation:none!important}}

