/* GDM Meet — foglio di stile.
   Home chiara e coerente con gli altri portali GDM, stanza scura come si conviene
   a una videoconferenza. Tutto responsive: il cellulare è di casa. */

:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --slate-bg: #f8fafc;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 18px 40px rgba(15,23,42,.16);

  /* stanza */
  --room-bg: #0b1220;
  --room-tile: #16233a;
  --room-panel: #111c2e;
  --room-line: #1e2f4a;
  --room-ink: #e8eefc;
  --room-muted: #93a4c4;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
  overscroll-behavior: none;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.screen { min-height: 100%; }

/* ---------------- pulsanti e campi ---------------- */
.btn { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: 10px;
  font-weight: 600; font-size: 14px; transition: background .15s, transform .08s; }
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { display: block; width: 100%; }
.btn.big { padding: 14px 20px; font-size: 15px; border-radius: 12px; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--slate-bg); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--slate-bg); color: var(--ink); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

.field { margin-bottom: 14px; }
.field label, form label { display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; min-height: 80px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 150px; }
.check { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: 13.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.alert { padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px;
  background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.alert.info { background: #dbeafe; color: #1e3a8a; border-color: #bfdbfe; }

.ic { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; }

/* ---------------- accesso ---------------- */
.login-wrap { display: flex; align-items: center; justify-content: center; padding: 22px;
  min-height: 100dvh; background: radial-gradient(1200px 600px at 20% -10%, #1e40af 0%, transparent 60%), linear-gradient(135deg, #0b1220 0%, #14274a 60%, #1e3a8a 100%); }
.login-card { background: var(--panel); padding: 34px 32px; border-radius: 18px; width: 100%; max-width: 400px;
  box-shadow: 0 30px 60px rgba(2,6,23,.45); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-brand img { height: 44px; width: auto; }
.login-brand h1 { font-size: 21px; margin: 0; letter-spacing: -.3px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.login-sep { text-align: center; margin: 18px 0 14px; position: relative; }
.login-sep::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.login-sep span { position: relative; background: #fff; padding: 0 12px; color: var(--muted); font-size: 12px; }
.login-foot { text-align: center; color: var(--muted); font-size: 11.5px; margin: 20px 0 0; }
#login-form label { margin-top: 12px; }
#login-form .btn { margin-top: 20px; }

/* ---------------- home ---------------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--border); height: 60px;
  display: flex; align-items: center; padding: 0 18px; gap: 14px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-logo { height: 32px; width: auto; display: block; }
.brand-text { color: var(--muted); font-weight: 600; font-size: 14px; border-left: 1px solid var(--border); padding-left: 10px; }
.topbar .spacer { flex: 1; }
.topnav { display: flex; gap: 4px; }
.topnav button { background: none; border: none; padding: 8px 13px; border-radius: 9px; font-weight: 600;
  font-size: 13.5px; color: var(--muted); }
.topnav button:hover { background: var(--slate-bg); color: var(--ink); }
.topnav button.active { background: #eff6ff; color: var(--primary-dark); }
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px 8px 5px 5px; border-radius: 999px; }
.user-chip:hover { background: var(--slate-bg); }
.user-chip .avatar { width: 34px; height: 34px; font-size: 13px; }
.user-chip .u-name { font-weight: 600; font-size: 13px; line-height: 1.15; }
.user-chip .u-role { font-size: 11px; color: var(--muted); text-transform: capitalize; }

.avatar { border-radius: 50%; background: linear-gradient(135deg, #2563eb, #1e3a8a); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar.big { width: 96px; height: 96px; font-size: 34px; }

.home-main { max-width: 1080px; margin: 0 auto; padding: 30px 20px 60px; }

.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 32px;
  box-shadow: var(--shadow); margin-bottom: 26px; }
.hero h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: -.6px; line-height: 1.15; }
.hero p { color: var(--muted); margin: 0 0 22px; font-size: 15px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art { background: linear-gradient(135deg, #1e3a8a, #2563eb); border-radius: 16px; aspect-ratio: 16/10;
  display: grid; place-items: center; position: relative; overflow: hidden; }
.hero-art::after { content: ''; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 70% 20%, rgba(255,255,255,.22), transparent 70%); }
.hero-art .mini { display: grid; grid-template-columns: repeat(2, 66px); gap: 10px; }
.hero-art .mini i { display: block; height: 46px; border-radius: 9px; background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.22); }
.hero-art .mini i:nth-child(2) { background: rgba(255,255,255,.32); }

.join-box { display: flex; gap: 10px; }
.join-box input { flex: 1; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 28px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.mcard { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; transition: box-shadow .18s, transform .18s; }
.mcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.mcard .m-title { font-weight: 700; font-size: 15.5px; }
.mcard .m-when { color: var(--primary); font-weight: 600; font-size: 13px; }
.mcard .m-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--muted); }
.mcard .m-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.mcard.live { border-color: #86efac; background: linear-gradient(0deg, #f0fdf4, #fff); }
.mcard.mia { border-color: #bfdbfe; background: linear-gradient(0deg, #f5f9ff, #fff); }
.mcard .m-title .pill { vertical-align: middle; margin-left: 6px; }
/* suggerimenti della rubrica mentre si scrive un indirizzo */
.sugg { position: absolute; left: 0; right: 0; z-index: 40; margin-top: 2px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 232px; overflow-y: auto; }
.sugg button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; padding: 9px 12px; font-size: 13.5px; color: var(--ink);
  border-bottom: 1px solid var(--border); cursor: pointer; }
.sugg button:last-child { border-bottom: none; }
.sugg button.on, .sugg button:hover { background: #eff6ff; }
.sugg .s-nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg .s-mail { color: var(--muted); font-size: 12.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sugg .pill { flex: none; }

/* elenco degli invitati con il loro link personale */
.invitati { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; max-height: 240px; overflow-y: auto; }
.inv-riga { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.inv-riga:last-child { border-bottom: none; }
.inv-chi { font-size: 13.5px; min-width: 0; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.inv-azioni { display: flex; gap: 6px; flex: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--slate-bg); color: var(--muted); }
.pill.green { background: #dcfce7; color: #15803d; }
.pill.blue { background: #dbeafe; color: #1d4ed8; }
.pill.amber { background: #fef3c7; color: #b45309; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); background: var(--panel);
  border: 1px dashed var(--border); border-radius: 14px; }

/* riquadro con intestazione (es. "Posta in uscita") */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 13px 18px; background: var(--slate-bg); border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; letter-spacing: -.2px; }
.panel-body { padding: 18px; }
.panel-body .row > .btn { flex: 0 0 auto; min-width: 0; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); }
table.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 11px 14px; background: var(--slate-bg); border-bottom: 1px solid var(--border); }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: none; }

/* ---------------- pre-ingresso ---------------- */
.prejoin { background: var(--room-bg); color: var(--room-ink); display: grid; place-items: center;
  min-height: 100dvh; padding: 24px 18px; }
.prejoin-inner { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); gap: 34px;
  max-width: 1040px; width: 100%; align-items: center; }
.prejoin-video { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 16/9;
  box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.prejoin-video video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #000; }
.pj-off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; background: var(--room-tile); color: var(--room-muted); }
.pj-controls { position: absolute; bottom: 16px; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; }
.pj-level { position: absolute; top: 14px; left: 14px; width: 74px; height: 6px; border-radius: 4px;
  background: rgba(255,255,255,.2); overflow: hidden; }
.pj-level span { display: block; height: 100%; width: 0%; background: #4ade80; transition: width .1s linear; }
.prejoin-side h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.4px; }
.prejoin-side .muted { color: var(--room-muted); }
.prejoin-side label { color: var(--room-muted); }
.prejoin-side input, .prejoin-side select { background: var(--room-panel); border-color: var(--room-line); color: var(--room-ink); }
.prejoin-side input:focus, .prejoin-side select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.prejoin-side .btn.ghost { color: var(--room-muted); }
.prejoin-side .btn.ghost:hover { background: rgba(255,255,255,.06); color: #fff; }
.prejoin-side .btn.block + .btn.block { margin-top: 8px; }
.devices { margin: 4px 0 18px; border: 1px solid var(--room-line); border-radius: 12px; padding: 12px 14px;
  background: var(--room-panel); }
.devices summary { cursor: pointer; font-size: 13px; color: var(--room-muted); font-weight: 600; }
.devices[open] summary { margin-bottom: 12px; }
#pj-hint { margin-top: 14px; color: #7c8db0; }

/* ---------------- stanza ---------------- */
.room { background: var(--room-bg); color: var(--room-ink); height: 100dvh; display: flex; flex-direction: column;
  overflow: hidden; }
.room-top { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
  gap: 10px; border-bottom: 1px solid var(--room-line); flex: none; }
.rt-left, .rt-right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.rt-left strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.7);
  animation: pulse 2.2s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.chip { font-size: 12px; color: var(--room-muted); background: var(--room-panel); border: 1px solid var(--room-line);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip.quality.good { color: #4ade80; } .chip.quality.medium { color: #fbbf24; } .chip.quality.bad { color: #f87171; }
.chip.rec { color: #fca5a5; border-color: #7f1d1d; background: #2a0f14; }
.chip.rec .ic { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.room-body { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; position: relative; min-width: 0; padding: 10px; }
.grid { display: flex; flex-direction: column; gap: 10px; width: 100%; height: 100%; min-height: 0; }
.main-slot { flex: 1; min-height: 0; }
.strip { flex: none; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; height: 116px; padding-bottom: 2px; }
.strip .tile { width: 200px; height: 112px; flex: none; }
.main-slot > .tile { height: 100%; }

.tile { position: relative; background: var(--room-tile); border-radius: var(--radius); overflow: hidden;
  min-height: 0; display: grid; place-items: center; border: 2px solid transparent; transition: border-color .2s; }
.tile.speaking { border-color: #38bdf8; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0d1626; }
.tile.self video { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; background: #060b14; }
/* immagine di forma molto diversa dal riquadro: si mostra intera, senza tagliarla.
   Le fasce prendono il colore del riquadro, così sembrano bordi e non un difetto. */
.tile.intera video { object-fit: contain; background: var(--room-tile); }
.tile .t-avatar { position: absolute; inset: 0; display: grid; place-items: center; background: var(--room-tile); }
.tile .t-avatar .avatar { width: 84px; height: 84px; font-size: 28px; }
.tile .t-name { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 7px;
  background: rgba(2,6,23,.62); backdrop-filter: blur(6px); padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; max-width: calc(100% - 20px); }
.tile .t-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t-name .ic { width: 14px; height: 14px; }
.tile .t-name .ic.off { color: #f87171; }
.tile .t-badges { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.tile .t-badges .b { background: rgba(2,6,23,.62); backdrop-filter: blur(6px); border-radius: 8px; padding: 4px 7px;
  font-size: 12px; display: grid; place-items: center; }
.tile .t-badges .b.hand { background: #f59e0b; color: #1f1300; }
.tile .t-badges .b.host { background: rgba(37,99,235,.85); color: #fff; font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; padding: 4px 8px; }
.tile .t-pin { position: absolute; right: 10px; bottom: 10px; opacity: 0; transition: opacity .15s; }
.tile:hover .t-pin { opacity: 1; }
.tile .t-net { position: absolute; left: 10px; top: 10px; width: 8px; height: 8px; border-radius: 50%; }
.tile .t-net.good { background: #22c55e; } .tile .t-net.medium { background: #f59e0b; } .tile .t-net.bad { background: #ef4444; }
.tile .t-net.connecting { background: #64748b; animation: blink 1s infinite; }

/* invito a condividere il link quando si è da soli */
.chip.conf { background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.chip.conf.spento { background: rgba(148,163,184,.18); color: var(--room-muted); }

.alone-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(17,28,46,.94); border: 1px solid var(--room-line); border-radius: 16px;
  padding: 18px 22px; text-align: center; box-shadow: 0 18px 40px rgba(0,0,0,.45);
  max-width: min(520px, 92%); backdrop-filter: blur(8px); }
.alone-card .ac-close { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px;
  border: none; background: none; color: var(--room-muted); font-size: 22px; line-height: 1;
  border-radius: 8px; cursor: pointer; }
.alone-card .ac-close:hover { background: rgba(255,255,255,.08); color: #fff; }
.alone-card .ac-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; padding: 0 22px; }
.alone-card .ac-sub { color: var(--room-muted); font-size: 13px; margin-bottom: 12px; }
.alone-card .ac-link { background: var(--room-tile); border-radius: 10px; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  margin-bottom: 12px; word-break: break-all; color: #93c5fd; }
.alone-card .btn { width: 100%; }

.captions { position: absolute; left: 50%; transform: translateX(-50%); bottom: 18px; max-width: min(760px, 92%);
  background: rgba(2,6,23,.82); border-radius: 12px; padding: 10px 16px; font-size: 16px; line-height: 1.45;
  text-align: center; pointer-events: none; }
.captions b { color: #7dd3fc; font-weight: 700; margin-right: 6px; }
.reactions { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.reaction-fly { position: absolute; bottom: 60px; font-size: 44px; animation: fly 2.6s ease-out forwards; }
@keyframes fly { 0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-30px) scale(1.1); }
  100% { transform: translateY(-320px) scale(1); opacity: 0; } }
.lobby-banner { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: #1d4ed8;
  color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13.5px; display: flex; gap: 10px;
  align-items: center; box-shadow: var(--shadow-lg); }
.lobby-banner button { border: none; background: #fff; color: #1d4ed8; font-weight: 700; padding: 6px 12px;
  border-radius: 8px; font-size: 12.5px; }
.lobby-banner button.deny { background: rgba(255,255,255,.18); color: #fff; }

/* pannello laterale */
.side { width: 330px; flex: none; background: var(--room-panel); border-left: 1px solid var(--room-line);
  display: flex; flex-direction: column; min-height: 0; }
.side-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--room-line); }
.side-tab { background: none; border: none; color: var(--room-muted); font-weight: 600; font-size: 13px;
  padding: 8px 12px; border-radius: 8px; }
.side-tab.active { background: rgba(59,130,246,.16); color: #93c5fd; }
.side-close { margin-left: auto; }
.side-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.msg .m-head { font-size: 11.5px; color: var(--room-muted); margin-bottom: 3px; }
.msg .m-body { background: var(--room-tile); padding: 9px 12px; border-radius: 12px; font-size: 13.5px;
  word-wrap: break-word; overflow-wrap: anywhere; }
.msg.mine .m-body { background: #1e40af; }
.msg.sys { text-align: center; color: var(--room-muted); font-size: 12px; font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--room-line); }
.chat-form input { background: var(--room-tile); border-color: var(--room-line); color: var(--room-ink); border-radius: 999px; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--room-line); }
.person .avatar { width: 34px; height: 34px; font-size: 12.5px; }
.person .p-name { font-size: 13.5px; font-weight: 600; }
.person .p-sub { font-size: 11.5px; color: var(--room-muted); }
.person .p-actions { margin-left: auto; display: flex; gap: 6px; }
.person .p-icons { margin-left: auto; display: flex; gap: 8px; color: var(--room-muted); }
.person .p-icons .off { color: #f87171; }
.people-head { padding: 12px 14px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--room-muted); font-weight: 700; }

/* barra comandi */
.room-bar { flex: none; height: 76px; display: flex; align-items: center; padding: 0 14px;
  border-top: 1px solid var(--room-line); gap: 10px; }
.bar-left, .bar-right { flex: 1; min-width: 0; }
.bar-right { display: flex; justify-content: flex-end; }
.bar-info { color: var(--room-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.bar-center { display: flex; gap: 9px; align-items: center; }
.rbtn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--room-line); background: var(--room-panel);
  color: var(--room-ink); display: grid; place-items: center; position: relative; transition: background .15s, transform .08s; }
.rbtn svg { width: 21px; height: 21px; fill: currentColor; }
.rbtn:hover { background: #1b2a44; }
.rbtn:active { transform: scale(.94); }
.rbtn.small { width: 36px; height: 36px; }
.rbtn.small svg { width: 17px; height: 17px; }
.rbtn.off { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.rbtn.on { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.rbtn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.rbtn.hangup { background: #dc2626; border-color: #dc2626; color: #fff; width: 62px; border-radius: 30px; }
.rbtn.hangup:hover { background: #b91c1c; }
.rbtn .badge { position: absolute; top: -2px; right: -2px; background: #ef4444; color: #fff; font-size: 10px;
  font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

.popover { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%); background: var(--room-panel);
  border: 1px solid var(--room-line); border-radius: 14px; padding: 10px; display: flex; gap: 6px;
  box-shadow: var(--shadow-lg); z-index: 40; }
.popover button { background: none; border: none; font-size: 26px; padding: 6px 8px; border-radius: 10px; }
.popover button:hover { background: #1b2a44; }
.popover.menu { flex-direction: column; padding: 8px; min-width: 250px; }
.popover.menu button { font-size: 13.5px; color: var(--room-ink); text-align: left; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; width: 100%; }
.popover.menu button .ic { width: 17px; height: 17px; color: var(--room-muted); }
.popover.menu hr { border: none; border-top: 1px solid var(--room-line); margin: 6px 0; }

/* ---------------- finestre e avvisi ---------------- */
.modal-back { position: fixed; inset: 0; background: rgba(2,6,23,.62); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 18px; }
.modal { background: #fff; color: var(--ink); border-radius: 18px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); max-height: 90dvh; overflow-y: auto; }
.modal .m-head { padding: 20px 24px 4px; }
.modal .m-head h3 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.modal .m-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal .m-body { padding: 18px 24px; }
.modal .m-foot { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--slate-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; word-break: break-all; }
.copybox code { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: toastin .25s ease-out; max-width: 90vw; }
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* ---------------- cellulare ---------------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero-art { display: none; }
  .prejoin-inner { grid-template-columns: 1fr; gap: 18px; }
  .prejoin-video { aspect-ratio: 4/3; }
  .side { position: absolute; inset: 0; width: auto; z-index: 30; border-left: none; }
  .room-body { position: relative; }
}
@media (max-width: 640px) {
  .home-main { padding: 20px 14px 50px; }
  .hero h1 { font-size: 23px; }
  /* dal cellulare il menu resta raggiungibile: va a capo sotto il logo */
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; row-gap: 6px; gap: 8px; }
  .topnav { order: 3; width: 100%; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav button { flex: 1 0 auto; padding: 9px 14px; font-size: 13px; background: var(--slate-bg);
    white-space: nowrap; min-height: 38px; }
  .user-chip .u-name, .user-chip .u-role { display: none; }
  .room-top { height: 46px; padding: 0 10px; }
  .rt-left strong { max-width: 40vw; font-size: 13px; }
  #room-code, #room-quality, #room-people { display: none; }
  .stage { padding: 6px; }
  .grid { gap: 6px; }
  .room-bar { height: 68px; padding: 0 6px; }
  .bar-left, .bar-right { display: none; }
  .bar-center { width: 100%; justify-content: center; gap: 6px; }
  .rbtn { width: 44px; height: 44px; }
  .rbtn svg { width: 19px; height: 19px; }
  .rbtn.hangup { width: 56px; }
  #btn-emoji, #btn-people { display: none; }
  .tile .t-name { font-size: 11.5px; padding: 4px 9px; }
  .tile .t-avatar .avatar { width: 60px; height: 60px; font-size: 20px; }
  .captions { font-size: 14px; bottom: 10px; }
  .strip { height: 82px; } .strip .tile { width: 122px; height: 70px; }
  .modal { max-width: 100%; }
}
@media (display-mode: standalone) {
  .room-bar { padding-bottom: env(safe-area-inset-bottom); height: calc(76px + env(safe-area-inset-bottom)); }
}
