:root {
  --bg: #f2f3ef;
  --bg-2: #eaece6;
  --card: #ffffff;
  --ink: #17191c;
  --muted: #6b7079;
  --line: #e3e5de;
  --accent: #2c5b4f;
  --accent-2: #3a7566;
  --accent-soft: #e5eee9;
  --online: #2e9d6b;
  --danger: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 25, 20, 0.05), 0 8px 24px rgba(20, 25, 20, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #e4ece7 0%, transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0 0; font-size: 14px; }

/* ----- Botones y campos ----- */
button {
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover { background: var(--accent-2); border-color: var(--accent-2); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
}
button.ghost:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }

label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; accent-color: var(--accent); }

/* ----- Pantallas y tarjetas ----- */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

.card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
}
.card h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 30px;
  margin: 0;
  letter-spacing: -0.01em;
}
.card h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  margin: 0;
}
.card form { display: grid; gap: 14px; margin-top: 6px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 22, 0.35);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}

.row { display: flex; gap: 8px; justify-content: flex-end; }

/* ----- +18 y avisos ----- */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 0 6px;
  line-height: 1.5;
}

.notice {
  margin: 4px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.notice .tag { margin-right: 4px; }

/* ----- Avatares ----- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--muted);
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--card);
  position: relative;
}
.avatar .mod-star {
  position: absolute; right: 0; bottom: -2%;
  line-height: 1; color: #ffc93c; font-weight: 400;
  text-shadow: 0 0 2px #000, 0 0 3px rgba(0,0,0,.8);
  pointer-events: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pointer { cursor: pointer; }

.avatar-edit { display: grid; gap: 10px; justify-items: center; }
.avatar-box {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.avatar-box img { width: 100%; height: 100%; object-fit: cover; }
.avatar-box .avatar { width: 104px; height: 104px; }
.avatar-edit input[type="file"] { padding: 6px; font-size: 13px; }

/* ----- Barra superior ----- */
.app { display: flex; flex-direction: column; padding: 0; place-items: stretch; min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), #1d4238);
  color: #fff;
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 19px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(44, 91, 79, 0.25);
}
.titles { display: grid; min-width: 0; }
.topbar strong {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.subtitle {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
  max-width: 220px;
}
.me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

/* ----- Layout ----- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 216px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

aside {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  overflow-y: auto;
  min-height: 0;
  box-shadow: var(--shadow);
}
aside h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 8px 6px;
}
aside h3:first-child { margin-top: 4px; }

/* ----- Salas y privados ----- */
.side-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 2px 0;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 10px;
}
.side-btn:hover { background: var(--bg); color: var(--ink); }
.side-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}
.side-btn.unread .name { font-weight: 700; }
.side-btn .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.count {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.count:empty { display: none; }
.count.live::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 0 3px rgba(46, 157, 107, 0.15);
}
.side-btn.active .count { color: var(--accent); }

.nbadge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(44, 91, 79, 0.3);
}

/* ----- Usuarios conectados ----- */
.users ul { list-style: none; padding: 0; margin: 0; }
.users li.user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 14px;
  word-break: break-word;
}
.users li.clickable { cursor: pointer; }
.users li.clickable:hover { background: var(--bg); }
.users li.user.dim { opacity: 0.45; }
.view-nick { font-family: 'Source Serif 4', Georgia, serif; font-size: 20px; text-align: center; }
.view-bio { margin: 0; text-align: center; color: var(--muted); word-break: break-word; }

/* ----- Pestañas de salas y privados abiertos ----- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 4px;
  margin-bottom: -10px; /* las pestañas apoyan sobre la ventana de chat */
  position: relative;
  z-index: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  max-width: 220px;
  padding: 8px 8px 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.tab:hover { color: var(--ink); background: #f7f8f5; }
.tab.active {
  color: var(--accent);
  background: var(--card);
  box-shadow: inset 0 2px 0 var(--accent);
}
.tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tab-close {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
  border-radius: 6px;
}
.tab-close:hover { color: var(--danger); background: var(--accent-soft); }
.badge {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ----- Chat ----- */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 10px; }

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c9cdc4 transparent;
  box-shadow: var(--shadow);
}

.msg { display: flex; align-items: flex-start; gap: 11px; padding: 7px 10px; margin: 0 -6px; border-radius: 12px; }
.msg:hover { background: #f7f8f5; }
.msg .body { flex: 1; min-width: 0; }
.msg .head { display: flex; align-items: baseline; gap: 8px; }
.msg .nick { font-weight: 700; font-size: 14px; }
.msg .nick.pointer:hover { text-decoration: underline; text-underline-offset: 2px; }
.msg .time { color: var(--muted); font-size: 12px; }
.msg .text { margin-top: 2px; line-height: 1.5; word-break: break-word; }
.msg.mine .nick { color: var(--accent); }
.msg .report { opacity: 0; transition: opacity 0.15s; }
.msg:hover .report { opacity: 1; }

.report {
  align-self: center;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 6px;
}
.report:hover { color: var(--danger); background: transparent; }

.empty {
  margin: auto;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* ----- Barra de envío ----- */
.send {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.send #text {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 10px 12px;
  box-shadow: none;
}
.send #text:focus { box-shadow: none; }
.send button[type="submit"] {
  border-radius: 999px;
  padding: 10px 20px;
}

/* ----- Emotes y adjuntos ----- */
.emote-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.emote-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

.emote-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.emote-pick {
  display: grid;
  place-items: center;
  padding: 8px 4px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid transparent;
}
.emote-pick:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.emote-pick .emote { font-size: 1.5em; }

.emote {
  display: inline-block;
  font-size: 1.35em;
  line-height: 1;
  vertical-align: -0.2em;
  transform-origin: center bottom;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  animation-duration: 1.2s;
}
.emote.bounce  { animation-name: bounce; }
.emote.spin    { animation-name: spin; animation-timing-function: linear; animation-duration: 2.4s; }
.emote.shake   { animation-name: shake; animation-duration: 0.4s; }
.emote.pulse   { animation-name: pulse; }
.emote.float   { animation-name: float; animation-duration: 2s; }
.emote.flicker { animation-name: flicker; animation-duration: 0.9s; }
.emote.wiggle  { animation-name: wiggle; }
.emote.pop     { animation-name: pop; animation-duration: 1.6s; }

@keyframes bounce  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes shake   { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-2px) rotate(-6deg); } 75% { transform: translateX(2px) rotate(6deg); } }
@keyframes pulse   { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes float   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px) rotate(4deg); } }
@keyframes flicker { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08) rotate(-3deg); opacity: 0.85; } }
@keyframes wiggle  { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
@keyframes pop     { 0%, 60%, 100% { transform: scale(1); } 70% { transform: scale(1.35); } 80% { transform: scale(0.9); } }

@media (prefers-reduced-motion: reduce) {
  .emote { animation: none !important; }
}

/* ----- Fotos y videos en privados ----- */
.media-link { display: block; width: fit-content; max-width: 100%; margin-top: 4px; }
.media-img {
  display: block;
  max-width: 280px;
  max-height: 260px;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.media-video {
  display: block;
  width: 100%;
  max-width: 320px;
  margin-top: 4px;
  border-radius: 12px;
  background: #000;
}

/* ----- Menú de usuario ----- */
.user-menu {
  position: fixed;
  z-index: 70;
  width: 250px;
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(20, 25, 20, 0.16);
}
.um-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.um-head strong {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.um-bio { margin: 0; font-size: 13px; color: var(--muted); word-break: break-word; }
.um-btn {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
  padding: 8px 12px;
}
.um-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.um-btn.um-danger { color: var(--danger); }
.um-btn.um-danger:hover { background: #fbeceb; border-color: #fbeceb; color: var(--danger); }

/* ----- Móvil ----- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 210px minmax(0, 1fr) 170px; }
}
@media (max-width: 800px) {
  .card h1 { font-size: 26px; }
  .me > span:not(.avatar) { display: none; }
  .me { padding: 3px; }
  .subtitle { display: none; }
}

/* ----- Ingreso con cuenta ----- */
.auth { gap: 14px; }
.auth-logo { margin: 0 0 2px; }
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.seg-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px;
  font-weight: 600;
}
.seg-btn:hover { background: transparent; color: var(--ink); }
.seg-btn.active { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(20, 25, 20, 0.1); }
.auth-form { margin-top: 0; }
.guest-box { display: grid; gap: 8px; }
.guest-box .small { margin: 0; text-align: center; }
.ok { color: var(--accent); margin: 6px 0 0; font-size: 14px; }
.row.between { justify-content: space-between; align-items: center; }

/* ----- Roles, moderación y panel ----- */
.top-right { display: flex; align-items: center; gap: 8px; }
.panel-link {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  border-radius: 999px;
}
.panel-link:hover { background: var(--accent); color: #fff; }

.tilde { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; margin-left:4px; border-radius:50%; background:#1d9bf0; color:#fff; font-size:10px; font-weight:900; line-height:1; vertical-align:middle; flex:none; }
.role-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  line-height: 1.5;
  align-self: center;
}
.role-tag.admin { background: #7a3e9d; }
.role-tag.mod { background: #b26a00; }
.users li.user .role-tag { margin-left: auto; }

.mod-del {
  align-self: center;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
}
.mod-del:hover { background: var(--danger); color: #fff; }

/* Panel de administración */
.panel-wrap { max-width: 980px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.panel-wrap h1 { font-family: 'Source Serif 4', Georgia, serif; margin: 0; font-size: 26px; }
.panel-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.panel-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.panel-tabs button.ghost.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.item { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; }
.item .meta { font-size: 13px; color: var(--muted); }
.item .quote { background: var(--bg); border-radius: 10px; padding: 8px 10px; word-break: break-word; }
.item .actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item .actions select, .item .actions input { width: auto; padding: 6px 8px; }
.item .actions button { padding: 6px 10px; font-size: 13px; }
.item .actions button.danger { background: var(--danger); border-color: var(--danger); }
.item .actions button.danger:hover { background: #8f1d17; border-color: #8f1d17; }
.empty-note { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

/* ----- Fotos y videos: botón en el chat y ventana para verlos ----- */
.media-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
}
.media-chip:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.media-modal { z-index: 30; }
.media-box {
  position: relative;
  max-width: min(92vw, 900px);
  max-height: 90vh;
  display: grid;
  gap: 10px;
  justify-items: end;
}
.media-x { padding: 6px 12px; font-size: 13px; }
.media-full {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  background: #000;
  object-fit: contain;
}

/* ===== Social Nebu: solo la cabecera y la barra de envío van en el estilo nuevo ===== */
:root {
  --s-paper: #f7f4ec;
  --s-ink: #17173a;
  --s-pink: #ff3d8b;
  --s-pink-2: #e02a75;
  --s-blue: #2238c9;
  --s-dot: rgba(34, 56, 201, 0.13);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s-paper: #15132c; --s-ink: #f7f4ec; --s-pink: #ff5c9d; --s-pink-2: #ff7fb2; --s-blue: #8c9bff; --s-dot: rgba(140, 155, 255, 0.15);
  }
}
:root[data-theme="dark"] {
  --s-paper: #15132c; --s-ink: #f7f4ec; --s-pink: #ff5c9d; --s-pink-2: #ff7fb2; --s-blue: #8c9bff; --s-dot: rgba(140, 155, 255, 0.15);
}

.topbar {
  background: var(--s-paper) radial-gradient(var(--s-dot) 1.2px, transparent 1.4px) 0 0 / 14px 14px;
  border-bottom: 2px solid var(--s-ink);
  box-shadow: 0 4px 0 var(--s-pink);
}
.topbar .logo {
  background: var(--s-pink);
  color: #fff;
  border: 2px solid var(--s-ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--s-ink);
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400;
  font-size: 22px;
}
.topbar strong {
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--s-ink);
}
.topbar .subtitle { font-family: 'Archivo', system-ui, sans-serif; }
.topbar .me {
  background: #ffffff;
  border: 2px solid var(--s-ink);
  box-shadow: 3px 3px 0 var(--s-ink);
  color: #17173a;
}
.topbar .me:hover { background: #ff3d8b; color: #ffffff; }
.topbar .panel-link {
  background: var(--s-paper);
  color: var(--s-ink);
  border: 2px solid var(--s-ink);
  box-shadow: 2px 2px 0 var(--s-ink);
}
.topbar .panel-link:hover { background: var(--s-pink); color: #fff; }

/* ===== Social Nebu: pantalla de ingreso en el estilo nuevo ===== */
#register .card {
  background: #ffffff radial-gradient(rgba(34, 56, 201, 0.12) 1.2px, transparent 1.4px) 0 0 / 14px 14px;
  border: 2px solid #17173a;
  border-top: 10px solid #ff3d8b;
  border-radius: 12px;
  box-shadow: 8px 8px 0 #2238c9;
  padding: 34px;
}
#register .card h1 {
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400;
  font-size: 56px;
  line-height: 0.95;
  text-transform: uppercase;
  color: #17173a;
}
#register .card h1::after { content: "."; color: #ff3d8b; }
#register .seg { background: #f7f4ec; border: 2px solid #17173a; }
#register .seg-btn { font-family: 'Anton', Impact, sans-serif; font-weight: 400; text-transform: uppercase; font-size: 16px; letter-spacing: 0.03em; }
#register .seg-btn.active { background: #2238c9; color: #ffffff; border-color: #17173a; box-shadow: 3px 3px 0 #17173a; }
#register .seg-btn.active { color: #ffffff; }
#register .card button[type="submit"] { font-family: 'Anton', Impact, sans-serif; font-weight: 400; font-size: 20px; padding: 12px 16px; }
#register .guest-box button.ghost { background: #2238c9; color: #ffffff; border-color: #17173a; font-family: 'Anton', Impact, sans-serif; font-weight: 400; font-size: 18px; text-transform: uppercase; }
#register .guest-box button.ghost:hover { background: #1a2aa0; color: #ffffff; }
#register .notice .tag { background: #ff3d8b; color: #fff; }

/* ===== Social Nebu: cabecera del panel de admin en el estilo nuevo ===== */
.panel-wrap > header {
  background: #f7f4ec radial-gradient(rgba(34, 56, 201, 0.13) 1.2px, transparent 1.4px) 0 0 / 14px 14px;
  border: 2px solid #17173a;
  border-top: 8px solid #ff3d8b;
  border-radius: 12px;
  box-shadow: 6px 6px 0 #2238c9;
  padding: 16px 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-wrap > header h1 {
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #17173a;
}
.panel-wrap > header h1::after { content: "."; color: #ff3d8b; }
.panel-wrap > header .panel-link {
  background: #ff3d8b;
  color: #ffffff;
  border: 2px solid #17173a;
  box-shadow: 3px 3px 0 #17173a;
}
.panel-wrap > header .panel-link:hover { background: #e02a75; color: #ffffff; }

/* ===== Social Nebu: nombre del sitio siempre visible junto al logo ===== */
.site-name {
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ff3d8b;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar .titles { border-left: 2px solid #ff3d8b; padding-left: 12px; min-width: 0; }

/* ===== Perfiles, filtros y llamadas ===== */
.facts { display: grid; gap: 6px; margin-top: 4px; }
.fact { display: grid; grid-template-columns: 84px 1fr; gap: 8px; font-size: 14px; }
.fact-k { color: var(--muted); font-weight: 600; }
.fact-v { word-break: break-word; }
.premium-note { margin: 0; text-align: center; font-weight: 700; color: var(--accent); }
.role-tag.premium { background: #b7791f; }
.prof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prof-grid label:last-child { grid-column: 1 / -1; }
.seeks { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; display: grid; gap: 6px; margin: 0; }
.seeks legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.filters { display: grid; gap: 6px; margin: 0 8px 10px; }
.filters select, .filters input { padding: 6px 8px; font-size: 13px; }
.call-box { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; box-shadow: 0 12px 32px rgba(20, 25, 20, 0.2); }
.call-box p { margin: 0; font-weight: 600; }
.call-modal { z-index: 35; padding: 0; }
.call-box-big { position: fixed; inset: 16px; display: grid; grid-template-rows: auto 1fr; gap: 8px; }
.call-box-big iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; background: #000; }
.call-modal .row { justify-content: flex-end; }

/* ===== Ajustes de salas en el panel ===== */
.room-list { display: grid; gap: 8px; margin: 10px 0 16px; }
.room-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); }
.room-row.is-hidden { border-style: dashed; opacity: 0.7; }
.room-name { font-size: 15px; }
.room-state { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.room-row.is-hidden .room-state { color: var(--muted); }
.room-row button { min-width: 96px; padding: 7px 12px; font-size: 13px; }
.room-cfg { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 14px; }
.room-field { display: grid; gap: 4px; font-size: 13px; min-width: 180px; }
.room-field input { width: 100%; }
.room-cfg > button { height: 42px; }
.room-add { display: flex; gap: 8px; flex-wrap: wrap; }
.room-add input { flex: 1; min-width: 200px; }
.room-add button { white-space: nowrap; }
.room-info { display: grid; gap: 2px; }
.room-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .room-row button { min-width: 0; }
}

/* Beneficios premium en el perfil */
.premium-benefits { margin-top: 12px; font-size: 13px; color: var(--muted, #666); }
.premium-benefits ul { margin: 6px 0 0; padding-left: 18px; }
.premium-benefits li { margin: 2px 0; }

/* Me gusta, match y quién vio */
.view-social { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.social-row { display: flex; gap: 8px; flex-wrap: wrap; }
.match-note { color: var(--pink, #ff3d8b); font-weight: 700; margin: 0; }
.viewers-box { margin-top: 12px; }
.viewers-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }

/* Respuesta citada */
.quote { display: flex; flex-direction: column; min-width: 0; margin: 2px 0 6px; padding: 4px 8px; border-left: 3px solid var(--pink, #ff3d8b); background: var(--chip, rgba(0, 0, 0, 0.06)); font-size: 13px; }
.quote span { color: var(--muted, #666); overflow-wrap: anywhere; }
.msg .reply { background: none; border: 0; padding: 0 4px; color: var(--blue, #2238c9); font: inherit; font-size: 12px; cursor: pointer; }
.msg .reply:focus-visible { outline: 2px solid var(--pink, #ff3d8b); }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; background: var(--chip, #eee); border-left: 3px solid var(--pink, #ff3d8b); }
.reply-bar[hidden] { display: none; }
.reply-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#replyCancel { background: none; border: 0; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; }

/* Logo nuevo (ícono de la app) en la cabecera y el login */
img.logo {
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 8px;
  padding: 0;
  object-fit: contain;
}
.topbar img.logo { width: 38px; height: 38px; }
img.auth-logo { width: 64px; height: 64px; border-radius: 14px; }

/* Pantalla de carga mientras se conecta (evita el flash del login al cambiar de página) */
.boot { align-content: center; justify-items: center; gap: 14px; }
.boot-text { color: var(--muted, #666); font-size: 14px; margin: 0; }


/* ---------- Formato del chat ---------- */
.fmt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 6px; margin-bottom: 4px; }
.fmt-bar button { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line, #d9d4c6); border-radius: 6px; background: var(--card, #fff); color: inherit; font: inherit; font-size: 13px; cursor: pointer; line-height: 1; }
.fmt-bar button:hover:not(:disabled) { border-color: currentColor; }
.fmt-bar button:disabled { opacity: 0.4; cursor: default; }
.fmt-bar button:focus-visible { outline: 2px solid var(--pink, #ff3d8b); outline-offset: 1px; }
.fmt-bar .sw { font-size: 16px; padding: 0 4px; min-width: 26px; border: 0; background: transparent; }
.fmt-sep { width: 1px; height: 20px; background: var(--line, #d9d4c6); margin: 0 4px; }
.c-rojo { color: #e53935; }
.c-naranja { color: #f57c00; }
.c-amarillo { color: #c79a00; }
.c-verde { color: #2e9d4f; }
.c-celeste { color: #1e9bd7; }
.c-azul { color: #3b4fd3; }
.c-violeta { color: #8e3bc4; }
.c-rosa { color: #ff3d8b; }
.messages span[class^="c-"] { font-weight: inherit; }

/* Editor del chat */
.composer-input { white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; max-height: 120px; outline: none; color: var(--fg); cursor: text; }
.composer-input[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.composer-input.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.composer-input[contenteditable="false"].is-empty::before { opacity: 0.8; }
.f-b { font-weight: 800; }
.f-i { font-style: italic; }
.f-s { text-decoration: line-through; }
.fmt-bar button[aria-pressed="true"] { background: var(--fg, #17173a); color: var(--bg, #f7f4ec); border-color: var(--fg, #17173a); }
.fmt-bar button[aria-pressed="true"] b, .fmt-bar button[aria-pressed="true"] i, .fmt-bar button[aria-pressed="true"] s { color: inherit; }

/* Colores del editor: bolitas con su color */
.fmt-bar .sw { width: 22px; height: 22px; min-width: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--card, #fff); box-shadow: 0 0 0 1px var(--line, #d9d4c6); background: var(--sw); font-size: 0; }
.fmt-bar .sw:hover:not(:disabled) { transform: scale(1.12); }
.fmt-bar .sw.c-rojo { --sw: #e53935; }
.fmt-bar .sw.c-naranja { --sw: #f57c00; }
.fmt-bar .sw.c-amarillo { --sw: #e0b100; }
.fmt-bar .sw.c-verde { --sw: #2e9d4f; }
.fmt-bar .sw.c-celeste { --sw: #1e9bd7; }
.fmt-bar .sw.c-azul { --sw: #3b4fd3; }
.fmt-bar .sw.c-violeta { --sw: #8e3bc4; }
.fmt-bar .sw.c-rosa { --sw: #ff3d8b; }

/* ----- Emotes como icono (estilo WhatsApp) ----- */
.emote-chip {
  display: inline-block;
  font-size: 1.2em;
  line-height: 1;
  vertical-align: -0.15em;
  user-select: none;
  -webkit-user-select: none;
  margin: 0 1px;
}
.emote-suggest {
  position: fixed;
  z-index: 60;
  display: grid;
  min-width: 180px;
  max-width: 260px;
  padding: 4px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.emote-suggest button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.emote-suggest button.on,
.emote-suggest button:hover { background: var(--accent-soft); }
.emote-suggest .emote-chip { font-size: 1.4em; }


/* ----- Avisos flotantes y estado de envío ----- */
#status {
  position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 60;
  margin: 0; padding: 10px 14px; border-radius: 12px; text-align: center; font-size: 14px; font-weight: 600;
  background: #15152f; color: #ffffff; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); opacity: 1;
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  min-height: 0;
}
#status:empty { display: none; }
#status.show { opacity: 1; transform: none; }
#status.show { opacity: 1; }
.pending-wrap { display: grid; gap: 2px; }
.msg.pending { opacity: .65; }
.msg.pending.sending { opacity: 1; }
.send-state { font-size: 12px; color: var(--muted); text-align: right; padding: 0 4px 6px; }
.send-state.failed { color: var(--danger); font-weight: 600; }
.send-retry { background: none; border: 0; padding: 0 4px; font: inherit; font-size: 12px; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { #status { transition: none; } }

/* Barra de scroll de los mensajes (Chrome / Edge / Safari) */
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: #c9cdc4; border-radius: 8px; }
.messages::-webkit-scrollbar-thumb:hover { background: #aeb3a8; }
.messages::-webkit-scrollbar-track { background: transparent; }

/* Bots (Nebu y Guardián) */
.role-tag.bot { background: #3a6ea5; margin-left: 4px; }
.msg.bot .nick { color: #3a6ea5; }
.msg.solo { background: rgba(58, 110, 165, .08); border-left: 3px solid #3a6ea5; border-radius: 8px; }
.msg .solo-note { font-size: 11px; color: var(--muted, #888); font-style: italic; }
.users li.user.bot .role-tag { margin-left: auto; }
.users li.user.bot { cursor: default; }
.users li.user.bot + li.user:not(.bot) { border-top: 1px solid var(--line, #e3e3e3); margin-top: 4px; padding-top: 8px; }
.users li.user.bot span { white-space: nowrap; }

/* ===== Celular: como una app de chat =====
   La pantalla no scrollea: arriba la barra, en el medio los mensajes (el único scroll) y abajo para escribir.
   Las salas (☰) y los conectados (👥) se abren como paneles que salen de los costados. */
.mob-btn, .solo-cel, .drawer-back { display: none; }
@media (max-width: 800px) {
  .solo-pc { display: none; }
  .solo-cel { display: inline; }
  .app { height: var(--app-h, 100dvh); min-height: 0; overflow: hidden; }
  .topbar { padding: 6px 8px; gap: 6px; }
  .brand { gap: 6px; flex: 1; }
  .brand .logo, .brand img.logo { width: 30px; height: 30px; }
  .site-name { display: none !important; }
  .topbar strong { font-size: 16px; }
  .top-right { gap: 6px; flex-shrink: 0; }
  .top-right .panel-link { padding: 6px 10px; font-size: 13px; }
  #nebuInstall { font-size: 0 !important; padding: 0 9px !important; height: 38px; min-width: 38px; }
  #nebuInstall::before { content: '📲'; font-size: 17px; }
  .topbar .mob-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 3px; position: relative;
    min-width: 38px; height: 38px; padding: 0 8px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    font-size: 18px; font-weight: 700; line-height: 1; flex-shrink: 0;
  }
  .topbar .mob-btn:hover { background: var(--accent-soft); }
  #usersBtn { font-size: 15px; }
  #usersBtnN { font-size: 13px; }
  .mob-dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--pink, #ff3d8b); }
  .mob-dot[hidden] { display: none; }

  .layout { grid-template-columns: 1fr; padding: 6px 8px 8px; gap: 0; }
  .chat { gap: 6px; }
  .messages { flex: 1; height: auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .tabs { flex-shrink: 0; }

  /* Paneles laterales */
  .side, .users {
    position: fixed; top: 0; bottom: 0; z-index: 60; width: min(84vw, 320px); max-height: none;
    border-radius: 0; overflow-y: auto; overscroll-behavior: contain;
    transition: transform .22s ease; box-shadow: 0 0 30px rgba(0, 0, 0, .25);
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .side { left: 0; transform: translateX(-105%); }
  .users { right: 0; transform: translateX(105%); }
  .app.ver-salas .side, .app.ver-gente .users { transform: none; }
  .drawer-back { display: block; position: fixed; inset: 0; z-index: 59; background: rgba(10, 10, 30, .4); }
  .drawer-back[hidden] { display: none; }

  /* Formato en una sola fila que se desliza */
  .fmt-bar { flex-wrap: nowrap; overflow-x: auto; margin: 0; padding: 2px 2px; scrollbar-width: none; flex-shrink: 0; }
  .fmt-bar::-webkit-scrollbar { display: none; }
  .fmt-bar button { flex-shrink: 0; }
  .send { flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom); }
  .send #text { font-size: 16px; } /* menos de 16px hace que el iPhone haga zoom al escribir */
  #status:empty { display: none; }
  /* La sala ya se ve en la pestaña: arriba queda lugar para los botones */
  .topbar .titles, #roomTag { display: none !important; }
  /* Mensajes: botones chicos para que el texto tenga lugar */
  .msg { gap: 8px; padding: 6px 6px; flex-wrap: wrap; }
  .msg .body { flex: 1 1 calc(100% - 48px); }
  /* Responder / Borrar / Reportar pasan a una filita abajo del texto, a la derecha */
  .msg > button { margin-top: -2px; align-self: auto; }
  .msg .body + button { margin-left: auto; }
  .msg .mod-del, .msg .reply, .msg .report { font-size: 11px; padding: 2px 6px; }
  .msg .report { opacity: .6; }
}
@media (max-width: 800px) and (prefers-reduced-motion: reduce) { .side, .users { transition: none; } }
