.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;
  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;
  min-width: 220px;
  width: 100%;
  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(38vh, 260px);
  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;
}

.chat-connected-item--self {
  border-color: #ffde59;
  box-shadow: 0 0 8px rgba(255, 222, 89, 0.45);
  color: #ffde59;
}

.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 {
  flex: 2;
  min-width: 0;
  width: 100%;
  border: 4px double red;
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 12px yellow;
  color: #fff;
  overflow: hidden;
}

.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-size: 12px;
  margin-bottom: 10px;
  color: #ffde59;
  align-items: center;
}

.chat-admin-clear-btn {
  justify-self: end;
  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-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;
}

.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;
}

.chat-line {
  font-size: 13px;
  margin: 0 0 5px;
  color: #f3f3f3;
  word-break: break-word;
}

.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 {
  border: 3px double #6b2d9e;
  border-radius: 12px;
  background: rgba(10, 6, 18, 0.92);
  box-shadow: 0 0 12px rgba(180, 120, 255, 0.45);
  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, #3d1566, #6b2d9e);
  border-bottom: 2px solid #c9a0ff;
  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: #4a1a7a;
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  cursor: pointer;
  border-radius: 4px;
}

.chat-dm-header-btn:hover {
  background: #6b2d9e;
}

.chat-dm-header-btn--close {
  background: #6b1010;
}

.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 #8b5cf6;
  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--self {
  color: #a7f3d0;
}

.chat-dm-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-dm-input {
  padding: 8px;
  background: #0f0f0f;
  border: 2px solid #8b5cf6;
  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: #6b2d9e;
  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;
  }
}

/* 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-neocities-frame-wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 24px;
  height: min(88vh, 920px);
  min-height: 560px;
  border: 2px solid red;
  border-radius: 12px;
  box-shadow: 0 0 14px yellow;
  overflow: hidden;
  background: #0a0a0a;
  box-sizing: border-box;
}

.chat-neocities-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 0;
  background: #000;
}
