/* Lost Carousel — versione telefono (app web installabile)
   Tutto vive sotto body.m, che mobile.js accende sui telefoni e sui tablet piccoli (o se lo scegli dal menu).
   Sul computer questo file non cambia nulla. */

/* elementi che esistono solo sul telefono */
#mbar,#mdock,#mtabs,#mscrim,#mtext,#minst{display:none}

body.m{
  --sat:env(safe-area-inset-top,0px);--sab:env(safe-area-inset-bottom,0px);--sal:env(safe-area-inset-left,0px);--sar:env(safe-area-inset-right,0px);
  --tab-h:58px;--kb:0px;--sh:0px;--vvh:100dvh;
  height:100dvh;overscroll-behavior:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation;-webkit-text-size-adjust:100%;
  padding-left:var(--sal);padding-right:var(--sar);
}
html:has(body.m){overscroll-behavior:none}
body.m button,body.m .st,body.m #mdock,body.m #mtabs,body.m .pcard,body.m .mhd,body.m #mbar{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
body.m input,body.m textarea,body.m select{font-size:16px;-webkit-user-select:text;user-select:text}       /* 16 px: iOS non zooma da solo quando si tocca un campo */
body.m select,body.m input[type=date],body.m input[type=text],body.m input[type=search]{height:46px}
body.m #pill select,body.m #drw select,body.m #sq,body.m #cmdIn,body.m .pop select{height:auto}
body.m button{min-height:44px;padding:8px 14px}
body.m .capbox{-webkit-user-select:text;user-select:text}
body.m ::-webkit-scrollbar{display:none}

/* niente "hover" appiccicato dopo un tocco */
@media (hover:none){
  body.m button:hover,body.m .tpl>div:hover,body.m .it:hover,body.m .tsr:hover,body.m #menu a:hover,body.m .pop a:hover{background:revert-layer;border-color:revert-layer}
  body.m .pcard:hover{transform:none;border-color:var(--pcard-bd)}
  body.m .st:hover .acts{display:none}
}

/* ---------- barra in alto (home, nuovo, redazione) ---------- */
body.m .top{height:calc(52px + var(--sat));padding:var(--sat) 58px 0 16px;justify-content:flex-start;gap:10px}
body.m .lg{width:25px;height:30px}
body.m .top #burger{right:calc(8px + var(--sar));top:calc(50% + var(--sat)/2);width:46px;height:46px;font-size:25px;padding:0;min-height:0;border-radius:14px}
body.m .top::after{content:attr(data-t);font-weight:700;font-size:17px;letter-spacing:-.01em;color:var(--hink)}
body.m #nav{display:none}
body.m.ed .top{display:none}

/* barra a icone in basso */
body.m #mtabs{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:50;height:calc(var(--tab-h) + var(--sab));padding:0 var(--sal) var(--sab) var(--sar);background:var(--glass-s);-webkit-backdrop-filter:blur(22px);backdrop-filter:blur(22px);border-top:1px solid var(--glass-bd)}
body.m.ed #mtabs,body.m.layer #mtabs{display:none}
#mtabs button,#mdock button{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;background:none;border:0;border-radius:0;color:var(--mut);font-size:11px;padding:4px 2px;min-height:var(--tab-h);backdrop-filter:none;-webkit-backdrop-filter:none}
#mtabs button.on,#mdock button.on{color:var(--ink)}
#mtabs i,#mdock i{font-style:normal;font-size:21px;line-height:1.1;display:block}
#mtabs .mplus i{width:44px;height:30px;border-radius:15px;background:var(--acc);color:var(--acc-ink);display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:300}
body.m .view{padding-bottom:calc(var(--tab-h) + var(--sab) + 18px)}
body.m #vEdit{padding-bottom:0}

/* menu: foglio dal basso */
body.m #menu{position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;border-radius:22px 22px 0 0;max-height:82dvh;overflow:auto;padding:10px 10px calc(14px + var(--sab));z-index:170;box-shadow:0 -14px 44px rgba(0,0,0,.45);overscroll-behavior:contain}
body.m #menu a{padding:14px 12px;font-size:16px}body.m #menu .mh{padding-top:14px}
body.m #menu .seg button{min-height:42px}
body.m #menu .seg{display:flex}
#mscrim{position:fixed;inset:0;z-index:140;background:rgba(5,12,20,.52);opacity:0;pointer-events:none;transition:opacity .2s}
body.m #mscrim{display:block}body.m.layer #mscrim{opacity:1;pointer-events:auto}
body.m .pop{position:fixed!important;left:0!important;right:0!important;top:auto!important;bottom:0!important;width:auto;border-radius:22px 22px 0 0;padding:10px 10px calc(14px + var(--sab));z-index:180;box-shadow:0 -14px 44px rgba(0,0,0,.45);max-height:70dvh;overflow:auto}
body.m .pop a{padding:15px 14px;font-size:16px}

/* ---------- home ---------- */
body.m .wrap{padding:8px 14px 24px}
body.m .htop{margin-bottom:10px}body.m .htop h2{font-size:22px}body.m #hNew{display:none}
body.m .hbar{gap:8px;margin-bottom:14px}body.m .hbar input{flex:1 1 100%;min-width:0}body.m .hbar select{flex:1 1 calc(50% - 4px);min-width:0}body.m .hbar .sp,body.m .hbar .seg{display:none}
body.m .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
body.m .pcard{border-radius:18px}body.m .pcard .t{padding:8px 10px 10px}
body.m .pcard .dots3{display:flex;align-items:center;justify-content:center;width:42px;height:42px;padding:0;min-height:0;border-radius:11px;top:6px;right:6px}
body.m .pcard .st{left:7px;top:7px}
body.m .tab{display:none}                    /* la lista in tabella non c'è sul telefono: mobile.js passa alla griglia */

/* ---------- nuovo carosello ---------- */
body.m .narrow{max-width:none}body.m .form{padding:8px 14px 16px;border-radius:18px}
body.m .form .row{flex-direction:column;gap:0}
body.m .form textarea{min-height:120px}
body.m .drop{padding:28px 14px;font-size:15px}
body.m .form .mact{flex-wrap:wrap}body.m .form .mact button{flex:1 1 auto}
body.m .v{border-radius:18px;padding:6px 14px}

/* ---------- redazione ---------- */
body.m .rd{grid-template-columns:40px minmax(0,1fr) 54px;gap:10px;padding:10px 0}
body.m .rd>*:nth-child(3){display:none}

/* ---------- finestre: fogli dal basso ---------- */
body.m #modal{align-items:flex-end;padding:0;z-index:160}
body.m .mbox{width:100%!important;max-width:none;border-radius:22px 22px 0 0;max-height:calc(var(--vvh) * .92);padding:18px 16px calc(16px + var(--sab));overscroll-behavior:contain;margin-bottom:var(--kb);animation:shUp .22s ease-out}
body.m #modal:has(.mbox.ig){align-items:center;padding:0}
body.m .mbox.ig{max-height:none;margin:0;animation:none}
body.m .tpl{grid-template-columns:1fr}body.m .tpl>div{padding:14px}
body.m .mact{flex-wrap:wrap;gap:8px}body.m .mact button{flex:1 1 auto}body.m .mact .sp{display:none}
body.m .ppl .pr{flex-wrap:wrap}body.m .ppl .prole{width:auto;flex:1}
body.m .bigpin{font-size:42px}
body.m .row{flex-wrap:wrap}
body.m .mbox .row>*{flex:1 1 140px}
body.m #toast{bottom:calc(var(--tab-h) + var(--sab) + 20px);max-width:90vw;z-index:400}
body.m #upd{bottom:calc(var(--tab-h) + var(--sab) + 18px);z-index:400}
@keyframes shUp{from{transform:translateY(100%)}to{transform:none}}

/* ---------- editor ---------- */
body.m #mbar{display:flex;align-items:center;gap:2px;flex:none;height:calc(50px + var(--sat));padding:var(--sat) 4px 0}
body.m:not(.ed) #mbar{display:none}
#mbar button{width:46px;min-height:46px;height:46px;padding:0;background:none;border:0;border-radius:14px;font-size:22px;color:var(--ink);display:flex;align-items:center;justify-content:center;backdrop-filter:none;-webkit-backdrop-filter:none;flex:none}
#mbar .mt{flex:1;min-width:0;text-align:center;line-height:1.15}
#mbar .mt b{display:block;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#mbar .mt small{display:block;color:var(--mut);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#mbar .mt small a{color:var(--warn);text-decoration:underline}
#mbar #mUndo,#mbar #mRedo{font-size:19px}
#mbar button:disabled{opacity:.3}

body.m #ewrap{display:block;position:relative;flex:1;min-height:0;padding:0 0 var(--sh) 0;overflow:hidden}
body.m #rail,body.m #pill,body.m #stripbar .sp,body.m #stripbar>span:last-child{display:none}
body.m #stage{height:100%;min-height:0}
body.m #upper{flex:1;min-height:0}
body.m #center{padding:4px 14px;justify-content:center;align-items:flex-start;overflow:hidden}
body.m #pvwrap{position:relative;overflow:hidden;border-radius:6px;touch-action:pan-y}
body.m #pv{cursor:default;border-radius:0}
body.m #stripwrap{margin:0;border-radius:0;border-width:1px 0 0;height:124px;background:var(--glass-s)}
body.m #stripbar{padding:6px 14px 0;font-size:12px}
body.m #strip{gap:10px;padding:6px 14px 8px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
body.m .st{width:58px;scroll-snap-align:center;opacity:1;filter:none;touch-action:pan-x}
body.m .st:not(.sel):not(.add){opacity:.62}
body.m .st .th{width:58px;height:72px;border-radius:8px}
body.m .st .th .slide{transform:scale(.0537)}
body.m .st .lb{font-size:10.5px;margin-top:3px}
body.m .st .pls,body.m .st .acts{display:none!important}
body.m .st.lift{z-index:20;opacity:1;filter:none;box-shadow:0 12px 30px rgba(0,0,0,.5);transition:none}
body.m .st.add{opacity:1}
body.m .st.add .th{display:flex;align-items:center;justify-content:center;border:2px dashed var(--bd2);outline:0;background:transparent;font-size:28px;font-weight:300;color:var(--ink)}
body.m .st.add .lb{justify-content:center}
body.m .st.sel .th{outline-width:3px}

/* barra delle azioni in basso (editor) */
body.m.ed #mdock{display:flex;flex:none;position:relative;height:calc(var(--tab-h) + var(--sab));padding:0 var(--sal) var(--sab) var(--sar);background:var(--glass-s);-webkit-backdrop-filter:blur(22px);backdrop-filter:blur(22px);border-top:1px solid var(--glass-bd);z-index:30}
body.m.sheet #stripwrap,body.m.sheet #mdock{display:none}
body.m #cmd{display:none}

/* fogli (pannelli, slide, comandi, testo) */
body.m #fly,body.m #cmd.open,body.m #mtext:not([hidden]){display:block;position:fixed;left:0;right:0;bottom:var(--kb);top:auto;width:auto;z-index:150;margin:0;border-radius:22px 22px 0 0;border:1px solid var(--glass-bd);border-bottom:0;background:var(--modal);-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:0 -14px 44px rgba(0,0,0,.45);overflow:auto;overscroll-behavior:contain;padding:0 16px calc(16px + var(--sab));animation:shUp .22s ease-out}
body.m #fly{max-height:calc(var(--vvh) * .64)}
body.m #drw{max-height:calc(var(--vvh) * .64);overflow:auto}
body.m #drw{display:block;position:fixed;left:0;right:0;bottom:var(--kb);top:auto;width:auto;z-index:150;margin:0;border-radius:22px 22px 0 0;border:1px solid var(--glass-bd);border-bottom:0;background:var(--modal);-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:0 -14px 44px rgba(0,0,0,.45);overflow:auto;overscroll-behavior:contain;padding:0 16px calc(16px + var(--sab));animation:shUp .22s ease-out}
body.m #fly[hidden],body.m #drw[hidden],body.m #mtext[hidden]{display:none!important}
.mhd{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:8px;margin:0 -16px;padding:18px 12px 8px 16px;background:var(--modal)}
.mhd .grab{position:absolute;left:50%;top:7px;width:38px;height:4px;margin-left:-19px;border-radius:2px;background:var(--bd2)}
.mhd b{flex:1;font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--h3);min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mhd .mcnt{font-size:12px;color:var(--mut);white-space:nowrap}
.mhd button{min-height:40px;height:40px;padding:0 16px;border-radius:12px;font-weight:600}
body.m #fly section>h3:first-child{display:none}
body.m #fly section h3{margin-top:22px}
body.m #ed{background:none;border:0;padding:0;backdrop-filter:none;max-width:none;min-width:0}
body.m #ed h3:first-child{display:none}
body.m #ed .bar{gap:8px}
body.m #capText{min-height:36dvh}
/* cassetto Design della slide */
body.m #drw .dh{flex-wrap:wrap;gap:8px;padding-top:2px}
body.m #drw .dh b{display:none}
body.m #drw .dh .sp{display:none}
body.m #drw .dfond{flex:1 1 140px}body.m #drw .dh select{width:100%;height:44px;padding:0 10px}
body.m #drw .dh button{flex:1 1 auto;padding:0 12px;min-height:44px;font-size:14px}
body.m .dgal{gap:12px;padding:12px 2px 6px}
body.m .dtile{width:84px}
body.m .dth{width:76px;height:94px;border-radius:10px}
body.m .dsl{width:72px;height:90px}
body.m .dnm{font-size:11px;margin-top:5px}
.mrow{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}.mrow button{flex:1 1 auto;min-height:44px;font-size:14px}
/* comandi */
body.m #cmd.open{display:flex;flex-direction:column;max-height:calc(var(--vvh) * .7);margin:0}
body.m #cmd.open .mhd{order:0}body.m #cmd.open #cmdbox{order:1}body.m #cmd.open #cmdList{order:2}
body.m #cmd.open #cmdList{position:static;margin:0;border:0;box-shadow:none;background:none;padding:4px 0;max-height:46dvh;overflow:auto;border-radius:0}
body.m #cmd.open #cmdList a{padding:14px 10px;font-size:16px;border-radius:12px}
body.m #cmd.open #cmdbox{margin:0 0 6px;padding:6px 14px;border-radius:14px}
body.m #cmd.open #cmdIn{font-size:16px;height:40px}
body.m #cmd.open #cmdbox b{display:none}
/* testo */
#mtext textarea{width:100%;min-height:132px;max-height:42dvh;resize:none;font-size:18px;line-height:1.35;border-radius:14px;padding:12px 14px;height:auto}
#mtext .mhint{margin-top:8px;font-size:12.5px;color:var(--mut)}
#mtext .mhint .warn{color:var(--warn)}#mtext .mhint .bad{color:var(--bad)}
/* galleria */
.gal{display:flex;flex-direction:column;gap:12px}
.gal .gstat{font-size:14px;color:var(--mut)}
.gal .gbar{height:8px;border-radius:99px;background:var(--field);overflow:hidden}.gal .gbar i{display:block;height:100%;width:0;background:var(--acc);transition:width .2s}
.gal .gthumbs{display:flex;gap:6px;overflow-x:auto;padding:2px 0 6px}.gal .gthumbs img{width:52px;height:65px;object-fit:cover;border-radius:7px;flex:none;border:1px solid var(--bd2)}
.gal button.big{width:100%;min-height:54px;font-size:17px;border-radius:14px}
.gal .gopt{display:flex;gap:10px;align-items:flex-start;font-size:14px;color:var(--ink)}.gal .gopt input{margin-top:3px;width:20px;height:20px;flex:none}
.gal .gnote{font-size:13px;color:var(--mut);line-height:1.45}
.gal .gerr{color:var(--bad);font-size:14px}
/* installazione */
body.m #minst{display:flex;position:fixed;left:12px;right:12px;bottom:calc(var(--tab-h) + var(--sab) + 12px);z-index:60;gap:10px;align-items:center;padding:12px 12px 12px 14px;border-radius:16px;background:var(--modal);border:1px solid var(--glass-bd);box-shadow:0 10px 30px rgba(0,0,0,.4);font-size:14px}
body.m #minst[hidden]{display:none}body.m.ed #minst,body.m.layer #minst{display:none}
#minst span{flex:1;line-height:1.35}#minst button{min-height:40px;padding:0 12px}#minst .x{background:none;border:0;font-size:18px;padding:0 6px}
.steps{margin:6px 0 0;padding-left:20px}.steps li{margin:8px 0;line-height:1.45}
/* accesso */
body.m #login{padding:calc(24px + var(--sat)) 18px calc(24px + var(--sab))}
body.m #login input{font-size:24px}
body.m #login .lgrid{grid-template-columns:repeat(2,1fr)}
/* anteprima Instagram: il telefono finto sta nello schermo */
body.m .igtop{width:auto;gap:10px}

/* ---------- telefono in orizzontale ---------- */
@media (orientation:landscape) and (max-height:520px){
  body.m{--tab-h:46px}
  body.m #mbar{height:calc(40px + var(--sat))}body.m #mbar button{min-height:40px;height:40px}
  body.m #stripwrap{height:96px}body.m .st{width:46px}body.m .st .th{width:46px;height:57px}body.m .st .th .slide{transform:scale(.0426)}body.m .st .lb{display:none}
  body.m #fly,body.m #drw{max-height:calc(var(--vvh) * .8)}
  body.m .grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}

/* il foglio Slide: prima i design, poi le azioni */
body.m #drw:not([hidden]){display:flex;flex-direction:column}
body.m #drw .mhd{order:0}body.m #drw .dgal{order:1}body.m #drw .dh{order:2}body.m #drw .mrow{order:3}
/* con un foglio aperto l'anteprima resta ben visibile (niente velo scuro) */
body.m.sheet #mscrim{background:transparent;opacity:1}
body.m textarea{resize:none}
/* anteprima centrata nello spazio libero */
body.m #center{align-items:center}

/* caselle da spuntare: abbastanza grandi per un dito */
body.m input[type=checkbox]{width:22px;height:22px;flex:none}
body.m label:has(>input[type=checkbox]){display:flex;align-items:center;gap:12px;min-height:46px}
body.m .tsr{padding:12px 10px;min-height:46px}
body.m .tsr .tc{width:22px;height:22px}body.m .tsr.on .tc:after{left:6px;top:2px;width:6px;height:11px}

#moff{position:fixed;left:0;right:0;top:0;z-index:500;padding:calc(6px + var(--sat,0px)) 12px 6px;background:var(--warn);color:#241600;font-size:13px;font-weight:600;text-align:center}
#moff[hidden]{display:none}

#mtext .mtools{display:flex;align-items:center;gap:10px;margin-top:8px}
#mtext .mtools button{min-height:40px;height:40px;padding:0 14px;flex:none}

/* con la tastiera aperta c'è poco spazio: il campo di testo si fa più basso e l'anteprima resta visibile */
body.m.kb #mtext textarea{min-height:76px;max-height:104px}
body.m.kb #mtext .mhint:not(.mtools .mhint){display:none}

/* allegato: sul telefono il pulsante Incolla c'è, i tasti sono grandi */
body.m .attrow .pst{display:inline-flex;align-items:center}
body.m .attrow .attb,body.m .attrow .pst{flex:1 1 140px;justify-content:center}
body.m .attrow .hint{flex:1 1 100%}

#vNew .nQ{display:none}body.m #vNew .nQ:not([hidden]){display:inline-flex;align-items:center;justify-content:center}
