/* Shin Tomo — restyling grafico del social (solo aspetto, nessuna modifica alle funzioni).
   Caricato dopo app.css. Coerente con la homepage pubblica: nero, carta, rosso; etichette in stile "manifest". */

/* ---------- Palette ---------- */
html:root{
  --st-red:#c21f1d;--st-red2:#c21f1d;--st-red-text:#a31c1b;
  --st-bg:#f3f0ea;--st-surface:#fffdfa;--st-surface2:#f4f1eb;--st-text:#121213;--st-muted:#6c6a66;--st-border:#e4dfd6;
  --st-shadow:0 1px 0 rgba(18,18,19,.04),0 10px 30px -18px rgba(18,18,19,.22);
  --st-radius:20px;
  --st-hover:color-mix(in srgb,var(--st-red) 6%,var(--st-surface2));
  --st-ring:conic-gradient(from 210deg,#c21f1d,#ff6b4a,#c21f1d 60%,#121213 85%,#c21f1d);
  --st-mono:ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace;
}
html[data-st-theme=dark]:root{
  --st-red:#d42825;--st-red2:#d42825;--st-red-text:#ff6a5f;
  --st-bg:#232528;--st-surface:#2b2d31;--st-surface2:#34363b;--st-text:#f3f2ef;--st-muted:#aeaca7;--st-border:#3e4046;
  --st-shadow:0 1px 0 rgba(255,255,255,.03) inset,0 18px 40px -24px rgba(0,0,0,.8);
  --st-hover:color-mix(in srgb,var(--st-red) 12%,var(--st-surface2));
}

html body{background:var(--st-bg);-webkit-font-smoothing:antialiased}
html ::selection{background:var(--st-red);color:#fff}

/* ---------- Barra in alto ---------- */
html .st-topbar{background:color-mix(in srgb,var(--st-surface) 82%,transparent);backdrop-filter:blur(20px) saturate(1.4);border-bottom:1px solid var(--st-border);box-shadow:inset 0 3px 0 var(--st-red)}
html .st-brand-logo{transition:transform .25s cubic-bezier(.2,.8,.2,1)}
html .st-brand:hover .st-brand-logo{transform:rotate(-6deg) scale(1.06)}
html .st-search{border-radius:999px;background:var(--st-surface2);border-color:transparent;transition:border-color .2s,box-shadow .2s,background .2s}
html .st-search:focus-within{background:var(--st-surface);border-color:var(--st-red);box-shadow:0 0 0 4px color-mix(in srgb,var(--st-red) 14%,transparent)}
html .st-icon-btn{border-color:var(--st-border);background:var(--st-surface);transition:transform .15s,border-color .15s,color .15s,background .15s}
html .st-icon-btn:hover{transform:translateY(-1px);border-color:var(--st-red);color:var(--st-red-text)}
html .st-user-chip img{box-shadow:0 0 0 2px var(--st-surface),0 0 0 4px var(--st-red)}

/* ---------- Menu laterale ---------- */
html .st-sidebar a{position:relative;border-radius:14px;color:var(--st-muted);transition:background .15s,color .15s,transform .15s}
html .st-sidebar a:hover{background:var(--st-hover);color:var(--st-text);box-shadow:none;transform:translateX(2px)}
html .st-sidebar a.active{background:var(--st-text);color:var(--st-bg);box-shadow:0 12px 24px -14px rgba(0,0,0,.6)}
html .st-sidebar a.active .st-nav-icon{color:var(--st-red)}
html[data-st-theme=dark] .st-sidebar a.active{background:var(--st-surface2);color:var(--st-text);box-shadow:inset 3px 0 0 var(--st-red)}
html .st-sidebar a.active::after{content:"";position:absolute;right:12px;top:50%;width:6px;height:6px;margin-top:-3px;border-radius:50%;background:var(--st-red)}

/* ---------- Schede ---------- */
html .st-card,html .st-composer,html .st-live-stage,html .st-chat-panel,html .st-content-card,html .st-auth-card,html .st-mod-panel,html .st-action{
  border-radius:var(--st-radius);border-color:var(--st-border);background:var(--st-surface);box-shadow:var(--st-shadow)}
html .st-rightbar .st-card{position:relative}
html .st-rightbar .st-card::before{content:"";position:absolute;left:18px;top:-1px;width:56px;height:3px;border-radius:0 0 3px 3px;background:var(--st-red)}
html .st-card h3{letter-spacing:-.02em;font-weight:800}

/* Etichette "kicker" in stile manifest */
html .st-kicker{display:inline-flex;align-items:center;gap:8px;font-family:var(--st-mono);font-size:.7rem;letter-spacing:.16em;color:var(--st-red-text)}
html .st-kicker::before{content:"";width:7px;height:7px;background:var(--st-red);transform:rotate(45deg);flex:0 0 7px}
html .st-section-title h2,html .st-pagehead h1{font-weight:800;letter-spacing:-.04em;font-size:clamp(1.6rem,2.4vw,2.1rem)}

/* ---------- Pulsanti ---------- */
html .st-btn{border-radius:999px;font-weight:800;letter-spacing:-.01em;transition:transform .15s,box-shadow .2s,background .2s,border-color .2s}
html .st-btn-primary{background:var(--st-red);border-color:var(--st-red);box-shadow:0 10px 24px -12px color-mix(in srgb,var(--st-red) 90%,transparent)}
html .st-btn-primary:hover:not(:disabled){background:color-mix(in srgb,var(--st-red) 88%,#fff);box-shadow:0 14px 28px -12px var(--st-red)}
html .st-btn:focus-visible,html .st-icon-btn:focus-visible,html .st-sidebar a:focus-visible{outline:3px solid color-mix(in srgb,var(--st-red) 55%,transparent);outline-offset:2px}

/* ---------- Stories ---------- */
html .st-story-ring{background:var(--st-ring)!important;transition:transform .25s cubic-bezier(.2,.8,.2,1)}
html .st-story-bubble:hover .st-story-ring{transform:scale(1.06) rotate(-4deg)}
html .st-story-avatar-wrap{box-shadow:0 0 0 3px var(--st-surface)}
html .st-story-bubble strong{font-weight:700;letter-spacing:-.01em}

/* ---------- Composer ---------- */
html .st-composer textarea{border-radius:16px;background:var(--st-surface2);border:1px solid transparent;transition:border-color .2s,background .2s}
html .st-composer textarea:focus{background:var(--st-surface);border-color:var(--st-red)}
html .st-composer-quick-actions button,html .st-composer-quick-actions a{border-radius:999px;transition:background .15s,color .15s}
html .st-composer-quick-actions button:hover,html .st-composer-quick-actions a:hover{background:var(--st-hover);color:var(--st-red-text)}

/* ---------- Post ---------- */
html .st-post{transition:box-shadow .25s,transform .25s}
html .st-post:hover{box-shadow:0 1px 0 rgba(0,0,0,.03),0 22px 44px -26px rgba(0,0,0,.38)}
html .st-post-head img{box-shadow:0 0 0 2px var(--st-surface),0 0 0 3px var(--st-border)}
html .st-post-head-main strong{font-weight:800;letter-spacing:-.015em}
html .st-post-head .meta{font-family:var(--st-mono);font-size:.72rem;letter-spacing:.04em}
html .st-official{background:var(--st-text);color:var(--st-bg);border-radius:6px;letter-spacing:.06em;font-size:.68rem;padding:4px 7px;box-shadow:inset 0 -2px 0 var(--st-red)}
html .st-kind{border-radius:6px;font-family:var(--st-mono);font-size:.64rem;letter-spacing:.1em;background:transparent;border:1px solid var(--st-border)}
html .st-post-media{border-top:1px solid var(--st-border);border-bottom:1px solid var(--st-border)}
html .st-hashtag{color:var(--st-red-text);font-weight:700}
html .st-actbar{border-top:0}
html .st-act{border-radius:999px;transition:background .15s,color .15s,transform .15s}
html .st-act:hover{background:var(--st-hover);color:var(--st-red-text)}
html .st-act:active{transform:scale(.92)}
/* Contatore reazioni: pillola compatta attaccata al cuore (prima era un cerchio largo 44px spostato a destra del numero) */
html body .st-actbar .st-act-count{width:auto;min-width:0;height:30px!important;min-height:0!important;align-self:center;padding:0 8px;margin:0 2px 0 -8px;border-radius:999px;justify-content:center;font-weight:700;font-variant-numeric:tabular-nums}
html body .st-actbar .st-act-count:hover,html body .st-actbar .st-act-count:focus-visible{background:var(--st-hover);color:var(--st-red-text)}
html .st-like-button.active,html .st-act.active{color:var(--st-red-text)}
html .st-comment-bubble{border-radius:4px 16px 16px 16px}
html .st-reaction-strip button{border-radius:999px}

/* Feed: ogni post è una scheda separata (prima erano un unico blocco con divisori) */
html body #st-feed:has(>.st-post),html body #st-saved:has(>.st-post){display:flex;flex-direction:column;gap:18px;background:transparent;border:0;border-radius:0;box-shadow:none;overflow:visible;margin-inline:0}
html body #st-feed>.st-post,html body #st-saved>.st-post,html body #st-feed>*+.st-post,html body #st-saved>*+.st-post{border:1px solid var(--st-border);border-radius:var(--st-radius);overflow:hidden;background:var(--st-surface);box-shadow:var(--st-shadow);margin:0}
@media (max-width:760px){html body #st-feed:has(>.st-post),html body #st-saved:has(>.st-post){gap:12px}}

/* ---------- Live ---------- */
html .st-live-home-card{border-radius:var(--st-radius);border-color:color-mix(in srgb,var(--st-red) 45%,var(--st-border))}
html .st-live-dot{animation:st-rf-pulse 1.6s ease-in-out infinite}
html .st-live-badge{font-family:var(--st-mono);letter-spacing:.08em}
@keyframes st-rf-pulse{50%{box-shadow:0 0 0 9px color-mix(in srgb,var(--st-red) 0%,transparent)}}

/* ---------- Messaggi ---------- */
html .st-private-message.mine .st-message-bubble{background:var(--st-red);border-radius:18px 18px 4px 18px}
html .st-private-message:not(.mine) .st-message-bubble{border-radius:18px 18px 18px 4px}
html .st-conversation-item.active{box-shadow:inset 3px 0 0 var(--st-red)}

/* ---------- Barra mobile ---------- */
html .st-bottom-nav{backdrop-filter:blur(18px) saturate(1.4);background:color-mix(in srgb,var(--st-surface) 86%,transparent);border-top:1px solid var(--st-border)}
html .st-bottom-nav a.active{color:var(--st-red-text)}
html .st-bottom-create{background:var(--st-red)!important;color:#fff!important;box-shadow:0 10px 24px -10px var(--st-red)}

/* ---------- Piè di pagina ---------- */
html .st-footer{font-family:var(--st-mono);font-size:.72rem;letter-spacing:.06em;text-transform:uppercase}

@media (max-width:1180px){html .st-sidebar a.active::after{display:none}}

/* Scrollbar */
html{scrollbar-color:color-mix(in srgb,var(--st-text) 25%,transparent) transparent}

@media (prefers-reduced-motion:reduce){html .st-post,html .st-sidebar a,html .st-story-ring,html .st-live-dot{transition:none;animation:none}}

/* ==========================================================================
   3.20.0 — Telefono in verticale e in orizzontale: niente contenuti o pulsanti tagliati.
   ========================================================================== */

/* Barre laterali (schermi larghi ma bassi, es. telefono grande in orizzontale): scorrono invece di uscire dallo schermo. */
@media (min-width:761px){
 .st-sidebar,.st-rightbar{max-height:calc(100dvh - 100px);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none}
 .st-sidebar::-webkit-scrollbar,.st-rightbar::-webkit-scrollbar{display:none}
 body.admin-bar .st-sidebar,body.admin-bar .st-rightbar{max-height:calc(100dvh - 146px)}
}
@media (min-width:761px) and (max-height:500px){
 .st-messages-layout{min-height:0}
}

@media (max-width:760px){
 /* "hidden" rendeva il body un contenitore di scorrimento: la barra in alto non restava ferma e si spostava. */
 html,body{overflow-x:clip}
 /* La sfocatura sulla barra in alto "intrappolava" il menu mobile, che si apriva più in basso e usciva dallo schermo.
    La sfocatura resta, ma su uno strato dietro la barra. */
 html .st-topbar{-webkit-backdrop-filter:none;backdrop-filter:none}
 .st-topbar::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;-webkit-backdrop-filter:blur(20px) saturate(1.4);backdrop-filter:blur(20px) saturate(1.4)}
 .st-mobile-menu-panel{max-height:calc(100dvh - 78px - env(safe-area-inset-bottom));overscroll-behavior:contain}

 /* Chat: con una conversazione aperta la barra in basso si nasconde (copriva il campo per scrivere). */
 body:has(#st-messages-app.has-active-conversation) .st-bottom-nav{display:none}
 /* Elenco chat: l'altezza tiene conto della barra in basso. */
 body:has(#st-messages-app:not(.has-active-conversation)) .st-messages-layout{height:calc(100dvh - 130px - env(safe-area-inset-bottom));max-height:calc(100dvh - 130px - env(safe-area-inset-bottom))}
 body.admin-bar:has(#st-messages-app:not(.has-active-conversation)) .st-messages-layout{height:calc(100dvh - 196px - env(safe-area-inset-bottom));max-height:calc(100dvh - 196px - env(safe-area-inset-bottom))}

 /* Tomo Shop: i due pulsanti vanno a capo invece di tagliare il testo; le schede stanno nello schermo. */
 .st-shop-actions{flex-wrap:wrap}
 .st-shop-actions>.st-btn{flex:1 1 auto;min-width:0;padding-left:12px;padding-right:12px}
 .st-shop-tabs>button{padding-left:12px;padding-right:12px}

 /* Tomo TCG: il pulsante audio non esce più a destra; le schede scorrono se serve. */
 .stt-head-tools{width:100%;min-width:0;max-width:100%}
 .stt-head-tools>.stt-tabs{min-width:0;overflow-x:auto;scrollbar-width:none}
 .stt-head-tools>.stt-tabs::-webkit-scrollbar{display:none}

 /* Finestre e pannelli: mai più alti dello schermo. */
 dialog[open]{max-height:calc(100dvh - 16px);overflow-y:auto;overscroll-behavior:contain}
 .st-create-sheet[open]{max-height:100dvh}
}

/* Telefono in orizzontale (schermo basso): barre più compatte e più spazio ai contenuti. */
@media (max-width:760px) and (max-height:500px){
 .st-topbar{position:relative;top:auto!important;height:52px}
 .st-mobile-menu-panel{top:58px;max-height:calc(100dvh - 66px)}
 .st-bottom-nav{height:calc(50px + env(safe-area-inset-bottom));padding-top:2px}
 .st-bottom-nav>a,.st-bottom-nav>button{flex-direction:row;gap:6px}
 .st-bottom-create{width:42px!important;height:42px!important;transform:none}
 .st-shell{padding-bottom:calc(66px + env(safe-area-inset-bottom))}
 body:has(#st-messages-app:not(.has-active-conversation)) .st-messages-layout{height:calc(100dvh - 110px - env(safe-area-inset-bottom));max-height:calc(100dvh - 110px - env(safe-area-inset-bottom))}
 body:has(#st-messages-app.has-active-conversation) .st-messages-layout{height:calc(100dvh - 60px);max-height:calc(100dvh - 60px)}
 body.admin-bar:has(#st-messages-app:not(.has-active-conversation)) .st-messages-layout{height:calc(100dvh - 156px - env(safe-area-inset-bottom));max-height:calc(100dvh - 156px - env(safe-area-inset-bottom))}
 body.admin-bar:has(#st-messages-app.has-active-conversation) .st-messages-layout{height:calc(100dvh - 106px);max-height:calc(100dvh - 106px)}
 /* Elenco chat: titolo, ricerca e filtri scorrono insieme alle conversazioni. */
 .st-conversation-list{display:block;overflow-y:auto}
 .st-conversations-scroll{overflow:visible}
 .st-messenger-list-head{padding-top:8px}
 .st-conversation-head{min-height:0;padding-top:6px;padding-bottom:6px}
 .st-private-messages{padding-top:8px}
}

/* 3.20.1 — Gestisci Tomo Shop: posizione e ordine dei post. */
.st-shop-settings{width:min(560px,calc(100vw - 24px))}
.st-shop-order{display:grid;gap:10px;min-width:0;margin:4px 0 0;padding:12px;border:1px solid var(--st-border);border-radius:14px}
.st-shop-order legend{padding:0 6px;font-weight:700}
.st-shop-order>p{margin:0}
.st-shop-order-nums{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.st-shop-order-nums label{min-width:0}
.st-shop-order-hint{font-size:13px;color:var(--st-text)}
.st-shop-order-list{list-style:none;margin:0;padding:0;display:grid;gap:6px;max-height:min(340px,45dvh);overflow-y:auto;counter-reset:stso;overscroll-behavior:contain}
.st-shop-order-list li{counter-increment:stso;display:grid;grid-template-columns:22px 44px minmax(0,1fr) auto;align-items:center;gap:10px;padding:6px 8px;border:1px solid var(--st-border);border-radius:12px;background:var(--st-surface2)}
.st-shop-order-list li::before{content:counter(stso);font-weight:700;color:var(--st-muted);text-align:center}
.st-shop-order-thumb{width:44px;height:44px;border-radius:8px;overflow:hidden;display:grid;place-items:center;background:var(--st-surface);color:var(--st-muted);font-size:11px;font-weight:600}
.st-shop-order-thumb img{width:100%;height:100%;object-fit:cover}
.st-shop-order-text{min-width:0;display:grid;gap:2px}
.st-shop-order-text strong{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:14px}
.st-shop-order-text small{color:var(--st-muted);font-size:12px}
.st-shop-order-btns{display:flex;gap:4px}
.st-shop-order-btns .st-icon-btn{width:34px;height:34px;font-size:16px;font-weight:700}
.st-shop-order-btns .st-icon-btn:disabled{opacity:.35;cursor:default}
@media (max-width:420px){.st-shop-order-nums{grid-template-columns:1fr}.st-shop-order-list li{grid-template-columns:18px 40px minmax(0,1fr) auto;gap:8px}.st-shop-order-thumb{width:40px;height:40px}}
