:root {
  --header: #7fa8c8;
  --accent: #2e8ee8;
  --panel: #d9eafa;
  --line: #a8bfd4;
  --text: #111;
  font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

.app-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f4f3ef;
  transition: opacity .45s ease, visibility .45s ease;
}

.app-preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-preloader-card {
  width: min(490px, 90vw);
  min-height: 390px;
  padding: 42px 34px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.app-preloader-logo {
  width: min(320px, 72vw);
  max-height: 230px;
  margin-bottom: 32px;
  object-fit: contain;
}

.app-preloader-spinner {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.icona-rooms-x {
    width: 20px !important;
    height: 20px !important;
    object-fit: contain;
    border: 0px solid #c8d8ea !important;    /* ? Mantieni il tuo stile */
    background: #ffffff00 !important;        /* ? Mantieni il tuo stile */
    display: inline-block !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
}
.app-preloader-spinner span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ee243c;
  animation: preloaderPulse .8s infinite ease-in-out alternate;
}

.app-preloader-spinner span:nth-child(2) {
  background: #2f72c9;
  animation-delay: .15s;
}

.app-preloader-spinner span:nth-child(3) {
  background: #8d74c9;
  animation-delay: .3s;
}

@keyframes preloaderPulse {
  from {
    transform: scale(.7);
    opacity: .45;
  }
  to {
    transform: scale(1.25);
    opacity: 1;
  }
}

.app-preloader-version {
  color: #858585;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  text-align: center;
}

html,
body {
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--text);
  background: #bcd2e4;
  font-size: 12px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.chat-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: #c8dced;
  //--chat-background-image: url("../assets/brand/privato.img.png");
}

.chat-shell:not(.in-room) {
  grid-template-rows: auto minmax(0, 1fr);
}


.top-strip {
  display: none;
}

.chat-shell:not(.in-room) .top-strip,
.chat-shell.in-room .top-strip {
  display: none;
}

.secondary-strip a[href*="youtube"],
.secondary-strip a[href*="facebook"],
.secondary-strip a[href*="apple"],
.secondary-strip a[href*="android"],
.secondary-strip [data-action*="youtube" i],
.secondary-strip [data-action*="facebook" i],
.secondary-strip [data-action*="stream" i],
.secondary-strip [data-action*="apple" i],
.secondary-strip [data-action*="android" i] {
  display: none !important;
}

.chat-shell.in-room #signinTop {
  display: none;
}

.secondary-strip,
.module-row,
.secondary-strip .module-row {
  height: var(--secondary-strip-height, 70px) !important;
  min-height: var(--secondary-strip-height, 70px) !important;
  box-sizing: border-box;
}

.secondary-strip,
.module-row {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.secondary-strip {
  align-items: center;
}

.secondary-strip.has-custom-background,
.module-row.has-custom-background {
  background-image:
    linear-gradient(rgba(210, 230, 245, .60), rgba(210, 230, 245, .60)),
    var(--secondary-strip-background-image);
}

.secondary-strip .top-actions,
.secondary-strip .secondary-actions,
.secondary-strip [data-action],
.module-row .top-actions,
.module-row .secondary-actions,
.module-row [data-action] {
  height: 100%;
  display: flex;
  align-items: center;
}

.secondary-strip button,
.secondary-strip a,
.module-row button,
.module-row a {
  min-width: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid #80a5c6;
  border-radius: 50%;
  color: #287ac5;
  background: radial-gradient(circle at 30% 30%, #fff, #9fd6ff);
  font-size: 21px;
  font-weight: 900;
  transform: rotate(-18deg);
}

#aboutModal .brand-mark {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  display: inline-block !important;
  background: url("../assets/brand/321ConnectChatLogo.png") center / contain no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
  overflow: hidden !important;
  border-radius: 8px !important;
  transform: none !important;
  border: 0 !important;
}

#aboutModal #aboutName {
  color: #0074d9 !important;
  font-weight: 800 !important;
}

.brand strong {
  display: block;
  color: #f08200;
  font-size: 16px;
  text-shadow: 1px 1px #fff;
}

.brand span {
  display: block;
  max-width: 46vw;
  overflow: hidden;
  color: #507089;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions button,
.top-actions a,
.module-button {
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid #a1b9ce;
  border-radius: 5px;
  color: #344;
  background: linear-gradient(#fff, #d7e5f1);
  text-decoration: none;
}

.top-actions button:not(:first-child),
.info-btn,
.module-icon {
  min-width: 26px;
  min-height: 26px;
  padding: 0 4px;
  border: 0;
  color: #3087cf;
  background: transparent;
  font-size: 20px;
}

.toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  isolation: isolate;
  width: 36px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
  overflow: visible;
}

.toolbar-icon-btn::after,
.toolbar-label-btn[data-tooltip]::after,
.input-avatar[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%) translateY(-4px);
  background: rgba(15, 63, 104, .96);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  padding: 3px 6px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
  z-index: 9999;
}

/* .input-avatar sta incollato al fondo del riquadro messaggi (nessuno
   spazio sotto): se il tooltip si apre verso il basso, il contenitore
   con overflow:hidden lo taglia e non si vede piu'. Solo per questo
   pulsante il tooltip resta sopra, dove c'e' spazio visibile. */
.input-avatar[data-tooltip]::after {
  top: auto;
  bottom: calc(100% + 7px);
  transform: translateX(-50%) translateY(4px);
}

/* Le icone della riga in alto (webcam, regali, menu, info) sono subito
   sopra al riquadro chat/pannello laterale: aprendo il tooltip verso il
   basso finisce tagliato/coperto da quel riquadro. Anche qui il tooltip
   resta sopra il pulsante, dove c'e' spazio libero. */
.module-row .toolbar-icon-btn[data-tooltip]::after,
.module-row .toolbar-icon-btn::after {
  top: auto;
  bottom: calc(100% + -1px);
  transform: translateX(-50%) translateY(4px);
}

.toolbar-icon-btn:hover::after,
.toolbar-icon-btn:focus-visible::after,
.toolbar-label-btn[data-tooltip]:hover::after,
.toolbar-label-btn[data-tooltip]:focus-visible::after,
.input-avatar[data-tooltip]:hover::after,
.input-avatar[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toolbar-icon-btn:hover,
.toolbar-icon-btn:focus-visible,
.toolbar-label-btn[data-tooltip]:hover,
.toolbar-label-btn[data-tooltip]:focus-visible,
.input-avatar[data-tooltip]:hover,
.input-avatar[data-tooltip]:focus-visible {
  background: linear-gradient(to bottom,#fff,#cdd8ed);
  box-shadow: 0 0 10px rgba(0, 195, 255, .35);
  outline: none;
}

.toolbar-icon-btn.is-active {
  background: rgba(0, 170, 255, .18);
  box-shadow: 0 0 12px rgba(0, 195, 255, .55);
}

.toolbar-icon-btn.is-disabled {
  opacity: .45;
  pointer-events: none;
}

.toolbar-icon-svg {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
  opacity: .93;
  filter: none;
  transition: filter .18s ease, opacity .18s ease, transform .18s ease;
}

.toolbar-icon-btn:hover .toolbar-icon-svg,
.toolbar-icon-btn:focus-visible .toolbar-icon-svg {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(0, 195, 255, .55)) brightness(1.14) saturate(1.12);
}

.toolbar-icon-btn.is-active .toolbar-icon-svg {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(0, 195, 255, .85)) brightness(1.2) saturate(1.15);
}

.toolbar-icon-btn.is-disabled .toolbar-icon-svg {
  opacity: .48;
  filter: grayscale(.75) brightness(.95);
}

.toolbar-label-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #a1b9ce;
  border-radius: 5px;
  color: #344;
  background: linear-gradient(#fff, #d7e5f1);
  text-decoration: none;
  position: relative;
  overflow: visible;
}

.toolbar-label-btn .toolbar-icon-svg {
  width: 18px;
  height: 18px;
  filter: none;
}

.module-camera {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 9px;
  color: #238ad0;
  background: transparent;
  transition: background-color .15s ease, box-shadow .15s ease, opacity .15s ease, color .15s ease, transform .15s ease;
}

.module-camera.is-off {
  opacity: .72;
}

.module-camera.is-active {
  color: #59d5ff;
  background: rgba(0, 195, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(89, 213, 255, .2), 0 0 14px rgba(89, 213, 255, .26);
}

.module-camera .webcam-icon-img {
  display: block;
  width: 19px;
  height: 19px;
  object-fit: contain;
  opacity: .92;
  filter: grayscale(.22) brightness(1.05) contrast(1.05);
  transition: filter .15s ease, opacity .15s ease, transform .15s ease;
}

.module-camera:hover .webcam-icon-img,
.module-camera:focus-visible .webcam-icon-img {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(68, 215, 255, .72)) brightness(1.1) saturate(1.18);
  transform: translateY(-1px);
}

.module-camera.is-active .webcam-icon-img {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(68, 215, 255, .95)) brightness(1.18) saturate(1.2);
}

.module-camera.is-off .webcam-icon-img {
  opacity: .62;
  filter: grayscale(.55) brightness(.95);
}

/* Badge ?? "Richieste di registrazione da approvare"   visibile in chat solo agli
   staff (admin/superadmin) quando il modulo di registrazione   in modalit 
   "Con approvazione e foto" e ci sono richieste pendenti da revisionare. */
.reg-requests-badge-btn {
  font-size: 18px;
  line-height: 1;
}

/* FIX: la classe .toolbar-icon-btn impone display:inline-flex a tutte le icone
   della toolbar (camera, profilo, avatar, ecc.) con la stessa specificita'
   dell'attributo [hidden], ma essendo una regola "autore" vince sempre sulla
   regola di default del browser [hidden]{display:none}. Risultato: impostare
   el.hidden = true da JS non bastava a nascondere davvero il pulsante.
   Questa regola forza la priorita' dell'attributo [hidden] su tutte le altre. */
.reg-requests-badge-btn[hidden] {
  display: none !important;
}

/* FIX 2: la regola "#chatScreen > .module-row .toolbar-icon-btn { display:
   inline-flex !important }" (vedi sotto, riga ~5256) ha specificita' piu' alta
   (contiene l'ID #chatScreen) e vinceva sulla regola sopra anche con !important.
   Questo selettore usa DUE ID per garantire una specificita' superiore in ogni
   caso, indipendentemente dall'ordine delle regole nel file. */
#chatScreen #regRequestsBadgeBtn[hidden] {
  display: none !important;
}

/* Sotto i 760px (mobile) il pulsante resta sempre nascosto, anche per
   admin/superadmin: la visibilita' su mobile e' bloccata indipendentemente
   dal ruolo. Su desktop la visibilita' e' gestita da JS (solo admin/superadmin). */
@media (max-width: 760px) {
  .reg-requests-badge-btn {
    display: none !important;
  }
}

.reg-requests-badge-btn .reg-requests-badge-icon {
  display: block;
  opacity: .9;
  transition: filter .18s ease, opacity .18s ease, transform .18s ease;
}

.reg-requests-badge-btn:hover .reg-requests-badge-icon,
.reg-requests-badge-btn:focus-visible .reg-requests-badge-icon {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(255, 196, 0, .65));
  transform: translateY(-1px);
}

.reg-requests-badge-count {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e5384b;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(11, 18, 32, .92), 0 0 8px rgba(229, 56, 75, .6);
  animation: regRequestsBadgePulse 1.8s ease-in-out infinite;
}

@keyframes regRequestsBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}


@media (hover: none) {
  .toolbar-icon-btn::after,
  .toolbar-label-btn[data-tooltip]::after,
  .input-avatar[data-tooltip]::after {
    display: none;
  }
}

.select-room-screen {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  border-radius: 0;
  background-color: #f0f4f8;
  background-image: url("/assets/brand/321ConnectChat.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-attachment: fixed;
}

.select-room-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  pointer-events: none;
}

.select-room-screen > * {
  position: relative;
  z-index: 1;
}

.select-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.42);
}

.select-title-row h1 {
  margin: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,.85), 0 0 7px rgba(0,0,0,.35);
}

.select-room-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.side-search input {
  min-height: 22px;
  border: 1px solid #b4c5d4;
  border-radius: 4px;
  background: #fff;
}

.side-search span {
  grid-column: 2;
  margin-top: 2px;
}

.select-room-action {
  min-height: 28px;
  padding: 5px 11px;
  color: #fff;
  border: 1px solid rgba(117, 205, 255, 0.85);
  border-radius: 8px;
  background: rgba(8, 22, 56, 0.78);
  box-shadow: 0 0 10px rgba(0, 195, 255, 0.35);
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
}

.select-room-action.icon-button {
  min-width: 30px;
  padding-inline: 8px;
}

.select-room-action:hover {
  background: rgba(0, 116, 217, 0.95);
  box-shadow: 0 0 14px rgba(0, 195, 255, 0.65);
}

.select-rooms-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 126px);
  overflow-y: auto;
  padding-right: 2px;
}

.select-room-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 78px;
  padding: 14px 18px;
  background: rgba(12, 24, 46, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-left: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255,255,255,0.12);
}

.select-room-row:nth-child(even) {
  background: rgba(12, 24, 46, 0.46);
}

.select-room-row:hover {
  background: rgba(20, 40, 70, 0.62);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Bordo colorato a sinistra in base allo stato stanza */
.select-room-row.is-live    { border-left-color: #35d07f; }
.select-room-row.is-empty   { border-left-color: rgba(255,255,255,0.3); }
.select-room-row.is-closed  { border-left-color: #ff5470; opacity: 0.72; }

/* --- Avatar stanza con indicatore live --- */
.select-room-avatar {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.select-room-row img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.5);
  flex-shrink: 0;
  background: #fff;
}

.select-room-row.is-live .select-room-avatar img {
  border-color: #35d07f;
  box-shadow: 0 0 0 3px rgba(53, 208, 127, 0.25);
}

.select-room-row.is-closed .select-room-avatar img {
  border-color: #ff5470;
  filter: grayscale(0.5);
}

.select-room-live-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  border: 2px solid rgba(12,24,46,0.9);
}

.select-room-row.is-live .select-room-live-dot {
  background: #35d07f;
  box-shadow: 0 0 8px rgba(53, 208, 127, 0.85);
  animation: roomLivePulse 1.6s ease-in-out infinite;
}

.select-room-row.is-closed .select-room-live-dot {
  background: #ff5470;
}

@keyframes roomLivePulse {
  0%, 100% { box-shadow: 0 0 6px rgba(53, 208, 127, 0.7); }
  50%      { box-shadow: 0 0 12px rgba(53, 208, 127, 1); }
}

/* --- Testi principali --- */
.select-room-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.select-room-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.select-room-copy strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  letter-spacing: 0.2px;
}

.select-room-copy small {
  display: block;
  color: rgba(255,255,255,0.88);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
}

/* Tag di stato (password / soci / chiusa) */
.select-room-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.select-room-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 20px;
  white-space: nowrap;
  color: #fff;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.3);
}

.select-room-tag .tag-ico { font-size: 11px; }

.select-room-tag.tag-password { background: rgba(255, 196, 0, 0.22); border-color: rgba(255, 196, 0, 0.55); color: #ffe28a; }
.select-room-tag.tag-members  { background: rgba(120, 170, 255, 0.22); border-color: rgba(120, 170, 255, 0.5); color: #cfe0ff; }
.select-room-tag.tag-closed   { background: rgba(255, 84, 112, 0.25); border-color: rgba(255, 84, 112, 0.55); color: #ffc4cf; }

/* --- Colonna destra: contatore + feature icone --- */
.select-room-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.select-room-brand {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}

.select-room-count {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-weight: 800;
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  padding: 5px 12px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.select-room-count .icona-rooms-x { width: 15px !important; height: 15px !important; }

.select-room-count.is-hot {
  background: rgba(255, 176, 32, 0.22);
  border-color: rgba(255, 176, 32, 0.55);
  color: #ffd98a;
}

.select-room-count.is-full {
  background: rgba(255, 84, 112, 0.25);
  border-color: rgba(255, 84, 112, 0.6);
  color: #ffc4cf;
}

.select-room-features {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.85;
}

.select-room-features .icona-rooms-x {
  width: 22px !important;
  height: 22px !important;
}

.chat-screen {
  display: grid;
  grid-template-rows: var(--secondary-strip-height, 38px) minmax(0, 1fr);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #c8dced;
}
.module-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding: 0 12px !important;
  border-top: 1px solid #eff8ff;
  border-bottom: 1px solid #8daeca;
  background: linear-gradient(#dcedfb, #a9c6dd);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.module-spacer { flex: 1 1 auto; }

.chat-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  column-gap: 0;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0 0 0 0px;
  background: #b8cfe1;
}

.main-chat,
.side-panel {
  min-height: 0;
  max-height: 100%;
  border: 1px solid #8faec7;
  background: #eef6fd;
}

.main-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border-right: 0;
  background: linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.72)), var(--chat-background-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.room-media-panel {
  display: grid;
  gap: 5px;
  padding: 6px 8px;
  border-bottom: 1px solid #9eb8cf;
  background: #eef6fd;
  color: #18364f;
  font-size: 12px;
}

.room-media-panel[hidden] {
  display: none;
}

.room-media-panel audio,
.room-media-panel video {
  width: 100%;
  max-height: 180px;
}

.room-media-panel a {
  color: #0759a6;
}

.room-tabbar {
  display: flex;
  align-items: end;
  flex: 0 0 auto;
  min-height: 29px;
  border-bottom: 1px solid #9eb8cf;
  background: linear-gradient(#eaf6ff, #c7ddef);
  gap: 3px;
  padding: 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
}

.room-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 110px;
  max-width: 220px;
  height: 29px;
  border: 1px solid #8faec7;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #fff;
  color: #111;
  font-weight: 700;
  padding: 0 6px 0 8px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.room-tab.active {
  background: #d0e8ff;
  border-color: #4a90c9;
  color: #003366;
  z-index: 1;
}

.tab-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
  color: #777;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.tab-close:hover {
  background: rgba(180, 0, 0, 0.12);
  color: #c00;
}

.tab-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e44;
  color: white;
  border-radius: 9999px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* -- Tab privato ------------------------------------------------------- */
.room-tab.is-private-tab {
  background: #fff7f0;
  border-color: #c8876a;
  color: #7a3500;
}
.room-tab.is-private-tab.active {
  background: #ffe8d6;
  border-color: #c05c20;
  color: #5a2000;
}
.room-tab.is-private-tab .tab-close:hover {
  background: rgba(180,60,0,0.13);
  color: #c03000;
}

/* -- Banner notice chat privata (in cima a #messages) ------------------- */
.private-chat-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, #fff3e0 0%, #ffe0b2 100%);
  border: 1px solid #ffb74d;
  border-radius: 6px;
  padding: 6px 12px;
  margin: 0 0 8px;
  font-size: 12.5px;
  color: #7a4000;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 2;
}

.messages {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  height: auto;
  padding: 6px 7px;
  background-color: rgb(255 255 255 / 12%);
  background-image: var(--chat-background-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-blend-mode: lighten;
}

.message {
  position: relative;
  min-height: 29px;
  padding: 4px 6px 4px 33px;
  font-size: 13px;
  line-height: 20px;
}

.message.system {
  padding-left: 22px;
  color: #126ee4;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .2px;
}

.message .avatar {
 // position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  object-fit: cover;
}

.message strong { color: #111; }
.msg-own-nick-arrow {
  color: #1a73e8;
  font-weight: 900;
}
.message time {
  display: block;
  margin-top: 3px;
  color: #83909a;
  font-size: 11px;
  font-weight: 400;
}
.inline-smiley {
  max-width: 42px;
  max-height: 42px;
  width: auto;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}


/* ===== MENTION BADGE: > destinatario ===== */
.msg-mention-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 5px;
  padding: 1px 8px 1px 5px;
  background: linear-gradient(135deg, #1a73e8 0%, #0d5dbf 100%);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(26,115,232,0.35);
  white-space: nowrap;
  user-select: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.18);
  transition: box-shadow 0.15s;
}
.msg-mention-badge:hover {
  box-shadow: 0 2px 8px rgba(26,115,232,0.5);
}
.msg-mention-arrow {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  color: rgba(255,255,255,0.75);
  margin-right: 1px;
}
.msg-mention-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dark skin adaptation */
.skin-dark .msg-mention-badge {
  background: linear-gradient(135deg, #2b88ff 0%, #1a60d4 100%);
  box-shadow: 0 1px 4px rgba(43,136,255,0.4);
}

/* recipientSelect: evidenzia quando un utente e' selezionato */
#recipientSelect.has-recipient {
  border-color: #1a73e8 !important;
  background-color: #e8f0fe !important;
  color: #1a47a8 !important;
  font-weight: 600 !important;
}


/* ===== YOUTUBE POPUP ===== */
.youtube-popup {
  width: 340px;
  padding: 0 !important;
  overflow: hidden;
  z-index: 50;
}
.youtube-popup .popup-title {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid #dde4ea;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.youtube-popup-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.youtube-popup-body input[type="url"] {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #c8d8e8;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #f7fafd;
  color: #1a2233;
  transition: border-color .15s;
}
.youtube-popup-body input[type="url"]:focus { border-color: #FF0000; }
.youtube-preview {
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
  width: 100%;
}
.youtube-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.youtube-popup-actions {
  display: flex;
  gap: 8px;
}
.youtube-btn-preview {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1.5px solid #c8d8e8;
  background: #f0f4f8;
  color: #3a5270;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.youtube-btn-preview:hover { background: #dde8f4; }
.youtube-btn-send {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: #FF0000;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.youtube-btn-send:hover:not(:disabled) { background: #cc0000; }
.youtube-btn-send:disabled { background: #f8b8b8; cursor: not-allowed; }
.youtube-error {
  color: #c00;
  font-size: 12px;
  padding: 4px 0;
}

/* Chat: YouTube embedded player */
.chat-youtube-wrap {
  display: block;
  width: 100%;
  max-width: 340px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  margin: 4px 0;
  aspect-ratio: 16/9;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.chat-youtube-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ===== GIF POPUP ===== */
.gif-popup {
  width: 300px;
  padding: 0 !important;
  overflow: hidden;
  z-index: 50;
}
.gif-popup .popup-title {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid #dde4ea;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gif-search-bar {
  display: flex;
  gap: 5px;
  padding: 7px 8px;
  border-bottom: 1px solid #edf1f5;
  background: #f7fafd;
}
.gif-search-bar input {
  flex: 1;
  padding: 5px 8px;
  border: 1.5px solid #c8d8e8;
  border-radius: 7px;
  font-size: 12px;
  outline: none;
  background: #fff;
  color: #1a2233;
  transition: border-color .15s;
}
.gif-search-bar input:focus { border-color: #7c3aed; }
.gif-search-bar button {
  padding: 5px 10px;
  border: none;
  border-radius: 7px;
  background: #7c3aed;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.gif-search-bar button:hover { background: #6d28d9; }
.gif-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 6px;
  max-height: 200px;
  overflow-y: auto;
  background: #f7fafd;
}
.gif-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .12s, transform .12s;
  display: block;
}
.gif-grid img:hover {
  border-color: #7c3aed;
  transform: scale(1.04);
  z-index: 1;
  position: relative;
}
.gif-placeholder {
  grid-column: 1/-1;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 30px 0;
}
.gif-loading {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  padding: 16px;
}

/* ===== SOUND POPUP (invio audio in chat) ===== */
.sound-popup { width: 280px; }
.sound-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  /* Mostra al massimo 4 righe (42px ciascuna + gap), oltre scrolla */
  max-height: 196px;
  overflow-y: auto;
  background: #f7fafd;
}
.sound-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  height: 42px;
  box-sizing: border-box;
  flex: 0 0 auto;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
}
.sound-item-name {
  flex: 1;
  font-size: 12.5px;
  color: #1a2233;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sound-item-preview,
.sound-item-send {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background .15s;
}
.sound-item-preview {
  background: #eef2f6;
  color: #334155;
}
.sound-item-preview:hover { background: #dde4ea; }
.sound-item-preview.is-playing {
  background: #7c3aed;
  color: #fff;
}
.sound-item-send {
  background: #7c3aed;
  color: #fff;
}
.sound-item-send:hover { background: #6d28d9; }

/* Messaggio audio nel rullo chat */
.sound-message {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0f4fa;
  border: 1px solid #dde4ea;
  border-radius: 20px;
  padding: 5px 12px 5px 5px;
  max-width: 260px;
}
.sound-msg-play {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #7c3aed;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.sound-msg-play:hover { background: #6d28d9; }
.sound-msg-play.is-playing { background: #5b21b6; }
.sound-msg-name {
  font-size: 12.5px;
  color: #1a2233;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Chat GIF image */
.chat-gif-img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 8px;
  display: block;
  margin: 4px 0;
  cursor: pointer;
  border: 1px solid #d0dde8;
}

/* Toolbar GIF/YouTube buttons */
#gifToggle svg, #youtubeToggle svg {
  pointer-events: none;
}
.chat-image {
  display: block;
  max-width: 260px;
  max-height: 190px;
  border: 1px solid #9eb6ca;
  background: #fff;
  object-fit: contain;
}

.gift-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  color: #0a93ff;
  font-size: 16px;
  font-weight: 700;
}

.gift-line img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.message-box {
  display: grid;
  grid-template-rows: 30px minmax(0, 1fr);
  flex: 0 0 auto;
  margin-top: auto;
  min-height: 104px;
  max-height: 104px;
  border-top: 1px solid #8faec7;
  background: #fff;
}

.bottom-compose {
  align-self: stretch;
}

.toolbar-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 5px;
  border-bottom: 1px solid #9db7cf;
  background: linear-gradient(#d9eaf8, #92b0c9);
}

.toolbar-line select { width: 103px; min-height: 22px; }
.toolbar-grow { flex: 1 1 auto; }

.tool-btn {
  min-width: 25px;
  min-height: 22px;
  border: 0;
  color: #1c72bd;
  background: transparent;
  font-size: 18px;
  font-weight: 700;
}

.tool-btn.active {
  color: #111;
  background: #d5e8f8;
}

.input-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 92px;
  min-height: 74px;
  background: #fff;
}

.input-avatar {
  display: grid;
  place-items: center;
  border: 0;
  background: #fff;
  position: relative;
  overflow: visible;
}

.input-avatar img,
.me-card img {
  width: 46px;
  height: 46px;
  object-fit: cover;
}

.input-line textarea {
  width: 100%;
  height: 74px;
  min-height: 74px;
  border: 0;
  border-left: 1px solid #d7e1ea;
  outline: 0;
  padding: 7px 8px;
  resize: none;
}

.send-stack {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 5px 6px;
}

.send-stack button,
.modal-actions button,
.legacy-modal button:not(.secondary),
.webcam-window button,
.edit-profile-form button:not(.secondary) {
  min-height: 25px;
  border: 1px solid #2b82d7;
  border-radius: 5px;
  color: #fff;
  background: linear-gradient(#3aa1ff, #1680dc);
}

.side-panel {
  position: relative;
  display: grid;
  grid-template-rows: 62px 31px 28px minmax(0, 1fr) auto;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  overflow: hidden;
  background: #edf5fb;
}

.me-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #c1d2df;
  background: #f8fcff;
}

.me-card-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.me-card strong {
  display: block;
  max-width: 100%;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge crediti moderno: sostituisce le vecchie emoji ????, resta sotto
   il nick (posizione originale) e usa lo spazio che prima "sprecava"
   il tasto ? (ora rimosso, ridondante col menu opzioni gi  in toolbar). */
.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border: 1px solid #e3c377;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff8e6, #ffe9b8);
  color: #8a5a10;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.credits-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(138, 90, 16, .25), inset 0 1px 0 rgba(255, 255, 255, .7);
  background: linear-gradient(135deg, #fffbef, #ffdf9e);
}
.credits-pill:active { transform: translateY(0); }
.credits-pill-icon { flex: 0 0 auto; display: block; }
.credits-pill b { font-variant-numeric: tabular-nums; }

.side-search {
  display: none !important;
  width: auto;
  margin: 5px 8px;
}

.side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid #d0dfeb;
  border-bottom: 1px solid #a6bfd5;
}

.side-tabs button {
  border: 0;
  background: #d8e9f8;
  color: #31566f;
  font-weight: 700;
  font-size: 0.92em;
  padding: 8px 4px;
  white-space: nowrap;
}

.side-tabs button.active {
  color: #fff;
  background: linear-gradient(#76a6cf, #3f83bc);
}

.side-tab-panel { min-height: 0; overflow: hidden; grid-row: 4; }
.users-list {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
}
.users-list::-webkit-scrollbar { width: 8px; }
.users-list::-webkit-scrollbar-thumb { background: #9db8cc; border-radius: 4px; }
.users-list::-webkit-scrollbar-track { background: transparent; }

.friend-item.is-offline { opacity: 0.55; }
.friends-empty { padding: 16px 12px; text-align: center; color: #5b7387; font-size: 0.9em; }
.rooms-list {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  background-size: 176px 100%;
  background-position: center top;
  background-repeat: no-repeat;
}

#usersTab,
#roomsTab {
  grid-row: 4;
}

#sponsorCard {
  grid-row: 5;
}

#roomsTab {
  position: relative;
  padding: 4px;
  border-radius: 22px;
  overflow: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

#roomsTab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

#roomsTab .rooms-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0px;
}

#usersTab .users-list {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 2px;
}

.user-item,
.room-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 34px;
  margin-bottom: 0;
  padding: 4px 6px;
  gap: 4px;
  border: 1px solid rgba(120, 160, 210, 0.45);
  border-radius: 12px;
  color: #111;
  text-align: left;
  background: rgba(240, 246, 255, 0.88);
  box-shadow: 0 2px 8px rgba(36, 72, 107, 0.1);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-template-columns: unset;
  min-height: 58px;
  padding: 1px 10px;
  margin-bottom: 5px;
  border-radius: 10px;
}

.room-item:nth-child(even) {
  background: rgba(232, 241, 252, 0.9);
}

.room-item.is-live   { border-left: 3px solid #1f9d5c; }
.room-item.is-empty  { border-left: 3px solid rgba(120, 160, 210, 0.45); }
.room-item.is-closed { border-left: 3px solid #d63a56; opacity: 0.75; }

.room-item-avatar {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.room-item img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #c8d8ea;
  background: #fff;
}

.room-item.is-live .room-item-avatar img {
  border-color: #1f9d5c;
  box-shadow: 0 0 0 2px rgba(31, 157, 92, 0.2);
}

.room-item-live-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(120, 160, 210, 0.5);
  border: 2px solid #fff;
}

.room-item.is-live .room-item-live-dot {
  background: #1f9d5c;
  box-shadow: 0 0 6px rgba(31, 157, 92, 0.8);
  animation: roomLivePulse 1.6s ease-in-out infinite;
}

.room-item.is-closed .room-item-live-dot { background: #d63a56; }

.room-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-item-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.room-item strong {
  display: block;
  color: #16324a;
  font-size: 12.5px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-item small {
  display: block;
  color: #52708a;
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-item-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.room-item-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #1c3a53;
  background: rgba(120, 160, 210, 0.16);
  border: 1px solid rgba(120, 160, 210, 0.35);
  border-radius: 20px;
  padding: 2px 8px;
}

.room-item-count .icona-rooms-x { width: 12px !important; height: 12px !important; }

.room-item-count.is-hot  { background: rgba(255, 176, 32, 0.18); border-color: rgba(255, 176, 32, 0.5); color: #8a5a00; }
.room-item-count.is-full { background: rgba(214, 58, 86, 0.16); border-color: rgba(214, 58, 86, 0.45); color: #8a1c30; }

.room-item-tags {
  display: flex;
  gap: 4px;
}

.room-item-tag {
  font-size: 11px;
  line-height: 1;
}

.room-item:hover {
  transform: translateY(2px);
  box-shadow: 0 8px 18px rgba(36, 72, 107, 0.18);
}

.room-item.active {
  border-color: rgba(62, 125, 177, 0.72);
  box-shadow: 0 8px 18px rgba(36, 72, 107, 0.18), inset 3px 0 var(--accent);
}

.user-identity {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.user-gender-icon {
  flex: 0 0 auto;
}

.user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-user-tooltip] {
  position: relative;
}

[data-user-tooltip]::after {
  content: attr(data-user-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 10010;
  min-width: max-content;
  max-width: 220px;
  padding: 4px 8px;
  border: 1px solid rgba(0,0,0,.28);
  border-radius: 4px;
  background: rgba(35, 45, 55, .96);
  color: #fff;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(3px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
}

[data-user-tooltip]:hover::after,
[data-user-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.sponsor-card {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(10, 20, 40, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-overlay,
.signin-overlay {
  background: rgb(0 0 0 / 78%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#signinModal.has-login-background,
.signin-modal.has-login-background {
  background: rgba(15, 25, 50, 0.55) !important;
}

#signinModal.has-login-background .signin-modal-body,
#signinModal.has-login-background .auth-modal-body {
  background: transparent !important;
}

/* Blocca lo scroll della pagina sotto il login */
.modal-backdrop,
.signin-overlay {
  pointer-events: all;
  touch-action: none;
  overflow: hidden;
}

.legacy-modal,
.floating-popup {
  z-index: 35;
  border: 1px solid #9eb6ca;
  border-radius: 5px;
  background: #f4f8fc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}

/* LOGIN: resetta il bianco di legacy-modal e blocca lo scroll sotto */
.legacy-modal.signin-modal,
.legacy-modal.auth-modal,
#joinForm.legacy-modal {
  background: rgb(0 0 0 / 0%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.50) !important;
}

.signin-window {
  width: min(430px, calc(100vw - 28px));
  min-height: 0;
  padding: 0;
  /* Limita l'altezza del modal alla viewport: il contenuto interno
     (es. il blocco fotocamera in registrazione) scrolla invece di
     spingere i pulsanti fuori dallo schermo */
  max-height: min(680px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
}

.signin-modal,
.auth-modal {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 16px;
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.signin-modal-body,
.auth-modal-body {
  padding: 20px 22px 22px;
  background: transparent;
  /* Corpo scrollabile: header resta fisso, contenuto e pulsanti
     (incluso "Crea account") restano sempre raggiungibili */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.signin-modal-header,
.auth-modal-header {
  margin: 0;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.signin-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
}

.signin-warning span {
  font-size: 22px;
}

.signin-warning p {
  margin: 0;
  color: rgba(255, 255, 255, 0.90);
  font-size: 12px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.signin-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.signin-fields label {
  display: grid;
  gap: 5px;
  margin: 0;
  color: rgba(255, 255, 255, 0.90);
  font-weight: 600;
  font-size: 12px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.signin-fields .check-row {
  display: flex !important;
  justify-content: start;
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
}

.signin-fields input:not([type="checkbox"]),
.signin-fields select {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}

.signin-fields input:not([type="checkbox"]):focus,
.signin-fields select:focus {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10);
}

.signin-fields input::placeholder {
  color: rgba(255, 255, 255, 0.50);
}

.signin-fields select option {
  background: #1a2a4a;
  color: #fff;
}

.auth-switches {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 4px;
}

.auth-switches button {
  flex: 1 1 0;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-switches button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.legacy-modal label {
  display: grid;
  gap: 4px;
  margin: 7px 0;
  font-weight: 700;
}

.legacy-modal input,
.legacy-modal select,
.legacy-modal textarea,
.admin-panel input,
.admin-panel select,
.admin-panel textarea,
.admin-login input {
  min-height: 26px;
  border: 1px solid #9eb6ca;
  border-radius: 3px;
  background: #fff;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 7px;
}

.check-row input { min-height: auto; }

.modal-title,
.popup-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin: 0 -12px 10px;
  padding: 4px 9px;
  border-radius: 4px 4px 0 0;
  color: #fff;
  background: linear-gradient(#9fc0db00, #7299b9);
  font-weight: 700;
}

.popup-title { margin: 0 0 7px; }

.modal-title button,
.popup-title button {
  min-height: 0;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 12px;
  margin-top: 10px;
}

/* --- ANNUNCI ADMIN (popup globale, visibile in tutte le stanze) --- */
.announcement-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 20, 40, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: announcementFadeIn .18s ease;
}

@keyframes announcementFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.announcement-box {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  border-radius: 10px;
  overflow: hidden;
  background: #f4f8fc;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .40);
  animation: announcementPop .18s ease;
}

@keyframes announcementPop {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.announcement-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  background: linear-gradient(#9fc0db, #7299b9);
  color: #fff;
}

.announcement-box.is-staff .announcement-header {
  background: linear-gradient(#e7c469, #b8923a);
}

.announcement-icon {
  font-size: 18px;
  line-height: 1;
}

.announcement-label {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}

.announcement-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: .9;
}

.announcement-close:hover {
  opacity: 1;
}

.announcement-body {
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #1d2b36;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
}

button.secondary {
  color: #234;
  border: 1px solid #b6c7d5;
  background: linear-gradient(#fff, #e6edf3);
}

.form-error {
  min-height: 18px;
  color: #b30000;
  font-weight: 700;
}

.floating-popup {
  position: fixed;
  z-index: 34;
  padding: 0 0px 7px;
}

.font-popup {
  left: 8px;
  bottom: 110px;
  width: min(648px, calc(100vw - 16px));
  max-height: min(520px, calc(100vh - 130px));
  overflow: hidden;
  padding: 0;
  border-color: #9fb8cc;
  background: #f4f8fc;
  color: #1d2b36;
  box-shadow: 0 4px 14px rgba(26, 54, 79, .28);
}

.font-popup .popup-title {
  min-height: 30px;
  margin: 0;
  padding: 5px 9px 5px 11px;
  border-bottom: 1px solid #7f9fba;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #9dbbd1 0%, #6f97b5 100%);
  color: #fff;
  text-shadow: 0 1px rgba(21, 54, 79, .55);
}

.font-popup-body {
  display: grid;
  grid-template-columns: 205px 190px minmax(210px, 1fr);
  gap: 9px;
  max-height: calc(min(520px, calc(100vh - 130px)) - 30px);
  overflow: auto;
  padding: 10px;
  border-top: 1px solid #dceaf4;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fc 100%);
}

.font-panel {
  min-width: 0;
  padding: 7px;
  border: 1px solid #b6c9d9;
  border-radius: 4px;
  background: #eef5fb;
  box-shadow: inset 0 1px rgba(255, 255, 255, .86);
}

.font-panel-title {
  display: block;
  margin: 0 0 6px;
  color: #24445f;
  font-weight: 700;
}

.font-family-list {
  display: grid;
  gap: 4px;
  max-height: 342px;
  overflow-y: auto;
  padding: 3px;
  border: 1px solid #cfdae4;
  background: #fff;
}

.font-family-list button {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: #f8fbff;
  color: #1d2b36;
  text-align: left;
}

.font-family-list button:hover,
.font-family-list button.is-selected {
  border-color: #1e88e5;
  background: #fff;
  color: #0d4f88;
  box-shadow: inset 3px 0 #1e88e5;
}

.font-size-grid {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 7px;
  justify-content: center;
  padding: 6px;
  border: 1px solid #cfdae4;
  background: #fff;
}

.font-size-grid button {
  width: 34px;
  height: 31px;
  min-height: 31px;
  border: 1px solid #a9bfd2;
  border-radius: 3px;
  background: linear-gradient(#fff, #edf5fb);
  color: #1d2b36;
  font-weight: 700;
}

.font-size-grid button:hover,
.font-size-grid button.is-selected {
  border-color: #1e88e5;
  background: #e6f3ff;
  color: #0a61ac;
  box-shadow: 0 0 0 1px rgba(255, 211, 77, .65), inset 0 1px rgba(255, 255, 255, .9);
}

.font-style-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}

.font-style-btn {
  width: 34px;
  height: 28px;
  min-height: 28px;
  border: 1px solid #9fb8cc;
  border-radius: 3px;
  background: linear-gradient(#fff, #e6eef6);
  color: #1d2b36;
  font-weight: 800;
}

.font-style-btn:nth-child(2) { font-style: italic; }
.font-style-btn:nth-child(3) { text-decoration: underline; }

.font-style-btn.active {
  border-color: #1e88e5;
  background: #dff0ff;
  color: #0a61ac;
  box-shadow: inset 0 -2px #ffd34d;
}

.font-preview {
  min-height: 44px;
  margin-top: 9px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid #b6c9d9;
  border-radius: 3px;
  background: #fff;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.font-color-grid {
  display: grid;
  grid-template-columns: repeat(6, 24px);
  gap: 6px;
  justify-content: center;
  max-height: 342px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #cfdae4;
  background: #fff;
}

.font-color-grid button {
  position: relative;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid #8ea8bb;
  border-radius: 2px;
  box-shadow: inset 0 1px rgba(255, 255, 255, .55);
}

.font-color-grid button[style*="#ffffff"] {
  box-shadow: inset 0 0 0 1px #e2e7ec;
}

.font-color-grid button:hover,
.font-color-grid button.is-selected {
  border-color: #1e88e5;
  box-shadow: 0 0 0 2px #ffd34d, 0 1px 5px rgba(30, 136, 229, .32);
}

.font-color-grid button.is-selected::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  content: "?";
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px #000, 0 0 2px #000;
}

.font-color-grid button[data-font-color="#ffffff"].is-selected::after,
.font-color-grid button[data-font-color="#fff8d6"].is-selected::after,
.font-color-grid button[data-font-color="#e3f2fd"].is-selected::after,
.font-color-grid button[data-font-color="#ffebee"].is-selected::after {
  color: #0a61ac;
  text-shadow: 0 1px #fff;
}

.picker-popup {
  left: 120px;
  bottom: 92px;
  width: 275px;
}

.tabs-mini {
  display: flex;
  gap: 0;
  margin-bottom: 7px;
}

.tabs-mini button {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #d6e0e9;
  border-bottom-color: #c7d4df;
  background: #f8fbfd;
  color: #223;
}

.tabs-mini button.active {
  border-bottom-color: #fff;
  background: #fff;
  font-weight: 700;
}

.currency-panel[hidden],
[data-currency-panel][hidden] {
  display: none !important;
}

.smiley-picker {
  display: grid;
  grid-template-columns: repeat(7, 36px);
  gap: 4px;
}

.smiley-picker.emoji-picker {
  grid-template-columns: repeat(7, 31px);
}

.smiley-picker.emoji-picker button {
  font-size: 18px;
}

.smiley-picker button,
.asset-grid button {
  display: grid;
  place-items: center;
  border: 1px solid #d3e0eb;
  background: #fff;
}

.smiley-picker button {
  min-height: 34px;
}

.smiley-picker img {
  max-width: 32px;
  max-height: 32px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.avatar-window {
  position: fixed;
  left: 390px;
  top: 160px;
  width: 502px;
  padding: 0 20px 20px;
}

.avatar-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.avatar-camera-panel {
  margin-top: 12px;
  padding: 10px;
  background: #f6fbff;
  border: 1px solid #d5e4f1;
  border-radius: 8px;
}

.avatar-camera-panel[hidden] {
  display: none;
}

.avatar-camera-panel video {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #aec8dd;
  background: #101828;
}

.avatar-camera-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #aec8dd;
}

.avatar-camera-status {
  margin-top: 8px;
  color: #345;
  font-size: 13px;
  min-height: 20px;
}

.gift-window,
.profile-window {
  position: fixed;
  right: 285px;
  top: 200px;
  width: 300px;
  padding: 0 10px 12px;
}

.gift-window {
  top: 76px;
  width: 462px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 96px);
  border-color: #7f9bb3;
  background: #e8f0f7;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gift-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 2px 12px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(6, 42px);
  gap: 7px;
  min-height: 120px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e0e8ef;
}

.asset-grid button.active {
  outline: 2px solid #1680dc;
}

.asset-grid img {
  width: 32px;
  height: 32px;
  object-fit: cover;
}

.asset-grid span {
  font-size: 10px;
}

.gift-window .modal-title {
  background: linear-gradient(#8fb3d0, #5e86a7);
}

.gift-window .tabs-mini {
  margin-bottom: 0;
  padding-left: 2px;
}

.gift-window .tabs-mini button {
  min-width: 82px;
  min-height: 26px;
  border-color: #9fb5c8;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(#eef5fb, #d4e3ef);
  color: #1d2b36;
  font-weight: 600;
}

.gift-window .tabs-mini button.active {
  background: #fff;
  color: #111;
}

.gift-window .asset-grid,
.gift-grid {
  grid-template-columns: repeat(6, 64px);
  gap: 6px;
  min-height: 0;
  max-height: none;
  overflow: visible;
  border-color: #9fb5c8;
  background: #f8fbff;
}

.gift-grid button {
  grid-template-rows: 40px minmax(24px, auto) 15px;
  align-content: start;
  min-height: 88px;
  padding: 5px 3px;
  border-color: #5c8eb8;
  color: #ffffff;
  background: linear-gradient(#3f84b6, #1f5f95);
}

.gift-grid button.active,
.gift-grid button.is-selected {
  outline: 0;
  border: 2px solid #ffcc33;
  background: linear-gradient(#4a95cc, #236ba7);
  box-shadow: 0 0 0 1px rgba(255,255,255,.8), inset 0 0 0 1px rgba(17,50,78,.45);
}

.gift-grid img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.gift-grid span,
.gift-grid .gift-name {
  width: 100%;
  overflow: visible;
  color: #ffffff;
  font-size: 10px;
  line-height: 12px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
  white-space: normal;
  overflow-wrap: anywhere;
}

.gift-grid small,
.gift-grid .gift-card-cost {
  color: #ffd34d;
  font-size: 10px;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0,0,0,.45);
}

.gift-bottom {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 2px 0;
}

.gift-preview {
  display: grid;
  grid-template-rows: 58px 18px 16px;
  justify-items: center;
  min-height: 96px;
  border: 1px solid #b5c7d5;
  background: #fff;
}

.gift-preview img {
  width: 54px;
  height: 54px;
  margin-top: 4px;
  object-fit: contain;
}

.gift-preview strong,
.gift-preview span {
  overflow: hidden;
  max-width: 112px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-form {
  display: grid;
  align-content: start;
  gap: 6px;
}

.gift-form label {
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  margin: 0;
}

.gift-form input {
  width: 100%;
}

.gift-legacy-note {
  margin: 8px 0 5px;
  color: #d00000;
  font-size: 11px;
  line-height: 15px;
}

.gift-cost {
  margin-top: 5px;
  color: #c26500;
  font-weight: 700;
}

.gift-balance {
  color: #31566f;
  font-weight: 700;
}

.coin-status {
  min-height: 18px;
  padding: 6px;
  color: #0b67b1;
  font-weight: 700;
}

.profile-body {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.profile-body img {
  width: 64px;
  height: 64px;
  object-fit: cover;
}

.profile-body p {
  margin: 6px 0;
}

.about-window {
  width: 360px;
  padding: 0 12px 14px;
}

.about-body {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: var(--about-text-color, #333333);
}

.about-body h2 {
  margin: 0 0 4px;
  color: #f08200;
  font-size: 17px;
}

.about-body p {
  margin: 5px 0;
  color: var(--about-text-color, #333333);
}

.about-body p a {
  color: inherit;
  text-decoration: underline;
}

.webcam-popup {
  position: fixed;
  right: 24px;
  bottom: 80px;
  z-index: 9999;
  width: min(300px, calc(100vw - 32px));
  pointer-events: auto;
}

.webcam-popup[hidden] {
  display: none;
}

.webcam-popup .webcam-window {
  width: 100%;
  background: #111827;
  border: 1px solid rgba(96, 225, 255, .55);
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(0,0,0,.45);
  overflow: hidden;
  color: #eaf7ff;
}

.webcam-popup.is-maximized {
  top: 72px;
  left: 24px;
  right: 24px;
  bottom: 24px;
  width: auto;
}

.webcam-popup.is-maximized .webcam-window {
  height: 100%;
}

.webcam-popup.is-maximized #localWebcamVideo {
  height: calc(100vh - 236px);
  max-height: none;
}

.webcam-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  color: #eaf7ff;
  background: linear-gradient(#263447, #111827);
  border-bottom: 1px solid rgba(96, 225, 255, .16);
  cursor: move;
}

.webcam-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
}

.webcam-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webcam-title-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #43e0ff;
  box-shadow: 0 0 10px rgba(67,224,255,.85);
}

.webcam-window-actions {
  display: flex;
  gap: 6px;
}

.webcam-action-btn {
  width: 30px;
  height: 28px;
  border: 1px solid rgba(117,205,255,.45);
  border-radius: 7px;
  color: #fff;
  background: rgba(15, 23, 42, .92);
  box-shadow: 0 0 10px rgba(0,195,255,.12);
  font-size: 18px;
  line-height: 1;
}

.webcam-action-btn:hover,
.webcam-control-btn:hover {
  background: rgba(0,116,217,.9);
  box-shadow: 0 0 14px rgba(0,195,255,.6);
}

.webcam-action-btn.close {
  color: #ff9ba7;
}

.webcam-body {
  padding: 14px;
}

.webcam-popup.is-minimized .webcam-body {
  display: none;
}

#localWebcamVideo {
  display: block;
  width: 100%;
  height: 160px;
  background: #020617;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  object-fit: cover;
}

.webcam-status {
  margin-top: 12px;
  min-height: 38px;
  color: #c6d8e6;
  font-size: 13px;
  line-height: 1.35;
}

.webcam-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.webcam-control-btn {
  min-width: 72px;
  height: 48px;
  padding: 0 10px;
  color: #fff;
  background: rgba(15, 23, 42, .92);
  border: 1px solid rgba(117,205,255,.75);
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,195,255,.28);
}

.webcam-control-btn.is-off {
  opacity: .58;
  filter: grayscale(1);
}

.webcam-control-btn.stop {
  border-color: rgba(255, 112, 112, .82);
  color: #ffd5d5;
}

.webcam-request-window {
  position: fixed;
  right: 24px;
  top: 132px;
  width: 300px;
  padding: 0 12px 12px;
  z-index: 10001;
}

.webcam-request-window .webcam-request-body {
  padding: 10px 4px 0;
}

.webcam-request-window p {
  margin: 0 0 10px;
}

.webcam-windows {
  position: fixed;
  left: 24px;
  top: 118px;
  z-index: 33;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: calc(100vw - 300px);
  //pointer-events: none;
}

.webcam-window {
  width: 250px;
  padding: 0 8px 8px;
  pointer-events: auto;
}

.webcam-window .modal-title {
  margin-left: -8px;
  margin-right: -8px;
}

.webcam-window video {
  display: block;
  width: 232px;
  height: 174px;
  border: 1px solid #7393ad;
  background: #111;
  object-fit: cover;
}

.webcam-note {
  padding-top: 5px;
  color: #31566f;
}

.webcam-open {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  color: #14a0d8;
}

.webcam-open-icon {
  width: 14px;
  height: 14px;
  display: block;
  filter: drop-shadow(0 0 4px rgba(24, 161, 216, .35));
}

body.dragging-webcam {
  user-select: none;
}

#webcamWindows.webcam-windows {
  position: fixed;
  //inset: 0;
  z-index: 10000;
  display: block;
  max-width: none;
  //pointer-events: none;
}

#webcamWindows .webcam-window {
  position: fixed;
  width: 268px;
  min-height: 214px;
  padding: 0;
  color: #dcefff;
  background: #0b111a;
  border: 1px solid rgba(91, 205, 242, .55);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(0,0,0,.52), 0 0 0 1px rgba(255,255,255,.04) inset;
  overflow: hidden;
  pointer-events: auto;
}

#webcamWindows .webcam-window.is-minimized {
  min-height: 0;
  height: 30px !important;
}

#webcamWindows .webcam-window.is-minimized .webcam-body {
  display: none;
}

#webcamWindows .webcam-window.is-maximized {
  left: 24px !important;
  top: 72px !important;
  width: min(760px, calc(100vw - 48px)) !important;
  height: min(560px, calc(100vh - 96px)) !important;
}

#webcamWindows .webcam-window.is-maximized .webcam-body {
  height: calc(100% - 30px);
}

#webcamWindows .webcam-window.is-maximized .webcam-video-shell {
  height: calc(100% - 78px);
}

#webcamWindows .webcam-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 6px 0 8px;
  color: #f4fbff;
  background: linear-gradient(#303946, #151b24);
  border-bottom: 1px solid rgba(128, 222, 255, .18);
  cursor: move;
}

#webcamWindows .webcam-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#webcamWindows .webcam-title strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#webcamWindows .webcam-title-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5bdcff;
  box-shadow: 0 0 9px rgba(91, 220, 255, .8);
}

#webcamWindows .webcam-window-actions {
  display: flex;
  gap: 4px;
}

#webcamWindows .webcam-action-btn,
#webcamWindows .webcam-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(127, 171, 196, .55);
  color: #dcefff;
  background: linear-gradient(#263241, #101722);
  box-shadow: inset 0 1px rgba(255,255,255,.08);
}

#webcamWindows .webcam-action-btn {
  width: 23px;
  height: 22px;
  border-radius: 4px;
  font-size: 13px;
}

#webcamWindows .webcam-action-btn.close {
  color: #ffb2bd;
}

#webcamWindows .webcam-body {
  padding: 8px;
  background: radial-gradient(circle at top, rgba(32, 50, 68, .72), rgba(5, 9, 14, .98));
}

#webcamWindows .webcam-video-shell {
  position: relative;
  height: 146px;
  border: 1px solid rgba(141, 178, 200, .38);
  border-radius: 6px;
  background: #020407;
  overflow: hidden;
}

#webcamWindows .webcam-window video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #020407;
  object-fit: cover;
}

#webcamWindows .webcam-empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  color: #8ea3b4;
  font-size: 12px;
  text-align: center;
  background: linear-gradient(135deg, rgba(16, 24, 34, .96), rgba(5, 9, 14, .96));
}

#webcamWindows .webcam-empty-state[hidden] {
  display: none;
}

#webcamWindows .webcam-status {
  min-height: 18px;
  margin: 7px 0;
  color: #bcd1df;
  font-size: 11px;
  line-height: 1.2;
}

#webcamWindows .webcam-controls {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 0;
}

#webcamWindows .webcam-control-btn {
  width: 34px;
  height: 32px;
  border-radius: 7px;
  font-size: 15px;
  filter: grayscale(.35);
}

#webcamWindows .webcam-action-btn:hover,
#webcamWindows .webcam-control-btn:hover {
  background: linear-gradient(#28506a, #11283a);
  box-shadow: 0 0 10px rgba(91, 220, 255, .34), inset 0 1px rgba(255,255,255,.1);
  filter: none;
}

#webcamWindows .webcam-control-btn.is-active {
  color: #ffffff;
  border-color: rgba(91, 220, 255, .95);
  background: linear-gradient(#1680a8, #0a4e72);
  box-shadow: 0 0 12px rgba(91, 220, 255, .56);
  filter: none;
}

/* Modern Webcam Box  --  .wcw-outer */

@keyframes wcw-border-shift {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

.wcw-outer {
  padding: 2px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f46e5 0%, #a855f7 35%, #06b6d4 70%, #4f46e5 100%);
  background-size: 400% 400%;
  animation: wcw-border-shift 6s ease infinite;
  box-shadow:
    0 0 20px rgba(99,102,241,.40),
    0 0 42px rgba(168,85,247,.22),
    0 0 65px rgba(6,182,212,.14),
    0 26px 58px rgba(0,0,0,.72);
  /* Resizing is handled by JS via .wcw-resize-handle (see below).
     Native `resize: both` was removed: it silently fought with the
     drag handlers on the same element and never worked on touch. */
  position: relative;
  resize: none;
  overflow: hidden;
  min-width: 180px;
  min-height: 110px;
  width: 230px;
  height: 150px;
}

.wcw-root {
  display: flex;
  flex-direction: row;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(5,8,14,.94);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  height: 100%;
  min-height: 0;
}

/* Camera area   fills available space as box is resized */
.wcw-cam-wrap {
  position: relative;
  flex: 1;
  min-width: 100px;
  height: 100%;
  background: #020407;
  overflow: hidden;
}

/* Grab cursor on entire box; buttons/handle override below */
.wcw-outer { cursor: grab; }
.wcw-outer:active { cursor: grabbing; }

/* pointer-events none = clicks pass through to parent for drag */
.wcw-cam-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.wcw-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #1e3a5f;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: #030610;
  pointer-events: none;
}
.wcw-empty[hidden] { display: none; }

/* Always-visible bottom bar */
.wcw-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 16px 6px 5px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.84));
  pointer-events: none;
}
.wcw-bar-info,
.wcw-bar-btns { pointer-events: auto; }

.wcw-bar-info {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}
.wcw-bar-btns {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.wcw-bar-sep {
  width: 1px;
  height: 14px;
  background: rgba(255,255,255,.15);
  margin: 0 2px;
  flex-shrink: 0;
}

.wcw-bar-info .webcam-title-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16,185,129,.8);
  transition: background .25s, box-shadow .25s;
}
.wcw-name {
  font-size: 10px;
  font-weight: 600;
  color: rgba(226,240,255,.90);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
}

/* Top bar: name + quality badges, only on local webcam box */
.wcw-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: linear-gradient(rgba(0,0,0,.78), transparent);
  pointer-events: none;
  z-index: 4;
}
.wcw-top-bar .webcam-title-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16,185,129,.8);
}
.wcw-top-bar .wcw-name { flex: 1; min-width: 0; }

.wcw-quality-badge {
  flex-shrink: 0;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .03em;
  line-height: 1.4;
  padding: 2px 5px;
  border-radius: 4px;
  color: #fff;
  text-shadow: none;
}
.wcw-badge-hd {
  background: rgb(59 130 246 / 35%);
  box-shadow: 0 0 6px rgb(59 130 246 / 0%);
}
.wcw-badge-4k {
  background: linear-gradient(135deg, #f59e0b63, #efab4469);
  box-shadow: 0 0 6px rgb(245 158 11 / 0%);
}
@media (max-width: 760px) {
  .wcw-top-bar { padding: 4px 6px; gap: 4px; }
  .wcw-top-bar .wcw-name { font-size: 8.5px; }
  .wcw-quality-badge { font-size: 7.5px; padding: 1.5px 4px; }
}

/* Status text - top center, fades via JS */
.wcw-status {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  color: rgba(148,163,184,.9);
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.95);
  pointer-events: none;
  background: rgba(0,0,0,.35);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Cam/Mic/Vol buttons  --  red=OFF  green=ON */
.wcw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(239,68,68,.50);
  background: rgba(90,10,10,.65);
  color: #f87171;
  cursor: pointer;
  transition: all .16s;
  flex-shrink: 0;
  box-shadow: 0 1px 5px rgba(0,0,0,.55);
}
.wcw-btn svg { width: 12px; height: 12px; pointer-events: none; }
.wcw-btn:hover {
  background: rgba(153,27,27,.75);
  border-color: rgba(239,68,68,.80);
  color: #fca5a5;
  box-shadow: 0 0 9px rgba(239,68,68,.40);
  transform: scale(1.10);
}
/* ON state */
.wcw-btn.is-active {
  border-color: rgba(34,197,94,.70);
  background: rgba(5,46,22,.70);
  color: #4ade80;
  box-shadow: 0 0 9px rgba(34,197,94,.35);
}
.wcw-btn.is-active:hover {
  background: rgba(21,128,61,.78);
  border-color: rgba(34,197,94,.95);
  color: #86efac;
  box-shadow: 0 0 16px rgba(34,197,94,.55);
  transform: scale(1.10);
}

/* Window buttons  (-  x) */
.wcw-wbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.50);
  color: #94a3b8;
  cursor: pointer;
  transition: background .14s, color .14s;
  flex-shrink: 0;
}
.wcw-wbtn svg { width: 8px; height: 8px; pointer-events: none; }
.wcw-wbtn:hover { background: rgba(255,255,255,.18); color: #f1f5f9; }
.wcw-close { border-color: rgba(239,68,68,.22); }
.wcw-close:hover {
  background: rgba(239,68,68,.38);
  border-color: rgba(239,68,68,.60);
  color: #fca5a5;
}

/* Mute button (viewer window) */
.wcw-mute-btn {
  width: 20px;
  height: 20px;
  color: #60a5fa;
  border-color: rgba(96,165,250,.25);
}
.wcw-mute-btn svg { width: 11px; height: 11px; }
.wcw-mute-btn:hover { background: rgba(96,165,250,.18); color: #93c5fd; }

/* -- Mobile: smaller, finger-friendly webcam box ----------------------
   Keeps the same box, just shrinks it and frees it from the bulky EQ
   strip so it stops covering half the screen on a phone. Drag is
   handled by the touchstart/move/end listeners added in app.js;
   touch-action:none stops the page from scrolling/zooming while you
   move the box with your finger.                                     */
@media (max-width: 760px) {
  .wcw-outer {
    width: 150px;
    height: 122px;
    min-width: 110px;
    min-height: 90px;
    resize: none;           /* native corner-resize doesn't work with touch */
    touch-action: none;     /* let JS own all touch gestures on the box */
  }
  .wcw-eq-strip { width: 18px; padding: 4px 2px; }   /* narrower, not hidden */
  .wcw-bar { padding: 10px 4px 4px 6px; gap: 2px; }
  .wcw-name { font-size: 8.5px; }
  .wcw-btn { width: 22px; height: 22px; }
  .wcw-btn svg { width: 11px; height: 11px; }
  .wcw-wbtn { width: 18px; height: 18px; }
  .wcw-wbtn svg { width: 9px; height: 9px; }
  .wcw-vol-slider { width: 36px; }
  .wcw-viewers-panel { width: 140px; max-width: calc(100vw - 16px); right: 2px; bottom: 32px; max-height: 110px; }
  .wcw-settings-panel { width: 160px; max-width: calc(100vw - 16px); right: 2px; bottom: 32px; max-height: 160px; }
}

/* Stesse regole anche se il telefono riporta una larghezza CSS > 760px
   (succede senza un viewport meta corretto): rileviamo il touch invece
   della larghezza, cos  le barre EQ restano piccole su qualunque mobile. */
@media (pointer: coarse) {
  .wcw-eq-strip { width: 18px !important; padding: 4px 2px !important; }
}

/* Il pannello "chi mi sta guardando" deve poter uscire dal riquadro
   della webcam (che ha overflow:hidden) senza essere tagliato.        */
.wcw-cam-wrap:has(.wcw-viewers-panel:not([hidden])),
.wcw-root:has(.wcw-viewers-panel:not([hidden])),
.wcw-outer:has(.wcw-viewers-panel:not([hidden])),
.wcw-cam-wrap:has(.wcw-settings-panel:not([hidden])),
.wcw-root:has(.wcw-settings-panel:not([hidden])),
.wcw-outer:has(.wcw-settings-panel:not([hidden])) {
  overflow: visible;
}

/* Volume slider (viewer window) */
.wcw-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 52px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, #3b82f6 var(--val, 80%), rgba(255,255,255,.18) var(--val, 80%));
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}
.wcw-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #60a5fa;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(96,165,250,.5);
}
.wcw-vol-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #60a5fa;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(96,165,250,.5);
}

/* EQ strip */
.wcw-eq-strip {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  align-self: stretch;
  background: rgba(0,0,0,.55);
  border-left: 1px solid rgba(255,255,255,.04);
  padding: 6px 4px;
  box-sizing: border-box;
}
.wcw-eq-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100px;
}

/* Resize handle   always visible in bottom-right corner, drives the
   JS resize logic in app.js (makeWebcamWindowResizable). */
.wcw-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  z-index: 30;
  cursor: nwse-resize;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 0 40%, rgba(255,255,255,.55) 40% 46%, transparent 46% 54%, rgba(255,255,255,.55) 54% 60%, transparent 60% 68%, rgba(255,255,255,.55) 68% 74%, transparent 74%);
  opacity: .55;
  border-radius: 0 0 10px 0;
  transition: opacity .15s, background-color .15s;
}
.wcw-resize-handle:hover,
.wcw-outer.is-resizing .wcw-resize-handle {
  opacity: 1;
  background-color: rgba(96,165,250,.20);
}
@media (pointer: coarse) {
  /* bigger touch target on phones/tablets */
  .wcw-resize-handle { width: 26px; height: 26px; opacity: .7; }
}

/* Minimized */
.wcw-outer.is-minimized { padding: 2px; overflow: hidden; }
.wcw-outer.is-minimized .wcw-root { display: none; }

/* Maximized */
.wcw-outer.is-maximized .wcw-cam-wrap { width: auto; flex: 1; height: auto; }
.wcw-outer.is-maximized .wcw-root { height: 100%; }

/* ===== "Chi mi sta guardando"   pulsante + badge + pannello ===== */
.wcw-viewers-btn {
  position: relative;
  border-color: rgba(96,165,250,.45);
  background: rgba(8,30,60,.65);
  color: #93c5fd;
}
.wcw-viewers-btn:hover {
  background: rgba(30,64,120,.78);
  border-color: rgba(96,165,250,.85);
  color: #bfdbfe;
  box-shadow: 0 0 9px rgba(96,165,250,.45);
}
.wcw-viewers-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: #ef4444;
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(5,8,14,.9);
}
.wcw-viewers-count[hidden] { display: none; }

.wcw-viewers-panel {
  position: absolute;
  right: 6px;
  bottom: 38px;
  width: 168px;
  max-height: 150px;
  overflow-y: auto;
  background: rgba(8,12,22,.96);
  border: 1px solid rgba(96,165,250,.35);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.65), 0 0 16px rgba(96,165,250,.18);
  padding: 6px;
  z-index: 8;
}
.wcw-viewers-panel[hidden] { display: none; }
.wcw-viewers-panel-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(191,219,254,.85);
  padding: 0 4px 5px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 4px;
}
.wcw-viewers-empty {
  font-size: 10px;
  color: rgba(148,163,184,.85);
  padding: 6px 4px;
  text-align: center;
}
.wcw-viewer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 4px;
  border-radius: 6px;
}
.wcw-viewer-row:hover { background: rgba(255,255,255,.06); }
.wcw-viewer-name {
  font-size: 10.5px;
  color: rgba(226,240,255,.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.wcw-viewer-kick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 5px;
  border: 1px solid rgba(239,68,68,.45);
  background: rgba(90,10,10,.55);
  color: #f87171;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: all .14s;
}
.wcw-viewer-kick:hover {
  background: rgba(239,68,68,.55);
  border-color: rgba(239,68,68,.9);
  color: #fff;
  transform: scale(1.08);
}

/* Settings button (webcam/mic device picker)   sits right next to the eye button */
.wcw-settings-btn {
  border-color: rgba(168,85,247,.45);
  background: rgba(46,10,70,.65);
  color: #d8b4fe;
}
.wcw-settings-btn:hover {
  background: rgba(88,28,135,.78);
  border-color: rgba(168,85,247,.85);
  color: #e9d5ff;
  box-shadow: 0 0 9px rgba(168,85,247,.45);
}

.wcw-settings-panel {
  position: absolute;
  right: 6px;
  bottom: 38px;
  width: 190px;
  max-height: 230px;
  overflow-y: auto;
  background: rgba(8,12,22,.96);
  border: 1px solid rgba(168,85,247,.35);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.65), 0 0 16px rgba(168,85,247,.18);
  padding: 6px;
  z-index: 9;
}
.wcw-settings-panel[hidden] { display: none; }
.wcw-settings-panel-title-mic { margin-top: 6px; }

.wcw-device-list { margin-bottom: 2px; }

.wcw-device-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 6px;
  padding: 5px 6px;
  margin: 1px 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(226,240,255,.90);
  font-size: 10.5px;
  text-align: left;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}
.wcw-device-row:hover { background: rgba(255,255,255,.07); }
.wcw-device-row.is-active {
  background: rgba(168,85,247,.20);
  border-color: rgba(168,85,247,.55);
  color: #f3e8ff;
}
.wcw-device-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.options-popup {
  right: 10px;
  top: 86px;
  display: flex;
  flex-direction: column;
  width: 230px;
  max-height: min(443px, calc(100vh - 110px));
  overflow-y: auto;
  padding: 25px 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

.options-popup button {
  min-height: 32px;
  border: 0;
  border-bottom: 0px solid #e0e8ef;
  color: #1d2b36;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 1px 0px;
  font-size: 13px;
  background: transparent;
  transition: background .12s ease;
}

.options-popup button:hover {
  background: #446f8b6b;
}

.options-popup-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
}

.blacklist-popup {
  right: 18px;
  top: 92px;
  width: min(280px, calc(100vw - 24px));
  max-height: min(420px, calc(100vh - 130px));
  padding: 10px 12px 12px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.blacklist-popup-title {
  margin: 4px 0 8px;
  font-size: 15px;
  color: #1d2b36;
  border-bottom: 1px solid #e0e8ef;
  padding-bottom: 6px;
}

.blacklist-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.blacklist-empty {
  color: #6b7a87;
  font-size: 13px;
  text-align: center;
  padding: 14px 0;
}

.blacklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e0e8ef;
  border-radius: 6px;
  background: #f7fafc;
}

.blacklist-username {
  font-size: 13px;
  font-weight: 600;
  color: #1d2b36;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blacklist-remove-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 5px;
  background: #e53935;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 9px;
  cursor: pointer;
}

.blacklist-remove-btn:hover {
  opacity: 0.88;
}

.blacklist-remove-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.ignore-notice-window {
  width: min(360px, calc(100vw - 32px));
  padding: 0 0 14px;
}

.ignore-notice-window .modal-title {
  background: linear-gradient(#ef5350, #c62828);
  color: #fff;
}

.ignore-notice-body {
  padding: 4px 16px 0;
  text-align: center;
}

.ignore-notice-body p {
  margin: 6px 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #1d2b36;
}

.ignore-notice-body .profile-action-btn {
  width: auto;
  min-width: 140px;
  margin: 0 auto;
}

.guest-menu-popup {
  top: 75px;
  right: 14px;
  width: 174px;
}

.user-action-popup {
  right: auto;
  top: auto;
  width: 178px;
}

.user-action-popup .coin-status {
  font-size: 11px;
  color: #0b67b1;
}

.user-context-menu {
  position: fixed;
  min-width: 170px;
  max-width: 230px;
  width: 210px;
  background: #f3f3f3;
  border: 1px solid #777;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
  z-index: 9999;
  font-size: 12px;
  padding: 0;
}

.user-context-menu[hidden] {
  display: none !important;
}

.user-context-menu-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 0;
  background: linear-gradient(#555, #333);
  color: #fff;
}

.user-context-menu-header-copy {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
}

.user-context-menu-header strong {
  font-size: 13px;
}

.user-context-menu-close {
  min-width: 26px;
  min-height: 26px;
  margin: 4px 4px 0 0;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: rgba(255,255,255,.08);
  font-size: 18px;
  line-height: 1;
}

.user-context-menu-options {
  display: grid;
  padding: 2px 0;
}

.user-context-menu-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  color: #222;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.2);
  background: transparent;
  text-align: left;
}

.user-context-menu-option:hover {
  background: #dbeafe;
}

.user-context-menu-option.is-danger {
  color: #b91c1c;
}

/* ===== CHAT PRIVATO COMPACTO - LEGACY STYLE ===== */

/* ===== PRIVATE CHAT   Design Moderno Compatto ===== */
/* ===== PRIVATE CHAT   Stile 123FlashChat ===== */
.private-chat-windows-layer {
  position: fixed !important;
  inset: 0 !important;
  pointer-events: none !important;
  z-index: 9997 !important;
}
.private-chat-windows-layer .private-chat-window {
  pointer-events: auto !important;
}

/* -- Finestra principale -- */
.private-chat-window {
  position: fixed !important;
  /* left/top settati via JS; right/bottom azzerati al primo drag */
  left: auto;
  top: auto;
  right: auto;
  bottom: auto;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  height: 370px !important;
  min-height: 370px !important;
  max-height: 370px !important;
  padding: 0 !important;
  background: #f0f5fb !important;
  border: 1px solid #8593a0 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.20), 0 1px 4px rgba(0,0,0,.12) !important;
  z-index: 9998 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Stato drag */
.private-chat-window.is-dragging {
  box-shadow: 0 10px 32px rgba(0,0,0,.28), 0 3px 10px rgba(0,0,0,.16) !important;
  opacity: .97 !important;
}
body.pchat-dragging,
body.pchat-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

/* -- Header (stile me-card della skin) -- */
.private-chat-header {
  flex: 0 0 40px !important;
  height: 40px !important;
  background: linear-gradient(to bottom, #dcedfb, #a9c6dd) !important;
  border-bottom: 1px solid #8593a0 !important;
  color: #000 !important;
  padding: 0 8px !important;
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  cursor: grab !important;
  user-select: none !important;
  overflow: hidden !important;
}
.private-chat-header:active { cursor: grabbing !important; }

.private-chat-avatar,
.private-chat-header > img {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  border-radius: 4px !important;
  object-fit: cover !important;
  border: 1px solid rgba(255,255,255,.8) !important;
  flex-shrink: 0 !important;
}

.private-chat-header-copy {
  min-width: 0 !important;
  flex: 1 !important;
  overflow: hidden !important;
  display: block !important;
}
.private-chat-title,
.private-chat-header-copy strong {
  display: block !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  color: #000 !important;
}
.private-chat-header-copy span,
.private-chat-meta,
.private-chat-status { display: none !important; }

.private-chat-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 3px !important;
  flex-shrink: 0 !important;
}

.private-chat-btn {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  border: 1px solid #8593a0 !important;
  background: rgba(255,255,255,.4) !important;
  color: #333 !important;
  font-size: 11px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.private-chat-btn:hover { background: rgba(255,255,255,.7) !important; }

.private-chat-unread {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 16px !important;
  height: 16px !important;
  padding: 0 4px !important;
  border-radius: 999px !important;
  background: #ff7d00 !important;
  color: #fff !important;
  font-size: 9px !important;
  font-weight: 800 !important;
}

/* -- Toolbar (stile toolbar-line della skin) -- */
.private-chat-toolbar {
  flex: 0 0 28px !important;
  height: 28px !important;
  background: linear-gradient(to bottom, #dae5eb, #f0f5fb) !important;
  border-bottom: 1px solid #a1b5c7 !important;
  display: flex !important;
  align-items: center !important;
  gap: 2px !important;
  padding: 0 6px !important;
  overflow: hidden !important;
}

.private-chat-tool {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: #555 !important;
  font-size: 13px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background .1s, border-color .1s !important;
}
.private-chat-tool:hover {
  background: rgba(0,0,0,.07) !important;
  border-color: #a1b5c7 !important;
}

.private-chat-title-label {
  margin-left: auto !important;
  font-size: 9.5px !important;
  color: #5987c9 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 90px !important;
}

/* -- Storico messaggi -- */
.private-chat-history {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 7px !important;
  background: #fff !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}
.private-chat-history::-webkit-scrollbar { width: 4px !important; }
.private-chat-history::-webkit-scrollbar-thumb { background: #a8bfd4 !important; border-radius: 4px !important; }

/* Bolle messaggio stile 123FlashChat */
.private-chat-message {
  display: flex !important;
  flex-direction: column !important;
  max-width: 86% !important;
  align-self: flex-start !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  margin: 0 !important;
}
.private-chat-message.is-self {
  align-self: flex-end !important;
  background: none !important;
}
.private-chat-message-head {
  display: flex !important;
  align-items: center !important;
  gap: 3px !important;
  margin-bottom: 2px !important;
}
.private-chat-message-head img {
  width: 14px !important; height: 14px !important;
  min-width: 14px !important; max-width: 14px !important;
  border-radius: 3px !important; object-fit: cover !important;
}
.private-chat-message.is-self .private-chat-message-head { flex-direction: row-reverse !important; }
.private-chat-message-head strong {
  font-size: 10px !important;
  color: #2668b6 !important;
  font-weight: 700 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
.private-chat-message time { font-size: 9px !important; color: #8593a0 !important; }

.private-chat-message-body {
  background: #f0f5fb !important;
  color: #111;
  padding: 5px 8px !important;
  border-radius: 0 6px 6px 6px !important;
  border: 1px solid #c1d2df !important;
  word-break: break-word !important;
  font-size: 12px;
  line-height: 1.4 !important;
}
.private-chat-message.is-self .private-chat-message-body {
  background: linear-gradient(to bottom, #dcedfb, #c0daf2) !important;
  color: #111;
  border-color: #a8bfd4 !important;
  border-radius: 6px 0 6px 6px !important;
}

/* -- Form invio -- */
.private-chat-form { flex: 0 0 auto !important; margin: 0 !important; padding: 0 !important; }
.private-chat-compose {
  display: flex !important;
  align-items: flex-end !important;
  gap: 5px !important;
  padding: 6px !important;
  background: #f0f5fb !important;
  border-top: 1px solid #a1b5c7 !important;
}
.private-chat-input {
  flex: 1 !important;
  min-height: 32px !important;
  height: 32px !important;
  max-height: 70px !important;
  resize: none !important;
  font-size: 12px !important;
  font-family: Tahoma, Arial, sans-serif !important;
  padding: 6px 8px !important;
  line-height: 1.3 !important;
  border: 1px solid #a1b5c7 !important;
  border-radius: 4px !important;
  outline: none !important;
  background: #fff !important;
  color: #111 !important;
}
.private-chat-input:focus {
  border-color: #2e8ee8 !important;
  box-shadow: 0 0 0 2px rgba(46,142,232,.15) !important;
}
.private-chat-send {
  width: 44px !important;
  height: 32px !important;
  min-width: 44px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  border: 1px solid #2b82d7 !important;
  background: linear-gradient(to bottom, #3aa1ff, #1680dc) !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
.private-chat-send:hover { filter: brightness(1.08) !important; }

.private-chat-newline {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  border: 1px solid #a1b5c7 !important;
  background: linear-gradient(to bottom, #cfd8e9, #e5eaf3) !important;
  color: #333 !important;
  font-size: 11px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

/* -- Smiley box -- */
.private-chat-smiley-box {
  flex: 0 0 auto !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 2px !important;
  padding: 5px !important;
  background: #eef3f7 !important;
  border-top: 1px solid #a1b5c7 !important;
  max-height: 64px !important;
  overflow-y: auto !important;
}
.private-chat-smiley-box[hidden] { display: none !important; }
.private-chat-smiley-item {
  width: 22px !important; height: 22px !important;
  border: 1px solid #c1d2df !important;
  border-radius: 3px !important;
  background: #fff !important;
  font-size: 13px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.private-chat-smiley-item img { max-width: 16px !important; max-height: 16px !important; object-fit: contain !important; }
.private-chat-smiley-item:hover { background: #dcedfb !important; border-color: #7fa8c8 !important; }

/* -- GIF panel -- */
.private-gif-panel {
  flex: 0 0 auto !important;
  background: #f0f5fb !important;
  border-top: 1px solid #a1b5c7 !important;
  padding: 5px !important;
}
.private-gif-panel[hidden] { display: none !important; }
.private-gif-search-row { display: flex !important; gap: 4px !important; margin-bottom: 4px !important; }
.private-gif-search-input {
  flex: 1 !important; height: 24px !important;
  border: 1px solid #a1b5c7 !important; border-radius: 4px !important;
  padding: 0 7px !important; font-size: 11px !important;
  outline: none !important; background: #fff !important;
}
.private-gif-search-input:focus { border-color: #2e8ee8 !important; }
.private-gif-search-btn {
  height: 24px !important; padding: 0 8px !important;
  border: 1px solid #2b82d7 !important;
  background: linear-gradient(to bottom,#3aa1ff,#1680dc) !important;
  color: #fff !important; border-radius: 4px !important;
  font-size: 11px !important; cursor: pointer !important;
}
.private-gif-grid {
  display: grid !important;
  grid-template-columns: repeat(3,1fr) !important;
  gap: 3px !important; max-height: 84px !important; overflow-y: auto !important;
}
.private-gif-grid img {
  width: 100% !important; height: 52px !important;
  object-fit: cover !important; border-radius: 3px !important;
  cursor: pointer !important; border: 1px solid #c1d2df !important;
}
.private-gif-grid img:hover { border-color: #2e8ee8 !important; opacity: .9 !important; }
.private-gif-placeholder { font-size: 10px !important; color: #8593a0 !important; text-align: center !important; padding: 8px 0 !important; grid-column: 1/-1 !important; }

/* -- YouTube panel -- */
.private-yt-panel {
  flex: 0 0 auto !important;
  background: #f0f5fb !important;
  border-top: 1px solid #a1b5c7 !important;
  padding: 7px !important;
}
.private-yt-panel[hidden] { display: none !important; }
.private-yt-panel input {
  width: 100% !important; height: 26px !important;
  border: 1px solid #a1b5c7 !important; border-radius: 4px !important;
  padding: 0 7px !important; font-size: 11px !important;
  outline: none !important; background: #fff !important;
  box-sizing: border-box !important; margin-bottom: 5px !important;
}
.private-yt-panel input:focus { border-color: #2e8ee8 !important; }
.private-yt-btn-row { display: flex !important; gap: 4px !important; }
.private-yt-btn {
  flex: 1 !important; height: 24px !important;
  border-radius: 4px !important; font-size: 11px !important;
  cursor: pointer !important; font-weight: 700 !important;
}
.private-yt-btn.send {
  border: 1px solid #2b82d7 !important;
  background: linear-gradient(to bottom,#3aa1ff,#1680dc) !important;
  color: #fff !important;
}
.private-yt-btn.cancel {
  border: 1px solid #a1b5c7 !important;
  background: linear-gradient(to bottom,#cfd8e9,#e5eaf3) !important;
  color: #333 !important;
}
.private-yt-error { font-size: 9.5px !important; color: #b74747 !important; margin-top: 3px !important; }

/* Bottone T nascosto (rimosso anche via JS) */
[data-private-chat-tool="text"] { display: none !important; }

/* -- focus/text-active -- */
.private-chat-window.private-text-active .private-chat-input {
  border-color: #2e8ee8 !important;
  box-shadow: 0 0 0 2px rgba(46,142,232,.15) !important;
}

/* --------------------------------------------
   MINIMIZZATO ? CERCHIO perfetto stile Messenger
   -------------------------------------------- */
.private-chat-window.is-minimized {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  min-height: 54px !important;
  max-width: 54px !important;
  max-height: 54px !important;
  border-radius: 50% !important;
  overflow: visible !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  cursor: pointer !important;
  padding: 0 !important;
}
.private-chat-window.is-minimized .private-chat-toolbar,
.private-chat-window.is-minimized .private-chat-history,
.private-chat-window.is-minimized .private-chat-form,
.private-chat-window.is-minimized .private-chat-smiley-box,
.private-chat-window.is-minimized .private-gif-panel,
.private-chat-window.is-minimized .private-yt-panel,
.private-chat-window.is-minimized .private-chat-header-copy,
.private-chat-window.is-minimized .private-chat-header-actions { display: none !important; }

.private-chat-window.is-minimized .private-chat-header {
  width: 54px !important; height: 54px !important;
  min-width: 54px !important; min-height: 54px !important;
  border-radius: 50% !important;
  padding: 0 !important; margin: 0 !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
  position: relative !important;
}
.private-chat-window.is-minimized .private-chat-avatar {
  width: 54px !important; height: 54px !important;
  min-width: 54px !important; min-height: 54px !important;
  max-width: 54px !important; max-height: 54px !important;
  border-radius: 50% !important;
  border: 3px solid #fff !important;
  box-shadow: 0 3px 14px rgba(0,0,0,.30), 0 1px 4px rgba(0,0,0,.15) !important;
  object-fit: cover !important;
  display: block !important;
}
.private-chat-window.is-minimized .private-chat-unread {
  position: absolute !important;
  top: -2px !important; right: -2px !important;
  min-width: 18px !important; height: 18px !important;
  background: #ff7d00 !important;
  border: 2px solid #fff !important;
  border-radius: 999px !important;
  color: #fff !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.2) !important;
}

/* Notifica privato */
.private-message-notice {
  position: fixed !important;
  right: 290px !important;
  bottom: 150px !important;
  z-index: 10050 !important;
  background: linear-gradient(to bottom, #dcedfb, #a9c6dd) !important;
  color: #000 !important;
  border: 1px solid #8593a0 !important;
  border-radius: 6px !important;
  padding: 7px 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.25) !important;
  cursor: pointer !important;
}
.private-message-notice:hover { filter: brightness(1.05) !important; }
.private-message-notice[hidden] { display: none !important; }

/* Admin */
.admin-body {
  overflow: auto;
  background: #d7e2ea;
}

body.admin-locked .admin-panel-view,
body.admin-locked #adminPanelView,
body.admin-locked .admin-sidebar,
body.admin-locked .admin-content,
body.admin-locked .admin-main,
body.admin-locked .admin-layout,
body.admin-locked .admin-classic-layout,
body.admin-locked .admin-classic-nav,
body.admin-locked .admin-classic-main {
  display: none !important;
}

body.admin-authenticated .admin-login-view,
body.admin-authenticated #adminLoginView {
  display: none !important;
}

body.admin-locked .admin-login-view,
body.admin-locked #adminLoginView {
  display: grid;
}

.admin-shell {
  min-height: 100vh;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  color: #fff;
  background: linear-gradient(#3f6687, #264765);
}

.admin-header strong { display: block; font-size: 17px; }
.admin-header span { color: #d7e6f3; }
.admin-header a { color: #fff; font-weight: 700; }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 10px;
  padding: 10px;
}

.admin-login {
  display: grid;
  place-items: center;
  padding: 40px 10px;
}

.admin-login form,
.admin-panel {
  padding: 12px;
  border: 1px solid #7f9bb3;
  border-radius: 5px;
  background: linear-gradient(#fff, #dce9f3);
}

.admin-login form {
  display: grid;
  gap: 10px;
  width: min(360px, 100%);
}

.admin-panel h2,
.admin-panel h3 {
  margin: 0 0 10px;
  color: #23465f;
  font-size: 16px;
}

.stack-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-panel label,
.admin-login label {
  display: grid;
  gap: 4px;
  font-weight: 700;
}

.form-actions,
.row-actions {
  display: flex;
  gap: 8px;
}

.admin-panel button,
.admin-login button {
  min-height: 27px;
  border: 1px solid #285a84;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(#5e98c5, #3c78b5);
  font-weight: 700;
}

.admin-panel button,
.admin-login button,
.admin-panel .button,
.admin-actions button,
.modal-actions button,
.admin-classic-login button,
.admin-classic-layout button,
.classic-actions button,
.client-subnav button,
.room-editor-tabs button,
.skin-choice-grid button {
  transition:
    background-color .15s ease,
    box-shadow .15s ease,
    transform .12s ease,
    filter .15s ease;
}

.admin-panel button:hover,
.admin-login button:hover,
.admin-panel .button:hover,
.admin-actions button:hover,
.modal-actions button:hover,
.admin-classic-login button:hover,
.admin-classic-layout button:hover,
.classic-actions button:hover,
.client-subnav button:hover,
.room-editor-tabs button:hover,
.skin-choice-grid button:hover {
  filter: brightness(1.07);
  box-shadow: 0 2px 8px rgba(28, 95, 145, .25);
  transform: translateY(-1px);
}

.admin-panel button:active,
.admin-login button:active,
.admin-panel .button:active,
.admin-actions button:active,
.modal-actions button:active,
.admin-classic-login button:active,
.admin-classic-layout button:active,
.classic-actions button:active,
.client-subnav button:active,
.room-editor-tabs button:active,
.skin-choice-grid button:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.2);
}

.admin-login button[type="submit"],
.admin-classic-login button[type="submit"],
.admin-panel .primary,
.admin-panel button.primary,
.admin-panel button[data-save],
.admin-panel button.save,
.admin-classic-layout button.primary,
.admin-classic-layout button[data-save],
.admin-classic-layout button.save {
  color: #fff;
  border-color: #1d6fb8;
  background: linear-gradient(#3aa1ff, #1680dc);
}

.admin-login button[type="submit"]:hover,
.admin-classic-login button[type="submit"]:hover,
.admin-panel .primary:hover,
.admin-panel button.primary:hover,
.admin-panel button[data-save]:hover,
.admin-panel button.save:hover,
.admin-classic-layout button.primary:hover,
.admin-classic-layout button[data-save]:hover,
.admin-classic-layout button.save:hover {
  background: linear-gradient(#55b2ff, #0f76d3);
}

.admin-panel button.secondary,
.admin-login button.secondary,
.admin-panel button.reset,
.admin-panel button[data-reset],
.admin-classic-layout button.secondary,
.admin-classic-layout button.reset,
.admin-classic-layout button[data-reset],
.admin-classic-login button[type="reset"],
.classic-actions button[type="reset"] {
  color: #234;
  border-color: #9eb6ca;
  background: linear-gradient(#ffffff, #e4eef7);
}

.admin-panel button.secondary:hover,
.admin-login button.secondary:hover,
.admin-panel button.reset:hover,
.admin-panel button[data-reset]:hover,
.admin-classic-layout button.secondary:hover,
.admin-classic-layout button.reset:hover,
.admin-classic-layout button[data-reset]:hover,
.admin-classic-login button[type="reset"]:hover,
.classic-actions button[type="reset"]:hover {
  background: linear-gradient(#ffffff, #d6e8f6);
}

.admin-list {
  display: grid;
  gap: 6px;
}

.room-row,
.ban-row,
.skin-row,
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid #b4c6d5;
  border-radius: 4px;
  background: #f9fcff;
}

.gift-admin-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 92px 82px auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid #b4c6d5;
  border-radius: 4px;
  background: #f9fcff;
}

.gift-admin-row img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.gift-admin-row input[type="number"] {
  width: 92px;
}

.gift-admin-row .check-row {
  margin: 0;
}

.smiley-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.smiley-grid img {
  width: 22px;
  height: 22px;
}

.admin-message {
  position: fixed;
  right: 12px;
  bottom: 12px;
  max-width: 360px;
  padding: 8px 10px;
  border-radius: 4px;
  color: #fff;
  background: #1f405a;
  opacity: 0;
  pointer-events: none;
}

.admin-message.visible {
  opacity: 1;
}

.admin-classic-body {
  background: #8fa5b9;
  color: #1d2c38;
  min-height: 100vh;
}

.admin-classic-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #d8e1ea;
}

.admin-classic-header {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  border-bottom: 1px solid #2f5679;
  background: linear-gradient(#315d82, #214766);
  color: #fff;
}

.admin-classic-brand,
.admin-classic-title {
  padding: 12px 16px;
}

.admin-classic-brand {
  border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.admin-classic-brand strong {
  display: block;
  font-size: 18px;
}

.admin-classic-brand span {
  display: block;
  margin-top: 4px;
  color: #dbe8f3;
  font-size: 12px;
}

.admin-classic-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-classic-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.admin-classic-title a {
  color: #fff;
  font-weight: 700;
}

.admin-classic-login {
  display: grid;
  place-items: start center;
  padding: 42px 16px;
}

.admin-classic-login form {
  width: min(420px, 100%);
  border: 1px solid #667f97;
  background: #eef3f7;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.admin-modal-title {
  padding: 8px 10px;
  background: linear-gradient(#d5dde6, #b8c5d1);
  border-bottom: 1px solid #7d93a8;
  color: #16334b;
  font-weight: 700;
}

.admin-classic-login label,
.classic-form label {
  display: grid;
  gap: 4px;
  margin: 10px;
  color: #1f3548;
  font-size: 13px;
  font-weight: 700;
}

.admin-classic-login input,
.classic-form input,
.classic-form textarea {
  min-height: 28px;
  border: 1px solid #7b91a5;
  border-radius: 0;
  background: #fff;
  color: #172635;
  padding: 4px 6px;
  font: inherit;
}

.classic-form textarea {
  resize: vertical;
}

.admin-classic-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.admin-classic-nav {
  padding: 8px;
  border-right: 1px solid #788fa4;
  background: #c6d2dd;
  overflow: auto;
}

.admin-classic-nav button {
  display: block;
  width: 100%;
  min-height: 30px;
  margin: 0 0 4px;
  padding: 5px 8px;
  border: 1px solid #7b91a5;
  border-radius: 0;
  background: linear-gradient(#f8fbfd, #dce6ef);
  color: #16334b;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.admin-classic-nav button.active {
  border-color: #315d82;
  background: linear-gradient(#416f96, #295373);
  color: #fff;
}

.admin-classic-main {
  padding: 10px;
  overflow: auto;
  min-height: 0;
}

.admin-breadcrumb {
  padding: 7px 10px;
  border: 1px solid #8197aa;
  background: #edf3f8;
  color: #244863;
  font-weight: 700;
}

.admin-screen {
  display: none;
  margin-top: 10px;
  border: 1px solid #738ca3;
  background: #f5f7f9;
  min-height: 420px;
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.admin-screen.active {
  display: block;
}

.admin-screen h2 {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #8197aa;
  background: linear-gradient(#dfe7ef, #c5d1dc);
  color: #17354d;
  font-size: 17px;
}

.dashboard-block {
  margin: 10px;
  border: 1px solid #95a8b8;
  background: #eef3f7;
}

.dashboard-block h3 {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #a7b8c7;
  background: linear-gradient(#dce5ee, #c2cfdc);
  color: #18364f;
  font-size: 14px;
}

.dashboard-summary-cards,
.dashboard-quick-actions,
.dashboard-alerts {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.dashboard-summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dashboard-card {
  min-height: 82px;
  padding: 10px;
  border: 1px solid #8ea3b4;
  background: linear-gradient(#fff, #dde7f0);
  box-shadow: inset 0 1px rgba(255,255,255,.72);
}

.dashboard-card-label {
  color: #35506a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.dashboard-card-value {
  margin-top: 8px;
  color: #16334b;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.05;
}

.dashboard-card-detail {
  margin-top: 5px;
  color: #51697d;
  font-size: 12px;
}

.dashboard-card-blue { background: linear-gradient(#f7fbff, #d7e8f8); }
.dashboard-card-navy { background: linear-gradient(#edf4fb, #d1deeb); }
.dashboard-card-gray { background: linear-gradient(#f9fafb, #e2e8ee); }
.dashboard-card-gold { background: linear-gradient(#fff8e4, #efe0b6); }
.dashboard-card-red { background: linear-gradient(#fdecec, #f1caca); }
.dashboard-card-amber { background: linear-gradient(#fff7e7, #f4deb0); }
.dashboard-card-green { background: linear-gradient(#ecf7ef, #cee5d4); }
.dashboard-card-violet { background: linear-gradient(#f5f0fb, #ddd1ef); }

.dashboard-quick-actions {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.dashboard-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #7c92a7;
  background: linear-gradient(#fff, #d7e2ec);
  color: #17354d;
  font-weight: 700;
  text-decoration: none;
}

.dashboard-action:hover,
.dashboard-action:focus {
  border-color: #315d82;
  background: linear-gradient(#4e799f, #295373);
  color: #fff;
}

.dashboard-action-back {
  text-align: center;
}

.dashboard-alerts {
  grid-template-columns: 1fr;
}

.dashboard-alert {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid #9db0bf;
  background: #fff;
  color: #25384a;
}

.dashboard-alert strong {
  color: #17354d;
}

.dashboard-alert-ok {
  border-color: #95b0a0;
  background: #eef8f1;
}

.dashboard-alert-warning {
  border-color: #d1c08c;
  background: #fff8e2;
}

.dashboard-alert-danger {
  border-color: #cc8f8f;
  background: #faeaea;
}

.classic-form {
  padding: 10px;
}

.classic-form fieldset {
  margin: 0 0 10px;
  border: 1px solid #95a8b8;
  background: #eef3f7;
}

.classic-form legend {
  padding: 0 6px;
  color: #1c4668;
  font-weight: 700;
}

.classic-form .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.classic-form .check-row input {
  min-height: 0;
}

.classic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.classic-actions button {
  min-width: 76px;
  min-height: 28px;
  border: 1px solid #576f84;
  border-radius: 0;
  background: linear-gradient(#ffffff, #d3dde7);
  color: #17354d;
  font-weight: 700;
  cursor: pointer;
}

.admin-classic-login button,
.admin-classic-layout button,
.classic-actions button,
.client-subnav button,
.room-editor-tabs button,
.skin-choice-grid button {
  transition:
    background-color .15s ease,
    box-shadow .15s ease,
    transform .12s ease,
    filter .15s ease;
}

.admin-classic-login button:hover,
.admin-classic-layout button:hover,
.classic-actions button:hover,
.client-subnav button:hover,
.room-editor-tabs button:hover,
.skin-choice-grid button:hover {
  filter: brightness(1.07);
  box-shadow: 0 2px 8px rgba(28, 95, 145, .25);
  transform: translateY(-1px);
}

.admin-classic-login button:active,
.admin-classic-layout button:active,
.classic-actions button:active,
.client-subnav button:active,
.room-editor-tabs button:active,
.skin-choice-grid button:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.2);
}

.admin-classic-login button[type="submit"],
.admin-classic-layout button.primary,
.admin-classic-layout button[data-save],
.admin-classic-layout button.save {
  color: #fff;
  border-color: #1d6fb8;
  background: linear-gradient(#3aa1ff, #1680dc);
}

.admin-classic-login button[type="submit"]:hover,
.admin-classic-layout button.primary:hover,
.admin-classic-layout button[data-save]:hover,
.admin-classic-layout button.save:hover {
  background: linear-gradient(#55b2ff, #0f76d3);
}

.admin-classic-login button[type="reset"],
.admin-classic-layout button.secondary,
.admin-classic-layout button.reset,
.admin-classic-layout button[data-reset],
.classic-actions button[type="reset"] {
  color: #234;
  border-color: #9eb6ca;
  background: linear-gradient(#ffffff, #e4eef7);
}

.admin-classic-login button[type="reset"]:hover,
.admin-classic-layout button.secondary:hover,
.admin-classic-layout button.reset:hover,
.admin-classic-layout button[data-reset]:hover,
.classic-actions button[type="reset"]:hover {
  background: linear-gradient(#ffffff, #d6e8f6);
}

.classic-table {
  width: calc(100% - 20px);
  margin: 10px;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #8197aa;
  font-size: 13px;
}

.classic-table th,
.classic-table td {
  border: 1px solid #b5c2cf;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.classic-table th {
  background: #d8e1ea;
  color: #17354d;
  font-weight: 700;
}

.classic-table tr:nth-child(even) td {
  background: #f4f6f8;
}

.classic-pending {
  margin: 10px;
  padding: 8px;
  border: 1px solid #b8c6d3;
  background: #fff;
  color: #31485a;
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.client-settings-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 0;
}

.client-subnav {
  padding: 8px;
  border-right: 1px solid #9aaebe;
  background: #dbe5ee;
}

.client-subnav button {
  display: block;
  width: 100%;
  min-height: 27px;
  margin-bottom: 3px;
  border: 1px solid #879bad;
  border-radius: 0;
  background: linear-gradient(#fff, #d9e3ec);
  color: #18364f;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.client-subnav button.active {
  background: linear-gradient(#416f96, #295373);
  color: #fff;
}

.client-tab { display: none; }
.client-tab.active { display: block; }
.room-editor .room-tab { display: none; }
.room-editor .room-tab.active { display: block; }
.user-panel { display: none; }
.user-panel.active { display: block; }
.ban-tab { display: none; }
.ban-tab.active { display: block; }
.mute-tab { display: none; }
.mute-tab.active { display: block; }

.client-tab h3,
.room-editor h3 {
  margin: 0 0 10px;
  padding: 7px 9px;
  border: 1px solid #9aaebe;
  background: #edf3f8;
  color: #244863;
}

.room-editor {
  margin: 10px;
  border: 1px solid #8197aa;
  background: #dbe5ee;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 12px;
  margin-top: 10px;
}

.classic-fieldset {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #9aaebe;
  background: #f4f8fb;
}

.room-editor-tabs {
  flex-wrap: wrap;
  margin: 8px 8px 0;
}

.room-editor-tabs button {
  border-color: #879bad;
  border-radius: 0;
  background: linear-gradient(#fff, #d9e3ec);
  color: #18364f;
}

.room-editor-tabs button.active {
  background: linear-gradient(#416f96, #295373);
  color: #fff;
}

.room-editor .classic-form {
  max-height: 58vh;
  overflow: auto;
}

.room-editor select[size] {
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  min-height: 120px;
  border: 1px solid #7b91a5;
  border-radius: 0;
  background: #fff;
}

.classic-table input[type="radio"] {
  width: 16px;
  height: 16px;
}

.client-settings-form select,
.client-settings-form input[type="number"],
.room-editor select,
.room-editor input[type="number"] {
  min-height: 28px;
  border: 1px solid #7b91a5;
  border-radius: 0;
  background: #fff;
}

.client-settings-form select[size] {
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  min-height: 120px;
}

.classic-actions.compact { padding-block: 4px; }

.color-preview-swatch {
  display: block;
  width: 54px;
  min-width: 54px;
  height: 34px;
  border: 1px solid #7b91a5;
  background: #dcedfb;
  box-shadow: inset 0 1px rgba(255,255,255,.55);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  border-top: 1px solid #9aaebe;
  background: #dbe5ee;
}

.client-logo-preview {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 10px;
  padding: 8px;
  border: 1px solid #a8bac9;
  background: #fff;
}

.client-logo-preview img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.client-logo-preview span {
  grid-column: 2;
  color: #496273;
}

.chat-background-preview {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 10px;
  padding: 8px;
  border: 1px solid #a8bac9;
  background: #fff;
}

.chat-background-preview img {
  width: 110px;
  height: 74px;
  object-fit: cover;
  border: 1px solid #9eb6ca;
  background: #fff;
}

.chat-background-preview.secondary-strip-background-preview {
  background-color: var(--secondary-strip-bg-color, #fff);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.chat-background-preview.secondary-strip-background-preview.has-secondary-strip-color {
  background-image: none !important;
  background: var(--secondary-strip-bg-color) !important;
  background-color: var(--secondary-strip-bg-color) !important;
}

.chat-background-preview.secondary-strip-background-preview.has-secondary-strip-bg:not(.has-secondary-strip-color) {
  background-image: var(--secondary-strip-background-image) !important;
}

.chat-background-preview.secondary-strip-background-preview.has-secondary-strip-bg img {
  opacity: 0;
}

.chat-background-preview-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.chat-background-preview-copy strong {
  color: #244863;
}

.chat-background-preview-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #496273;
}

.skin-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 8px;
  margin: 10px;
}

.skin-choice-grid button {
  display: grid;
  gap: 6px;
  border: 1px solid #879bad;
  border-radius: 0;
  background: #fff;
  color: #17354d;
  padding: 7px;
  cursor: pointer;
}

.skin-choice-grid button.active { outline: 2px solid #315d82; }

.skin-preview {
  height: 42px;
  border: 1px solid #778b9e;
  background: linear-gradient(var(--skin-h) 0 30%, var(--skin-p) 30% 100%);
  position: relative;
}

.skin-preview::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 10px;
  background: var(--skin-a);
}

.defined-picker {
  display: grid;
  gap: 4px;
}

.defined-picker button {
  border: 1px solid #8ea2b5;
  border-radius: 0;
  background: #fff;
  color: #17354d;
  padding: 5px 7px;
  text-align: left;
}

.ad-banner {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 35;
  transform: translateX(-50%);
  border: 1px solid #3a5f82;
  background: #fff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
}

.ad-banner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.share-window {
  left: 50%;
  top: 110px;
  transform: translateX(-50%);
  width: min(520px, 92vw);
}

.share-window textarea {
  width: calc(100% - 20px);
  margin: 10px;
  resize: vertical;
}

.edit-profile-form {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.edit-profile-form img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  justify-self: center;
}

.edit-profile-form label {
  display: grid;
  gap: 4px;
  font-weight: 700;
}

/* Campi del box "Modifica profilo" (sesso + password): dimensioni compatte
   e coerenti, invece della larghezza/altezza di default del browser. */
.edit-profile-form input[type="text"],
.edit-profile-form input[type="email"],
.edit-profile-form input[type="password"],
.edit-profile-form input[type="date"],
.edit-profile-form select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #b6c9d9;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 400;
}

/* FIX (confermato da screenshot): i bottoni "Invia"/"Chiudi" stanno dentro
   .modal-actions, che in skin-123flashchat.css eredita lo stretch verticale
   di default del suo contenitore flex   per questo diventano enormi e a
   forma di pillola. Forziamo dimensioni compatte e centrate, con selettori
   basati su #editProfilePopup per avere priorit  sicura sulle regole dello
   skin, indipendentemente da come   strutturato l'HTML che non abbiamo. */
#editProfilePopup .modal-actions {
  align-self: flex-start;
  justify-self: start;
  flex-wrap: wrap;
}

#editProfilePopup .modal-actions button {
  flex: 0 0 auto;
  align-self: center;
  width: auto;
  height: auto;
  min-height: 32px;
  max-height: 38px;
  padding: 8px 22px;
}

/* I campi restano nella loro colonna, senza bottoni "intrusi" nel grid. */
.edit-profile-form button {
  justify-self: end;
  min-width: 90px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 700;
}

.edit-profile-password-section {
  display: grid;
  gap: 8px;
}

.edit-profile-divider {
  margin: 4px 0 0;
  border: none;
  border-top: 1px solid #d7e1ea;
}

#editProfilePasswordError.is-success {
  color: #2e7d32;
}

.hide-avatar-input .input-avatar { display: none; }

.avatar-extra-actions {
  display: flex;
  gap: 8px;
  padding: 8px 10px 0;
}

.avatar-extra-actions button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  body { overflow: hidden; }
  .chat-shell {
    min-height: 100vh;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .select-room-row { gap: 10px; padding: 10px 12px; min-height: 68px; }
  .select-room-row img { width: 46px; height: 46px; }
  .select-room-brand { display: none; }
  .select-room-features { display: none; }
  .chat-frame {
    grid-template-columns: minmax(0, 1fr) 210px;
    padding-left: 0;
  }
  .side-panel { border-left: 1px solid #a6bfd5; }
  .avatar-window, .profile-window { left: 5vw; right: auto; top: 130px; width: 90vw; }
  .gift-window { left: 5vw; right: auto; top: 70px; width: 90vw; max-height: calc(100vh - 90px); }
  .font-popup {
    left: 8px;
    right: 8px;
    bottom: 106px;
    width: auto;
    max-height: calc(100vh - 120px);
  }
  .font-popup-body {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 150px);
  }
  .font-family-list,
  .font-color-grid {
    max-height: 170px;
  }
  .font-size-grid {
    grid-template-columns: repeat(5, 34px);
  }
  .gift-window .asset-grid, .gift-grid { grid-template-columns: repeat(4, minmax(54px, 1fr)); }
  .gift-bottom { grid-template-columns: 1fr; }
  .gift-admin-row { grid-template-columns: 38px minmax(0, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-classic-header,
  .admin-classic-layout { grid-template-columns: 1fr; }
  .admin-classic-brand {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  }
  .admin-classic-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-classic-nav {
    border-right: 0;
    border-bottom: 1px solid #788fa4;
    max-height: 220px;
  }
  .admin-screen { max-height: none; }
  .client-settings-layout { grid-template-columns: 1fr; }
  .client-subnav { border-right: 0; border-bottom: 1px solid #9aaebe; }
  #smileyToggle { display: none !important; }
}
#chatScreen.chat-screen {
  grid-template-rows: var(--secondary-strip-height, 38px) minmax(0, 1fr);
}

#chatScreen > .module-row {
  height: var(--secondary-strip-height, 38px) !important;
  min-height: var(--secondary-strip-height, 38px) !important;
  max-height: none !important;
  display: flex !important;
  align-items: center !important;
  background-color: var(--secondary-strip-bg-color, transparent);
}

#chatScreen > .module-row .toolbar-icon-btn,
#chatScreen > .module-row .module-icon,
#chatScreen > .module-row .module-button,
#chatScreen > .module-row button,
#chatScreen > .module-row a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#chatScreen.chat-screen {
  grid-template-rows: var(--secondary-strip-height, 38px) minmax(0, 1fr);
}

#chatScreen > .module-row {
  height: var(--secondary-strip-height, 38px) !important;
  min-height: var(--secondary-strip-height, 38px) !important;
  background: linear-gradient(#dcedfb, #a9c6dd);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#chatScreen > .module-row.has-secondary-strip-color {
  background-image: none !important;
  background: var(--secondary-strip-bg-color) !important;
  background-color: var(--secondary-strip-bg-color) !important;
}

#chatScreen > .module-row.has-secondary-strip-bg:not(.has-secondary-strip-color) {
  /* NOTA: niente più "background-color: transparent !important" qui.
     Il colore scelto in "Sfondo barra" resta impostato sotto (vedi la
     regola più in basso su --chatskin-module-row-bg): così l'immagine sta
     sopra al colore invece di cancellarlo, e cambiando il colore mentre
     l'immagine è attiva l'effetto resta visibile nelle zone trasparenti
     dell'immagine (es. PNG con alpha).
     L'immagine può essere caricata a qualsiasi misura: qui viene forzata
     a 100% di larghezza e 56px di altezza (le stesse misure della barra
     reale), niente "cover": nessun ritaglio, solo adattamento esatto. */
  background-image: var(--secondary-strip-background-image) !important;
  background-size: 100% 56px !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.nickname-colored.nickname-role-superadmin,
.user-name.nickname-role-superadmin,
.message strong.nickname-role-superadmin,
.message strong .nickname-role-superadmin {
  color: var(--nickname-color-superadmin, #d4af37) !important;
}

.nickname-colored.nickname-role-admin,
.user-name.nickname-role-admin,
.message strong.nickname-role-admin,
.message strong .nickname-role-admin {
  color: var(--nickname-color-admin, #2f72c9) !important;
}

.nickname-colored.nickname-role-moderator,
.user-name.nickname-role-moderator,
.message strong.nickname-role-moderator,
.message strong .nickname-role-moderator {
  color: var(--nickname-color-moderator, #b74747) !important;
}

.nickname-colored.nickname-role-dj,
.user-name.nickname-role-dj,
.message strong.nickname-role-dj,
.message strong .nickname-role-dj {
  color: var(--nickname-color-dj, #7a52c7) !important;
}

.nickname-colored.nickname-user-male,
.user-name.nickname-user-male,
.message strong.nickname-user-male,
.message strong .nickname-user-male {
  color: var(--nickname-color-user-male, #1f4f7a) !important;
}

.nickname-colored.nickname-user-female,
.user-name.nickname-user-female,
.message strong.nickname-user-female,
.message strong .nickname-user-female {
  color: var(--nickname-color-user-female, #ad3d71) !important;
}

.nickname-colored.nickname-user-neutral,
.user-name.nickname-user-neutral,
.message strong.nickname-user-neutral,
.message strong .nickname-user-neutral {
  color: var(--nickname-color-user-neutral, #4f5965) !important;
}

.nickname-colored.nickname-role-guest,
.user-name.nickname-role-guest,
.message strong.nickname-role-guest,
.message strong .nickname-role-guest {
  color: var(--nickname-color-guest, #2E4A62) !important;
}

.picker-popup {
  width: min(360px, calc(100vw - 24px)) !important;
  max-height: min(460px, calc(100vh - 130px)) !important;
  overflow: hidden !important;
}

/* wrapper: altezza fissa 4 righe, scrollbar verticale a destra */
.smiley-scroll-wrap {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100% !important;
  height: calc(4 * 44px + 3 * 4px) !important; /* 188px = 4 righe visibili */
  padding: 4px !important;
  box-sizing: border-box !important;
}

/* griglia: 7 colonne fisse, righe automatiche che crescono verso il basso */
.smiley-picker {
  display: grid !important;
  grid-template-columns: repeat(7, 44px) !important;
  grid-auto-rows: 44px !important;
  grid-auto-flow: row !important;
  gap: 4px !important;
  width: max-content !important;
  overflow: visible !important;
  padding: 0 !important;
}

.smiley-picker.emoji-picker {
  grid-template-columns: repeat(7, 44px) !important;
}

.smiley-picker button,
.smiley-picker.emoji-picker button {
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 2px !important;
  overflow: visible !important;
}

.smiley-picker img {
  max-width: 40px !important;
  max-height: 40px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

.inline-smiley {
  max-width: 42px !important;
  max-height: 42px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  vertical-align: middle !important;
}

.private-chat-smiley-box {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)) !important;
  gap: 6px !important;
  max-height: 190px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 7px !important;
}

.private-chat-smiley-item {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 2px !important;
  overflow: visible !important;
}

.private-chat-smiley-item img {
  max-width: 38px !important;
  max-height: 38px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

.chat-shell,
.webcam-window,
.private-chat-window,
.admin-classic-shell {
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select,
[contenteditable="true"],
.messages,
.private-chat-history {
  -webkit-user-select: text;
  user-select: text;
}

img,
video,
canvas {
  -webkit-user-drag: none;
  user-drag: none;
  
}
img.emoji {
  width: 25px !important;
  height: 25px !important;
  vertical-align: -0.2em;
  margin: 0 1px;
}
.classic-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #9db2c3;
  background: #eef5fb;
}

.classic-filters label {
  display: grid;
  gap: 3px;
  font-size: 11px;
  color: #244863;
}

.classic-filters input {
  min-width: 0;
}

.admin-classic-title button {
  min-height: 26px;
  padding: 3px 10px;
  border: 1px solid #6f8497;
  background: linear-gradient(#f9fbfd, #dbe6ef);
  color: #1d3448;
  cursor: pointer;
}
/* User list media badges: webcam + microphone */
.user-media-badges {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 5px;
  vertical-align: middle;
}

.user-media-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 2px;
  border-radius: 4px;
  line-height: 1;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(50, 95, 140, 0.35);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.user-media-badge .webcam-open-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.user-mic-badge {
  color: #0f7a55;
  font-size: 14px;
}

.user-webcam-badge {
  cursor: pointer;
}
/* Quitar hora debajo de los mensajes */
.message-time {
  display: none !important;
}

/* Aumentar nickname cuando escriben en el chat */
.message > strong,
.message strong .user-identity,
.message strong .user-name,
.message .nickname-colored {
  font-size: 27px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
}

/* Darle un poco m s de presencia al nombre */
.message > strong {
  display: inline-block;
  margin-bottom: 3px;
}

/* Mensajes: texto al lado del nickname, no debajo */
.message:not(.system) {
  display: flex !important;
  align-items: flex-start !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}

.message:not(.system) > .avatar {
  flex: 0 0 auto !important;
  width: 24px !important;
  height: 24px !important;
  margin-top: 2px !important;
}

.message:not(.system) > strong {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 4px 0 0 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

.message:not(.system) > div {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.15 !important;
}

/* Si el mensaje es largo, que siga debajo pero alineado bonito */
.message:not(.system) > div {
  flex: 1 1 auto !important;
  min-width: 80px !important;
}

/* Quitar hora si todav a aparece */
.message-time {
  display: none !important;
}
/* Ocultar emoji/g nero antes del nickname SOLO en los mensajes del chat */
#messages .user-gender-icon,
.messages .user-gender-icon,
.message .user-gender-icon {
  display: none !important;
}

/* Ajustar nickname para que quede limpio sin el emoji */
#messages .user-identity,
.messages .user-identity,
.message .user-identity {
  gap: 0 !important;
}

/* Quitar tooltip negro de rol/sexo al pasar el mouse por usuarios */
[data-user-tooltip]::after,
[data-user-tooltip]:hover::after,
[data-user-tooltip]:focus-visible::after {
  content: none !important;
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Permisos de avatar por rol:
   Permitido: usuario normal, guest, DJ.
   Bloqueado: superadmin, admin, moderador. */
body.avatar-change-allowed #avatarButton,
body.avatar-change-allowed [data-action="avatar"] {
  display: inline-flex !important;
}

body.avatar-change-allowed #avatarPopup:not([hidden]) {
  display: block !important;
}

body.avatar-change-allowed #avatarUploadButton,
body.avatar-change-allowed #avatarWebcamButton {
  display: inline-flex !important;
}

body.avatar-change-blocked #avatarButton,
body.avatar-change-blocked [data-action="avatar"],
body.avatar-change-blocked #avatarPopup {
  display: none !important;
}

/* Avatar est ndar Infinity */
#myAvatarImg,
#sideAvatar,
.message > img.avatar,
.private-chat-avatar,
#editProfileAvatarPreview {
  object-fit: contain !important;
  background: #ffffff !important;
}

/* Avatar principal de la lista de usuarios y mensajes */
.user-item > img,
.message > img.avatar,
#sideAvatar,
#myAvatarImg,
.private-chat-avatar {
  border-radius: 50% !important;
  object-fit: cover !important;
  background: #ffffff !important;
}

/* Carita peque a al lado del nickname */
.user-gender-icon.user-mood-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  font-size: 15px !important;
  line-height: 1 !important;
  margin-right: 3px !important;
}

/* Mantener alineado nickname + carita */
.user-identity {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
}

/* En mensajes del chat puedes ocultar la carita para no ensuciar el texto */
.message .user-gender-icon {
  display: none !important;
}

/* Icono peque o al lado del nickname: por defecto logo Infinity.
   Esto NO es el avatar grande. */
.user-mood-icon-wrap {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 22px !important;
  height: 20px !important;
  flex: 0 0 18px !important;
  margin-right: 3px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
}

.user-mood-icon-wrap.is-own {
  cursor: pointer !important;
}


.user-mood-icon-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* =========================================================
   Icone genere: omino maschio / donna al posto del logo
   ========================================================= */
.user-gender-svg-icon {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 82% !important;
}

/* Omino maschio   silhouette blu */
.gender-icon-male {
  background-image: url("/assets/sesso/uomo.png") !important;
}

/* Omino donna   silhouette rosa */
.gender-icon-female {
  background-image: url("/assets/sesso/donna.png") !important;
}


/* El avatar grande se mantiene independiente */
.user-item > img,
.message > img.avatar,
#sideAvatar,
#myAvatarImg,
.private-chat-avatar {
  border-radius: 20% !important;
  object-fit: cover !important;
}

/* En mensajes del chat no mostrar el icono peque o para no ensuciar el texto */
.message .user-mood-icon-wrap {
  display: none !important;
}

/* Admin > Client Settings > Skin > Sfondi */
.chat-background-preview {
  position: relative !important;
  min-height: 120px !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 12px !important;
  overflow: hidden !important;
  border: 1px solid rgba(35, 65, 95, .28) !important;
  border-radius: 10px !important;
  background: #eef4f8 !important;
}

.chat-background-preview.has-current-bg {
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.94), rgba(255,255,255,.65)),
    var(--current-bg-image) !important;
  background-size: cover !important;
  background-position: center !important;
}

.chat-background-preview.has-current-color {
  background: var(--current-bg-color) !important;
}

.chat-background-preview img {
  width: 150px !important;
  height: 90px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 1px solid rgba(0,0,0,.18) !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.15) !important;
}

.chat-background-preview-copy {
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}

.chat-background-preview-copy strong {
  color: #1f405f !important;
  font-size: 14px !important;
}

.chat-background-preview-copy span {
  word-break: break-all !important;
  font-size: 12px !important;
  color: #24384b !important;
}

.background-preview-open {
  width: fit-content !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #0b74d1 !important;
  text-decoration: underline !important;
}

/* Admin Skin > Sfondi: vista clara de imagen actual guardada */
.chat-background-preview {
  position: relative !important;
  min-height: 120px !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 12px !important;
  overflow: hidden !important;
  border: 1px solid rgba(35, 65, 95, .28) !important;
  border-radius: 10px !important;
  background: #eef4f8 !important;
}

.chat-background-preview.has-current-bg {
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.94), rgba(255,255,255,.65)),
    var(--current-bg-image) !important;
  background-size: cover !important;
  background-position: center !important;
}

.chat-background-preview.has-current-color {
  background: var(--current-bg-color) !important;
}

.chat-background-preview img {
  width: 150px !important;
  height: 90px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 1px solid rgba(0,0,0,.18) !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.15) !important;
}

.chat-background-preview-copy {
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}

.chat-background-preview-copy strong {
  color: #1f405f !important;
  font-size: 14px !important;
}

.chat-background-preview-copy span {
  word-break: break-all !important;
  font-size: 12px !important;
  color: #24384b !important;
}

.background-preview-open {
  width: fit-content !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #0b74d1 !important;
  text-decoration: underline !important;
}

/* Admin Skin > Sfondi: vista clara de imagen actual guardada */
.chat-background-preview {
  position: relative !important;
  min-height: 120px !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 12px !important;
  overflow: hidden !important;
  border: 1px solid rgba(35, 65, 95, .28) !important;
  border-radius: 10px !important;
  background: #eef4f8 !important;
}

.chat-background-preview.has-current-bg {
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.94), rgba(255,255,255,.65)),
    var(--current-bg-image) !important;
  background-size: cover !important;
  background-position: center !important;
}

.chat-background-preview.has-current-color {
  background: var(--current-bg-color) !important;
}

.chat-background-preview img {
  width: 150px !important;
  height: 90px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 1px solid rgba(0,0,0,.18) !important;
  background: #fff !important;
  box-shadow: 0 4px 14px rgba(0,0,0,.15) !important;
}

.chat-background-preview-copy {
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}

.chat-background-preview-copy strong {
  color: #1f405f !important;
  font-size: 14px !important;
}

.chat-background-preview-copy span {
  word-break: break-all !important;
  font-size: 12px !important;
  color: #24384b !important;
}

.background-preview-open {
  width: fit-content !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #0b74d1 !important;
  text-decoration: underline !important;
}

/* FIX: bot n Enviar/Invia dentro del compositor, no como barra gigante */
#messageForm.bottom-compose .input-line {
  display: grid !important;
  grid-template-columns: 54px minmax(0, 1fr) 88px !important;
  align-items: stretch !important;
  min-height: 74px !important;
  height: 74px !important;
  background: #fff !important;
}

#messageForm.bottom-compose .input-line.hide-avatar-input {
  grid-template-columns: minmax(0, 1fr) 88px !important;
}

#messageForm.bottom-compose #messageInput {
  display: block !important;
  width: 100% !important;
  height: 74px !important;
  min-height: 74px !important;
  max-height: 74px !important;
  margin: 0 !important;
  resize: none !important;
}

#messageForm.bottom-compose .send-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  width: 88px !important;
  min-width: 88px !important;
  max-width: 88px !important;
  padding: 6px !important;
  margin: 0 !important;
}

#messageForm.bottom-compose #sendButton {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  border-radius: 5px !important;
  white-space: nowrap !important;
}

/* M vil: mantener bot n peque o, nunca de ancho completo */
@media (max-width: 720px) {
  #messageForm.bottom-compose .input-line {
    grid-template-columns: 42px minmax(0, 1fr) 78px !important;
    height: 64px !important;
    min-height: 64px !important;
  }

  #messageForm.bottom-compose .input-line.hide-avatar-input {
    grid-template-columns: minmax(0, 1fr) 78px !important;
  }

  #messageForm.bottom-compose #messageInput {
    height: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
  }

  #messageForm.bottom-compose .send-stack {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    padding: 5px !important;
  }

  #messageForm.bottom-compose #sendButton {
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    height: 27px !important;
    min-height: 27px !important;
    max-height: 27px !important;
    font-size: 11px !important;
  }
}

/* =========================================================
   FIX FINAL COMPOSER: textarea + bot n Invia bien alineados
   ========================================================= */

#messageForm.bottom-compose {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  background: #ffffff !important;
  overflow: hidden !important;
}

#messageForm.bottom-compose .compose-toolbar,
#messageForm.bottom-compose .toolbar-row,
#messageForm.bottom-compose .input-toolbar {
  flex: 0 0 auto !important;
}

/* L nea real donde se escribe */
#messageForm.bottom-compose .input-line {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  width: 100% !important;
  height: 62px !important;
  min-height: 62px !important;
  max-height: 62px !important;
  padding: 6px 8px !important;
  gap: 8px !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  overflow: hidden !important;
}

/* Avatar del input */
#messageForm.bottom-compose .input-avatar,
#messageForm.bottom-compose .input-avatar-wrap,
#messageForm.bottom-compose .composer-avatar {
  flex: 0 0 42px !important;
  width: 42px !important;
  height: 50px !important;
  max-width: 42px !important;
  overflow: hidden !important;
}

/* Caja de escribir */
#messageForm.bottom-compose #messageInput {
  flex: 1 1 auto !important;
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  height: 50px !important;
  min-height: 50px !important;
  max-height: 50px !important;
  margin: 0 !important;
  padding: 6px 8px !important;
  box-sizing: border-box !important;
  resize: none !important;
  overflow-y: auto !important;
  font-size: 13px !important;
  line-height: 17px !important;
  color: #0f2438 !important;
  background: #ffffff !important;
  border: 1px solid #7fa0ba !important;
  outline: none !important;
}

/* Contenedor del bot n */
#messageForm.bottom-compose .send-stack {
  flex: 0 0 84px !important;
  width: 84px !important;
  min-width: 84px !important;
  max-width: 84px !important;
  height: 50px !important;
  min-height: 50px !important;
  max-height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  boximportant;
  min-height: 50px !important;
  max-height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content-sizing: border-box !important;
}

/* Bot n Invia */
#messageForm.bottom-compose #sendButton {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  margin: 0 !important;
  padding: 0 10px !important;
  box-sizing: border-box !important;
  border-radius: 5px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* Evitar que reglas viejas lo vuelvan barra gigante */
#messageForm.bottom-compose .input-line > #sendButton,
#messageForm.bottom-compose button#sendButton {
  flex: 0 0 76px !important;
}

/* M vil */
@media (max-width: 720px) {
  #messageForm.bottom-compose .input-line {
    height: 58px !important;
    min-height: 58px !important;
    max-height: 58px !important;
    padding: 5px !important;
    gap: 5px !important;
  }

  #messageForm.bottom-compose .input-avatar,
  #messageForm.bottom-compose .input-avatar-wrap,
  #messageForm.bottom-compose .composer-avatar {
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 48px !important;
  }

  #messageForm.bottom-compose #messageInput {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    font-size: 13px !important;
    line-height: 17px !important;
  }

  #messageForm.bottom-compose .send-stack {
    flex: 0 0 70px !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    height: 48px !important;
  }

  #messageForm.bottom-compose #sendButton {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    font-size: 11px !important;
  }
}

/* FIX: ocultar Chat privato cuando el rol no puede iniciar conversaci n */
#userActionPopup[data-can-private="0"] [data-user-action="private"],
.user-action-popup[data-can-private="0"] [data-user-action="private"],
.user-action-popover[data-can-private="0"] [data-user-action="private"] {
  display: none !important;
}

/* FIX lista usuarios: mood/icono grande izquierda, avatar peque o junto al nick */
#usersTab .users-list {
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-auto-rows: min-content !important;
  align-content: start !important;
  gap: 2px !important;
}

.user-item {
  align-self: start !important;
}

.user-item {
  width: 100% !important;
  min-height: 34px !important;
  padding: 9px 6px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  text-align: left !important;
  overflow: hidden !important;
  border-radius: 12px !important;
}

.user-list-main-mood {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  overflow: hidden !important;
}

.user-list-main-mood img,
.user-list-main-mood .mood-icon,
.user-list-main-mood .user-mood-icon {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  object-fit: contain !important;
}

.user-list-main-mood svg {
  width: 18px !important;
  height: 18px !important;
}

.user-item > span:not(.user-list-main-mood) {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.user-list-identity {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

.user-list-role-label {
  color: #8b95a1 !important;
  font-weight: 500 !important;
}

.user-item strong {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  max-width: 100% !important;
  font-size: 13px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.user-item small {
  margin-top: 0 !important;
  font-size: 9px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.user-name,
.nickname-colored {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* FIX: ocultar opci n Admin para moderator, dj, usuarios y guest */
body:not([data-can-admin-panel="1"]) [data-option="admin"],
body:not([data-can-admin-panel="1"]) [data-admin-link],
body:not([data-can-admin-panel="1"]) a[href="/admin"],
body:not([data-can-admin-panel="1"]) a[href*="/admin"] {
  display: none !important;
}

/* FIX men  principal: ocultar Opzioni y limitar Admin */
[data-option="options"],
[data-option="opzioni"],
[data-option="settings"] {
  display: none !important;
}

body:not([data-can-admin-panel="1"]) [data-option="admin"],
body:not([data-can-admin-panel="1"]) [data-admin-link],
body:not([data-can-admin-panel="1"]) a[href="/admin"],
body:not([data-can-admin-panel="1"]) a[href*="/admin"] {
  display: none !important;
}

/* FIX: barra debajo de la radio m s alta para que se vea mejor la imagen */
.chat-shell .top-strip.secondary-strip {
  min-height: 88px !important;
  height: 88px !important;
  padding: 10px 14px !important;
  display: flex !important;
  align-items: center !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

/* Que el logo y el texto respiren mejor dentro de esa barra */
.chat-shell .top-strip.secondary-strip .brand,
.chat-shell .top-strip.secondary-strip .sponsor-mini,
.chat-shell .top-strip.secondary-strip .top-actions {
  align-items: center !important;
}

/* Logo dentro de la barra */
.chat-shell .top-strip.secondary-strip img,
.chat-shell .top-strip.secondary-strip .brand img {
  max-height: 62px !important;
  width: auto !important;
  object-fit: contain !important;
}

/* Botones de la derecha centrados */
.chat-shell .top-strip.secondary-strip .top-actions {
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
}

/* En m vil que no sea demasiado alta */
@media (max-width: 700px) {
  .chat-shell .top-strip.secondary-strip {
    min-height: 70px !important;
    height: 70px !important;
    padding: 8px 10px !important;
  }

  .chat-shell .top-strip.secondary-strip img,
  .chat-shell .top-strip.secondary-strip .brand img {
    max-height: 50px !important;
  }
}


.chat-shell > .top-strip.secondary-strip,
.chat-shell.in-room > .top-strip.secondary-strip,
.chat-shell:not(.in-room) > .top-strip.secondary-strip {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

/* Se ha imagen o texto dentro, que se acomode */
.module-row img {
  max-height: 55px !important;
  object-fit: contain !important;
}

@media (max-width: 700px) {
  .module-row {
    min-height: 40px !important;
    height: 40px !important;
  }

  .module-row img {
    max-height: 36px !important;
  }
}

/* Que el texto/imagen de REVOLUTIONCHAT no se aplaste */
.module-row .sponsor-line,
.module-row #sponsorLine,
.module-row strong,
.module-row span {
  line-height: 1.1 !important;
}

/* Botones de la derecha centrados dentro de la barra */
.module-row .top-actions {
  height: 62px !important;
  display: flex !important;
  align-items: center !important;
}

/* En m vil un poco menos alto */
@media (max-width: 700px) {
  .module-row {
    min-height: 52px !important;
    height: 52px !important;
  }

  .module-row .top-actions {
    height: 52px !important;
  }
}

/* FIX REAL: altura de la barra REVOLUTIONCHAT dentro del chat */
#chatScreen {
  --secondary-strip-height: 56px !important;
  grid-template-rows: 56px minmax(0, 1fr) !important;
}

#chatScreen > .module-row {
  --secondary-strip-height: 56px !important;
  height: 56px !important;
  min-height: 56px !important;
  max-height: 56px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  overflow: hidden !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

#chatScreen > .module-row .top-actions,
#chatScreen > .module-row .secondary-actions {
  height: 56px !important;
  display: flex !important;
  align-items: center !important;
}

/* M vil */
@media (max-width: 700px) {
  #chatScreen {
    --secondary-strip-height: 46px !important;
    grid-template-rows: 46px minmax(0, 1fr) !important;
  }

  #chatScreen > .module-row {
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
  }

  #chatScreen > .module-row .top-actions,
  #chatScreen > .module-row .secondary-actions {
    height: 46px !important;
  }
}




/* Sfondo trasparente lista stanze */
.select-rooms-list {
  background: transparent !important;
}

/* Stanze su sfondo immagine: glassmorphism, coerente col bordo di stato colorato */
.select-room-screen .select-room-row {
  background: var(--chatskin-selectroomrow-bg, rgb(12 24 46 / 0%)) !important;
  backdrop-filter: blur(0px) saturate(1.3) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.3) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.12) !important;
}

.select-room-screen .select-room-row:hover {
  background: var(--chatskin-selectroomrow-hover-bg, rgb(70 20 20 / 28%)) !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2) !important;
  transform: translateY(-3px) !important;
}

.select-room-screen .select-room-row strong { color: #fff !important; text-shadow: 0 1px 4px rgba(0,0,0,0.5) !important; }
.select-room-screen .select-room-row small  { color: rgba(255,255,255,0.88) !important; text-shadow: 0 1px 3px rgba(0,0,0,0.5) !important; }
.select-room-screen .select-room-count      { background: rgba(255, 255, 255, 0.16) !important; border-color: rgba(255,255,255,0.35) !important; color: #fff !important; }

/* Profilo utente */
.profile-body {
    display: flex !important;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.profile-avatar-container {
    display: flex;
    justify-content: center;
}

.profile-large-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #2f72c9;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.profile-info {
    flex: 1;
}

.profile-label {
    font-weight: 600;
    color: #475569;
    display: inline-block;
    min-width: 55px;
}

.profile-info p {
    margin: 10px 0;
    padding: 4px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.profile-name {
    font-size: 18px !important;
    border-bottom: 2px solid #2f72c9 !important;
}

.profile-action-btn {
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    background: linear-gradient(#3a9eff, #1680dc);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-action-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.profile-action-btn.is-danger {
    background: linear-gradient(#ef5350, #c62828);
}

.profile-action-btn.is-success {
    background: linear-gradient(#43a047, #2e7d32);
}
/* ===== USERCODE BADGE (codice univoco stabile per utente) ===== */
.user-code-badge {
  display: inline-block;
  font-size: 9px;
  font-family: monospace;
  letter-spacing: 0.03em;
  color: var(--accent, #3c78b5);
  opacity: 0.60;
  margin-left: 4px;
  vertical-align: middle;
  user-select: all;
  cursor: default;
}
.user-item:hover .user-code-badge { opacity: 1; }
/* ===== LOGIN GLASSMORPHISM   override definitivo ===== */
#signinModal,
#signinModal .signin-modal,
#signinModal .auth-modal,
#joinForm,
#changePasswordModal,
#changePasswordModal .signin-modal,
#changePasswordModal .auth-modal,
#changePasswordForm {
  background: var(--chatskin-authmodal-bg, rgb(0 0 0 / 40%)) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 0px !important;
  backdrop-filter: blur(4px) saturate(1.6) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.6) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55),
              inset 0 1px 0 rgba(255, 255, 255, 0.30) !important;
}

#signinModal .signin-modal-body,
#signinModal .auth-modal-body,
#changePasswordModal .signin-modal-body,
#changePasswordModal .auth-modal-body {
  background: transparent !important;
}

#signinModal .signin-modal-header,
#signinModal .auth-modal-header,
#signinModal .modal-title,
#changePasswordModal .signin-modal-header,
#changePasswordModal .auth-modal-header,
#changePasswordModal .modal-title {
  background: rgba(255, 255, 255, 0.07) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  border-radius: 18px 18px 0 0 !important;
}

#signinModal .signin-fields label,
#signinModal .signin-fields .check-row,
#changePasswordModal .signin-fields label,
#changePasswordModal .signin-fields .check-row {
  color: rgba(255, 255, 255, 0.92) !important;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5) !important;
}

#signinModal .signin-fields input:not([type="checkbox"]),
#signinModal .signin-fields select,
#changePasswordModal .signin-fields input:not([type="checkbox"]),
#changePasswordModal .signin-fields select {
  background: rgba(255, 255, 255, 0.13) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 8px !important;
  color: #fff !important;
  min-height: 36px !important;
  padding: 0 12px !important;
}

#signinModal .signin-fields input:focus,
#signinModal .signin-fields select:focus,
#changePasswordModal .signin-fields input:focus,
#changePasswordModal .signin-fields select:focus {
  background: rgba(255, 255, 255, 0.22) !important;
  border-color: rgba(255, 255, 255, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08) !important;
  outline: none !important;
}

#signinModal .signin-fields select option,
#changePasswordModal .signin-fields select option {
  background: #0f1932 !important;
  color: #fff !important;
}

#signinModal .signin-warning,
#changePasswordModal .signin-warning {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 8px !important;
  color: rgba(255,255,255,0.88) !important;
}

#signinModal .signin-warning p,
#changePasswordModal .signin-warning p {
  color: rgba(255, 255, 255, 0.88) !important;
}

#signinModal .auth-switches {
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 10px !important;
  padding: 4px !important;
}

#signinModal .auth-switches button {
  color: rgba(255, 255, 255, 0.70) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 7px !important;
  padding: 7px 10px !important;
  font-weight: 600 !important;
}

#signinModal .auth-switches button.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.20) !important;
  border: 1px solid rgba(255, 255, 255, 0.32) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18) !important;
}

#signinModal .modal-actions,
#changePasswordModal .modal-actions {
  background: transparent !important;
  border-top: 1px solid rgba(255, 255, 255, 0.10) !important;
  padding: 14px 20px 18px !important;
}

#signinModal .modal-actions button,
#changePasswordModal .modal-actions button {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  color: #fff !important;
  border-radius: 8px !important;
  padding: 8px 20px !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

#signinModal .modal-actions button:hover,
#changePasswordModal .modal-actions button:hover {
  background: rgba(255, 255, 255, 0.28) !important;
  transform: translateY(-1px) !important;
}

#signinModal .modal-actions button[type="submit"],
#changePasswordModal .modal-actions button[type="submit"] {
  background: rgba(22, 128, 212, 0.75) !important;
  border-color: rgba(22, 128, 212, 0.90) !important;
  box-shadow: 0 2px 12px rgba(22, 128, 212, 0.35) !important;
}

#signinModal .modal-actions button[type="submit"]:hover,
#changePasswordModal .modal-actions button[type="submit"]:hover {
  background: rgba(22, 128, 212, 0.92) !important;
  box-shadow: 0 6px 20px rgba(22, 128, 212, 0.45) !important;
}

#signinModal .modal-actions button.secondary,
#changePasswordModal .modal-actions button.secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: rgba(255, 255, 255, 0.75) !important;
}

/* Blocca scroll sotto il modal */
#signinModal,
#changePasswordModal {
  pointer-events: all !important;
  overflow: hidden !important;
}

/* ===== BLOCCA SCROLL SOTTO IL LOGIN ===== */
#signinModal:not([hidden]) ~ *,
#changePasswordModal:not([hidden]) ~ * {
  pointer-events: none !important;
}

#signinModal:not([hidden]),
#changePasswordModal:not([hidden]) {
  overflow: hidden !important;
  overscroll-behavior: contain !important;
}

/* Quando il modal   aperto, blocca lo scroll della lista stanze */
body.modal-open .select-rooms-list,
body.modal-open .select-room-screen {
  overflow: hidden !important;
  pointer-events: none !important;
}

/* ========================================================
   SITE LOGO   logo personalizzato a sinistra
   appare nella barra di selezione stanza e dentro la room
   ======================================================== */
.site-logo-img {
  display: block;
  flex-shrink: 0;
  height: 44px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  border-radius: 6px;
}

/* fuori dalla room: barra select-title-row */
.select-title-row .site-logo-img {
  height: 40px;
  max-width: 340px;
  margin-right: 0px;   /* piccolo spazio dal bordo sinistro */
}

/* dentro la room: barra module-row
   il module-spacer che segue si espande e spinge
   tutti i bottoni verso destra */
.module-row .site-logo-img {
  height: 40px;
  max-width: 340px;
  margin-right: 0px;
}

/* su mobile riduci un po' */
@media (max-width: 600px) {
  .site-logo-img,
  .select-title-row .site-logo-img,
  .module-row .site-logo-img {
    height: 30px;
    max-width: 90px;
  }
}

/* =====================================================
   TYPING INDICATOR & ACTIVITY STATUS DOT
   ===================================================== */

/* Pallino status (verde = disponibile, giallo = inattivo) */
.user-status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
  position: relative;
  top: -1px;
}

/* Scritta "sta scrivendo..." in italico colorata */
.user-typing-label {
  color: #7c9cff;
  font-style: italic;
  font-size: 0.82em;
  margin-right: 4px;
}

/* Matita animata accanto al nickname */
.user-typing-pencil {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.95em;
  animation: pencil-wiggle 0.6s ease-in-out infinite alternate;
  transform-origin: bottom left;
  position: relative;
  top: -1px;
}

@keyframes pencil-wiggle {
  0%   { transform: rotate(-12deg) translateY(0px); }
  50%  { transform: rotate(0deg)   translateY(-2px); }
  100% { transform: rotate(12deg)  translateY(0px); }
}

/* Pallino giallo con pulsazione leggera */
.user-status-dot[style*="#f59e0b"] {
  animation: dot-pulse-yellow 2s ease-in-out infinite;
}

@keyframes dot-pulse-yellow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(245,158,11,0.3); }
  50%       { box-shadow: 0 0 0 4px rgba(245,158,11,0.15); }
}

/* Pallino verde con pulsazione leggera */
.user-status-dot[style*="#22c55e"] {
  animation: dot-pulse-green 3s ease-in-out infinite;
}

@keyframes dot-pulse-green {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.3); }
  50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0.1); }
}
/* ---------------------------------------------------------------
   AVATAR POPUP   Redesign completo con classi av-*
   --------------------------------------------------------------- */

/* Contenitore principale */
.avatar-window {
  position: fixed;
  left: 390px;
  top: 140px;
  width: 500px;
  max-width: calc(100vw - 20px);
  padding: 0;
  background: #ffffff;
  border: none;
  border-radius: 18px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, .22),
    0 4px 16px rgba(30, 80, 160, .12);
  overflow: hidden;
  z-index: 9000;
}

/* -- Header -- */
.av-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0px 0px;
  background: linear-gradient(#9fc0db, #7299b9);
  position: relative;
}

.av-header-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

.av-header-title {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .4px;
  text-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.av-header-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none !important;
  border-radius: 50%;
  background: rgba(255,255,255,.15) !important;
  color: rgba(255,255,255,.9) !important;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
  min-height: unset !important;
}
.av-header-close:hover {
  background: rgba(255,255,255,.30) !important;
  transform: rotate(90deg);
}

/* -- Azioni rapide (Carica / Webcam) -- */
.av-quick-actions {
  display: flex;
  gap: 10px;
  padding: 14px 16px 10px;
  background: #f8faff;
  border-bottom: 1px solid #e2ecf7;
}

.av-quick-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  background: #ffffff !important;
  border: 1.5px solid #c0d6ee !important;
  border-radius: 10px;
  color: #1a5fa0 !important;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(30,80,160,.08);
  min-height: unset !important;
}
.av-quick-btn:hover {
  background: #1a6fc4 !important;
  border-color: #1a6fc4 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(26,111,196,.30);
  transform: translateY(-1px);
}
.av-quick-btn:hover .av-quick-icon {
  filter: grayscale(0) brightness(1.2);
}

.av-quick-icon {
  font-size: 16px;
  line-height: 1;
}

/* -- Tabs categorie -- */
.av-tabs-wrap {
  display: flex;
  gap: 6px;
  padding: 10px 16px 8px;
  background: #f0f6ff;
  border-bottom: 1.5px solid #dceaf8;
}

.av-tabs-wrap button {
  flex: 1;
  padding: 6px 10px;
  border: 1.5px solid #b8d0ea !important;
  border-radius: 20px;
  background: #ffffff !important;
  color: #2870b8 !important;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  min-height: unset !important;
  letter-spacing: .3px;
}
.av-tabs-wrap button:hover {
  background: #e3f0fd !important;
  border-color: #2196f3 !important;
}
.av-tabs-wrap button.active {
  background: linear-gradient(135deg, #1a6fc4, #2196f3) !important;
  border-color: transparent !important;
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(33,150,243,.35);
}

/* -- Griglia avatar -- */
.av-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 14px 16px;
  background: #ffffff;
  min-height: 130px;
  max-height: 255px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #b8d0ea #f0f6ff;
}
.av-grid::-webkit-scrollbar { width: 5px; }
.av-grid::-webkit-scrollbar-track { background: #f0f6ff; border-radius: 4px; }
.av-grid::-webkit-scrollbar-thumb { background: #b8d0ea; border-radius: 4px; }

.av-grid button {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent !important;
  border-radius: 12px !important;
  background: #f0f6ff !important;
  padding: 5px;
  cursor: pointer;
  transition: all .18s;
  min-height: unset !important;
}
.av-grid button:hover {
  border-color: #2196f3 !important;
  background: #dbeeff !important;
  transform: scale(1.10);
  box-shadow: 0 4px 12px rgba(33,150,243,.25);
  z-index: 1;
  position: relative;
}
.av-grid button.active {
  border-color: #0f3460 !important;
  background: #cce2ff !important;
  box-shadow:
    0 0 0 3px rgba(33,150,243,.30),
    0 4px 12px rgba(15,52,96,.20);
  transform: scale(1.08);
  position: relative;
  z-index: 1;
}
.av-grid img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  pointer-events: none;
}

/* -- Pannello webcam -- */
.av-camera-panel {
  margin: 0 16px 0;
  padding: 12px;
  background: #f0f6ff;
  border: 1.5px solid #d0e4f8;
  border-radius: 12px;
  margin-bottom: 4px;
}
.av-camera-panel[hidden] { display: none; }

.av-camera-video {
  display: block;
  width: 100%;
  max-height: 175px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #b8d0ea;
  background: #101828;
}

.av-camera-preview {
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #b8d0ea;
}
.av-camera-preview img {
  display: block;
  width: 100%;
  max-height: 175px;
  object-fit: cover;
}

.av-camera-status {
  margin-top: 8px;
  font-size: 12px;
  color: #2060a0;
  font-weight: 500;
  text-align: center;
  min-height: 18px;
}

.av-camera-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* -- Blocco foto registrazione (dentro il modal scuro di login) -- */
.register-photo-label {
  display: block;
  color: rgba(255, 255, 255, 0.90);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 6px;
}
#registerPhotoBlock .av-camera-panel {
  margin: 0 0 4px;
}
#registerPhotoBlock .av-camera-status {
  color: #cfe6ff;
}

.av-cam-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  min-height: unset !important;
}
.av-cam-btn--primary {
  background: linear-gradient(135deg, #1a6fc4, #2196f3) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 3px 10px rgba(33,150,243,.35);
}
.av-cam-btn--primary:hover {
  background: linear-gradient(135deg, #1560b0, #1a87e0) !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(33,150,243,.45);
}
.av-cam-btn--secondary {
  background: #ffffff !important;
  border: 1.5px solid #b8d0ea !important;
  color: #2870b8 !important;
}
.av-cam-btn--secondary:hover {
  background: #f0f6ff !important;
  border-color: #2196f3 !important;
}

/* -- Footer (Applica / Annulla) -- */
.av-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px 16px;
  background: #f8faff;
  border-top: 1.5px solid #dceaf8;
  margin-top: 4px;
}

.av-apply-btn {
  flex: 2;
  padding: 10px 16px;
  background: linear-gradient(135deg, #0f3460 0%, #1a6fc4 60%, #2196f3 100%) !important;
  border: none !important;
  border-radius: 10px;
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  letter-spacing: .3px;
  box-shadow: 0 4px 14px rgba(26,111,196,.40);
  min-height: unset !important;
}
.av-apply-btn:hover {
  background: linear-gradient(135deg, #0a2847 0%, #1560b0 60%, #1a87e0 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26,111,196,.50);
}
.av-apply-btn:active {
  transform: translateY(0);
}

.av-cancel-btn {
  flex: 1;
  padding: 10px 16px;
  background: #ffffff !important;
  border: 1.5px solid #c0d6ee !important;
  border-radius: 10px;
  color: #4a7aa0 !important;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  min-height: unset !important;
}
.av-cancel-btn:hover {
  background: #f0f6ff !important;
  border-color: #2196f3 !important;
  color: #1a6fc4 !important;
}

/* -- Mobile responsive -- */
@media (max-width: 760px) {
  .avatar-window {
    left: 5vw !important;
    right: 5vw !important;
    top: 100px !important;
    bottom: 115px !important;
    width: 90vw !important;
    height: auto !important;
    max-height: none !important;
    transform: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  /* IMPORTANTE: senza questa regola il box avatar resterebbe visibile anche
     da chiuso, perch  il display:flex !important sopra vince sull'attributo hidden */
  .avatar-window[hidden] {
    display: none !important;
  }
  .av-grid {
    grid-template-columns: repeat(5, 1fr);
    max-height: 200px;
  }
  .av-grid img { width: 38px; height: 38px; }
  .av-quick-btn span:last-child { display: none; }
  .av-quick-btn { padding: 10px; }
}
/* -- Tasto "Accedi" che mostra il nickname dopo il login ----------------- */
#selectRoomSigninBtn.is-logged-in {
  color: #166e7d;
  font-weight: 600;
}
#selectRoomSigninBtn.is-logged-in svg {
  color: #1f8a3b;
}
#selectRoomSigninBtn.is-logged-in span {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ----------------------------------------------------------------
   COLORI SKIN VIDEOCHAT   personalizzabili dal pannello admin.
   Regole in fondo al file e con !important per avere sempre
   la priorit  sulle dichiarazioni di base della skin.
   ---------------------------------------------------------------- */
#chatScreen > .module-row {
  background: var(--chatskin-module-row-bg, #a9c6dd) !important;
}
.module-row .module-icon-svg {
  color: var(--chatskin-module-icon-color, #000000) !important;
}
.me-card {
  background: var(--chatskin-mecard-bg, #f8fcff) !important;
}
.side-tabs button {
  background: var(--chatskin-tabs-bg, #d8e9f8) !important;
  color: var(--chatskin-tabs-text, #31566f) !important;
}
.side-tabs button.active {
  background: var(--chatskin-tabs-active-bg, #3f83bc) !important;
  color: var(--chatskin-tabs-active-text, #ffffff) !important;
}
.side-panel {
  background: var(--chatskin-sidepanel-bg, #edf5fb) !important;
}
.toolbar-line {
  background: var(--chatskin-toolbar-bg, #92b0c9) !important;
}
.messages {
  background-color: var(--chatskin-messages-bg, rgba(255, 255, 255, 0.12)) !important;
}
/* ===== Tastino "Apri foto" in chat ===== */
/* Nota: il posizionamento (position/top/left) e' forzato inline con !important
   direttamente nell'HTML generato (vedi app.js) cosi' nessuna altra regola del
   sito puo' spostarlo. Qui restano solo lo stile grafico. */
.chat-image-wrap .chat-image,
.chat-image-wrap img.chat-image {
  box-sizing: border-box;
}
.chat-image-zoom-btn {
  padding: 4px 9px;
  border: none;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.92;
  white-space: nowrap;
  transition: background .15s, opacity .15s, transform .15s;
}
.chat-image-zoom-label {
  pointer-events: none;
}
.chat-image-zoom-btn:hover {
  background: rgba(15, 23, 42, 0.85);
  opacity: 1;
  transform: scale(1.08);
}

/* ===== Lightbox immagine ingrandita ===== */
.image-lightbox-backdrop {
  z-index: 9000;
  cursor: zoom-out;
}
.image-lightbox-inner {
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-lightbox-inner img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  object-fit: contain;
  cursor: default;
}
.image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9001;
  transition: background .15s;
}
.image-lightbox-close:hover { background: rgba(255,255,255,0.3); }