/* =============================================================
   AURA Social — stile
   I colori sono "variabili" (token): cambiandoli qui in alto
   cambia l'aspetto di tutto il sito. Il tema chiaro li ridefinisce.
   ============================================================= */

:root {
    --bg: #0b1020;
    --surface: #121831;
    --surface-2: #1b2242;
    --border: #252c4d;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-2: #a78bfa;
    --accent-soft: rgba(124, 58, 237, .16);
    --like: #f43f5e;
    --blue: #60a5fa;
    --ring: linear-gradient(45deg, #f59e0b, #ec4899 45%, #7c3aed);
    --radius: 14px;
    --shadow: 0 10px 40px rgba(0, 0, 0, .35);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --sidebar: 244px;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f7f6fb;
    --surface: #ffffff;
    --surface-2: #f1eff8;
    --border: #e4e1ee;
    --text: #0f172a;
    --muted: #64748b;
    --accent-2: #7c3aed;
    --accent-soft: rgba(124, 58, 237, .09);
    --blue: #3b82f6;
    --shadow: 0 10px 40px rgba(15, 23, 42, .12);
    color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 var(--font);
    -webkit-font-smoothing: antialiased;
    transition: background .3s, color .3s;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
i { font-style: normal; display: inline-flex; }
h1, h2, h3 { line-height: 1.2; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.icon { width: 24px; height: 24px; flex: none; }
.icon.filled { fill: currentColor; }
.icon.xl { width: 80px; height: 80px; stroke-width: 1.2; }
.verified { width: 15px; height: 15px; color: var(--blue); vertical-align: -2px; margin-left: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 4px 8px; }

.logo {
    font-weight: 800;
    font-size: 28px;
    letter-spacing: .5px;
    background: linear-gradient(90deg, var(--accent-2), #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Pulsanti ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    padding: 9px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: background .2s, transform .15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.secondary:hover { background: var(--border); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent-2); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn .icon { width: 18px; height: 18px; }

.link { color: var(--accent-2); font-weight: 600; font-size: 14px; }
.link:hover { opacity: .75; }
.link.muted { color: var(--muted); font-weight: 400; }
.link.strong { font-weight: 700; }

.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    padding: 6px;
    border-radius: 10px;
    transition: transform .15s, opacity .15s;
}
.icon-btn:hover { opacity: .65; }
.icon-btn:active { transform: scale(.88); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.badge {
    position: absolute;
    top: 4px;
    left: 26px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--like);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

/* ---------- Avatar ---------- */
.avatar {
    --s: 32px;
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    flex: none;
    display: inline-grid;
    place-items: center;
}
.avatar img, .avatar > span {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: calc(var(--s) * .42);
}
.avatar.ring { padding: 3px; background: var(--ring); }
.avatar.ring.seen { background: var(--border); }
.avatar.ring img, .avatar.ring > span { border: 2px solid var(--bg); }

/* ---------- Layout app ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    padding: 28px 12px 20px;
    border-right: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    z-index: 20;
}
.sidebar .logo { padding: 0 12px 30px; display: block; }
.logo-mini { display: none; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a, .side-nav button, .side-bottom button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    width: 100%;
    border-radius: 12px;
    font-size: 16px;
    text-align: left;
    transition: background .2s;
}
.side-nav a:hover, .side-nav button:hover, .side-bottom button:hover { background: var(--surface-2); }
.side-nav .icon, .bottombar .icon { transition: transform .2s; }
.side-nav a:hover .icon { transform: scale(1.08); }
.active { font-weight: 700; }
.active .icon { stroke-width: 2.7; }
.active .nav-avatar .avatar { outline: 2px solid var(--text); outline-offset: 1px; }
.nav-avatar .avatar { --s: 26px !important; }

.view { margin-left: var(--sidebar); padding: 28px 24px 60px; min-height: 100vh; }
.topbar, .bottombar { display: none; }

/* ---------- Home ---------- */
.home { display: flex; justify-content: center; gap: 56px; max-width: 1000px; margin: 0 auto; }
.feed { width: 100%; max-width: 470px; min-width: 0; }
.side { width: 320px; flex: none; padding-top: 14px; position: sticky; top: 28px; align-self: flex-start; }
.feed-end { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14px; padding: 20px 0; }
.feed-end .icon { color: var(--accent-2); }

/* Storie */
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 16px; margin-bottom: 8px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; flex: none; }
.story > span { font-size: 12px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-btn { position: relative; border-radius: 50%; display: inline-grid; transition: transform .15s; }
.story-btn:active { transform: scale(.95); }
.story-add {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: 3px solid var(--bg);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
}

/* Post */
.post { margin-bottom: 22px; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ph-text { flex: 1; min-width: 0; font-size: 14px; }
.ph-text small { display: block; font-size: 12px; color: var(--muted); }
.ulink { font-weight: 650; }
.ulink:hover { opacity: .75; }
.post-media {
    position: relative;
    background: var(--surface-2);
    touch-action: manipulation;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.post-media img { width: 100%; max-height: 600px; object-fit: cover; }
.big-heart {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    color: #fff;
    opacity: 0;
}
.big-heart .icon { width: 110px; height: 110px; filter: drop-shadow(0 6px 20px rgba(0, 0, 0, .35)); }
.big-heart.show { animation: big-heart .9s ease forwards; }
@keyframes big-heart {
    0% { opacity: 0; transform: scale(.3); }
    15% { opacity: 1; transform: scale(1.15); }
    30% { transform: scale(.95); }
    45% { transform: scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}
.post-actions { display: flex; gap: 8px; padding: 6px 8px 2px; }
.post-actions .save { margin-left: auto; }
.like.liked { color: var(--like); }
.pop { animation: pop .4s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }
.post-body { padding: 2px 14px 4px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.post-body > * { max-width: 100%; overflow-wrap: anywhere; }
.caption.clamp { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag, .mention { color: var(--accent-2); }
.tag:hover, .mention:hover { text-decoration: underline; }
.comment-form { display: flex; align-items: center; gap: 8px; padding: 8px 14px 12px; border-top: 1px solid var(--border); margin-top: 10px; }
.comment-form input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 14px; padding: 6px 0; }
.comment-form input:placeholder-shown + button { opacity: .4; pointer-events: none; }

/* Pannello laterale */
.user-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; width: 100%; text-align: left; }
.ur-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.ur-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-title { color: var(--muted); font-weight: 600; font-size: 14px; margin: 20px 0 4px; }
.side-foot { margin-top: 26px; font-size: 12px; color: var(--muted); }

.aura-card {
    display: block;
    width: 100%;
    text-align: left;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-soft), rgba(236, 72, 153, .1));
    border: 1px solid var(--border);
    font-size: 13px;
    transition: border-color .2s;
}
.aura-card:hover { border-color: var(--accent-2); }
.aura-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.aura-top b { font-size: 15px; }
.aura-bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin: 8px 0 4px; overflow: hidden; }
.aura-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ec4899); border-radius: 3px; transition: width .5s; }

/* ---------- Esplora e griglie ---------- */
.explore, .profile { max-width: 935px; margin: 0 auto; }
.search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    color: var(--muted);
}
.search:focus-within { border-color: var(--accent-2); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 15px; color: var(--text); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { padding: 6px 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; transition: border-color .2s; }
.chip:hover { border-color: var(--accent-2); }
.tag-title { margin: 6px 0 14px; font-size: 22px; }
.tag-title small { font-size: 14px; font-weight: 400; }
.user-results { padding: 6px 14px; margin-bottom: 16px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; grid-auto-flow: dense; }
.tile { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); border-radius: 4px; }
.tile.big { grid-column: span 2; grid-row: span 2; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.tile-over {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(0, 0, 0, .4);
    color: #fff;
    font-weight: 700;
    opacity: 0;
    transition: opacity .2s;
}
.tile-over span { display: flex; align-items: center; gap: 6px; }
.tile-over .icon { width: 20px; height: 20px; }
.tile:hover .tile-over, .tile:focus-visible .tile-over { opacity: 1; }
.tile:hover img { transform: scale(1.04); }

/* Stato vuoto */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty h3 { margin: 10px 0 0; color: var(--text); font-size: 22px; }
.empty p { margin: 0 0 10px; max-width: 340px; }
.icon-circle { width: 84px; height: 84px; border: 2px solid var(--text); border-radius: 50%; display: grid; place-items: center; color: var(--text); }
.icon-circle .icon { width: 40px; height: 40px; stroke-width: 1.5; }

/* ---------- Notifiche ---------- */
.notifs { max-width: 600px; margin: 0 auto; padding: 22px; }
.notifs h2 { margin: 0 0 6px; }
.n-group { font-size: 15px; margin: 18px 0 6px; }
.n-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; font-size: 14px; }
.n-row.unread { background: var(--accent-soft); }
.n-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.n-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }

/* ---------- Messaggi ---------- */
.dm {
    max-width: 935px;
    margin: 0 auto;
    height: calc(100dvh - 88px);
    display: grid;
    grid-template-columns: 340px 1fr;
    overflow: hidden;
}
.dm-list { border-right: 1px solid var(--border); overflow-y: auto; padding: 16px 12px; }
.dm-head { font-size: 20px; font-weight: 700; padding: 4px 8px 10px; }
.label { font-weight: 700; font-size: 14px; margin: 10px 8px 6px; }
.dm-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; width: 100%; transition: background .15s; }
.dm-row:hover, .dm-row.active { background: var(--surface-2); }
.dm-row.unread small { color: var(--text); font-weight: 600; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-2); flex: none; }
.dm-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dm-empty { margin: auto; text-align: center; padding: 20px; display: flex; flex-direction: column; align-items: center; }
.dm-empty h3 { margin: 16px 0 4px; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.back-btn { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.chat-intro { text-align: center; margin: 8px auto 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chat-intro h3 { margin: 8px 0 0; }
.chat-intro p { margin: 0 0 8px; }
.msg { max-width: 72%; align-self: flex-start; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; animation: msg-in .2s ease; }
.msg p { margin: 0; padding: 9px 14px; border-radius: 20px; background: var(--surface-2); overflow-wrap: anywhere; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.out p { background: var(--accent); color: #fff; }
.msg.out p a { color: #fff; text-decoration: underline; }
.msg time { font-size: 11px; color: var(--muted); padding: 0 8px; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.typing { display: flex; gap: 4px; padding: 13px 15px; background: var(--surface-2); border-radius: 20px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-form { display: flex; gap: 10px; align-items: center; margin: 10px 16px 16px; padding: 6px 14px 6px 18px; border: 1px solid var(--border); border-radius: 24px; }
.chat-form:focus-within { border-color: var(--accent-2); }
.chat-form input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 6px 0; }
.chat-form input:placeholder-shown + button { opacity: .4; pointer-events: none; }
.shared-post { width: 230px; max-width: 100%; border-radius: 14px; overflow: hidden; background: var(--surface-2); text-align: left; border: 1px solid var(--border); }
.shared-post header { display: flex; gap: 8px; align-items: center; padding: 8px 10px; font-size: 13px; font-weight: 600; }
.shared-post img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.shared-post small { display: block; padding: 8px 10px; font-size: 12px; color: var(--muted); }

/* ---------- Profilo ---------- */
.profile-head { display: flex; gap: 64px; align-items: flex-start; padding: 10px 40px 36px; border-bottom: 1px solid var(--border); }
.ph-avatar { flex: none; }
.ph-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ph-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ph-row h2 { margin: 0 6px 0 0; font-size: 21px; font-weight: 500; }
.ph-buttons { display: flex; gap: 8px; align-items: center; }
.follows-you { font-size: 12px; background: var(--surface-2); padding: 3px 8px; border-radius: 6px; color: var(--muted); }
.ph-stats { display: flex; gap: 36px; list-style: none; margin: 0; padding: 0; font-size: 15px; }
.ph-stats button:hover { opacity: .7; }
.ph-bio { font-size: 14px; }
.ph-bio p { margin: 2px 0 0; overflow-wrap: anywhere; }
.profile .aura-card { max-width: 360px; margin-top: 0; }
.ph-tabs { display: flex; justify-content: center; gap: 56px; margin-bottom: 4px; }
.ph-tabs button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--muted);
    border-top: 1px solid transparent;
    margin-top: -1px;
}
.ph-tabs button.active { color: var(--text); border-top-color: var(--text); }
.ph-tabs .icon { width: 14px; height: 14px; }

/* ---------- Finestre (modal) ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .65);
    animation: fade .2s;
}
.modal-box {
    width: 100%;
    max-width: 420px;
    max-height: calc(100dvh - 40px);
    overflow: auto;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    animation: zoom .2s;
}
.modal-box.wide { max-width: 1020px; overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
@keyframes zoom { from { opacity: 0; transform: scale(.96); } }
.modal-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 50px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}
.modal-head > :first-child { justify-self: start; }
.modal-head > :last-child { justify-self: end; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-foot { padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.list-body { padding: 8px 16px; max-height: 60vh; overflow-y: auto; }

/* Post aperto */
.pm { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); height: min(88dvh, 720px); }
.pm-media { background: #000; min-height: 0; display: grid; }
.pm-media .post-media { display: grid; place-items: center; background: #000; min-height: 0; }
.pm-media .post-media img { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.pm-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); }
.pm-side .post-head { border-bottom: 1px solid var(--border); }
.pm-comments { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 16px; }
.c-row { display: flex; gap: 12px; font-size: 14px; }
.c-row p { margin: 0; overflow-wrap: anywhere; }
.c-row small { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; }
.c-row small .link { font-size: 12px; }
.pm-empty { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.pm-foot { border-top: 1px solid var(--border); padding-bottom: 6px; }
.pm-foot .likes, .pm-foot > small { display: block; padding: 0 14px; font-size: 14px; }
.pm-foot > small { font-size: 12px; margin-top: 2px; }
.pm .comment-form { margin-top: 0; }

/* Crea */
.seg { display: flex; margin: 14px auto 0; background: var(--surface-2); border-radius: 10px; padding: 3px; width: max-content; }
.seg button { padding: 6px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.dropzone {
    margin: 16px;
    min-height: 340px;
    border: 2px dashed var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 20px;
    color: var(--muted);
    transition: .2s;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone p { margin: 0; font-size: 19px; color: var(--text); }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.create-body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); height: min(80dvh, 640px); }
.create-preview { background: #000; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.create-preview img { max-width: 100%; max-height: 100%; object-fit: contain; transition: filter .25s; }
.create-side { padding: 16px; overflow-y: auto; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.create-side .label { margin: 0; }
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.filter { display: flex; flex-direction: column; gap: 4px; align-items: center; font-size: 11.5px; color: var(--muted); }
.filter img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 2px solid transparent; }
.filter.active { color: var(--text); font-weight: 700; }
.filter.active img { border-color: var(--accent); }
.create-author { display: flex; align-items: center; gap: 8px; font-size: 14px; }
#captionInput { min-height: 110px; resize: vertical; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; outline: 0; }
#captionInput:focus { border-color: var(--accent-2); }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin-top: -8px; }
.field { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.field:focus-within { border-color: var(--accent-2); }
.field input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; }
.field .icon { width: 18px; height: 18px; color: var(--muted); }

/* Form generici */
.form { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.form input, .form textarea, .login-form input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 12px;
    outline: 0;
    font-weight: 400;
    resize: vertical;
}
.form input:focus, .form textarea:focus, .login-form input:focus { border-color: var(--accent-2); }
.ep-avatar { display: flex; align-items: center; gap: 14px; background: var(--surface-2); padding: 12px; border-radius: 12px; }
.ep-avatar > div { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

.menu-list button { display: block; width: 100%; padding: 15px; border-bottom: 1px solid var(--border); font-size: 15px; transition: background .15s; }
.menu-list button:last-child { border-bottom: 0; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list .danger { color: var(--like); font-weight: 600; }

.aura-info { padding: 16px 20px 20px; font-size: 14px; }
.aura-info p { margin: 0 0 12px; }
.aura-info ul { list-style: none; padding: 0; margin: 0 0 12px; }
.aura-info li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); }
.aura-info li b { color: var(--accent-2); }

/* ---------- Accesso ---------- */
.login {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: radial-gradient(circle at 50% 30%, rgba(124, 58, 237, .25), transparent 60%);
}
.login-card { width: 100%; max-width: 380px; padding: 36px 30px; text-align: center; }
.logo.big { font-size: 56px; margin: 0 0 6px; }
.login-form { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.error { color: var(--like); font-size: 13px; min-height: 1em; margin: 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 20px 0 4px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-card .label { text-align: left; }
.as-btn { border-radius: 10px; padding: 8px; }
.as-btn:hover { background: var(--surface-2); }
.login-foot { font-size: 12px; margin-top: 16px; }

/* ---------- Visualizzatore storie ---------- */
.stories-viewer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8, 8, 16, .96); animation: fade .2s; }
.sv {
    position: relative;
    height: min(100dvh, 760px);
    width: min(100vw, calc(min(100dvh, 760px) * 9 / 16));
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    color: #fff;
}
.sv::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 120px; background: linear-gradient(rgba(0, 0, 0, .5), transparent); z-index: 2; pointer-events: none; }
.sv-img { width: 100%; height: 100%; object-fit: cover; }
.sv-bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: #fff; }
.bar.done i { width: 100%; }
.bar i.run { animation: fill var(--story-ms, 5s) linear forwards; }
.sv.paused .bar i.run { animation-play-state: paused; }
@keyframes fill { to { width: 100%; } }
.sv-head { position: absolute; top: 22px; left: 12px; right: 8px; display: flex; align-items: center; gap: 10px; z-index: 3; font-size: 14px; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.sv-head a { font-weight: 700; }
.sv-head small { opacity: .8; flex: 1; }
.sv-tap { position: absolute; top: 70px; bottom: 76px; z-index: 2; }
.sv-tap.prev { left: 0; width: 35%; }
.sv-tap.next { right: 0; width: 65%; }
.sv-foot { position: absolute; left: 12px; right: 12px; bottom: 14px; z-index: 3; display: flex; align-items: center; gap: 10px; }
.sv-foot input { flex: 1; min-width: 0; background: rgba(0, 0, 0, .2); border: 1px solid rgba(255, 255, 255, .6); border-radius: 24px; padding: 10px 16px; color: #fff; outline: 0; }
.sv-foot input::placeholder { color: rgba(255, 255, 255, .8); }
.sv-foot span { flex: 1; font-size: 14px; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.sv .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .6); }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); animation: toast-in .25s ease; transition: .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* =============================================================
   RESPONSIVE
   ============================================================= */

/* Tablet: barra laterale solo icone */
@media (max-width: 1180px) {
    :root { --sidebar: 76px; }
    .sidebar .logo, .side-nav span, .side-bottom span { display: none; }
    .logo-mini {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        margin: 0 4px 26px;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--accent), #ec4899);
        color: #fff;
        font-weight: 800;
        font-size: 22px;
    }
    .side { display: none; }
}

/* Mobile */
@media (max-width: 767px) {
    .sidebar { display: none; }
    .topbar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 10px 0 16px;
        align-items: center;
        justify-content: space-between;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        z-index: 20;
    }
    .topbar .logo { font-size: 24px; }
    .topbar-actions { display: flex; gap: 4px; }
    .topbar .badge, .bottombar .badge { top: 0; left: auto; right: 0; }
    .bottombar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        justify-content: space-around;
        align-items: center;
        background: var(--bg);
        border-top: 1px solid var(--border);
        z-index: 20;
    }
    .bottombar a, .bottombar button { position: relative; padding: 10px 14px; display: grid; place-items: center; }

    .view { margin-left: 0; padding: 64px 0 76px; }
    .post { border-radius: 0; border-left: 0; border-right: 0; margin-bottom: 8px; }
    .stories { padding: 4px 12px 12px; }
    .explore { padding: 0 4px; }
    .search, .tags { margin-left: 8px; margin-right: 8px; }
    .tag-title { margin-left: 12px; }
    .grid { gap: 2px; }
    .tile { border-radius: 0; }
    .notifs { border-radius: 0; border-left: 0; border-right: 0; padding: 16px; }

    .dm { height: calc(100dvh - 132px); grid-template-columns: 1fr; border-radius: 0; border-left: 0; border-right: 0; }
    .dm.has-chat .dm-list { display: none; }
    .dm:not(.has-chat) .dm-chat { display: none; }
    .dm-list { border-right: 0; }
    .back-btn { display: inline-grid; }
    .msg { max-width: 85%; }

    .profile-head { gap: 20px; padding: 4px 16px 20px; }
    .ph-avatar .avatar { --s: 88px !important; }
    .ph-info { gap: 12px; }
    .ph-stats { gap: 18px; font-size: 14px; }
    .ph-tabs { gap: 40px; }

    .modal { padding: 0; }
    .modal-box { max-width: none; max-height: 100dvh; height: 100dvh; border-radius: 0; }
    .modal-box:not(.wide) { height: auto; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); border-radius: 16px; }
    .pm { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
    .pm-media .post-media img { max-height: 42dvh; }
    .pm-side { border-left: 0; }
    .create-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 51px); }
    .create-preview img { max-height: 38dvh; }
    .create-side { border-left: 0; }
    .sv { border-radius: 0; }
    .toasts { bottom: 76px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =============================================================
   NUOVE FUNZIONI v2 — Caroselli, Reels, Sfide, Evidenze, Privacy
   ============================================================= */

/* ---------- Foto e caroselli ---------- */
.post-media > img, .car-track > img { width: 100%; aspect-ratio: var(--ar, 1); max-height: none; object-fit: cover; }
.carousel { overflow: hidden; }
.car-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.car-track::-webkit-scrollbar { display: none; }
.car-track > img { flex: 0 0 100%; scroll-snap-align: start; }
.car-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .85);
    color: #111;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    opacity: .9;
    transition: opacity .2s, transform .2s;
}
.car-nav:hover { opacity: 1; transform: translateY(-50%) scale(1.08); }
.car-nav .icon { width: 18px; height: 18px; stroke-width: 2.6; }
.car-nav.prev { left: 10px; }
.car-nav.next { right: 10px; }
.car-count {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 9px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
.car-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; pointer-events: none; }
.car-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); transition: background .2s, transform .2s; }
.car-dots i.on { background: #fff; transform: scale(1.15); }

/* ---------- Reel (nel feed e ovunque) ---------- */
.reel-media { aspect-ratio: 4 / 5; overflow: hidden; background: #000; }
.reel-media video, .reel-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.reel-art { overflow: hidden; }
.reel-media img, .reel-media video { max-height: none; }
.reel-art img { width: 100%; height: 100%; object-fit: cover; animation: kenburns 9s ease-in-out infinite alternate; }
.is-paused .reel-art img { animation-play-state: paused; }
@keyframes kenburns {
    0% { transform: scale(1.05) translate(0, 0); }
    50% { transform: scale(1.25) translate(-4%, 3%) rotate(-1.5deg); }
    100% { transform: scale(1.12) translate(4%, -3%) rotate(1.5deg); }
}
.reel-badge, .sound-btn {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(0, 0, 0, .45);
}
.reel-badge { top: 12px; right: 12px; pointer-events: none; }
.sound-btn { bottom: 12px; right: 12px; z-index: 2; }
.reel-badge .icon, .sound-btn .icon { width: 18px; height: 18px; }
.paused-ico {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.paused-ico .icon { width: 64px; height: 64px; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .4)); }
.is-paused .paused-ico { opacity: .9; }

/* ---------- Pagina Reels ---------- */
.reels {
    height: calc(100dvh - 56px);
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    margin: -14px auto 0;
}
.reels::-webkit-scrollbar { display: none; }
.reel {
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 14px;
    padding: 10px 0;
}
.reel-stage { position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: 100%; border-radius: 12px; overflow: hidden; background: #000; }
.reel-stage .reel-media { aspect-ratio: auto; height: 100%; }
.reel-stage .reel-badge { display: none; }
.reel-stage .sound-btn { top: 12px; bottom: auto; }
.reel-info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 60px 14px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .65));
    color: #fff;
    font-size: 14px;
    pointer-events: none;
}
.reel-info a, .reel-info button { pointer-events: auto; }
.reel-user { display: flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }
.reel-user .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .7); padding: 4px 12px; }
.reel-cap { margin: 8px 0 6px; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.reel-cap a { color: #fff; font-weight: 600; }
.reel-audio { opacity: .9; font-size: 12.5px; }
.reel-side { display: flex; flex-direction: column; gap: 18px; padding-bottom: 12px; }
.rs-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; transition: transform .15s; }
.rs-btn:active { transform: scale(.88); }
.rs-btn .icon { width: 28px; height: 28px; }
.rs-btn.liked { color: var(--like); }
.rs-btn.liked span { color: var(--text); }

/* ---------- Griglie: icone e video ---------- */
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile-ico { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); pointer-events: none; }
.tile-ico .icon { width: 20px; height: 20px; }
.n-thumb { display: block; }
video.n-thumb { background: #000; }
.shared-post video { width: 100%; aspect-ratio: 1; object-fit: cover; }
.shared-post header .icon { width: 16px; height: 16px; margin-left: auto; }

/* ---------- Pannello laterale ---------- */
.side-rank { display: block; margin-top: 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); font-size: 13px; transition: border-color .2s; }
.side-rank:hover { border-color: var(--accent-2); }

/* ---------- Richieste di follow ---------- */
.req-btns { display: flex; gap: 6px; }
.req-banner { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 10px 0; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.req-banner .icon { width: 18px; height: 18px; }
.chat-blocked { text-align: center; padding: 16px; margin: 0; border-top: 1px solid var(--border); }
.lock-ico .icon { width: 18px; height: 18px; vertical-align: -2px; margin-right: 6px; }

/* ---------- Sfide ---------- */
.challenges { max-width: 935px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ch-hero { grid-column: 1 / -1; display: flex; align-items: center; gap: 28px; padding: 18px 22px; flex-wrap: wrap; background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.ch-flame { display: flex; align-items: center; gap: 10px; }
.flame { font-size: 40px; animation: flicker 1.6s ease-in-out infinite; }
@keyframes flicker { 50% { transform: scale(1.08) rotate(-3deg); } }
.ch-flame b, .ch-stat b { display: block; font-size: 20px; }
.ch-stat { text-align: center; }
.ch-stat small, .ch-flame small { font-size: 12px; }
.ch-aura { flex: 1; min-width: 240px; }
.ch-aura .aura-card { margin: 0; }
.ch-block { padding: 18px; }
.ch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ch-head h2 { margin: 0; font-size: 17px; }
.ch-head small { font-size: 12px; }
.ch-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ch-row:last-child { border-bottom: 0; }
.ch-row.claimed { opacity: .55; }
.ch-emoji { font-size: 24px; width: 32px; text-align: center; }
.ch-text { flex: 1; min-width: 0; font-size: 14px; }
.ch-text .aura-bar { margin: 6px 0 3px; }
.ch-text small { font-size: 12px; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; font-size: 14px; }
.rank-row.me { background: var(--accent-soft); }
.rank { width: 30px; text-align: center; font-weight: 700; font-size: 15px; }
.rank-sep { text-align: center; color: var(--muted); }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 12px 6px; border-radius: 12px; background: var(--surface-2); }
.badge-card span { font-size: 30px; }
.badge-card b { font-size: 13px; }
.badge-card small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.badge-card.locked { opacity: .5; }
.badge-card.locked span { filter: grayscale(1); }
.aura-list { list-style: none; padding: 0; margin: 0 0 10px; font-size: 14px; }
.aura-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.aura-list li b { color: var(--accent-2); }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 20px; width: fit-content; }
.badge-row em { font-style: normal; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); }

/* ---------- Storie in evidenza ---------- */
.highlights { display: flex; gap: 22px; overflow-x: auto; padding: 22px 40px 6px; scrollbar-width: none; }
.highlights::-webkit-scrollbar { display: none; }
.hl { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 78px; }
.hl span { font-size: 12px; font-weight: 600; max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-btn { width: 74px; height: 74px; border-radius: 50%; padding: 3px; border: 1px solid var(--border); background: var(--bg); overflow: hidden; transition: transform .15s; }
.hl-btn:hover { transform: scale(1.04); }
.hl-btn img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.hl-btn.new { display: grid; place-items: center; color: var(--muted); border-style: dashed; }
.hl-btn.new .icon { width: 30px; height: 30px; stroke-width: 1.5; }
.hl-form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.hl-form .label { margin: 0; }
.text-input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; outline: 0; }
.text-input:focus { border-color: var(--accent-2); }
.hl-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 46vh; overflow-y: auto; }
.hl-item { position: relative; aspect-ratio: 9 / 14; border-radius: 8px; overflow: hidden; border: 2px solid transparent; transition: border-color .15s; }
.hl-item img { width: 100%; height: 100%; object-fit: cover; }
.hl-item small { position: absolute; left: 6px; bottom: 5px; color: #fff; font-size: 11px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.hl-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; color: transparent; background: rgba(0, 0, 0, .25); }
.hl-check .icon { width: 14px; height: 14px; stroke-width: 3; }
.hl-item.on { border-color: var(--accent); }
.hl-item.on .hl-check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Crea: più foto, reel, filtri testo ---------- */
.seg button { padding: 6px 16px; }
.draft-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; flex: none; }
.dthumb { position: relative; flex: none; width: 58px; height: 58px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; }
.dthumb.active { border-color: var(--accent); }
.dthumb > button:first-child, .dthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dthumb-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; }
.dthumb-x .icon { width: 11px; height: 11px; stroke-width: 3; }
.dthumb.add { display: grid; place-items: center; border: 1px dashed var(--border); color: var(--muted); font-size: 20px; background: var(--surface-2); }
.dthumb.add .icon { width: 22px; height: 22px; }
.filter.text { justify-content: center; min-height: 40px; border-radius: 8px; background: var(--surface-2); border: 2px solid transparent; }
.filter.text.active { border-color: var(--accent); }
.create-preview { position: relative; }
.create-preview video { max-width: 100%; max-height: 100%; }
.create-preview.is-reel .reel-art, .create-preview.is-reel video { height: 100%; width: auto; aspect-ratio: 9 / 16; object-fit: cover; }

/* Post aperto: reel */
.pm.is-reel .pm-media .reel-media { aspect-ratio: auto; height: 100%; }
.pm.is-reel .pm-media .reel-media video { object-fit: contain; }

/* ---------- Impostazioni / form ---------- */
.menu-list a { display: block; width: 100%; padding: 15px; border-bottom: 1px solid var(--border); font-size: 15px; text-align: center; transition: background .15s; }
.menu-list a:hover { background: var(--surface-2); }
.switch-row { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.switch-row span { display: flex; flex-direction: column; gap: 2px; }
.switch-row small { font-weight: 400; font-size: 12px; }
.switch-row input {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 46px;
    height: 26px;
    padding: 0 !important;
    border-radius: 13px !important;
    background: var(--border) !important;
    border: 0 !important;
    position: relative;
    cursor: pointer;
    transition: background .2s;
}
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-row input:checked { background: var(--accent) !important; }
.switch-row input:checked::after { transform: translateX(20px); }

/* ---------- Accesso ---------- */
.test-box { margin-top: 18px; padding: 12px; border-radius: 12px; border: 1px dashed var(--accent-2); background: var(--accent-soft); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; }
.test-box span { font-family: ui-monospace, Menlo, monospace; }
.test-box .btn { margin-top: 6px; }
.login-switch { width: 100%; max-width: 380px; margin-top: 10px; padding: 18px; text-align: center; font-size: 14px; }

/* ---------- Responsive delle nuove parti ---------- */
@media (max-width: 1180px) {
    .challenges { grid-template-columns: 1fr; max-width: 600px; }
}
@media (max-width: 767px) {
    .reels { height: calc(100dvh - 120px - env(safe-area-inset-bottom)); margin: 0; }
    .reel { padding: 0; position: relative; }
    .reel-stage { width: 100%; aspect-ratio: auto; border-radius: 0; }
    .reel-side { position: absolute; right: 8px; bottom: 90px; color: #fff; z-index: 3; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
    .rs-btn.liked span { color: #fff; }
    .reel-info { padding-right: 64px; }
    .challenges { padding: 0 10px; gap: 10px; }
    .ch-hero { gap: 18px; padding: 16px; }
    .badge-grid { grid-template-columns: repeat(2, 1fr); }
    .highlights { padding: 14px 16px 4px; gap: 14px; }
    .hl { width: 66px; }
    .hl-btn { width: 62px; height: 62px; }
    .ph-buttons { width: 100%; }
    .ph-buttons .btn { flex: 1; }
    .create-side { gap: 10px; }
}

/* =============================================================
   v3 — Server locale: avviso nuovi post, server spento
   ============================================================= */
.new-pill {
    position: sticky;
    top: 12px;
    z-index: 5;
    display: block;
    margin: 0 auto 12px;
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow);
    animation: toast-in .25s ease;
}
.new-pill:hover { background: var(--accent-hover); }
.offline { display: flex; flex-direction: column; gap: 10px; }
.offline p { margin: 0; }
.offline code {
    display: block;
    padding: 12px;
    border-radius: 10px;
    background: var(--surface-2);
    font-family: ui-monospace, Menlo, monospace;
    font-size: 15px;
}
@media (max-width: 767px) {
    .new-pill { top: 68px; }
}

/* ---------- Apri sul telefono ---------- */
.phone-box { padding: 18px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.phone-box p { margin: 0; }
.qr-box { padding: 12px; background: #fff; border-radius: 14px; min-width: 204px; min-height: 204px; display: grid; place-items: center; }
.qr-box img, .qr-box canvas { display: block; }
.phone-steps { text-align: left; margin: 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.phone-url { font-family: ui-monospace, Menlo, monospace; font-size: 18px; font-weight: 700; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); user-select: all; word-break: break-all; }

/* =============================================================
   Online: consenso privacy, segnalazioni, moderazione
   ============================================================= */
.consent { display: flex; align-items: flex-start; gap: 10px; text-align: left; font-size: 13px; color: var(--muted); padding: 4px 2px; cursor: pointer; }
.consent input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.consent a, .login-foot a, .side-foot a { color: var(--accent-2); text-decoration: underline; }
.danger-btn { background: var(--like) !important; color: #fff !important; }
.danger-btn:hover { filter: brightness(1.1); }
.report-box { padding: 16px 0 0; }
.report-box > p { margin: 0 20px 6px; }
.report-box .menu-list { margin-top: 10px; border-top: 1px solid var(--border); }
.report-box .menu-list button { text-align: left; padding: 14px 20px; }
.pill-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: var(--like); color: #fff; font-size: 12px; }
.admin { max-width: 700px; margin: 0 auto; padding: 20px; }
.admin h2 { margin: 0; }
.admin-row { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.admin-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.admin-target { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.admin-target p { margin: 0; overflow-wrap: anywhere; }
.admin-target img, .admin-target video { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.admin-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 767px) { .admin { border-radius: 0; border-left: 0; border-right: 0; } }

/* ---------- Codice via email ---------- */
.auth-title { margin: 14px 0 6px; font-size: 20px; }
.code-input {
    text-align: center;
    font-size: 30px !important;
    font-weight: 800;
    letter-spacing: 12px;
    padding: 14px 10px 14px 22px !important;
    font-family: ui-monospace, Menlo, monospace;
}
.code-input::placeholder { color: var(--border); }
.login-card .forgot, .login-card .resend { display: block; margin: 14px auto 0; font-size: 14px; }
.login-card .resend:disabled { color: var(--muted); cursor: default; }

/* ---------- Profili demo ---------- */
.demo-tag {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .5px;
    vertical-align: 1px;
    color: var(--muted);
    border: 1px solid var(--border);
    line-height: 1.4;
}
.reel-info .demo-tag, .sv-head .demo-tag { color: #fff; border-color: rgba(255, 255, 255, .5); }
.demo-note { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }

/* ---------- App installabile e notifiche ---------- */
.app-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 10px 10px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-soft), rgba(236, 72, 153, .12));
    border: 1px solid var(--border);
    font-size: 14px;
}
.app-banner img { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.app-banner span { flex: 1; min-width: 0; }
.app-banner .icon-btn .icon { width: 18px; height: 18px; }
.install-box { padding: 18px 20px 20px; text-align: center; }
.install-box p { margin: 0 0 12px; }
.install-box ol { text-align: left; margin: 0 0 16px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.install-icon { width: 72px; height: 72px; border-radius: 16px; margin: 0 auto 12px; }
.ios-share { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); font-size: 13px; }
@media (max-width: 767px) { .app-banner { margin: 0 10px 10px; } }
/* Su iPhone installato: spazio per la "tacca" in alto */
@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 767px) and (display-mode: standalone) {
        .topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
        .view { padding-top: calc(64px + env(safe-area-inset-top)); }
    }
}

/* =============================================================
   v6 — Commenti, chat, storie, account, backup, nuovo accesso
   ============================================================= */

/* ---------- Commenti: Mi piace e risposte ---------- */
.c-row { align-items: flex-start; }
.c-body { flex: 1; min-width: 0; }
.c-row.reply { margin-left: 44px; }
.c-row small span { color: var(--muted); }
.c-like { flex: none; padding: 4px; margin-top: 2px; color: var(--muted); transition: transform .15s; }
.c-like .icon { width: 14px; height: 14px; }
.c-like.liked { color: var(--like); }
.c-like:active { transform: scale(.8); }
.reply-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 14px; font-size: 13px; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border); }
.reply-chip .icon { width: 14px; height: 14px; }

/* ---------- Chat: foto, vocali, visualizzato ---------- */
.chat-form { padding-left: 6px; gap: 6px; }
.chat-form input:placeholder-shown + button { opacity: 1; pointer-events: auto; }
.chat-form input:placeholder-shown ~ .send { opacity: .4; pointer-events: none; }
.chat-tool { color: var(--muted); font-size: 18px; min-width: 34px; }
.chat-tool .icon { width: 22px; height: 22px; }
.chat-tool.mic.recording { color: #fff; background: var(--like); border-radius: 18px; padding: 4px 10px; font-size: 13px; font-weight: 700; animation: rec 1.2s ease-in-out infinite; }
@keyframes rec { 50% { opacity: .75; } }
.msg-img { max-width: 240px; max-height: 320px; border-radius: 16px; display: block; object-fit: cover; }
.msg-audio { width: 240px; max-width: 70vw; height: 40px; }
.seen { align-self: flex-end; font-size: 11px; color: var(--muted); margin: -2px 8px 4px; }

/* ---------- Storie: testo, sticker, sondaggio ---------- */
.story-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); box-shadow: inset 0 0 0 2px var(--surface); }
.swatch.on { border-color: var(--accent-2); transform: scale(1.12); }
.chip-btn { padding: 5px 12px; border-radius: 14px; border: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.small-seg { margin: 0; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
.small-seg button { padding: 6px 0; }
.stickers { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.sticker { font-size: 22px; padding: 6px 0; border-radius: 10px; border: 2px solid transparent; background: var(--surface-2); transition: transform .15s; }
.sticker:hover { transform: scale(1.08); }
.sticker.on { border-color: var(--accent); }
.poll-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.create-preview.is-story { position: relative; }
.create-preview.is-story > img { width: 100%; height: 100%; object-fit: cover; }

.story-layer {
    position: absolute;
    inset: 70px 16px 80px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    pointer-events: none;
    text-align: center;
}
.create-preview .story-layer { inset: 16px; }
.story-layer.pos-top { justify-content: flex-start; }
.story-layer.pos-middle { justify-content: center; }
.story-layer.pos-bottom { justify-content: flex-end; }
.story-sticker { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); animation: sticker-in .4s ease; }
@keyframes sticker-in { from { transform: scale(.4) rotate(-15deg); opacity: 0; } }
.story-text { font-size: 24px; font-weight: 800; line-height: 1.25; padding: 4px 10px; border-radius: 10px; max-width: 100%; overflow-wrap: anywhere; text-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
.story-text.bg-dark { background: rgba(0, 0, 0, .6); text-shadow: none; }
.story-text.bg-light { background: rgba(255, 255, 255, .92); text-shadow: none; }
.story-poll { pointer-events: auto; width: min(260px, 100%); background: #fff; color: #111; border-radius: 16px; padding: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 8px; }
.poll-q { font-weight: 800; font-size: 16px; }
.poll-opt { position: relative; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; background: #f1f1f4; color: #111; font-weight: 700; overflow: hidden; }
button.poll-opt:hover:not(:disabled) { background: #e7e3fb; }
.poll-opt.result { justify-content: space-between; }
.poll-opt.result i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #c4b5fd, #f9a8d4); transition: width .6s ease; }
.poll-opt.result span, .poll-opt.result b { position: relative; }
.poll-opt.mine { outline: 2px solid #7c3aed; }
.story-poll small { color: #666; font-size: 12px; }

/* ---------- Profilo: link ---------- */
.ph-link { display: inline-block; margin-top: 4px; color: var(--accent-2); font-weight: 600; font-size: 14px; }
.ph-link:hover { text-decoration: underline; }

/* ---------- Account ---------- */
.account { padding: 6px 18px 18px; }
.account section { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.account section:last-child { border-bottom: 0; }
.account h4 { margin: 0; font-size: 15px; }
.account p { margin: 0; }
.inline-form { display: flex; gap: 8px; }
.stack-form { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.stack-form .btn, .inline-form .btn { align-self: flex-start; }
.account input, .input-prefix { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; outline: 0; }
.account input:focus, .input-prefix:focus-within { border-color: var(--accent-2); }
.input-prefix { display: flex; align-items: center; flex: 1; min-width: 0; padding: 0 0 0 12px; }
.input-prefix span { color: var(--muted); }
.input-prefix input { border: 0; background: none; flex: 1; min-width: 0; padding-left: 2px; }
.small-code { font-size: 22px !important; letter-spacing: 8px; }

/* ---------- Copie di sicurezza ---------- */
.backup-box { margin: 14px 0 6px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.backup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.backup-head div { display: flex; flex-direction: column; gap: 2px; }
.backup-head small { font-size: 12px; }
.backup-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.backup-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.backup-list li span { flex: 1; font-family: ui-monospace, Menlo, monospace; }
.admin-sub { margin: 18px 0 4px; font-size: 16px; }

/* ---------- Nuova pagina di accesso ---------- */
.login {
    position: relative;
    overflow: hidden;
    padding: 0;
    background:
        radial-gradient(60vmax 60vmax at 10% 10%, rgba(124, 58, 237, .28), transparent 60%),
        radial-gradient(50vmax 50vmax at 95% 85%, rgba(236, 72, 153, .22), transparent 60%),
        var(--bg);
}
.login::before, .login::after {
    content: "";
    position: absolute;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .35;
    pointer-events: none;
    animation: blob 18s ease-in-out infinite alternate;
}
.login::before { background: #7c3aed; top: -18vmax; left: -12vmax; }
.login::after { background: #ec4899; bottom: -20vmax; right: -14vmax; animation-delay: -9s; }
@keyframes blob { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

.auth {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1060px;
    min-height: 100dvh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    gap: 40px;
    padding: 32px 24px;
}
.auth-panel { display: flex; flex-direction: column; align-items: center; }
.login .login-card {
    max-width: 400px;
    padding: 34px 32px 28px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-color: color-mix(in srgb, var(--accent-2) 25%, var(--border));
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .03) inset;
}
.login .login-switch { max-width: 400px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.login .logo.big { font-size: 60px; filter: drop-shadow(0 6px 24px rgba(167, 139, 250, .45)); }
.login-form input { padding: 13px 14px; }
.login-form .btn.block {
    padding: 13px;
    font-size: 15px;
    background: linear-gradient(90deg, #7c3aed, #a855f7 50%, #ec4899);
    background-size: 200% 100%;
    transition: background-position .4s, transform .15s, box-shadow .2s;
    box-shadow: 0 8px 24px rgba(124, 58, 237, .35);
}
.login-form .btn.block:hover { background-position: 100% 0; }

.auth-hero { position: relative; display: flex; flex-direction: column; gap: 26px; }
.hero-tag { margin: 0; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.12; font-weight: 800; letter-spacing: -.5px; }
.hero-tag span { background: linear-gradient(90deg, var(--accent-2), #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-points { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 15px; }
.hero-points b { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 8px; border-radius: 9px; background: var(--surface-2); }
.hero-stage { position: relative; height: 430px; }
.phone {
    position: absolute;
    left: 50%;
    top: 0;
    width: 220px;
    height: 430px;
    transform: translateX(-50%) rotate(-4deg);
    border-radius: 38px;
    padding: 10px;
    background: #05070f;
    box-shadow: 0 40px 80px rgba(0, 0, 0, .5), 0 0 0 2px #262d4a inset;
    animation: phone-float 6s ease-in-out infinite;
}
@keyframes phone-float { 50% { transform: translateX(-50%) rotate(-2deg) translateY(-10px); } }
.phone-notch { position: absolute; top: 14px; left: 50%; width: 70px; height: 18px; transform: translateX(-50%); border-radius: 12px; background: #000; z-index: 2; }
.phone-screen { height: 100%; border-radius: 30px; overflow: hidden; background: #0b1020; padding: 34px 10px 10px; display: flex; flex-direction: column; gap: 10px; }
.pm-top { display: flex; justify-content: space-between; align-items: center; color: #fff; font-size: 12px; padding: 0 4px; }
.pm-top .logo { padding-left: 2px; }
.pm-top .logo { font-size: 16px; }
.pm-stories { display: flex; gap: 6px; }
.pm-stories span { width: 34px; height: 34px; border-radius: 50%; padding: 2px; background: var(--ring); }
.pm-stories img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid #0b1020; object-fit: cover; }
.pm-post { border-radius: 14px; overflow: hidden; background: #121831; }
.pm-post-head { display: flex; align-items: center; gap: 6px; padding: 7px 8px; color: #fff; font-size: 10px; }
.pm-post-head i { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, #0ea5e9, #22d3ee); }
.pm-post img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.pm-post-actions { padding: 6px 8px 2px; font-size: 12px; color: #fff; letter-spacing: 4px; }
.pm-post-actions .heart { color: #f43f5e; animation: beat 1.6s ease-in-out infinite; display: inline-block; }
@keyframes beat { 15%, 35% { transform: scale(1.3); } 25% { transform: scale(1); } }
.pm-lines { padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.pm-lines i { height: 6px; border-radius: 3px; background: #252c4d; }
.pm-lines i:last-child { width: 60%; }
.float-card {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
    animation: card-float 5s ease-in-out infinite;
    white-space: nowrap;
}
.float-card img { width: 30px; height: 30px; border-radius: 50%; }
.fc1 { top: 40px; left: 2%; }
.fc2 { top: 190px; right: 0; animation-delay: -1.7s; }
.fc3 { bottom: 30px; left: 8%; animation-delay: -3.3s; }
@keyframes card-float { 50% { transform: translateY(-12px); } }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; padding: 28px 16px; gap: 0; }
    .auth-hero { display: none; }
}
@media (max-width: 767px) {
    .c-row.reply { margin-left: 30px; }
    .msg-img, .msg-audio { max-width: 62vw; }
}

/* =============================================================
   v7 — Navigazione più chiara e campo password con l'occhio
   ============================================================= */

/* ---------- Barra laterale (computer) ---------- */
.sidebar { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 55%, var(--bg)), var(--bg) 70%); }
.side-nav a, .side-nav button, .side-bottom button { color: var(--muted); font-weight: 500; }
.side-nav a:hover, .side-nav button:hover, .side-bottom button:hover { color: var(--text); }
.side-nav a.active { color: var(--text); background: var(--accent-soft); font-weight: 700; }
.side-nav a.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(var(--accent-2), #ec4899);
}
.side-nav a.active .icon { color: var(--accent-2); }
.side-nav span small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.2; }
.side-nav [data-route="profile"] { margin-top: 6px; padding-top: 10px; padding-bottom: 10px; }
.side-nav .side-create {
    margin-top: 10px;
    justify-content: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(90deg, #7c3aed, #a855f7 55%, #ec4899);
    box-shadow: 0 10px 26px rgba(124, 58, 237, .35);
}
.side-nav .side-create:hover { background: linear-gradient(90deg, #7c3aed, #a855f7 55%, #ec4899); filter: brightness(1.1); color: #fff; }
.side-nav .side-create .icon { stroke-width: 2.4; }
.side-bottom { border-top: 1px solid var(--border); padding-top: 10px; }

/* ---------- Barre del telefono: effetto vetro, si nascondono scorrendo ---------- */
@media (max-width: 767px) {
    .topbar, .bottombar {
        background: color-mix(in srgb, var(--bg) 78%, transparent);
        backdrop-filter: blur(18px) saturate(1.4);
        -webkit-backdrop-filter: blur(18px) saturate(1.4);
        transition: transform .3s ease;
    }
    body.bars-hidden .topbar { transform: translateY(-105%); }
    body.bars-hidden .bottombar { transform: translateY(105%); }
    .bottombar a { color: var(--muted); }
    .bottombar a.active { color: var(--text); }
    .bottombar a.active .icon { color: var(--accent-2); }
    .bottombar a.active::after {
        content: "";
        position: absolute;
        bottom: 3px;
        left: 50%;
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: var(--accent-2);
        transform: translateX(-50%);
    }
    .bottombar .nav-create {
        width: 50px;
        height: 38px;
        padding: 0;
        border-radius: 14px;
        color: #fff;
        background: linear-gradient(135deg, #7c3aed, #ec4899);
        box-shadow: 0 6px 18px rgba(124, 58, 237, .45);
    }
    .bottombar .nav-create:active { transform: scale(.92); }
    .bottombar .nav-create .icon { stroke-width: 2.4; }
    .topbar .icon-btn.active .icon { color: var(--accent-2); }
}

/* ---------- Cambio pagina morbido ---------- */
.view.enter { animation: view-in .28s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Password con l'occhio ---------- */
.pw-field { position: relative; display: flex; }
.pw-field input { flex: 1; min-width: 0; padding-right: 48px !important; }
.pw-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px;
    border-radius: 8px;
    color: var(--muted);
    display: grid;
    place-items: center;
}
.pw-eye:hover { color: var(--text); background: var(--surface-2); }
.pw-eye .icon { width: 20px; height: 20px; }

/* =============================================================
   v8 — Più vita: animazioni, storie rinnovate, chi ha visto
   ============================================================= */

/* ---------- Anello delle storie che ruota ---------- */
.avatar.ring { position: relative; background: none; isolation: isolate; }
.avatar.ring::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(#f59e0b, #ec4899, #7c3aed, #22d3ee, #f59e0b);
    animation: ring-spin 3.5s linear infinite;
    z-index: -1;
}
.avatar.ring.seen::before { background: var(--border); animation: none; }
@keyframes ring-spin { to { transform: rotate(360deg); } }
.story-btn:hover .avatar.ring:not(.seen)::before { animation-duration: 1.2s; }

/* "+" per aggiungere una storia, sempre visibile */
.story-wrap { position: relative; }
.story-wrap .story-add { cursor: pointer; transition: transform .2s; }
.story-wrap .story-add:hover { transform: scale(1.15) rotate(90deg); }

/* ---------- Esplosione di cuoricini ---------- */
.burst { position: fixed; z-index: 200; pointer-events: none; width: 0; height: 0; }
.burst i {
    position: absolute;
    left: 0;
    top: 0;
    font-style: normal;
    font-size: calc(16px * var(--s, 1));
    color: var(--like);
    transform: translate(-50%, -50%) scale(.2);
    animation: burst-out .8s cubic-bezier(.2, .8, .3, 1) forwards;
}
@keyframes burst-out {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(.2) rotate(0); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y) - 14px)) scale(1) rotate(var(--r)); }
}

/* Mi piace, salva, numeri che scattano */
.like.liked .icon, .rs-btn.liked .icon { filter: drop-shadow(0 0 6px rgba(244, 63, 94, .55)); }
.pop { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(1); } 30% { transform: scale(.7); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
.saved-pop { animation: saved-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes saved-pop { 30% { transform: translateY(3px) scaleY(.8); } 60% { transform: translateY(-5px) scaleY(1.15); } }
.bump { animation: bump .45s ease; display: inline-block; }
@keyframes bump { 40% { transform: scale(1.18); color: var(--like); } }
.badge.bump { animation: badge-bump .6s ease; }
@keyframes badge-bump { 30% { transform: scale(1.5); } 60% { transform: scale(.9); } }
.big-heart.show .icon { color: #fff; }

/* Pulsanti che "rispondono" al tocco */
.btn, .icon-btn, .rs-btn, .chip, .story-btn, .tile { -webkit-tap-highlight-color: transparent; }
.btn { transition: background .2s, transform .15s, box-shadow .2s, filter .2s; }
.btn:hover { box-shadow: 0 6px 18px rgba(124, 58, 237, .28); }
.btn.secondary:hover { box-shadow: none; }

/* Icona della sezione attiva che salta quando la scegli */
.side-nav a.active .icon, .bottombar a.active .icon { animation: nav-hop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes nav-hop { 40% { transform: translateY(-4px) scale(1.12); } }

/* ---------- Elementi che entrano dolcemente ---------- */
.reveal { opacity: 0; transform: translateY(16px) scale(.985); transition: opacity .5s ease, transform .5s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.post { transition: box-shadow .25s, border-color .25s; }
@media (hover: hover) {
    .post:hover { border-color: color-mix(in srgb, var(--accent-2) 30%, var(--border)); box-shadow: 0 12px 34px rgba(0, 0, 0, .18); }
    .tile:hover { z-index: 1; }
}

/* Foto che "luccicano" mentre si caricano */
.post-media:not(.loaded):not(.reel-media), .tile:not(.loaded), .hl-btn:not(.loaded) {
    background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 60%, #fff 8%) 50%, var(--surface-2) 70%) 0 0 / 200% 100%;
    animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Finestre e messaggi più morbidi */
.modal-box { animation: modal-in .32s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.toast { animation: toast-spring .45s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes toast-spring { from { opacity: 0; transform: translateY(16px) scale(.9); } }

/* ---------- Visualizzatore storie ---------- */
.stories-viewer { animation: fade .25s; }
.sv { animation: sv-open .35s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes sv-open { from { transform: scale(.92); opacity: 0; } }
.sv.fade .sv-img { animation: sv-fade .35s ease; }
.sv.from-right { animation: sv-right .35s cubic-bezier(.2, .9, .3, 1); }
.sv.from-left { animation: sv-left .35s cubic-bezier(.2, .9, .3, 1); }
@keyframes sv-fade { from { opacity: .3; transform: scale(1.03); } }
@keyframes sv-right { from { transform: translateX(40%) rotateY(-12deg); opacity: 0; } }
@keyframes sv-left { from { transform: translateX(-40%) rotateY(12deg); opacity: 0; } }
.sv-bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(30px) brightness(.6); transform: scale(1.1); }
.sv-img { position: relative; object-fit: contain; }
.sv-bars .bar { background: rgba(255, 255, 255, .3); }
.sv-bars .bar i { box-shadow: 0 0 8px rgba(255, 255, 255, .6); }
.sv-head .sv-avatar .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.sv-head .demo-tag { color: #fff; border-color: rgba(255, 255, 255, .5); }
/* Tenendo premuto spariscono le scritte, come su Instagram */
.sv.holding .sv-bars, .sv.holding .sv-head, .sv.holding .sv-foot, .sv.holding .story-layer { opacity: 0; transition: opacity .2s; }

.sv-foot { transition: opacity .2s; }
.sv-like { color: #fff; }
.sv-like.liked { color: var(--like); }
.sv-like.liked .icon { filter: drop-shadow(0 0 6px rgba(244, 63, 94, .7)); }

/* Reazioni veloci (compaiono quando scrivi una risposta) */
.sv-reactions {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 70px;
    z-index: 4;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    border-radius: 18px;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity .25s, transform .3s cubic-bezier(.2, .9, .3, 1.2);
}
.sv.typing .sv-reactions { opacity: 1; transform: none; pointer-events: auto; }
.sv-reactions button { font-size: 30px; transition: transform .15s; }
.sv-reactions button:hover, .sv-reactions button:active { transform: scale(1.3); }

/* Chi ha visto la tua storia */
.sv-foot.own { gap: 8px; }
.sv-viewers-btn { display: flex; align-items: center; gap: 8px; flex: 1; color: #fff; font-size: 14px; text-align: left; }
.sv-faces { display: flex; }
.sv-faces .avatar { margin-right: -8px; box-shadow: 0 0 0 2px #000; }
.sv-faces:empty { display: none; }
.sv-faces + span { margin-left: 8px; }
.sv-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    max-height: 72%;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    color: var(--text);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, .45);
    animation: sheet-up .35s cubic-bezier(.2, .9, .3, 1.05);
}
.sv-sheet.closing { animation: sheet-down .22s ease forwards; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 10px auto 4px; }
.sv-sheet header { display: flex; align-items: center; gap: 10px; padding: 6px 12px 10px 18px; border-bottom: 1px solid var(--border); }
.sv-sheet header b { flex: 1; }
.sheet-likes { font-size: 14px; color: var(--like); font-weight: 700; }
.sheet-list { overflow-y: auto; padding: 6px 8px 14px; }
.viewer-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; animation: row-in .35s ease backwards; animation-delay: calc(var(--i) * 40ms); }
.viewer-row:hover { background: var(--surface-2); }
@keyframes row-in { from { opacity: 0; transform: translateX(-10px); } }
.vote-chip { font-size: 12px; padding: 3px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2); white-space: nowrap; }
.viewer-heart { font-size: 18px; animation: pop .6s ease; }
.sheet-empty { text-align: center; color: var(--muted); padding: 30px 10px; margin: 0; }

@media (prefers-reduced-motion: reduce) {
    .avatar.ring::before { animation: none; }
    .reveal { opacity: 1; transform: none; }
}


/* ---------- Moderazione: nuovi iscritti ---------- */
.newusers-box { margin: 14px 0 6px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.newusers-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 360px; overflow-y: auto; }
.newusers-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.newusers-list .ur-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nu-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.nu-meta small { font-size: 11px; }
.nu-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.nu-chip.ok { background: rgba(16, 185, 129, .15); color: #10b981; }
.nu-chip.wait { background: rgba(245, 158, 11, .15); color: #f59e0b; }

/* ---------- Vicecapi ---------- */
.mods-form { margin-top: 10px; }
.mods-form input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; outline: 0; }
.mods-form input:focus { border-color: var(--accent-2); }
.mod-badge { margin: 10px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.form .input-prefix { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-weight: 400; }
.form .input-prefix input { border: 0; background: none; padding: 11px 12px 11px 2px; }


/* =============================================================
   Rullino: scegli foto e video come nella galleria del telefono
   ============================================================= */
.modal-box.roll { max-width: 560px; display: flex; flex-direction: column; }
.roll { display: flex; flex-direction: column; min-height: 0; flex: 1; transition: box-shadow .2s; }
.roll.over { box-shadow: inset 0 0 0 3px var(--accent); }
.roll-preview { position: relative; aspect-ratio: 1; max-height: 44dvh; background: #000; display: grid; place-items: center; overflow: hidden; margin-top: 12px; }
.roll-preview.tall { aspect-ratio: 4 / 5; }
.roll-preview img, .roll-preview video { width: 100%; height: 100%; object-fit: cover; animation: roll-in .3s ease; }
@keyframes roll-in { from { opacity: .4; transform: scale(1.04); } }
.roll-empty { text-align: center; color: #94a3b8; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.roll-empty p { margin: 0; color: #e2e8f0; font-size: 17px; font-weight: 600; }
.roll-empty .icon.xl { width: 64px; height: 64px; }
.roll-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.roll-bar .chip-btn { display: inline-flex; align-items: center; gap: 6px; }
.roll-bar .chip-btn .icon { width: 16px; height: 16px; }
.roll-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; max-height: 32dvh; overflow-y: auto; overscroll-behavior: contain; }
.roll-tile { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--surface-2); }
.roll-tile img, .roll-tile video { width: 100%; height: 100%; object-fit: cover; transition: transform .2s, opacity .2s; }
.roll-tile:hover img { transform: scale(1.05); }
.roll-tile.sel img, .roll-tile.sel video { transform: scale(.9); opacity: .8; border-radius: 6px; }
.roll-tile.sel::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--accent-2); pointer-events: none; }
.roll-num {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    border: 2px solid #fff;
    animation: pop .35s ease;
}
.roll-tile.tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 28px;
    background: linear-gradient(135deg, var(--accent-soft), rgba(236, 72, 153, .14));
}
.roll-tile.tool span { font-size: 11px; font-weight: 700; color: var(--text); }
.roll-tile.tool:hover { filter: brightness(1.15); }
.roll-art { position: absolute; left: 5px; bottom: 4px; font-size: 12px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.roll-loading { grid-column: 1 / -1; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.roll-foot { padding: 10px 14px 14px; border-top: 1px solid var(--border); }
.roll-foot .btn:disabled, .modal-head .link:disabled { opacity: .4; cursor: default; box-shadow: none; }
@media (max-width: 767px) {
    .modal-box.roll, .modal-box.roll:not(.wide) { max-width: none; width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .roll-grid { flex: 1; max-height: none; grid-template-columns: repeat(4, 1fr); }
    .roll-preview { max-height: 42dvh; }
    .roll-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}


/* ---------- Etichette CAPO / VICECAPO ---------- */
.role-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 6px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .5px;
    vertical-align: 1px;
    line-height: 1.5;
    white-space: nowrap;
}
.role-tag.capo {
    color: #3b2a00;
    background: linear-gradient(135deg, #fde68a, #f59e0b 55%, #fbbf24);
    box-shadow: 0 0 10px rgba(245, 158, 11, .45);
    background-size: 200% 100%;
    animation: capo-shine 3s ease-in-out infinite;
}
@keyframes capo-shine { 50% { background-position: 100% 0; } }
.role-tag.vice { color: #fff; background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 0 10px rgba(124, 58, 237, .4); }
.ph-row h2 .role-tag { font-size: 11px; padding: 2px 8px; vertical-align: 3px; }


/* ---------- Aura versione meme ---------- */
.float-aura {
    position: fixed;
    z-index: 210;
    transform: translate(-50%, 0);
    pointer-events: none;
    font-weight: 900;
    font-size: 15px;
    white-space: nowrap;
    color: #fde68a;
    text-shadow: 0 2px 10px rgba(124, 58, 237, .8), 0 0 2px #000;
    animation: float-aura 1.25s cubic-bezier(.2, .8, .3, 1) forwards;
}
.float-aura.minus { color: #fca5a5; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
@keyframes float-aura {
    0% { opacity: 0; transform: translate(-50%, 6px) scale(.6); }
    15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -60px) scale(1); }
}
.aura-level { font-weight: 700; }
.aura-list li b.minus { color: #f87171; }
.level-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.level-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; opacity: .6; }
.level-list li.done { opacity: .85; }
.level-list li.now { opacity: 1; background: linear-gradient(90deg, var(--accent-soft), rgba(236, 72, 153, .15)); outline: 1px solid var(--accent-2); font-weight: 700; }
.level-list li small { color: var(--muted); }


/* ---------- Novità di AURA ---------- */
.updates { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px; max-height: 70dvh; overflow-y: auto; }
.update { padding: 14px; border-radius: 14px; background: var(--surface-2); animation: modal-in .4s ease backwards; }
.update.latest { background: linear-gradient(135deg, var(--accent-soft), rgba(236, 72, 153, .12)); border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent); }
.update-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.update-head b { font-size: 16px; }
.update ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.update li::marker { color: var(--accent-2); }
.updates .link { align-self: center; }
.update-bar {
    position: fixed;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    z-index: 150;
    padding: 10px 18px;
    border-radius: 22px;
    color: #fff;
    font-size: 14px;
    background: linear-gradient(90deg, #7c3aed, #ec4899);
    box-shadow: 0 10px 30px rgba(124, 58, 237, .45);
    animation: toast-spring .5s ease;
    max-width: calc(100vw - 32px);
}
@media (max-width: 767px) { .update-bar { top: calc(64px + env(safe-area-inset-top)); } }


/* =============================================================
   Rullino v2
   ============================================================= */
.roll-preview > img, .roll-preview > video { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; }
.roll-preview.fixed > img { width: auto; height: 100%; max-width: 100%; aspect-ratio: var(--crop); object-fit: cover; transition: aspect-ratio .25s; }
.roll-preview > img:not(.cover) { object-fit: contain; }
.roll-fab {
    position: absolute;
    bottom: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 17px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background .2s, transform .15s;
}
.roll-fab:active { transform: scale(.94); }
.roll-fab.left { left: 12px; }
.roll-fab.right { right: 12px; padding: 0 10px; }
.roll-fab.on { background: var(--accent); }
.roll-fab .icon { width: 18px; height: 18px; }
.roll-fab b { font-size: 12px; }

.roll-strip { display: flex; gap: 8px; padding: 10px 14px 2px; overflow-x: auto; scrollbar-width: none; }
.roll-strip::-webkit-scrollbar { display: none; }
.rs-item { position: relative; flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; animation: pop .3s ease; }
.rs-item.on { border-color: var(--accent-2); }
.rs-item > button:first-child, .rs-item img, .rs-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.rs-item > b { position: absolute; left: 4px; bottom: 3px; font-size: 11px; color: #fff; text-shadow: 0 1px 3px #000; }
.rs-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #fff; background: rgba(0, 0, 0, .65); }

.roll-bar { gap: 10px; }
.roll-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.roll-tabs button { padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); transition: background .2s, color .2s; }
.roll-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.roll-hint { color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (hover: none) { .roll-hint { display: none; } }

.roll-tile.focus::after { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--accent-2); }
.roll-ring { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .25); }
.roll-tile.gallery { background: linear-gradient(135deg, #7c3aed, #ec4899); }
.roll-tile.gallery span { color: #fff; }
.roll-tile.more { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 24px; background: var(--surface-2); border: 1px dashed var(--border); }
.roll-tile.more span { font-size: 11px; font-weight: 700; color: var(--muted); }
.roll-tile.skeleton, .roll-tile:not(.loaded):not(.tool):not(.more) {
    background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 60%, #fff 8%) 50%, var(--surface-2) 70%) 0 0 / 200% 100%;
    animation: shimmer 1.4s linear infinite;
}
.roll-tile:has(video) { animation: none; }
.roll-note { grid-column: 1 / -1; padding: 22px 14px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.roll-foot .btn { transition: background .2s, transform .15s, opacity .2s; }
.roll-grid { align-content: start; }
.roll-tile { min-height: 0; height: auto; }
.roll-grid > .roll-tile { aspect-ratio: 1 / 1; }
.roll-fab { border: 1px solid rgba(255, 255, 255, .3); }


/* =============================================================
   v12 — Stile sobrio: colori neutri, un solo colore d'accento,
   niente sfumature, bagliori o effetto vetro.
   ============================================================= */
:root {
    --bg: #000;
    --surface: #121212;
    --surface-2: #1f1f1f;
    --border: #2a2a2a;
    --text: #f5f5f5;
    --muted: #a3a3a3;
    --accent: #0a84ff;
    --accent-hover: #0070e0;
    --accent-2: #3d9bff;
    --accent-soft: rgba(10, 132, 255, .12);
    --like: #ff3040;
    --blue: #3d9bff;
    --ring: linear-gradient(45deg, #f9a825, #e1306c 60%, #c13584);
    --radius: 10px;
    --shadow: 0 4px 16px rgba(0, 0, 0, .4);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="light"] {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #efefef;
    --border: #dbdbdb;
    --text: #0a0a0a;
    --muted: #737373;
    --accent-2: #0a84ff;
    --accent-soft: rgba(10, 132, 255, .08);
    --blue: #0a84ff;
    --shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

/* Logo in tinta unita */
.logo { background: none; color: var(--text); -webkit-background-clip: border-box; background-clip: border-box; letter-spacing: -.5px; }
.logo span { color: var(--accent); }

/* Pulsanti pieni, senza sfumature né ombre colorate */
.btn, .login-form .btn.block, .side-nav .side-create, .side-nav .side-create:hover, .bottombar .nav-create,
.roll-tile.gallery, .update-bar, .role-tag.vice {
    background: var(--accent);
    background-image: none;
    box-shadow: none;
    filter: none;
}
.btn.secondary, .btn.ghost { background: var(--surface-2); }
.side-nav .side-create:hover { background: var(--accent-hover); }
.login-form .btn.block:hover { background: var(--accent-hover); }
.bottombar .nav-create { background: none; color: var(--text); border: 1.5px solid currentColor; width: 34px; height: 30px; border-radius: 8px; }

/* Pagina di accesso: sfondo pulito, nessuna macchia colorata */
.login { background: var(--bg); }
.login::before, .login::after { display: none; }
.login .login-card, .login .login-switch {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: var(--border);
    box-shadow: none;
}
.login .logo.big { filter: none; }
.hero-tag { font-weight: 700; letter-spacing: -.8px; }
.hero-sub { margin: 12px 0 0; color: var(--muted); font-size: 17px; }
.phone { animation: none; transform: translateX(-50%); box-shadow: 0 0 0 2px #2a2a2a inset; }
.phone-screen, .pm-stories img { background: #000; border-color: #000; }
.pm-post { background: #121212; }
.pm-post-head i { background: #3a3a3a; }
.pm-lines i { background: #2a2a2a; }
.pm-post-actions .heart { animation: none; }

/* Navigazione: niente sfumature, barre piene invece del vetro */
.sidebar { background: var(--bg); border-right: 1px solid var(--border); }
.side-nav a.active { background: none; }
.side-nav a.active::before { display: none; }
.side-nav a.active .icon, .bottombar a.active .icon, .topbar .icon-btn.active .icon { color: var(--text); }
.bottombar a.active::after { display: none; }
@media (max-width: 767px) {
    .topbar, .bottombar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .topbar { border-bottom: 1px solid var(--border); }
    .bottombar { border-top: 1px solid var(--border); }
}

/* Riquadri e barre: tinta unita */
.aura-card, .ch-hero, .update.latest, .level-list li.now { background: var(--surface-2); }
.ch-hero { background: var(--surface); }
.update.latest { border: 1px solid var(--border); }
.level-list li.now { outline: 1px solid var(--border); }
.aura-bar i, .poll-opt.result i { background: var(--accent); }
.poll-opt.result i { opacity: .25; }
.role-tag.capo { background: #f5c518; color: #000; box-shadow: none; }
.role-tag.vice { color: #fff; }

/* Elenco impostazioni pulito */
.menu-list button, .menu-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu-list small { color: var(--muted); font-size: 13px; font-weight: 400; }

/* Rullino */
.roll-tile.tool, .roll-tile.gallery, .roll-tile.more { background: var(--surface-2); color: var(--text); border: 0; }
.roll-tile.tool .icon, .roll-tile.more .icon { width: 26px; height: 26px; }
.roll-tile.gallery span, .roll-tile.more span { color: var(--muted); }
.roll-fab { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(0, 0, 0, .7); }
.roll-tabs { background: none; padding: 0; gap: 16px; }
.roll-tabs button { padding: 4px 0; border-radius: 0; background: none !important; box-shadow: none !important; border-bottom: 2px solid transparent; }
.roll-tabs button.on { border-bottom-color: var(--text); }

/* Barra aggiornamento: semplice */
.update-bar { border-radius: 8px; animation: none; }
.update-bar { background: var(--text); color: var(--bg); }
.app-banner { background: var(--surface); border: 1px solid var(--border); box-shadow: none; }
.test-box, .login .test-box { border-style: solid; border-color: var(--border); background: var(--surface-2); }

/* ---------- Reel aperto sul telefono: il video non copre più i commenti ---------- */
@media (max-width: 767px) {
    .pm-media { max-height: 42dvh; overflow: hidden; }
    .pm-media .post-media, .pm.is-reel .pm-media .reel-media { height: 42dvh; max-height: 42dvh; aspect-ratio: auto; }
    .pm-media video { width: 100%; height: 100%; max-height: 42dvh; object-fit: contain; }
    .pm-comments { min-height: 120px; }
}


/* ---------- 💡 Chat di gruppo "Idee per AURA" ---------- */
.ideas-ico { display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; font-size: 24px; background: var(--surface-2); }
.ideas-ico.big { width: 40px; height: 40px; font-size: 20px; }
.ideas-ico.huge { width: 88px; height: 88px; font-size: 44px; }
.ideas-row { border-bottom: 1px solid var(--border); margin-bottom: 6px; padding-bottom: 12px; }
.idea { display: flex; align-items: flex-end; gap: 8px; }
.idea.out { justify-content: flex-end; }
.idea .msg { max-width: 78%; }
.idea-author { display: block; font-size: 12px; margin-bottom: 2px; }
.idea-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; flex-wrap: wrap; }
.idea-actions time { margin-left: auto; }
.idea-vote { padding: 2px 8px; border-radius: 12px; border: 1px solid var(--border); font-size: 12px; }
.idea-vote.on { border-color: var(--accent); color: var(--accent); }
.msg.out .idea-vote.on { border-color: #fff; color: #fff; }
.idea-done { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700; }
.idea.done .msg { outline: 1px solid #22c55e; }


/* ---------- 💭 Note ---------- */
.notes-bar { display: flex; gap: 14px; overflow-x: auto; padding: 22px 4px 10px; scrollbar-width: none; }
.notes-bar::-webkit-scrollbar { display: none; }
.note { position: relative; flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.note small { font-size: 11px; color: var(--muted); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-bubble { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); z-index: 1; max-width: 96px; padding: 5px 9px; border-radius: 14px;
    font-size: 11px; line-height: 1.25; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-bubble.add { color: var(--muted); }

/* ---------- 👑 Aura del giorno ---------- */
.aod { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; margin: 0 0 16px; text-align: left; }
.aod-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; overflow: hidden; }
.aod-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.aod-text small { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: #d4a017; }
.aod-text .muted { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Risposte e reazioni nei messaggi ---------- */
.msg { position: relative; cursor: pointer; }
.msg-quote { font-size: 12px; color: var(--muted); padding: 4px 10px; border-left: 2px solid var(--border); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reacts { margin-top: -8px; padding: 1px 6px; border-radius: 10px; font-size: 13px; background: var(--surface); border: 1px solid var(--border); z-index: 1; }
.msg-tools { display: flex; gap: 2px; padding: 4px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: pop .2s ease; }
.msg-tools button { font-size: 20px; padding: 2px 4px; border-radius: 8px; }
.msg-tools button:hover { background: var(--surface-2); }


/* ---------- 💚 Amici più stretti ---------- */
.avatar.ring.close::before { background: #22c55e !important; }
.close-tag { color: #4ade80; font-weight: 700; }
.btn.close-on { background: #16a34a; }

/* ---------- 📝 Bozze ---------- */
.drafts { padding: 6px 12px 16px; display: flex; flex-direction: column; gap: 6px; max-height: 70dvh; overflow-y: auto; }
.draft-row { display: flex; align-items: center; gap: 8px; }
.draft-open { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; padding: 6px; border-radius: 10px; min-width: 0; }
.draft-open:hover { background: var(--surface-2); }
.draft-open img, .draft-open video { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; }
.draft-open span { display: flex; flex-direction: column; min-width: 0; }
.draft-open small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.create-side .btn.secondary { margin-top: 8px; }

/* ---------- 📊 Statistiche ---------- */
.insights { padding: 4px 16px 18px; }
.ins-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ins-tile { padding: 14px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.ins-tile b { font-size: 22px; }
.ins-tile small { color: var(--muted); font-size: 12px; }
.insights .label { margin: 16px 0 8px; }


/* ---------- 🖼️ Cornici ---------- */
.avatar.frame { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fc, #aaa); border-radius: 50%; }
.frame-silver { --fc: #c0c7d1; }
.frame-gold { --fc: #f5c518; }
.frame-neon { --fc: #22d3ee; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #22d3ee, 0 0 12px #22d3ee !important; }
.frame-fire { --fc: #f97316; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #f97316, 0 0 14px #ef4444 !important; }
.frame-rainbow { --fc: #ec4899; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #ec4899, 0 0 0 6px #f59e0b, 0 0 0 8px #22c55e !important; }
.frame-legend { --fc: #f5c518; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #f5c518, 0 0 18px #f5c518 !important; animation: legend-glow 2s ease-in-out infinite; }
@keyframes legend-glow { 50% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #fde68a, 0 0 26px #f5c518; } }
.shop, .battles { margin-bottom: 18px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; text-align: center; }
.shop-item.locked { opacity: .55; }
.shop-item small { font-size: 11px; }

/* ---------- ⚔️ Sfide ---------- */
.battles .ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.battle { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 14px 10px; margin-top: 10px; }
.bt-side { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.bt-side b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bt-side.win b { color: #f5c518; }
.bt-side.voted .bt-bar i { background: #22c55e; }
.bt-bar { width: 100%; max-width: 120px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bt-bar i { display: block; height: 100%; background: var(--accent); transition: width .5s; }
.bt-vs { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 26px; }
.bt-vs small { font-size: 11px; color: var(--muted); text-align: center; max-width: 90px; }
.bt-crown { font-size: 12px; font-weight: 700; color: #f5c518; }


/* ---------- 👥 Gruppi ---------- */
.new-group { width: 100%; text-align: left; padding: 10px 12px; margin: 2px 0 6px; border-radius: 10px; font-weight: 600; color: var(--accent-2); }
.new-group:hover { background: var(--surface-2); }
.pad-form { padding: 6px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.group-pick { max-height: 46dvh; overflow-y: auto; }
.group-pick .user-row { cursor: pointer; }
.group-pick input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- 🤝 Collaborazioni ---------- */
.collab-btns { display: inline-flex; gap: 8px; align-items: center; margin-left: 6px; }
