.chat-description {
  margin: 8px auto 16px;
  color: #ffffff;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 14px;
  text-align: center;
}

/* Misma base visual que .video-descripcion en Reseñas (boletin-videos): ancho completo del bloque */
.chat-wrapper {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 15px;
  width: 100%;
  max-width: 100%;
  margin: 30px auto 24px;
  padding: 10px;
  background-color: black;
  border: 2px solid red;
  border-radius: 8px;
  box-shadow: 0 0 10px yellow;
  box-sizing: border-box;
}

.chat-menu {
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 380px;
  width: auto;
  background-color: black;
  border: 4px double red;
  border-radius: 15px;
  box-shadow: 0 0 10px yellow;
  padding: 14px;
  text-align: left;
  color: white;
}

.chat-menu h3 {
  margin: 0 0 10px;
  color: #ffde59;
  font-size: 13px;
}

.chat-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chat-menu-list li {
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 2px solid red;
  border-radius: 8px;
  box-shadow: 0 0 5px yellow;
  background: rgba(15, 15, 15, 0.9);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.chat-menu-list code {
  color: #ffde59;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.chat-auth-error {
  min-height: 1.2em;
  margin: 8px 0 10px;
  font-size: 11px;
  color: #ff8888;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
}

.chat-auth-error.chat-auth-error--ok {
  color: #8aff8a;
}

.chat-admin-rtdb-hint {
  margin: 8px 0 10px;
  padding: 10px 10px;
  border: 2px dashed #ffde59;
  border-radius: 8px;
  background: rgba(40, 25, 0, 0.85);
  color: #fff3c4;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
}

.chat-admin-rtdb-hint code {
  color: #ffde59;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 10px;
  word-break: break-all;
}

.chat-auth-linkbtn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 0;
  border: none;
  background: none;
  color: #9ed0ff;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
  text-align: left;
}

.chat-auth-linkbtn:hover {
  color: #ffde59;
}

.chat-auth-guest {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px dashed rgba(255, 0, 0, 0.45);
}

.chat-auth-block {
  margin-bottom: 14px;
}

.chat-auth-block:last-of-type {
  margin-bottom: 0;
}

.chat-auth-title {
  margin: 0 0 8px;
  color: #ffde59;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
}

.chat-auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-auth-label {
  font-size: 10px;
  color: #ccc;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
}

.chat-auth-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font-size: 12px;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  background: #0f0f0f;
  border: 2px solid red;
  border-radius: 6px;
  color: #fff;
}

.chat-auth-submit {
  margin-top: 6px;
  padding: 8px 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  cursor: pointer;
  border: 2px solid #fff;
  background: #b00000;
  color: #fff;
  border-radius: 6px;
}

.chat-auth-submit:active {
  transform: translateY(1px);
}

.chat-auth-submit--anon {
  width: 100%;
  margin-top: 0;
  background: #1a3d1a;
  border-color: #8aff8a;
}

.chat-auth-hint {
  margin: 6px 0 0;
  font-size: 9px;
  color: #aaa;
  line-height: 1.35;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
}

.chat-auth-hint--logged {
  margin-top: 10px;
  margin-bottom: 8px;
}

.chat-auth-hint code {
  color: #ffde59;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
}

.chat-canal-user-view {
  margin-top: 4px;
}

.chat-connected-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(48vh, 320px);
  overflow-y: auto;
}

.chat-connected-item {
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 2px solid red;
  border-radius: 8px;
  box-shadow: 0 0 5px yellow;
  background: rgba(15, 15, 15, 0.9);
  font-size: 12px;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.chat-connected-item:hover {
  box-shadow: 0 0 10px rgba(255, 222, 89, 0.55);
}

.chat-connected-item--self {
  border-color: #ffde59;
  box-shadow: 0 0 8px rgba(255, 222, 89, 0.45);
  color: #ffde59;
}

.chat-connected-item--offline {
  color: #8a8a8a !important;
  opacity: 0.68;
  border-color: rgba(255, 0, 0, 0.28);
  box-shadow: none;
  background: rgba(12, 12, 12, 0.75);
}

.chat-connected-item--offline:hover {
  opacity: 0.88;
  box-shadow: 0 0 6px rgba(140, 140, 140, 0.25);
}

.chat-connected-item--offline.chat-connected-item--self {
  color: #b8a840 !important;
  opacity: 0.85;
}

.chat-connected-offline-tag {
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #666;
  margin-left: 4px;
}

.chat-member-list-meta {
  margin: 0 0 8px;
  font-size: 9px;
  color: #aaa;
  line-height: 1.35;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
}

.chat-auth-submit--logout {
  width: 100%;
  margin-top: 0;
}

.chat-auth-user {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px dashed rgba(255, 0, 0, 0.45);
}

.retro-chat-window {
  position: relative;
  flex: 2 1 400px;
  min-width: 0;
  width: auto;
  border: 4px double red;
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 12px yellow;
  color: #fff;
  overflow: hidden;
}

.chat-admin-star {
  color: #ffde59;
  font-size: 0.95em;
  text-shadow: 0 0 6px rgba(255, 222, 89, 0.85);
  vertical-align: baseline;
}

.chat-dm-invite-stack {
  position: absolute;
  top: 52px;
  left: 10px;
  right: 10px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.chat-dm-invite {
  pointer-events: auto;
  padding: 10px 12px;
  border: 2px solid #ffde59;
  border-radius: 10px;
  background: rgba(20, 8, 40, 0.96);
  box-shadow: 0 0 14px rgba(255, 222, 89, 0.35);
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  color: #f3f3f3;
}

.chat-dm-invite-text {
  margin: 0 0 10px;
}

.chat-dm-invite-text strong {
  color: #ffde59;
}

.chat-dm-invite-preview {
  display: block;
  margin-top: 6px;
  color: #c9b8ff;
  font-style: italic;
  word-break: break-word;
}

.chat-dm-invite-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.chat-dm-invite-btn {
  min-width: 64px;
  padding: 6px 12px;
  border: 2px solid #fff;
  border-radius: 6px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  cursor: pointer;
  color: #fff;
}

.chat-dm-invite-btn--yes {
  background: #1a6b3a;
  border-color: #8aff8a;
}

.chat-dm-invite-btn--yes:hover {
  background: #22884a;
}

.chat-dm-invite-btn--no {
  background: #4a1a1a;
  border-color: #f88;
}

.chat-dm-invite-btn--no:hover {
  background: #6b2020;
}

.retro-chat-titlebar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to right, #8b0000, #d22);
  color: #ffde59;
  padding: 8px 10px;
  border-bottom: 2px solid yellow;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
}

.chat-functions {
  padding: 10px;
  box-sizing: border-box;
}

.retro-chat-toolbar {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  padding: 8px;
  background: rgba(35, 0, 0, 0.8);
  border: 2px solid red;
  box-shadow: inset 0 0 8px rgba(255, 215, 0, 0.15);
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  margin-bottom: 10px;
  color: #ffde59;
  align-items: center;
}

.chat-toolbar-actions {
  display: flex;
  gap: 6px;
  justify-self: end;
  justify-content: flex-end;
  align-items: center;
}

#chat-motd {
  word-break: break-word;
}

#chat-motd.chat-motd--editable {
  cursor: pointer;
  text-decoration: underline dotted rgba(255, 222, 89, 0.6);
  text-underline-offset: 3px;
}

#chat-motd.chat-motd--editable:hover {
  color: #fff;
  text-decoration-color: #fff;
}

.chat-admin-clear-btn {
  min-width: 44px;
  min-height: 36px;
  padding: 4px 10px;
  border: 2px solid #fff;
  border-radius: 8px;
  background: rgba(100, 20, 20, 0.95);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 200, 100, 0.35);
}

.chat-admin-clear-btn:hover {
  background: rgba(160, 30, 30, 0.98);
}

.chat-admin-clear-btn:focus-visible {
  outline: 2px solid #ffde59;
  outline-offset: 2px;
}

.chat-sound-toggle-btn {
  min-width: 44px;
  min-height: 36px;
  padding: 4px 10px;
  border: 2px solid #fff;
  border-radius: 8px;
  background: rgba(20, 60, 100, 0.95);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(120, 200, 255, 0.35);
}

.chat-sound-toggle-btn:hover {
  background: rgba(30, 90, 150, 0.98);
}

.chat-sound-toggle-btn:focus-visible {
  outline: 2px solid #ffde59;
  outline-offset: 2px;
}

.chat-sound-toggle-btn[aria-pressed="false"] {
  background: rgba(70, 70, 70, 0.95);
  box-shadow: 0 0 6px rgba(200, 200, 200, 0.2);
  opacity: 0.85;
}

.chat-admin-context-menu {
  position: fixed;
  z-index: 9999;
  min-width: 160px;
  padding: 6px;
  background: rgba(20, 8, 8, 0.98);
  border: 2px solid #ffde59;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.chat-admin-context-menu__btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #c44;
  border-radius: 6px;
  background: #6b1010;
  color: #fff;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
}

.chat-admin-context-menu__btn:hover {
  background: #8b2020;
}

.chat-peer-context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 180px;
  padding: 6px;
  background: rgba(12, 8, 20, 0.98);
  border: 2px solid #c084fc;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65);
}

.chat-peer-context-menu__btn {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 8px 10px;
  border: 2px solid #6b2d9e;
  border-radius: 6px;
  background: #3d1a5c;
  color: #fff;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.chat-peer-context-menu__btn:last-child {
  margin-bottom: 0;
}

.chat-peer-context-menu__btn[hidden] {
  display: none !important;
}

.chat-peer-context-menu__btn:hover {
  background: #5a2880;
}

.chat-peer-context-menu__btn[data-action="kick"] {
  border-color: #c44;
  background: #6b1010;
}

.chat-peer-context-menu__btn[data-action="kick"]:hover {
  background: #8b2020;
}

.chat-self-context-menu {
  position: fixed;
  z-index: 10001;
  min-width: 200px;
  padding: 6px;
  background: rgba(28, 22, 0, 0.98);
  border: 2px solid #ffde59;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65), 0 0 12px rgba(255, 222, 89, 0.35);
}

.chat-self-context-menu__btn {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  padding: 8px 10px;
  border: 2px solid #b8860b;
  border-radius: 6px;
  background: #3d3200;
  color: #fff;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.chat-self-context-menu__btn:last-child {
  margin-bottom: 0;
}

.chat-self-context-menu__btn:hover:not(:disabled) {
  background: #5a4800;
  color: #ffde59;
}

.chat-self-context-menu__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-nick-badge--clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.chat-nick-badge--clickable:hover {
  color: #ffde59;
}

.chat-connected-item--self {
  cursor: pointer;
  border-color: #ffde59 !important;
}

.chat-user-status {
  display: inline;
  margin-left: 4px;
  font-size: 9px;
  color: #ccc;
  font-weight: normal;
  font-style: italic;
}

.chat-user-ninja-tag {
  margin-left: 2px;
  font-size: 10px;
}

.chat-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  box-sizing: border-box;
}

.chat-profile-overlay[hidden] {
  display: none !important;
}

.chat-profile-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 18px 16px 14px;
  border: 3px double #ffde59;
  border-radius: 12px;
  background: rgba(12, 10, 0, 0.96);
  box-shadow: 0 0 16px rgba(255, 222, 89, 0.35);
  color: #f5f5f5;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}

.chat-profile-title {
  margin: 0 0 12px;
  color: #ffde59;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  text-align: center;
}

.chat-profile-body p {
  margin: 0 0 8px;
}

.chat-profile-body strong {
  color: #ffde59;
}

.chat-profile-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 4px;
  background: #6b1010;
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  cursor: pointer;
}

.chat-profile-loading,
.chat-profile-error {
  color: #ccc;
  text-align: center;
}

.chat-dm-color-picker {
  position: fixed;
  z-index: 10003;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 200px;
  padding: 10px;
  background: rgba(10, 10, 10, 0.98);
  border: 2px solid #ffde59;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.chat-dm-color-picker[hidden] {
  display: none !important;
}

.chat-dm-color-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.chat-dm-color-swatch--active {
  outline: 2px solid #ffde59;
  outline-offset: 2px;
}

.chat-dm-color-btn-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid #fff;
  background: #6b2d9e;
}

.chat-user--btn {
  font: inherit;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-weight: bold;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-decoration: none;
}

.chat-user--btn:hover {
  text-decoration: underline;
}

/* ===== Menciones (@nick) ===== */
.chat-mention {
  display: inline;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(192, 132, 252, 0.18);
  color: #e9d5ff;
  border: 1px solid rgba(192, 132, 252, 0.55);
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-weight: bold;
}

.chat-mention--self {
  background: rgba(255, 222, 89, 0.22);
  color: #ffde59;
  border-color: #ffde59;
  text-shadow: 0 0 4px rgba(255, 0, 0, 0.45);
  animation: chat-mention-pulse 1.6s ease-in-out 0s 2;
}

@keyframes chat-mention-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 222, 89, 0); }
  50% { box-shadow: 0 0 8px rgba(255, 222, 89, 0.85); }
}

.chat-line--mention-me {
  background: rgba(255, 222, 89, 0.07);
  border-left: 3px solid #ffde59;
  padding-left: 6px;
  border-radius: 0 4px 4px 0;
}

/* ===== Dropdown de autocompletado @ ===== */
.chat-mention-suggest {
  position: fixed;
  z-index: 10001;
  min-width: 160px;
  max-width: 320px;
  padding: 4px;
  background: rgba(12, 8, 20, 0.98);
  border: 2px solid #c084fc;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65);
  overflow-y: auto;
}

.chat-mention-suggest[hidden] {
  display: none !important;
}

.chat-mention-suggest__item {
  display: block;
  width: 100%;
  margin-bottom: 2px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #fff;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.chat-mention-suggest__item:last-child {
  margin-bottom: 0;
}

.chat-mention-suggest__item:hover,
.chat-mention-suggest__item.is-active {
  background: #3d1a5c;
  border-color: #c084fc;
  color: #ffde59;
}

.retro-chat-messages {
  height: 300px;
  overflow-y: auto;
  margin: 0;
  padding: 8px;
  background: rgba(8, 8, 8, 0.95);
  border: 2px solid red;
  box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.12);
  text-align: left;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
}

.chat-line {
  font-size: 13px;
  margin: 0 0 5px;
  color: #f3f3f3;
  word-break: break-word;
}

.chat-line--replyable {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.chat-line--replyable:hover {
  background: rgba(255, 222, 89, 0.08);
}

.chat-line--reply-pending {
  background: rgba(255, 222, 89, 0.14);
  box-shadow: inset 3px 0 0 #ffde59;
}

.chat-line--reply-jump {
  animation: chat-reply-jump-flash 1.4s ease-out;
}

@keyframes chat-reply-jump-flash {
  0%,
  25% {
    background: rgba(255, 222, 89, 0.32);
    box-shadow: inset 3px 0 0 #ffde59;
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

.chat-line--is-reply {
  padding-left: 4px;
}

.chat-reply-connector {
  display: block;
  margin: 0 0 2px 6px;
  font-size: 11px;
  color: #b8b8b8;
  line-height: 1.3;
}

.chat-reply-connector--link {
  width: calc(100% - 6px);
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.12s ease, background 0.12s ease;
}

.chat-reply-connector--link:hover,
.chat-reply-connector--link:focus-visible {
  color: #ffde59;
  background: rgba(255, 222, 89, 0.08);
  outline: none;
}

.chat-reply-connector--link:hover .chat-reply-connector-label,
.chat-reply-connector--link:focus-visible .chat-reply-connector-label {
  text-decoration: underline;
}

.chat-dm-messages .chat-reply-connector--link:hover,
.chat-dm-messages .chat-reply-connector--link:focus-visible {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
}

.chat-reply-connector-line {
  display: inline-block;
  width: 2px;
  height: 10px;
  margin-right: 6px;
  vertical-align: middle;
  background: linear-gradient(to bottom, transparent, #ffde59 40%, #ffde59);
  border-radius: 1px;
}

.chat-reply-connector-label {
  vertical-align: middle;
  font-style: italic;
}

.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding: 6px 8px;
  background: rgba(255, 222, 89, 0.1);
  border: 2px solid #ffde59;
  border-radius: 6px;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 11px;
  color: #ffde59;
}

.chat-reply-bar[hidden] {
  display: none !important;
}

.chat-reply-bar-line {
  flex: 0 0 3px;
  align-self: stretch;
  min-height: 18px;
  background: #ffde59;
  border-radius: 2px;
}

.chat-reply-bar-text {
  flex: 1;
  min-width: 0;
}

.chat-reply-bar-nick {
  color: #fff;
  font-weight: normal;
}

.chat-reply-bar-cancel {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 6px;
  border: 1px solid #ffde59;
  border-radius: 4px;
  background: transparent;
  color: #ffde59;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.chat-reply-bar-cancel:hover {
  background: rgba(255, 222, 89, 0.2);
}

.chat-reply-bar--dm {
  margin: 0 0 8px;
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
}

.chat-reply-bar--dm .chat-reply-bar-line {
  background: #8b5cf6;
}

.chat-reply-bar--dm .chat-reply-bar-cancel {
  border-color: #8b5cf6;
  color: #c4b5fd;
}

.chat-reply-bar--dm .chat-reply-bar-nick {
  color: #e8e0ff;
}

.chat-time {
  color: #ffde59;
  margin-right: 6px;
}

.chat-user {
  color: #ff6666;
  font-weight: bold;
}

.chat-system {
  color: #9ed0ff;
  font-style: italic;
}

.chat-line-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 6px;
}

.chat-line-wrap .chat-line {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.chat-msg-delete-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 2px 6px;
  border: 2px solid #c44;
  border-radius: 4px;
  background: rgba(80, 20, 20, 0.95);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  font-family: "Silkscreen", Tahoma, Verdana, sans-serif;
}

.chat-msg-delete-btn:hover {
  background: #8b2020;
}

.chat-msg-delete-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.retro-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 0 0;
}

#chat-input {
  padding: 8px;
  background: #0f0f0f;
  border: 2px solid red;
  color: #fff;
  font-family: "Silkscreen", Tahoma, Verdana, sans-serif;
  font-size: 13px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#chat-send-btn {
  min-width: 90px;
  border: 2px solid #fff;
  background: red;
  color: black;
  font-family: "Press Start 2P", monospace;
  font-weight: bold;
  cursor: pointer;
  font-size: 10px;
}

#chat-send-btn:active {
  transform: translateY(1px);
}

.chat-dm-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 16px auto 0;
  box-sizing: border-box;
}

.chat-dm-window {
  --dm-border: #6b2d9e;
  --dm-header-from: #3d1566;
  --dm-header-to: #6b2d9e;
  --dm-header-border: #c9a0ff;
  --dm-msg-border: #8b5cf6;
  --dm-accent: #8b5cf6;
  --dm-btn-bg: #6b2d9e;
  --dm-glow: rgba(180, 120, 255, 0.45);
  border: 3px double var(--dm-border);
  border-radius: 12px;
  background: rgba(10, 6, 18, 0.92);
  box-shadow: 0 0 12px var(--dm-glow);
  overflow: hidden;
  color: #fff;
}

.chat-dm-window--collapsed .chat-dm-body {
  display: none;
}

.chat-dm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(to right, var(--dm-header-from), var(--dm-header-to));
  border-bottom: 2px solid var(--dm-header-border);
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: #e8d4ff;
}

.chat-dm-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-dm-header-btn {
  flex: 0 0 auto;
  min-width: 36px;
  height: 26px;
  padding: 0 6px;
  border: 2px solid #fff;
  background: var(--dm-btn-bg);
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  cursor: pointer;
  border-radius: 4px;
}

.chat-dm-header-btn:hover {
  filter: brightness(1.15);
}

.chat-dm-color-btn {
  min-width: 32px;
  padding: 0 4px;
}

.chat-dm-header-btn--close {
  background: #6b1010;
}

.chat-dm-sound-toggle-btn {
  background: #1a3a6b;
  font-size: 12px;
  padding: 0 8px;
}

.chat-dm-sound-toggle-btn:hover {
  background: #2a5a9c;
}

.chat-dm-sound-toggle-btn[aria-pressed="false"] {
  background: #444;
  opacity: 0.85;
}

.chat-dm-body {
  padding: 10px;
  box-sizing: border-box;
}

.chat-dm-messages {
  height: 160px;
  overflow-y: auto;
  margin: 0 0 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid var(--dm-msg-border);
  border-radius: 8px;
  text-align: left;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
}

.chat-dm-line-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 6px;
}

.chat-dm-line-wrap .chat-dm-line {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.chat-dm-actions {
  margin: 0 0 10px;
  text-align: right;
}

.chat-dm-actions .chat-auth-linkbtn {
  display: inline;
  width: auto;
  text-align: right;
}

.chat-dm-actions .chat-dm-clear-mine {
  font-size: 10px;
}

.chat-dm-line {
  margin: 0 0 6px;
  word-break: break-word;
  color: #e8e0ff;
}

.chat-dm-line--replyable {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.chat-dm-line--replyable:hover {
  background: color-mix(in srgb, var(--dm-accent) 14%, transparent);
}

.chat-dm-line--reply-pending {
  background: color-mix(in srgb, var(--dm-accent) 20%, transparent);
  box-shadow: inset 3px 0 0 var(--dm-accent);
}

.chat-dm-line--reply-jump {
  animation: chat-dm-reply-jump-flash 1.4s ease-out;
}

@keyframes chat-dm-reply-jump-flash {
  0%,
  25% {
    background: color-mix(in srgb, var(--dm-accent) 30%, transparent);
    box-shadow: inset 3px 0 0 var(--dm-accent);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

.chat-dm-line--is-reply {
  padding-left: 4px;
}

.chat-dm-line--self {
  color: #ffde59;
}

.chat-dm-line--self .chat-dm-line-meta {
  color: #ffe566;
}

.chat-dm-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-dm-input {
  padding: 8px;
  background: #0f0f0f;
  border: 2px solid var(--dm-msg-border);
  color: #fff;
  font-family: "Silkscreen", Tahoma, Verdana, sans-serif;
  font-size: 13px;
  border-radius: 6px;
  box-sizing: border-box;
  min-width: 0;
}

.chat-dm-send {
  min-width: 80px;
  border: 2px solid #fff;
  background: var(--dm-btn-bg);
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  cursor: pointer;
  border-radius: 6px;
}

@media (max-width: 768px) {
  .chat-wrapper {
    flex-direction: column-reverse;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    padding: 10px;
    margin: 20px auto 16px;
  }

  .chat-menu {
    min-width: 0;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
  }

  .retro-chat-window {
    width: 100%;
    border-width: 3px;
    box-sizing: border-box;
  }

  .chat-functions {
    padding: 8px;
  }

  .retro-chat-form {
    grid-template-columns: 1fr;
  }

  .chat-dm-form {
    grid-template-columns: 1fr;
  }

  .retro-chat-messages {
    height: 240px;
  }
}

/* Firebase Hosting (web.app / iframe): chat a la izquierda, menú Canal a la derecha */
.chat-host-body .chat-host-inner {
  max-width: 1100px;
  width: 100%;
  box-sizing: border-box;
}

.chat-host-body .chat-wrapper {
  flex-direction: row-reverse;
  flex-wrap: nowrap;
}

.chat-host-body .chat-menu {
  flex: 0 1 320px;
  max-width: 360px;
  min-width: 240px;
  width: auto;
}

.chat-host-body .retro-chat-window {
  flex: 1 1 480px;
  min-width: 280px;
  width: auto;
}

/* En Hosting, no apilar a 768px (el iframe suele ser estrecho); solo en pantallas muy pequeñas */
@media (max-width: 768px) {
  .chat-host-body .chat-wrapper {
    flex-direction: row-reverse;
    flex-wrap: nowrap;
  }

  .chat-host-body .chat-menu {
    flex: 0 1 34%;
    min-width: 200px;
    max-width: none;
    width: auto;
  }

  .chat-host-body .retro-chat-window {
    flex: 1 1 58%;
    width: auto;
  }
}

@media (max-width: 520px) {
  html:not(.chat-embed) .chat-host-body .chat-wrapper {
    flex-direction: column-reverse;
  }

  html:not(.chat-embed) .chat-host-body .chat-menu,
  html:not(.chat-embed) .chat-host-body .retro-chat-window {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
    min-width: 0;
  }
}

/* iframe Neocities (?embed=1): ancho fluido al iframe; dos columnas sin min-width fijo */
html.chat-embed body.chat-host-body {
  padding: 0;
  min-height: 0;
  overflow-x: hidden;
  background: #000;
}

html.chat-embed .chat-host-embed-chrome {
  display: none;
}

html.chat-embed .chat-host-inner {
  max-width: none;
  width: 100%;
  padding: 0;
  margin: 0;
}

html.chat-embed .chat-description {
  display: none;
}

html.chat-embed .chat-wrapper {
  flex-direction: row-reverse !important;
  flex-wrap: nowrap !important;
  margin: 8px 0 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}

html.chat-embed .chat-menu {
  flex: 0 1 34% !important;
  width: auto !important;
  max-width: 360px !important;
  min-width: 220px !important;
}

html.chat-embed .retro-chat-window {
  flex: 1 1 62% !important;
  min-width: 0 !important;
  width: auto !important;
}

html.chat-embed .retro-chat-messages {
  height: 340px;
}

html.chat-embed .retro-chat-toolbar {
  grid-template-columns: 1fr 1fr;
  font-size: 11px;
}

@media (max-width: 768px) {
  html.chat-embed .chat-wrapper {
    flex-direction: row-reverse !important;
    flex-wrap: nowrap !important;
  }

  html.chat-embed .chat-menu {
    flex: 0 1 36% !important;
    min-width: 200px !important;
    max-width: none !important;
  }

  html.chat-embed .retro-chat-window {
    flex: 1 1 60% !important;
  }
}

/* Mobile (iframe embed): apilar en columna — chat arriba, menú/instrucciones/cerrar
   sesión abajo, dock de mensajes privados al final */
@media (max-width: 600px) {
  html.chat-embed .chat-wrapper {
    flex-direction: column-reverse !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    padding: 8px !important;
    margin: 6px 0 0 !important;
  }

  html.chat-embed .chat-menu {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box;
    padding: 12px !important;
  }

  html.chat-embed .retro-chat-window {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box;
  }

  html.chat-embed .retro-chat-messages {
    height: 320px;
  }

  html.chat-embed .retro-chat-toolbar {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  html.chat-embed .chat-toolbar-actions {
    justify-self: stretch;
    justify-content: flex-end;
  }

  html.chat-embed .retro-chat-form {
    grid-template-columns: 1fr;
  }

  html.chat-embed .chat-dm-dock {
    margin-top: 12px;
  }

  html.chat-embed .chat-dm-window {
    width: 100%;
  }
}

/* Neocities: el chat en vivo va en iframe desde Firebase Hosting (CSP de Neocities bloquea fetch a Google) */
.chat-neocities-note {
  max-width: 720px;
  margin: 10px auto 6px;
  padding: 10px 12px;
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  color: #f5f5f5;
  text-align: center;
  border: 2px solid #c41e3a;
  border-radius: 10px;
  background: rgba(20, 10, 10, 0.85);
  box-sizing: border-box;
}

.chat-neocities-linkwrap {
  text-align: center;
  margin: 0 0 14px;
}

.chat-neocities-openlink {
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  font-size: 12px;
  color: #ffde59;
}

.chat-neocities-openlink:hover {
  text-decoration: underline;
}

#Chat {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#Chat .chat-neocities-frame-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 16px 0 24px;
  min-height: 520px;
  height: auto;
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
  box-sizing: border-box;
}

#Chat .chat-neocities-frame {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 720px;
  min-height: 520px;
  border: 0;
  background: transparent;
}

/* Escritorio: la sección debe ocupar todo el ancho del recuadro (main centra hijos y encogía el iframe) */
@media (min-width: 769px) {
  #Chat {
    align-self: stretch;
    width: 100%;
    max-width: 100%;
  }

  #Chat .chat-neocities-frame-wrap {
    width: 100%;
    max-width: 100%;
    min-height: 640px;
    margin: 20px 0 28px;
  }

  #Chat .chat-neocities-frame {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 640px;
    height: 800px;
  }
}

/* iframe embed: layout amplio solo en escritorio (móvil sigue con reglas de 600px) */
@media (min-width: 769px) {
  html.chat-embed .chat-wrapper {
    flex-direction: row-reverse !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
  }

  html.chat-embed .chat-menu {
    flex: 0 0 300px !important;
    width: 300px !important;
    min-width: 280px !important;
    max-width: 340px !important;
  }

  html.chat-embed .retro-chat-window {
    flex: 1 1 0 !important;
    min-width: 420px !important;
    width: auto !important;
  }

  html.chat-embed .retro-chat-messages {
    height: 400px;
    min-height: 360px;
  }

  html.chat-embed .retro-chat-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    font-size: 12px;
  }

  html.chat-embed .retro-chat-form {
    grid-template-columns: 1fr auto !important;
  }
}

/* Foro en Neocities: mismo contenedor iframe que el chat */
#Foro {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#Foro .chat-neocities-frame-wrap,
#Foro .forum-neocities-frame-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 16px 0 24px;
  min-height: 0;
  height: auto;
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
  box-sizing: border-box;
}

#Foro .chat-neocities-frame {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 420px;
  min-height: 0;
  border: 0;
  background: transparent;
}

@media (min-width: 769px) {
  #Foro {
    align-self: stretch;
    width: 100%;
    max-width: 100%;
  }

  #Foro .chat-neocities-frame-wrap,
  #Foro .forum-neocities-frame-wrap {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    margin: 20px 0 28px;
  }

  #Foro .chat-neocities-frame {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0;
    height: 420px;
  }
}
