/* rumrum — caja de chat compacta estilo Chatango, sobre la paleta de twoitter
   (negro cálido + dorado + JetBrains Mono + textura de puntos). */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #0d0c0a;
  --surface: #16130f;
  --border: #2a2622;
  --hairline: #221e1a;
  --text: #d8d2c4;
  --text-dim: #a89e8b;
  --muted: #6b6357;
  --accent: #e8b04a;
  --accent-dim: #b58836;
  --dots: #1a1612;
  --mono: 'JetBrains Mono', 'Menlo', monospace;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  /* la caja se centra: en una web embebida ocuparía su hueco; aquí, la pantalla */
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* textura de fondo (viñeta + puntitos) anclada al viewport, como en twoitter */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 55% 50% at 50% 45%, var(--bg) 0%, var(--bg) 30%, transparent 75%),
    radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: auto, 22px 22px;
}

.chatbox {
  width: min(520px, 100%);
  height: min(680px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

header {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(var(--surface), var(--bg));
}
header h1 { margin: 0; font-size: .95rem; font-weight: 600; color: var(--accent); }
header .meta { font-size: .72rem; color: var(--muted); }
header .meta b { color: var(--text-dim); font-weight: 500; }

/* barra de presencia: quién está en línea (puntito de color + nombre) */
.presence {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem .8rem;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
  font-size: .72rem;
  color: var(--muted);
  overflow-x: auto;
  white-space: nowrap;
}
.presence-label { flex-shrink: 0; }
.presence-chip { display: inline-flex; align-items: center; gap: .3rem; color: var(--text-dim); }
.presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 4px currentColor;
}

/* mensajes: filas densas, una por línea — el look "chatbox" de Chatango */
#messages {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: .5rem .7rem;
}
.msg {
  padding: .08rem 0;
  word-break: break-word;
}
.msg:hover { background: var(--hairline); }
.msg .time { color: var(--muted); font-size: .7rem; margin-right: .45rem; }
.msg .name { font-weight: 600; margin-right: .4rem; }
.msg .name::after { content: ':'; color: var(--muted); font-weight: 400; }
.msg .body { color: var(--text); }
.msg .body .link { color: var(--accent); text-decoration: underline; word-break: break-all; }

#composer {
  display: flex;
  gap: .5rem;
  padding: .6rem .7rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
#body {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .6rem;
}
#body::placeholder { color: var(--muted); }
#body:focus { outline: none; border-color: var(--accent); }
#composer button {
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  padding: 0 1rem;
  cursor: pointer;
}
#composer button:hover { background: var(--accent-dim); }

/* selector de color propio: un cuadradito a la derecha de la cabecera */
.swatch {
  margin-left: auto;
  width: 20px;
  height: 20px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  align-self: center;
}
/* botón de icono (silenciar) en la cabecera */
.iconbtn {
  background: none;
  border: 0;
  padding: 0 .1rem;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
}
.swatch::-webkit-color-swatch-wrapper { padding: 2px; }
.swatch::-webkit-color-swatch { border: none; border-radius: 2px; }
.swatch::-moz-color-swatch { border: none; border-radius: 2px; }

/* separador de día: la etiqueta centrada entre dos hilos */
.daysep {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .55rem 0;
  color: var(--muted);
  font-size: .7rem;
  text-transform: lowercase;
}
.daysep::before,
.daysep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* aviso de conexión (mensaje de sistema) */
.msg.system { color: var(--muted); font-style: italic; }
.msg.system .sys { margin-left: .1rem; }
