/* =========================================================
   CHATTITALY – stile
   ========================================================= */
:root {
  --bg: #0b0f0d;
  --bg-2: #0f1512;
  --panel: rgba(19, 26, 23, .74);
  --panel-solid: #151c19;
  --panel-2: rgba(255, 255, 255, .045);
  --panel-3: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f1f4f1;
  --text-2: #bac5bf;
  --text-3: #7f8d86;
  --green: #1fbf6e;
  --red: #e8364a;
  --violet: #1fbf6e;
  --accent: #1fbf6e;
  --accent-2: #2fd27f;
  --grad: linear-gradient(90deg, #1fbf6e 0%, #f4f6f2 50%, #e8364a 100%);
  --grad-btn: linear-gradient(135deg, #0c8a4c 0%, #1fbf6e 100%);
  --male: #5ab0ff;
  --female: #ff7ab6;
  --other: #b9a4ff;
  --gold: #ffcc4d;
  --ok: #2ee59d;
  --warn: #ffb547;
  --danger: #ff5470;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .65);
  --topbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #5fe0a0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: rgba(31, 191, 110, .45); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .22); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- sfondo aurora ---------- */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .45; animation: float 26s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: #0f9d58; opacity: .30; }
.aurora span:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 10vh; background: #f4f6f2; animation-duration: 32s; opacity: .06; }
.aurora span:nth-child(3) { width: 42vw; height: 42vw; left: 30vw; bottom: -22vw; background: #d42a3c; animation-duration: 38s; opacity: .26; }
@keyframes float { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vw, 4vh) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .aurora span { animation: none; } }

#root { position: relative; z-index: 1; height: 100%; }

/* ---------- boot ---------- */
.boot { height: 100%; display: grid; place-content: center; justify-items: center; gap: 22px; }
.boot img { animation: pop 1.2s ease-in-out infinite alternate; filter: drop-shadow(0 10px 30px rgba(31, 191, 110, .5)); }
.boot-bar { width: 140px; height: 4px; border-radius: 4px; background: var(--panel-3); overflow: hidden; position: relative; }
.boot-bar::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--grad); border-radius: 4px; animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes pop { from { transform: scale(.94); } to { transform: scale(1.04); } }

/* ---------- elementi base ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); font-weight: 600; white-space: nowrap;
  transition: transform .12s ease, background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { background: var(--panel-3); border-color: rgba(255, 255, 255, .22); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { border: 0; background: var(--grad-btn); color: #fff; box-shadow: 0 10px 30px -10px rgba(31, 191, 110, .7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.green { border: 0; background: linear-gradient(135deg, #18c172, #12a7a0); color: #fff; }
.btn.danger { border: 0; background: linear-gradient(135deg, #ff4d6a, #e5304f); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { height: 50px; font-size: 16px; border-radius: 14px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  display: inline-grid; place-items: center; color: var(--text-2); position: relative; flex: none;
  transition: background .2s, color .2s, transform .12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.active { color: #fff; background: rgba(31, 191, 110, .22); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
svg.i { width: 20px; height: 20px; flex: none; }

.badge {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 800;
  background: var(--red); color: #fff; display: inline-grid; place-items: center; line-height: 1;
}
.icon-btn .badge { position: absolute; top: 2px; right: 0; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: rgba(6, 9, 8, .55); color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea.input { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: rgba(31, 191, 110, .8); box-shadow: 0 0 0 4px rgba(31, 191, 110, .18); }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b4b8d8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
select.input option { background: var(--panel-solid); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 12.5px; color: var(--text-3); }
.error-box { background: rgba(255, 84, 112, .12); border: 1px solid rgba(255, 84, 112, .35); color: #ffb3c0; padding: 10px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }

.seg { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(6, 9, 8, .5); border: 1px solid var(--line); }
.seg button { flex: 1; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button.on.m { color: var(--male); }
.seg button.on.f { color: var(--female); }
.seg button.on.a { color: var(--other); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); margin-bottom: 10px; cursor: pointer; user-select: none; }
.check input { appearance: none; width: 20px; height: 20px; flex: none; border-radius: 6px; border: 1.5px solid var(--line-2); background: rgba(6, 9, 8, .5); display: grid; place-items: center; margin: 0; cursor: pointer; }
.check input:checked { background: var(--grad-btn); border-color: transparent; }
.check input:checked::after { content: ''; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check a { color: #5fe0a0; }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { appearance: none; position: absolute; inset: 0; margin: 0; border-radius: 20px; background: var(--panel-3); border: 1px solid var(--line-2); cursor: pointer; transition: background .2s; }
.switch input:checked { background: var(--grad-btn); border-color: transparent; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked::after { transform: translateX(18px); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }

/* ---------- avatar ---------- */
.avatar {
  --s: 38px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font-weight: 800; font-size: calc(var(--s) * .42); color: #fff;
  background: linear-gradient(135deg, #0c8a4c, #1fbf6e); overflow: hidden; text-transform: uppercase; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.M { background: linear-gradient(135deg, #2c7df0, #5ab0ff); }
.avatar.F { background: linear-gradient(135deg, #e0458c, #ff8fc0); }
.avatar.A { background: linear-gradient(135deg, #7b5cff, #c3a8ff); }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2.5px solid var(--panel-solid); }

.g-M { color: var(--male); }
.g-F { color: var(--female); }
.g-A { color: var(--other); }

.role { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 20px; letter-spacing: .02em; text-transform: uppercase; vertical-align: middle; }
.role.admin { background: rgba(255, 204, 77, .16); color: var(--gold); }
.role.mod { background: rgba(46, 229, 157, .14); color: var(--ok); }
.role.dj { background: rgba(31, 191, 110, .18); color: #ff8a95; }
.role.guest { background: rgba(255, 255, 255, .08); color: var(--text-3); }

/* =========================================================
   LANDING
   ========================================================= */
.landing { height: 100%; overflow-y: auto; overflow-x: hidden; }
.landing-inner { max-width: 1180px; margin: 0 auto; padding: 28px 24px 40px; min-height: 100%; display: flex; flex-direction: column; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 40px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 38px; height: 38px; filter: drop-shadow(0 6px 16px rgba(31, 191, 110, .45)); }
.wordmark { font-weight: 800; font-size: 21px; letter-spacing: -.02em; }
.wordmark b { background: linear-gradient(90deg, #1fd17a, #f5f6ff 50%, #ff3d57); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 30px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(46, 229, 157, .6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46, 229, 157, .6); } 70% { box-shadow: 0 0 0 10px rgba(46, 229, 157, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 229, 157, 0); } }

.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; flex: 1; }
.hero h1 { font-size: clamp(38px, 5.4vw, 64px); line-height: 1.02; letter-spacing: -.035em; margin: 0 0 20px; font-weight: 800; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 18px; color: var(--text-2); max-width: 540px; margin: 0 0 30px; }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; }
.feature { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); }
.feature .fi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.feature .fi svg { width: 22px; height: 22px; }
.feature b { display: block; font-size: 14.5px; }
.feature span { font-size: 12.5px; color: var(--text-3); }
.fi.c1 { background: rgba(31, 209, 122, .15); color: var(--green); }
.fi.c2 { background: rgba(31, 191, 110, .18); color: #5fe0a0; }
.fi.c3 { background: rgba(255, 61, 87, .15); color: #ff7d91; }
.fi.c4 { background: rgba(255, 204, 77, .15); color: var(--gold); }
.fi.c5 { background: rgba(90, 176, 255, .15); color: var(--male); }
.fi.c6 { background: rgba(255, 122, 182, .15); color: var(--female); }

.auth-card { padding: 26px; box-shadow: var(--shadow); position: relative; }
.auth-card::before { content: ''; position: absolute; inset: -1px; border-radius: var(--radius); padding: 1px; background: linear-gradient(160deg, rgba(31, 209, 122, .5), rgba(31, 191, 110, .25) 40%, rgba(255, 61, 87, .5)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.auth-card h2 { margin: 4px 0 4px; font-size: 22px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--text-3); font-size: 14px; margin: 0 0 18px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(6, 9, 8, .5); border: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { flex: 1; height: 38px; border: 0; background: transparent; border-radius: 10px; color: var(--text-2); font-weight: 700; font-size: 14px; }
.tabs button.on { background: var(--grad-btn); color: #fff; box-shadow: 0 6px 18px -8px rgba(31, 191, 110, .8); }
.adult-note { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; font-size: 12.5px; color: var(--text-3); }
.adult-note b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--red); color: #ff7d91; font-size: 10.5px; }
.landing-foot { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; color: var(--text-3); font-size: 13px; }
.landing-foot button { background: none; border: 0; color: var(--text-2); padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: calc(var(--topbar) + var(--safe-t)); padding: var(--safe-t) 16px 0; flex: none; display: flex; align-items: center; gap: 14px;
  background: rgba(10, 14, 12, .72); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  position: relative; z-index: 20;
}
.topbar .brand .wordmark { font-size: 19px; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav button { height: 40px; padding: 0 14px; border-radius: 12px; border: 0; background: transparent; color: var(--text-2); font-weight: 700; display: inline-flex; align-items: center; gap: 8px; position: relative; }
.nav button:hover { background: var(--panel-2); color: var(--text); }
.nav button.on { background: var(--panel-3); color: var(--text); }
.nav button .badge { position: static; }
.topbar .spacer { flex: 1; }

/* radio */
.radio {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 8px 0 6px; border-radius: 16px;
  background: var(--panel-2); border: 1px solid var(--line); min-width: 0; max-width: 380px;
}
.radio .play { width: 36px; height: 36px; border-radius: 12px; border: 0; background: var(--grad-btn); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px -6px rgba(31, 191, 110, .8); }
.radio .play svg { width: 18px; height: 18px; }
.radio .meta { min-width: 0; flex: 1; cursor: pointer; padding: 2px 4px; border-radius: 8px; }
.radio .meta:hover { background: var(--panel-2); }
.radio .meta small { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.radio .meta b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio .live { color: #ff6b81; display: inline-flex; align-items: center; gap: 5px; }
.radio .live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #ff3d57; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.radio .vol { width: 80px; accent-color: #1fbf6e; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 3px; background: var(--green); border-radius: 2px; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; background: #fff; }
.eq i:nth-child(3) { animation-delay: .4s; background: var(--red); }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }

.me-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 30px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); max-width: 220px; }
.me-btn:hover { background: var(--panel-3); }
.me-btn .nick { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; }

/* ---------- layout chat ---------- */
.chat { display: grid; grid-template-columns: 290px minmax(0, 1fr) 270px; height: 100%; gap: 14px; padding: 14px; }
.pane { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.pane-head { padding: 16px 16px 10px; display: flex; align-items: center; gap: 8px; }
.pane-head h3 { margin: 0; font-size: 15px; font-weight: 800; flex: 1; letter-spacing: -.01em; }
.pane-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 12px; }

.side-tabs { display: flex; margin: 12px 12px 4px; padding: 4px; gap: 4px; border-radius: 14px; background: rgba(6, 9, 8, .45); border: 1px solid var(--line); }
.side-tabs button { flex: 1; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.side-tabs button.on { background: var(--panel-3); color: var(--text); }

.section-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 12px 8px 6px; }
.list-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 13px; border: 0;
  background: transparent; text-align: left; color: var(--text); position: relative; transition: background .15s;
}
.list-item:hover { background: var(--panel-2); }
.list-item.on { background: linear-gradient(90deg, rgba(31, 191, 110, .22), rgba(31, 191, 110, .06)); box-shadow: inset 0 0 0 1px rgba(31, 191, 110, .3); }
.list-item .ri { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: var(--panel-2); border: 1px solid var(--line); flex: none; }
.list-item .lt { min-width: 0; flex: 1; }
.list-item .lt b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .lt > span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .count { font-size: 12px; font-weight: 700; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 20px; background: var(--panel-2); }
.list-item .count::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.list-item .count.zero::before { background: var(--text-3); }
.list-item .unread { position: static; }
.empty { text-align: center; color: var(--text-3); font-size: 13.5px; padding: 26px 16px; }
.empty .big { font-size: 34px; margin-bottom: 6px; }

/* ---------- conversazione ---------- */
.conv { min-width: 0; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--line); min-height: 66px; }
.conv-head .ri { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; background: var(--panel-2); border: 1px solid var(--line); flex: none; }
.conv-title { min-width: 0; flex: 1; }
.conv-title b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-title span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-actions { display: flex; gap: 6px; align-items: center; }
.cam-toggle.on { background: linear-gradient(135deg, #18c172, #12a7a0); border: 0; color: #fff; }

.camstrip { display: flex; gap: 10px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); background: rgba(4, 6, 5, .35); flex: none; }
.camtile { position: relative; width: 210px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #050806; flex: none; border: 1px solid var(--line-2); }
.camtile.big { width: 340px; }
.camtile video { width: 100%; height: 100%; object-fit: cover; background: #050806; display: block; }
.camtile.mine video { transform: scaleX(-1); }
.camtile .ct-label { position: absolute; left: 8px; bottom: 8px; right: 8px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.camtile .ct-label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 3px 8px; border-radius: 20px; background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px); }
.camtile .ct-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.camtile:hover .ct-tools, .camtile:focus-within .ct-tools { opacity: 1; }
@media (hover: none) { .camtile .ct-tools { opacity: 1; } }
.camtile .ct-tools button { width: 30px; height: 30px; border-radius: 9px; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.camtile .ct-tools button svg { width: 16px; height: 16px; }
.camtile .ct-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; font-size: 13px; color: var(--text-2); padding: 10px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: #5fe0a0; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.camtile .viewers { position: absolute; top: 6px; left: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: rgba(0, 0, 0, .55); display: inline-flex; gap: 5px; align-items: center; }
.camtile .viewers svg { width: 13px; height: 13px; }
.rec { width: 8px; height: 8px; border-radius: 50%; background: #ff3d57; animation: blink 1.2s infinite; flex: none; }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 8px; overscroll-behavior: contain; scroll-behavior: auto; }
.msg { display: flex; gap: 10px; padding: 2px 0; position: relative; }
.msg.first { margin-top: 12px; }
.msg .avatar-slot { width: 38px; flex: none; }
.msg .avatar { cursor: pointer; }
.msg .body { min-width: 0; max-width: min(680px, 82%); }
.msg .meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; padding-left: 2px; }
.msg .meta .who { font-weight: 800; font-size: 13.5px; cursor: pointer; background: none; border: 0; padding: 0; }
.msg .meta .who:hover { text-decoration: underline; }
.msg .meta time { font-size: 11.5px; color: var(--text-3); }
.bubble {
  display: inline-block; padding: 9px 13px; border-radius: 4px 18px 18px 18px; background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .06); white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14.5px;
}
.msg:not(.first) .bubble { border-radius: 18px; border-top-left-radius: 8px; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .body { display: flex; flex-direction: column; align-items: flex-end; }
.msg.mine .meta { flex-direction: row-reverse; padding-right: 2px; }
.msg.mine .bubble { background: linear-gradient(135deg, rgba(15, 157, 88, .9), rgba(31, 191, 110, .82)); border-color: transparent; border-radius: 18px 4px 18px 18px; color: #fff; }
.msg.mine:not(.first) .bubble { border-radius: 18px; border-top-right-radius: 8px; }
.msg.mention .bubble { box-shadow: 0 0 0 1.5px rgba(255, 204, 77, .7); background: rgba(255, 204, 77, .1); }
.msg.action .bubble { background: transparent; border: 1px dashed var(--line-2); font-style: italic; color: var(--text-2); }
.msg .bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg.mine .bubble a { color: #fff; }
.bubble .at { font-weight: 700; color: #ffd36b; }
.msg.mine .bubble .at { color: #fff3c4; }
.bubble.jumbo { background: transparent !important; border: 0 !important; font-size: 40px; padding: 0 2px; line-height: 1.15; box-shadow: none !important; }
.msg .tools { position: absolute; top: 50%; transform: translateY(-50%); right: 0; display: none; gap: 2px; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 10px; padding: 2px; z-index: 2; }
.msg.mine .tools { right: auto; left: 0; }
.msg:hover .tools { display: flex; }
.msg .tools button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); display: grid; place-items: center; }
.msg .tools button:hover { background: var(--panel-3); color: var(--text); }
.msg .tools svg { width: 15px; height: 15px; }
.msg .seen { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.notice { text-align: center; margin: 10px 0; }
.notice span { display: inline-block; font-size: 12.5px; color: var(--text-3); padding: 4px 12px; border-radius: 20px; background: rgba(255, 255, 255, .04); }
.notice.warn span { color: #ffd38a; background: rgba(255, 181, 71, .1); }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; color: var(--text-3); font-size: 12px; font-weight: 700; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.jump { position: absolute; right: 22px; bottom: 96px; z-index: 5; }
.jump .btn { box-shadow: var(--shadow); }

.typing { height: 22px; padding: 0 20px; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex: none; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); animation: tdot 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer { padding: 8px 12px 12px; flex: none; position: relative; }
.composer-box { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 18px; background: rgba(6, 9, 8, .6); border: 1px solid var(--line-2); transition: border-color .2s, box-shadow .2s; }
.composer-box:focus-within { border-color: rgba(31, 191, 110, .7); box-shadow: 0 0 0 4px rgba(31, 191, 110, .14); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; resize: none; max-height: 140px; min-height: 40px; padding: 9px 6px; line-height: 1.4; font-size: 15px; }
.composer textarea::placeholder { color: var(--text-3); }
.send { width: 42px; height: 42px; border-radius: 13px; border: 0; background: var(--grad-btn); color: #fff; display: grid; place-items: center; flex: none; transition: transform .12s, opacity .2s; }
.send:disabled { opacity: .4; cursor: default; }
.send:not(:disabled):active { transform: scale(.92); }
.send svg { width: 19px; height: 19px; }
.composer .counter { position: absolute; right: 70px; bottom: 20px; font-size: 11px; color: var(--text-3); pointer-events: none; }
.composer .locked { text-align: center; padding: 12px; color: var(--text-3); font-size: 13.5px; border-radius: 14px; background: var(--panel-2); }

/* emoji picker */
.emoji-pop { position: absolute; bottom: calc(100% - 2px); left: 12px; width: 340px; max-width: calc(100vw - 24px); height: 330px; display: flex; flex-direction: column; z-index: 30; box-shadow: var(--shadow); background: var(--panel-solid); }
.emoji-cats { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); }
.emoji-cats button { flex: 1; height: 34px; border: 0; border-radius: 9px; background: transparent; font-size: 18px; }
.emoji-cats button.on { background: var(--panel-3); }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); padding: 6px; gap: 2px; align-content: start; }
.emoji-grid button { aspect-ratio: 1; border: 0; background: transparent; border-radius: 9px; font-size: 22px; display: grid; place-items: center; padding: 0; }
.emoji-grid button:hover { background: var(--panel-3); }

/* ---------- utenti ---------- */
.search { position: relative; margin: 0 12px 6px; }
.search input { height: 38px; padding-left: 36px; font-size: 14px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); }
.filter-chips { display: flex; gap: 6px; padding: 4px 12px 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 11px; border-radius: 20px; border: 1px solid var(--line); background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.chip.on { background: var(--panel-3); color: var(--text); border-color: var(--line-2); }
.user-row .lt b { display: flex; align-items: center; gap: 6px; }
.user-row .lt b .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .cam-ic { color: var(--ok); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; }
.user-row .cam-ic:hover { background: rgba(46, 229, 157, .15); }
.user-row .cam-ic.priv { color: var(--warn); }
.user-row .cam-ic svg { width: 18px; height: 18px; }
.user-row.ignored { opacity: .45; }

/* ---------- popover / menu ---------- */
.pop {
  position: fixed; z-index: 60; min-width: 220px; max-width: min(320px, calc(100vw - 20px)); padding: 6px; border-radius: 16px;
  background: rgba(21, 29, 25, .97); border: 1px solid var(--line-2); box-shadow: var(--shadow); backdrop-filter: blur(20px);
  animation: popIn .14s ease-out;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.pop .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--text); font-size: 14px; font-weight: 600; }
.pop .menu-item:hover { background: var(--panel-3); }
.pop .menu-item svg { width: 18px; height: 18px; color: var(--text-2); }
.pop .menu-item.danger { color: #ff8a9c; }
.pop .menu-item.danger svg { color: #ff8a9c; }
.pop .menu-item:disabled { opacity: .45; cursor: default; }
.pop .menu-item:disabled:hover { background: transparent; }
.pop hr { border: 0; height: 1px; background: var(--line); margin: 5px 4px; }
.pop .menu-label { font-size: 11px; font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; padding: 8px 11px 4px; }
.user-card { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; }
.user-card b { font-size: 16px; display: block; }
.user-card .info { font-size: 13px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }

/* ---------- modali ---------- */
.overlay { position: fixed; inset: 0; z-index: 70; background: rgba(4, 5, 14, .66); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow); animation: rise .2s ease-out; position: relative; }
.modal.wide { max-width: 640px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; padding-right: 36px; }
.modal .sub { margin: 0 0 18px; color: var(--text-3); font-size: 14px; }
.modal .close { position: absolute; top: 14px; right: 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal .prose { color: var(--text-2); font-size: 14.5px; }
.modal .prose h4 { color: var(--text); margin: 18px 0 6px; }
.modal .prose li { margin-bottom: 6px; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.opt { padding: 14px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--panel-2); text-align: left; color: var(--text); }
.opt b { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.opt span { font-size: 12.5px; color: var(--text-3); }
.opt.on { border-color: #3fd28a; background: rgba(31, 191, 110, .14); }
.preview-video { width: 100%; aspect-ratio: 4 / 3; border-radius: 14px; background: #050806; object-fit: cover; transform: scaleX(-1); margin-bottom: 14px; display: block; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row > div { flex: 1; }
.setting-row b { display: block; font-size: 14.5px; }
.setting-row span { font-size: 12.5px; color: var(--text-3); }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.colors button.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .2); }
.colors button.none { background: conic-gradient(var(--male), var(--female), var(--other), var(--male)); }
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.profile-head .avatar { --s: 88px; }
.profile-head h3 { padding: 0; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 10px 0 16px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.bio { background: var(--panel-2); border: 1px solid var(--line); padding: 12px 14px; border-radius: 14px; white-space: pre-wrap; color: var(--text-2); font-size: 14px; }

/* ---------- chiamata ---------- */
.call { position: fixed; inset: 0; z-index: 80; background: #050806; display: flex; flex-direction: column; animation: fade .2s; }
.call .remote { flex: 1; min-height: 0; position: relative; }
.call .remote video { width: 100%; height: 100%; object-fit: contain; background: #050806; }
.call .local { position: absolute; right: 18px; top: calc(18px + var(--safe-t)); width: 180px; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .2); box-shadow: var(--shadow); background: #111; z-index: 2; }
.call .local video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.call .call-info { position: absolute; left: 0; right: 0; top: calc(20px + var(--safe-t)); text-align: center; z-index: 1; text-shadow: 0 2px 8px rgba(0, 0, 0, .7); }
.call .call-info b { font-size: 20px; display: block; }
.call .call-info span { color: var(--text-2); font-size: 14px; }
.call .call-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; text-align: center; }
.call .call-state .avatar { --s: 120px; box-shadow: 0 0 0 10px rgba(31, 191, 110, .12), 0 0 0 22px rgba(31, 191, 110, .06); animation: ring 1.6s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 16px rgba(31, 191, 110, .18), 0 0 0 34px rgba(31, 191, 110, .06); } }
.call-bar { display: flex; justify-content: center; gap: 16px; padding: 18px 18px calc(22px + var(--safe-b)); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); position: absolute; left: 0; right: 0; bottom: 0; }
.call-bar button { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; backdrop-filter: blur(10px); }
.call-bar button svg { width: 25px; height: 25px; }
.call-bar button.off { background: #fff; color: #111; }
.call-bar button.hang { background: #ff3d57; }
.call-bar button.answer { background: #18c172; }

/* ---------- toast ---------- */
#toasts { position: fixed; z-index: 90; top: calc(76px + var(--safe-t)); right: 16px; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 16px; background: rgba(21, 29, 25, .97); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: slideIn .25s ease-out; backdrop-filter: blur(16px); }
.toast.out { animation: slideOut .25s ease-in forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }
.toast .ti { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--panel-3); }
.toast .ti svg { width: 18px; height: 18px; }
.toast.ok .ti { background: rgba(46, 229, 157, .16); color: var(--ok); }
.toast.err .ti { background: rgba(255, 84, 112, .16); color: var(--danger); }
.toast.info .ti { background: rgba(31, 191, 110, .18); color: #5fe0a0; }
.toast.warn .ti { background: rgba(255, 181, 71, .16); color: var(--warn); }
.toast .tb { flex: 1; min-width: 0; font-size: 14px; }
.toast .tb b { display: block; margin-bottom: 1px; }
.toast .tb p { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.toast .ta { display: flex; gap: 8px; margin-top: 10px; }
.toast.clickable { cursor: pointer; }

/* ---------- bacheca ---------- */
.board { height: 100%; overflow-y: auto; padding: 22px 16px 40px; }
.board-inner { max-width: 660px; margin: 0 auto; }
.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.board-head h1 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.board-head p { margin: 4px 0 0; color: var(--text-3); }
.composer-card { padding: 16px; margin-bottom: 18px; }
.composer-card .top { display: flex; gap: 12px; }
.composer-card textarea { flex: 1; border: 0; background: transparent; outline: none; resize: none; min-height: 60px; font-size: 15.5px; padding: 8px 0; }
.composer-card .bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.img-preview { position: relative; margin: 8px 0 4px 50px; display: inline-block; }
.img-preview img { max-height: 220px; border-radius: 14px; display: block; }
.img-preview button { position: absolute; top: 8px; right: 8px; }
.post { padding: 16px 16px 8px; margin-bottom: 14px; animation: rise .25s ease-out; }
.post-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .who b { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.post-head .who > span { font-size: 12.5px; color: var(--text-3); }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; margin-bottom: 10px; }
.post-img { margin: 0 -16px 10px; background: #050806; }
.post-img img { width: 100%; max-height: 560px; object-fit: contain; display: block; cursor: zoom-in; }
.post-actions { display: flex; gap: 4px; border-top: 1px solid var(--line); padding-top: 6px; }
.post-actions button { flex: 1; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.post-actions button:hover { background: var(--panel-2); }
.post-actions button.liked { color: #ff5c86; }
.post-actions button.liked svg { fill: currentColor; }
.post-actions svg { width: 19px; height: 19px; }
.heart-pop { animation: heart .35s ease-out; }
@keyframes heart { 50% { transform: scale(1.35); } }
.comments { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 0 6px; }
.comment { display: flex; gap: 10px; margin-bottom: 10px; }
.comment .cb { background: var(--panel-2); border-radius: 4px 14px 14px 14px; padding: 8px 12px; min-width: 0; flex: 0 1 auto; }
.comment .cb b { font-size: 13px; cursor: pointer; }
.comment .cb p { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .cm { font-size: 11.5px; color: var(--text-3); margin: 3px 0 0 4px; display: flex; gap: 10px; }
.comment .cm button { border: 0; background: none; color: var(--text-3); padding: 0; font-size: 11.5px; font-weight: 700; }
.comment .cm button:hover { color: var(--danger); }
.comment-form { display: flex; gap: 8px; align-items: center; }
.comment-form .input { height: 40px; border-radius: 20px; }
.new-posts { position: sticky; top: 0; z-index: 5; display: flex; justify-content: center; margin-bottom: 10px; }
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(0, 0, 0, .9); display: grid; place-items: center; padding: 20px; cursor: zoom-out; animation: fade .2s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

/* ---------- admin ---------- */
.admin { height: 100%; overflow-y: auto; padding: 22px 16px 40px; }
.admin-inner { max-width: 1100px; margin: 0 auto; }
.admin h1 { margin: 0 0 16px; font-size: 28px; letter-spacing: -.03em; }
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px; }
.stat small { color: var(--text-3); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat b { display: block; font-size: 30px; letter-spacing: -.03em; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.actions { white-space: nowrap; text-align: right; }
table.t td.actions .btn { margin-left: 4px; }
.admin .card { padding: 16px; margin-bottom: 16px; }
.admin .card h3 { margin: 0 0 12px; font-size: 16px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: rgba(0, 0, 0, .35); padding: 2px 8px; border-radius: 6px; font-size: 13px; user-select: all; }
.station-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 8px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--panel-3); }
.pill.ok { background: rgba(46, 229, 157, .15); color: var(--ok); }
.pill.bad { background: rgba(255, 84, 112, .15); color: var(--danger); }

/* ---------- mobile nav ---------- */
.mobile-nav { display: none; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1180px) {
  .chat { grid-template-columns: 250px minmax(0, 1fr) 240px; gap: 10px; padding: 10px; }
  .radio .vol { display: none; }
}
@media (max-width: 980px) {
  .nav button span.lbl { display: none; }
  .radio { max-width: 260px; }
}
@media (max-width: 900px) {
  :root { --topbar: 58px; }
  body { font-size: 15px; }
  .topbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .topbar .wordmark { display: none; }
  .nav { display: none; }
  .me-btn .nick { display: none; }
  .me-btn { padding: 3px; }
  .radio { flex: 1; max-width: none; }
  .chat { display: block; padding: 0; position: relative; }
  .chat > .pane { position: absolute; inset: 0; border-radius: 0; border: 0; display: none; }
  .chat[data-pane="rooms"] > .p-rooms, .chat[data-pane="conv"] > .p-conv, .chat[data-pane="users"] > .p-users { display: flex; }
  .main { padding-bottom: calc(62px + var(--safe-b)); }
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: calc(62px + var(--safe-b)); padding-bottom: var(--safe-b);
    background: rgba(10, 14, 12, .92); border-top: 1px solid var(--line); backdrop-filter: blur(18px);
  }
  .mobile-nav button { flex: 1; border: 0; background: transparent; color: var(--text-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; position: relative; }
  .mobile-nav button svg { width: 23px; height: 23px; }
  .mobile-nav button.on { color: var(--text); }
  .mobile-nav button.on svg { color: #5fe0a0; }
  .mobile-nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
  .camtile { width: 150px; }
  .camtile.big { width: 240px; }
  .messages { padding: 10px 12px 6px; }
  .msg .body { max-width: 86%; }
  .msg .avatar-slot { width: 32px; }
  .msg .avatar { --s: 32px; }
  .msg .tools { display: none !important; }
  .call .local { width: 110px; }
  .jump { bottom: 86px; }
  #toasts { top: auto; bottom: calc(74px + var(--safe-b)); right: 12px; left: 12px; width: auto; }
  .conv-head { padding: 10px 10px 10px 10px; min-height: 60px; }
  .hide-m { display: none !important; }
}
@media (min-width: 901px) { .show-m { display: none !important; } }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 30px; }
  .hero h1 { text-align: center; }
  .hero p.lead { text-align: center; margin-left: auto; margin-right: auto; }
  .features { margin: 0 auto; }
  .landing-top .live-pill { display: none; }
  .landing-top { margin-bottom: 26px; }
}
@media (max-width: 520px) {
  .landing-inner { padding: 18px 16px 30px; }
  .features { grid-template-columns: 1fr; }
  .auth-card { padding: 20px 16px; }
  .opt-grid { grid-template-columns: 1fr; }
  .modal { padding: 20px 16px; border-radius: 20px; }
  .row.wrap-m { flex-direction: column; gap: 0; }
  .radio .meta small { font-size: 9.5px; letter-spacing: .04em; }
  .radio .meta b { font-size: 12.5px; }
  .station-row { grid-template-columns: 1fr; }
}

/* =========================================================
   v2 – tricolore, badge ruolo a icona, fix mobile
   ========================================================= */
.app { height: 100%; height: 100dvh; }
.radio .play { background: linear-gradient(135deg, #c21f31, #ef4256); box-shadow: 0 6px 16px -6px rgba(232, 54, 74, .8); }
.radio .vol { accent-color: #1fbf6e; }
.tabs button.on { box-shadow: 0 6px 18px -8px rgba(31, 191, 110, .8); }
.msg.mine .bubble { background: linear-gradient(135deg, #0c8a4c, #17a862); }
.send { box-shadow: 0 6px 16px -8px rgba(31, 191, 110, .8); }
.btn.primary { box-shadow: 0 10px 30px -12px rgba(31, 191, 110, .7); }
.list-item.on { background: linear-gradient(90deg, rgba(31, 191, 110, .18), rgba(31, 191, 110, .04)); box-shadow: inset 3px 0 0 #1fbf6e, inset 0 0 0 1px rgba(31, 191, 110, .22); }
.nav button.on { background: rgba(31, 191, 110, .14); color: #fff; box-shadow: inset 0 -2px 0 #1fbf6e; }
.topbar { box-shadow: 0 1px 0 rgba(255, 255, 255, .04); }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, #0f9d58 0 33.3%, #f4f6f2 33.3% 66.6%, #d42a3c 66.6% 100%); opacity: .55; }
.wordmark b { background: linear-gradient(90deg, #1fbf6e, #f4f6f2 50%, #e8364a); -webkit-background-clip: text; background-clip: text; }
.auth-card::before { background: linear-gradient(160deg, rgba(31, 191, 110, .65), rgba(244, 246, 242, .18) 45%, rgba(232, 54, 74, .65)); }
.hero h1 .grad { background: linear-gradient(90deg, #1fbf6e 0%, #8de0b4 30%, #f4f6f2 52%, #ff9aa5 72%, #e8364a 100%); -webkit-background-clip: text; background-clip: text; }
.bubble .at { color: #7ff0b4; }
.msg.mention .bubble { box-shadow: 0 0 0 1.5px rgba(31, 191, 110, .75); background: rgba(31, 191, 110, .1); }
.camtile.mine, .camtile { border-color: rgba(255, 255, 255, .12); }
.cam-toggle.on { background: linear-gradient(135deg, #c21f31, #ef4256); }

/* badge ruolo: piccolo cerchio con icona */
.role { width: 18px; height: 18px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 0; vertical-align: middle; }
.role svg { width: 11px; height: 11px; }
.role.admin { background: linear-gradient(135deg, #f5c542, #e09b12); color: #3a2600; }
.role.mod { background: linear-gradient(135deg, #1fbf6e, #0c8a4c); color: #fff; }
.role.dj { background: linear-gradient(135deg, #ef4256, #c21f31); color: #fff; }
.user-row .lt b { gap: 5px; }
.user-row .lt b .n { flex: 0 1 auto; min-width: 0; }

@media (max-width: 900px) {
  .main { padding-bottom: 0; }
  .view { bottom: calc(62px + var(--safe-b)); }
  .mobile-nav button.on svg { color: #1fbf6e; }
}
.p-conv { position: relative; }

/* =========================================================
   v3 – immagini in chat, stile testo, Capo
   ========================================================= */
.role.owner { background: conic-gradient(from 200deg, #1fbf6e, #f4f6f2, #e8364a, #1fbf6e); color: #3a2600; box-shadow: 0 0 0 1.5px #f5c542, 0 0 10px rgba(245, 197, 66, .55); }
.role.owner svg { color: #8a5a00; filter: drop-shadow(0 0 1px #fff); }
.role.admin { background: linear-gradient(135deg, #f5c542, #e09b12); color: #3a2600; }
.f-pacifico { font-family: 'Pacifico', cursive; }
.f-caveat { font-family: 'Caveat', cursive; font-size: 1.3em; line-height: 1.15; }
.f-lobster { font-family: 'Lobster', cursive; font-size: 1.08em; }
.f-comfortaa { font-family: 'Comfortaa', sans-serif; }
.f-courier { font-family: 'Courier Prime', ui-monospace, monospace; }
.f-playfair { font-family: 'Playfair Display', serif; font-style: italic; font-size: 1.06em; }
.f-dancing { font-family: 'Dancing Script', cursive; font-size: 1.25em; line-height: 1.2; }
.f-fredoka { font-family: 'Fredoka', sans-serif; font-size: 1.04em; }
.f-marker { font-family: 'Permanent Marker', cursive; }
.f-bebas { font-family: 'Bebas Neue', sans-serif; font-size: 1.25em; letter-spacing: .03em; }
.msg.mine .bubble.styled { background: rgba(31, 191, 110, .12); border: 1px solid rgba(31, 191, 110, .45); }
.bubble.img { padding: 4px; background: rgba(255, 255, 255, .05) !important; border-color: var(--line) !important; line-height: 0; }
.bubble.img img { display: block; max-width: min(280px, 62vw); max-height: 320px; border-radius: 13px; cursor: zoom-in; background: rgba(255, 255, 255, .04); min-width: 60px; min-height: 60px; object-fit: contain; }
.composer .uploading { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); padding: 0 8px 8px; }
.conv.dragover::after { content: 'Rilascia qui per inviare l\'immagine'; position: absolute; inset: 8px; border: 2px dashed #1fbf6e; border-radius: 16px; background: rgba(10, 14, 12, .85); display: grid; place-items: center; font-weight: 700; font-size: 18px; color: #fff; z-index: 20; }
.style-pop { position: absolute; bottom: calc(100% - 2px); left: 12px; width: 360px; max-width: calc(100vw - 24px); padding: 14px; z-index: 30; box-shadow: var(--shadow); background: var(--panel-solid); }
.style-pop h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.style-pop .tc { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.style-pop .tc button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.style-pop .tc button.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .2); }
.style-pop .tc button.none { background: conic-gradient(#1fbf6e, #f4f6f2, #e8364a, #1fbf6e); }
.style-pop .fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 190px; overflow-y: auto; margin-bottom: 12px; }
.style-pop .fonts button { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.style-pop .fonts button.on { border-color: #1fbf6e; background: rgba(31, 191, 110, .14); }
.style-pop .preview { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); margin-bottom: 12px; min-height: 42px; }
.icon-btn.styled-on { color: #1fbf6e; }
.owner-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.owner-hero .role.owner { width: 40px; height: 40px; }
.owner-hero .role.owner svg { width: 22px; height: 22px; }
.owner-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.owner-form .field { margin: 0; flex: 1; min-width: 140px; }

@media (max-width: 900px) {
  .composer-box { gap: 2px; padding: 5px; }
  .composer-box .icon-btn { width: 34px; height: 40px; }
  .composer textarea { padding-left: 4px; }
}

/* sussurro */
.msg.whisper .bubble { background: rgba(245, 197, 66, .07) !important; border: 1px dashed rgba(245, 197, 66, .65) !important; color: #ffe8a8; font-style: italic; }
.msg.whisper.mine .bubble { color: #ffe8a8; }
.wh-label { font-size: 11.5px; font-weight: 700; color: #f5c542; margin: 0 0 3px 2px; }
.msg.mine .wh-label { margin: 0 2px 3px 0; }
.whisper-bar { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 8px 6px 14px; margin-bottom: 6px; border-radius: 12px; background: rgba(245, 197, 66, .1); border: 1px dashed rgba(245, 197, 66, .55); color: #ffe8a8; font-size: 13px; }
.whisper-bar b { color: #f5c542; }

@media (max-width: 900px) { .logs-grid { grid-template-columns: 1fr !important; } }

/* separatore sottile tra messaggi di utenti diversi */
.msg.first { margin-top: 10px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.messages > .msg.first:first-child,
.day-sep + .msg.first,
.notice + .msg.first { border-top: 0; padding-top: 2px; }
.msg.first .tools { top: calc(50% + 6px); }

/* trillo */
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-9px, 3px) rotate(-.6deg); } 20% { transform: translate(8px, -4px) rotate(.6deg); }
  30% { transform: translate(-7px, -3px); } 40% { transform: translate(7px, 4px) rotate(-.4deg); }
  50% { transform: translate(-6px, 2px); } 60% { transform: translate(5px, -2px) rotate(.3deg); }
  70% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } 90% { transform: translate(-2px, 1px); }
}
.app.shake { animation: shake .8s cubic-bezier(.36, .07, .19, .97) both; }
@media (prefers-reduced-motion: reduce) { .app.shake { animation: none; } }

.notice.join span { color: #5fe0a0; background: rgba(31, 191, 110, .1); }
.notice.leave span { color: #ff8a95; background: rgba(232, 54, 74, .1); }

/* smartphone: il modulo di accesso subito in alto, la presentazione sotto */
@media (max-width: 860px) {
  .hero > .auth-card { order: -1; }
  .hero h1 { font-size: clamp(30px, 8vw, 40px); margin-top: 6px; }
  .landing-top { margin-bottom: 16px; }
}
@media (max-width: 520px) { .row.wrap-m > * { flex: 1 1 auto !important; } }
