/* Phone layout of the studio (Lucas 2026-10-31: « optimisation complète de la version mobile »). Loaded after every other stylesheet;
   everything sits under max-width 860px, the computer layout does not change. The tab bar and the top bar are built by mobile.js. */
.m-tabbar,.m-title,.m-filter,.m-top,.m-lb-close{display:none}
@media (max-width:860px){
  .ps2{--m-tab:62px;--m-safe:env(safe-area-inset-bottom,0px);--m-bottom:calc(var(--m-tab) + var(--m-safe))}
  html,body{overflow-x:hidden}
  .ps2.shell,.ps2 .studio-workspace,.ps2 main{max-width:100vw;min-width:0}
  .ps2 main{overflow-x:clip}
  /* a page (.s2) is a grid: one column that never grows past the screen, so a wide table scrolls in its own box */
  .ps2 main .s2{grid-template-columns:minmax(0,1fr)}
  .ps2 main .s2>*{min-width:0}

  /* top bar: logo, name of the screen (tap = back to the top), spend of the day, NSFW filter */
  .ps2 .side{position:sticky;top:0;z-index:20;display:flex;flex-direction:row;align-items:center;gap:8px;min-height:58px;padding:6px 10px 6px 14px!important;overflow:visible}
  #shell.ps2 .side .brand{display:contents}
  .ps2 .side .brand .logo{order:0;flex:none;width:32px;height:32px;border-radius:10px}
  .ps2 .side .brand-name{display:none}
  .ps2 .m-title{display:block;order:1;flex:1;min-width:0;min-height:44px;padding:0 4px;border:0;background:none;color:#fff;text-align:left;font:700 18px/44px "Space Grotesk",Inter,sans-serif;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .ps2 .side .s2-cost-chip{order:2;margin-left:0}
  .ps2 .m-filter{display:grid;order:3;place-items:center;flex:none;width:44px;height:44px;border-radius:14px;border:1px solid #ffffff1f;background:#ffffff08;color:#e3dbe9;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .ps2 .m-filter svg{width:21px;height:21px}
  .ps2 .m-filter.is-off{border-color:#cf8bff80;background:#a855f722;color:#edd8ff}
  .ps2 .m-filter.is-off .m-filter-cut{display:none}
  .ps2 .side-burger{display:none!important}
  .ps2 .content-toolbar{display:none}
  .ps2 .studio-workspace main{padding:18px 16px calc(var(--m-bottom) + 36px)!important}

  /* the thumb bar */
  .ps2 .m-tabbar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;left:0;right:0;bottom:0;z-index:19;height:var(--m-bottom);padding:5px 6px var(--m-safe);background:#0d0c11f0;border-top:1px solid #ffffff14;-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}
  .ps2 .m-tabbar>a,.ps2 .m-tabbar>button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;min-height:50px;margin:0;padding:0;border:0;border-radius:14px;background:none;color:#a39bb0;font:600 11px/1.1 Inter,sans-serif;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .ps2 .m-tabbar svg{width:24px;height:24px;transition:transform .18s}
  .ps2 .m-tabbar span{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .ps2 .m-tabbar .is-on{color:#fff}
  .ps2 .m-tabbar .is-on svg{color:#ff6aa6;transform:translateY(-1px)}
  .ps2 .m-tabbar .is-on::before{content:"";position:absolute;top:2px;width:44px;height:30px;border-radius:999px;background:linear-gradient(120deg,#ff4f8b33,#a855f733);z-index:-1}
  .ps2 .m-tabbar>a:active,.ps2 .m-tabbar>button:active{background:#ffffff0d}
  .ps2 .m-tab-count{position:absolute;top:2px;left:calc(50% + 7px);min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#ff4f8b;color:#fff;font:700 10.5px/18px Inter,sans-serif;text-align:center;box-shadow:0 0 0 2px #0d0c11}
  .ps2 .m-tab-count[hidden]{display:none}

  /* « remonter » */
  .ps2 .m-top{display:grid;place-items:center;position:fixed;right:14px;bottom:calc(var(--m-bottom) + 14px);z-index:18;width:46px;height:46px;border-radius:50%;border:1px solid #ffffff24;background:#1b1722e8;color:#fff;box-shadow:0 10px 26px #0008;opacity:0;transform:translateY(10px) scale(.9);pointer-events:none;transition:opacity .2s,transform .2s;cursor:pointer}
  .ps2 .m-top svg{width:20px;height:20px}
  .ps2 .m-top.is-on{opacity:1;transform:none;pointer-events:auto}
  body.s2-menu-open .ps2 .m-top{display:none}

  /* « Plus »: the whole menu, above the thumb bar, scrolls as one page */
  .ps2 .side.is-open{position:fixed!important;left:0;right:0;top:0;bottom:var(--m-bottom);z-index:21;display:flex;flex-wrap:wrap;align-content:flex-start;overflow-y:auto;overscroll-behavior:contain;padding:6px 14px!important;background:#0d0c11!important;-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
  .ps2 .side.is-open>nav{order:5;position:static!important;flex:0 0 100%;display:grid!important;grid-template-columns:1fr 1fr;grid-auto-flow:row!important;overflow:visible!important;gap:6px!important;padding:4px 0 12px!important;animation:s2menu .22s ease-out}
  .ps2 .side.is-open>nav .grp{grid-column:1/-1;margin:14px 4px 2px!important;padding:0!important}
  .ps2 .side.is-open>nav a{display:flex!important;align-items:center;gap:10px;min-height:52px;padding:10px 12px!important;border-radius:14px;background:#ffffff07;border:1px solid #ffffff0f;font-size:14.5px!important;line-height:1.2!important;white-space:normal;transform:none!important}
  .ps2 .side.is-open>nav a svg{flex:none;width:20px;height:20px}
  .ps2 .side.is-open>nav a span{min-width:0;overflow-wrap:anywhere}
  .ps2 .side.is-open>.side-foot{order:6;position:static!important;flex:0 0 100%;display:flex!important;flex-direction:column;gap:8px;padding:14px 0 18px!important;border-top:1px solid var(--s2-line)}
  .ps2 .side.is-open>.side-foot>a,.ps2 .side.is-open>.side-foot>button{min-height:46px;display:flex;align-items:center;justify-content:center}

  /* buttons, fields and choices big enough for a thumb; 16 px text so iOS does not zoom in a field */
  .ps2 main :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select,textarea){font-size:16px!important;max-width:100%}
  .ps2 main :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select){min-height:44px}
  .ps2 main :is(.s2-btn,.s2-btn-ghost,.s2-btn-sm,button.btn,a.btn,.btn,.ghost){min-height:44px}
  .ps2 main :is(button.small,a.small,button.primary,.pcx-refresh){min-height:44px}
  .ps2 main .s2-seg button,.ps2 main .chips button,.ps2 main .chip,.ps2 main .s2-pills button,.ps2 main .dc-markets button{min-height:42px}
  .ps2 main .s2-fav{min-width:40px;min-height:40px}
  .ps2 main input[type=checkbox],.ps2 main input[type=radio]{width:20px;height:20px}
  .ps2 main .s2-head{flex-direction:column;align-items:stretch;gap:14px;margin-bottom:18px;padding-bottom:16px}
  .ps2 main .s2-head h1{font-size:clamp(28px,8.4vw,36px);overflow-wrap:anywhere}
  .ps2 main .s2-head-r{display:flex;flex-wrap:wrap;gap:8px}
  .ps2 main .s2-head-r>*{flex:1 1 auto}
  .ps2 main .page-head{flex-direction:column;align-items:stretch;gap:12px}
  .ps2 main .page-head .row{flex-wrap:wrap}
  .ps2 main :is(h1,h2,h3,p,li,dd,dt,label,b,strong,em,small,span,a){overflow-wrap:break-word}
  .ps2 main :is(img,video,canvas,svg){max-width:100%}
  .ps2 main pre,.ps2 main code{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
  .ps2 main .row{flex-wrap:wrap}
  /* tables: scroll inside their own box rather than pushing the page sideways */
  .ps2 main table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  /* ... and a table of 4 columns or more (mobile.js labels its cells) becomes one card per row */
  .ps2 main table.m-stack{display:block;overflow:visible;border:0}
  .ps2 main table.m-stack>thead{display:none}
  .ps2 main table.m-stack>tbody{display:grid;gap:10px}
  .ps2 main table.m-stack>tbody>tr{display:grid;grid-template-columns:minmax(0,1fr);gap:7px;padding:12px 14px;border:1px solid #ffffff14;border-radius:16px;background:#ffffff06}
  .ps2 main table.m-stack>tbody>tr>td{display:grid;grid-template-columns:92px minmax(0,1fr);gap:10px;align-items:baseline;min-width:0;padding:0!important;border:0!important;text-align:left!important;white-space:normal!important;overflow-wrap:anywhere}
  .ps2 main table.m-stack>tbody>tr>td::before{content:attr(data-label);color:var(--s2-muted,#958da1);font-size:12px;line-height:1.35}
  .ps2 main table.m-stack>tbody>tr>td:not([data-label]),.ps2 main table.m-stack>tbody>tr>td[data-label=""]{display:flex;flex-wrap:wrap;gap:8px}
  .ps2 main table.m-stack>tbody>tr>td:not([data-label])::before,.ps2 main table.m-stack>tbody>tr>td[data-label=""]::before{display:none}
  .ps2 main table.m-stack>tbody>tr>td:empty{display:none}
  .ps2 main table.m-stack .btn,.ps2 main table.m-stack button{min-height:42px}
  .ps2 main label.check{flex-wrap:nowrap!important;align-items:flex-start;gap:10px}
  .ps2 main label.check>input{flex:none;margin-top:2px}
  /* rows of segmented choices scroll sideways in place */
  .ps2 main .s2-seg{max-width:100%;overflow-x:auto;scrollbar-width:none}
  .ps2 main .s2-seg::-webkit-scrollbar{display:none}
  .ps2 main .s2-seg>*{flex:none}

  /* screens */
  .ps2 .s2-topline{border-radius:22px}
  .ps2 .s2-val button{min-height:46px;font-size:15px}
  .ps2 .s2-pv-bar>.s2-pv-models{flex:1 1 100%;min-width:0;max-width:100%}
  .ps2 .pub-more[open]>.pub-more-menu{position:fixed;left:12px;right:12px;top:auto;bottom:calc(var(--m-bottom) + 12px);min-width:0;max-height:70dvh;overflow-y:auto;z-index:25}
  .ps2 .pub-more-menu button{min-height:46px}

  /* bars that stick to the bottom of a screen sit above the thumb bar */
  .ps2 :is(.s2-bsl-go,.s2-cn3-bar,.dc-mbar){bottom:calc(var(--m-bottom) + 10px)!important}
  .ps2 .pub-drive #pub-auto-progress{bottom:calc(var(--m-bottom) + 10px)}
  .ps2 #pub-csv-progress{bottom:var(--m-bottom)}
  .s2-boot-float{bottom:calc(var(--m-bottom,62px) + 12px)!important;right:12px!important;width:calc(100vw - 24px)!important}
  .toast{left:12px;right:12px!important;bottom:calc(62px + env(safe-area-inset-bottom,0px) + 12px)!important;text-align:center}

  /* the photo viewer: from the top, a close button that follows the scroll, thumb-sized buttons */
  .lightbox{justify-content:flex-start!important;align-items:stretch!important;gap:14px!important;padding:12px 12px calc(24px + env(safe-area-inset-bottom,0px))!important;overscroll-behavior:contain}
  .lightbox>img{align-self:center}
  .lightbox .m-lb-close{display:grid;place-items:center;position:sticky;top:0;z-index:3;align-self:flex-end;flex:none;width:46px;height:46px;margin:0 0 -60px;border-radius:50%;border:1px solid #ffffff30;background:#16131ce8;color:#fff;box-shadow:0 8px 22px #0009;cursor:pointer}
  .lightbox .m-lb-close svg{width:22px;height:22px}
  .lightbox .lb-side{width:100%;max-width:none;max-height:none;overflow:visible;flex:none;font-size:14px}
  .lightbox>img{flex:none;max-height:70vh}
  .lightbox :is(button,.btn,select,input:not([type=checkbox]):not([type=radio])){min-height:44px}
  .lightbox :is(select,input,textarea){font-size:16px!important}

  /* windows open full screen on a phone */
  .ps2 dialog[open],body>dialog[open],dialog.pub-dialog[open],dialog.pcx-dialog[open]{width:100vw!important;max-width:100vw!important;height:100dvh;max-height:100dvh!important;margin:0!important;border-radius:0!important;border:0!important;overflow-y:auto}
  dialog.sw-dlg[open] .sw-dlg-in{max-height:100dvh;padding-bottom:env(safe-area-inset-bottom,0px)}
  .sw-dlg-x{width:44px!important;height:44px!important}
  dialog[open] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea){font-size:16px!important}
  dialog[open] :is(button,.btn,.s2-btn):not(:empty){min-height:44px}
  dialog[open] .sw-rd-sw{gap:10px}
  dialog[open] .sw-rd-sw>button{width:36px;height:36px;min-height:0}
  .modal>.card,.modal>div{width:100%!important;max-width:100%!important;max-height:100dvh!important;border-radius:0!important;overflow-y:auto}
  .modal{padding:0!important}
}
@media (max-width:860px) and (prefers-reduced-motion:reduce){.ps2 .m-tabbar svg,.ps2 .m-top{transition:none}.ps2 .side.is-open>nav{animation:none}}
