/* pantalla chat — el efecto firma: panel de vidrio esmerilado */

.chat-screen {
  position: absolute;
  inset: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 900px) {
  .chat-screen { inset: 16px; }
}

@media (max-width: 899px) {
  .chat-screen.sheet {
    animation: chat-in-mobile .28s var(--ease) both;
  }
}
@keyframes chat-in-mobile {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Header ------------------------------------------------ */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex: 0 0 auto;
  background: var(--glass-strong);
  border-bottom: 1px solid var(--edge);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

.chat-header .chat-back { display: inline-flex; }
@media (min-width: 900px) {
  .chat-header .chat-back { display: none; }
}

.chat-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.chat-id .avatar { position: relative; }
.avatar-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--bg);
}

.chat-id-text { min-width: 0; }
.chat-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 650;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.verified-tick { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); }
.chat-sub {
  font-size: 12.5px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.chat-follow { font-size: 12.5px; padding: 6px 12px; white-space: nowrap; }
.chat-follow.is-following { background: var(--accent-soft); border-color: var(--accent); }

.icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--glass);
  border: 1px solid var(--edge);
  color: var(--ink);
  cursor: pointer;
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.icon-btn:hover { background: var(--glass-strong); border-color: var(--edge-hi); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

/* ---- Body / bubbles ----------------------------------------- */
.chat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1.5;
  padding: 40px 20px;
}

.msg-row { display: flex; }
.msg-row.me { justify-content: flex-end; }
.msg-row.them { justify-content: flex-start; }
.msg-row.channel-post { justify-content: center; }

/* Los mensajes nuevos entran con el lenguaje fantasma (.ghost-in, one-shot,
   opacity 0 + blur → nítido — definido en app.css). Se aplica desde chat.js. */
.msg-row.ghost-in { will-change: opacity, filter, transform; }

.bubble {
  max-width: 78%;
  padding: 10px 14px 8px;
  border-radius: 18px;
}
.msg-row.me .bubble { border-bottom-right-radius: 4px; }
.msg-row.them .bubble { border-bottom-left-radius: 4px; }
.bubble-me { background: var(--bubble-me); border: 1px solid var(--edge); }

.msg-author {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--accent);
  margin-bottom: 2px;
}
.msg-text {
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-time {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ---- Channel post style --------------------------------------- */
.post-card {
  width: 92%;
  max-width: 640px;
  margin: 0 auto;
  border-radius: var(--radius-card);
  padding: 14px 16px;
}

/* ---- Product card ---------------------------------------------- */
.product-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  max-width: 260px;
  padding: 20px 18px 16px;
}
.product-emoji { font-size: 44px; line-height: 1; }
.product-name { font-weight: 650; font-size: 15px; }
.product-price { color: var(--accent); font-weight: 650; font-size: 14px; }
.product-buy { width: 100%; margin-top: 8px; padding: 10px 16px; font-size: 14px; }

/* ---- Typing indicator -------------------------------------------- */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
}
.typing-bubble .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-dim);
  animation: typing-bounce 1.1s ease-in-out infinite;
}
.typing-bubble .dot:nth-child(2) { animation-delay: .15s; }
.typing-bubble .dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Chips (business only) ---------------------------------------- */
.chat-chips {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px 2px;
  flex: 0 0 auto;
}
.chat-chip {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 550;
  border-color: var(--accent);
  background: var(--accent-soft);
  transition: transform .12s var(--ease), background .2s var(--ease),
    border-color .2s var(--ease), box-shadow .25s var(--ease);
}
.chat-chip:hover {
  background: var(--glass-strong);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 6px 22px var(--accent-soft);
}

/* ---- Input bar ------------------------------------------------------ */
.chat-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  padding: 6px 6px 6px 12px;
  border-radius: var(--radius-pill);
}

.chat-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  padding: 9px 4px;
  outline: none;
}
.chat-input::placeholder { color: var(--ink-faint); }

/* Glow tecnológico #3: el botón de enviar es EL botón de la app; lleva el
   halo del acento del momento (sombra fija, solo cicla el color). */
.send-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  box-shadow: 0 0 24px -8px var(--accent-glow);
  color: var(--bg);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .12s var(--ease), filter .2s var(--ease), opacity .2s var(--ease);
}
.send-btn:hover { filter: brightness(1.08); }
.send-btn:active { transform: scale(.9); }
.send-btn:disabled { opacity: .35; cursor: default; }

/* ============================================================
   ZONA DE TRADUCCIÓN (lenguaje fantasma)
   ============================================================ */

/* Botón mundito en el header */
.tr-toggle.is-on {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Región bajo el header: sólo la píldora de estado, EN FLUJO (empuja el
   contenido, nunca lo tapa). El panel ahora es un modal centrado. */
.tr-region {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  padding: 0 14px;
}

/* Píldora de estado (reabre el modal) */
.tr-pill {
  margin: 6px 0 0;
  font-size: 12.5px;
  white-space: nowrap;
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Modal del traductor: centrado sobre backdrop oscurecido + blur */
.tr-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 8, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: tr-backdrop-in .22s var(--ease) both;
  transition: opacity .28s var(--ease);
}
@keyframes tr-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.tr-modal-backdrop.is-closing { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .tr-modal-backdrop { animation: none !important; }
}

/* Modal a nivel ESPACIAL (referencia: modal del demo-sitio):
   radius 28, doble halo, título con gradiente, gradiente en ACTIVAR. */
.tr-modal {
  width: min(100%, 400px);
  padding: 24px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: 28px;
  /* Fondo del modal: antes dos azules fríos sobre el negro azulado viejo.
     Ahora plum + índigo violeta (los tonos de --blob-1/--blob-2) sobre el
     negro cálido nuevo.
     Van con alpha explícito, no con var(--blob-*): los tokens son colores
     sólidos y meterlos acá saturaba el panel entero. */
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(110, 58, 128, .5), transparent 60%),
    radial-gradient(120% 70% at 100% 100%, rgba(74, 58, 134, .45), transparent 58%),
    rgba(15, 10, 13, .92);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, .65),
    inset 0 1px 0 rgba(255, 255, 255, .18),
    0 0 0 1px rgba(255, 240, 234, .06);
}
.tr-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tr-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.tr-title-grad {
  background: linear-gradient(100deg, var(--ink), var(--accent) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tr-close {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--glass);
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s var(--ease), color .2s var(--ease), transform .12s var(--ease);
}
.tr-close:hover { background: var(--glass-strong); color: var(--ink); }
.tr-close:active { transform: scale(.9); }

/* Secciones: "Tu idioma" + "Idioma de este chat" */
.tr-sec { display: flex; flex-direction: column; gap: 8px; }
.tr-sec-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tr-mylang { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tr-mylang-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.tr-mylang-note { font-size: 11.5px; color: var(--ink-faint); display: block; margin-top: 8px; }

/* Adenda F — "Tu idioma" ahora es un botón que despliega el selector acá mismo */
.tr-mylang-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--ink);
  cursor: pointer;
  transition: filter .15s var(--ease), transform .12s var(--ease);
}
.tr-mylang-btn:hover { filter: brightness(1.08); }
.tr-mylang-btn:active { transform: scale(.99); }
.tr-mylang-current { font-size: 14px; font-weight: 650; }
.tr-mylang-edit { font-size: 12.5px; color: var(--accent); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.tr-mylangs {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding: 6px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--edge);
  scrollbar-width: thin;
}
.tr-mylangs[hidden] { display: none; }
.tr-mylangs::-webkit-scrollbar { width: 6px; }

/* Selector completo de idiomas: lista de vidrio scrolleable */
.tr-langs {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--edge);
  scrollbar-width: thin;
}
.tr-langs::-webkit-scrollbar { width: 6px; }
.tr-lang {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  border-radius: 12px;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .15s var(--ease);
}
.tr-lang:hover { background: var(--glass-strong); }
.tr-lang-flag { font-size: 17px; flex: 0 0 auto; }
.tr-lang-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-lang.is-sel {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.tr-lang-check { color: var(--accent); font-weight: 700; flex: 0 0 auto; }

/* ACTIVAR = gradiente acento→violeta con glow (btn-primary de la capa
   espacial); DESACTIVAR = sobrio, borde danger suave. */
.tr-switch {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .05em;
  border-radius: var(--radius-pill);
}
.tr-switch.btn-primary {
  box-shadow: 0 8px 28px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.tr-switch:disabled {
  opacity: .4;
  cursor: not-allowed;
  filter: none !important;
  box-shadow: none;
  transform: none;
}
.tr-switch--off {
  background: rgba(255, 107, 125, .08);
  border: 1px solid rgba(255, 107, 125, .45);
  color: var(--danger);
}
.tr-switch--off:hover { background: rgba(255, 107, 125, .14); border-color: rgba(255, 107, 125, .6); }
.tr-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-dim);
  text-align: center;
}

/* Bloque de traducción DENTRO de la burbuja (original arriba, esto abajo) */
.tr-block {
  display: block;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--edge);
}
.tr-block-label {
  display: block;
  font-size: 11px;
  letter-spacing: .03em;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.tr-block-text {
  display: block;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Preview mágico flotante sobre el input */
.tr-preview-slot {
  position: relative;
  flex: 0 0 auto;
  padding: 0 14px;
}
.tr-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding: 8px 12px;
  border-radius: 14px;
}
.tr-preview-flag { font-size: 16px; flex: 0 0 auto; }
.tr-preview-label {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tr-preview-text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Audios (teatro visual): onda + transcripción escrita --------- */
.audio-bubble {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 210px;
  padding: 10px 14px 8px;
}
.msg-row.me .audio-bubble { border-bottom-right-radius: 4px; }
.msg-row.them .audio-bubble { border-bottom-left-radius: 4px; }
.audio-main { display: flex; align-items: center; gap: 10px; }

.audio-play {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  transition: transform .12s var(--ease), filter .2s var(--ease);
}
.audio-play:hover { filter: brightness(1.08); }
.audio-play:active { transform: scale(.9); }

.audio-track {
  position: relative;
  flex: 1;
  min-width: 90px;
  height: 26px;
  overflow: hidden;
  border-radius: 6px;
}
.audio-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}
.audio-wave span {
  flex: 1;
  min-width: 2px;
  max-width: 3px;
  border-radius: 2px;
  background: var(--ink-dim);
  opacity: .7;
}
.audio-progress {
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--accent-soft);
  border-radius: inherit;
  pointer-events: none;
}
.audio-bubble.playing .audio-progress {
  animation: audio-fill 2s linear both;
}
@keyframes audio-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .audio-bubble.playing .audio-progress { animation: none !important; }
}

.audio-dur {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* Modal/pill/preview/bloques respetan reduced-motion vía .ghost-* y guards */

/* ============================================================
   ADJUNTOS (fotos / videos / archivos — teatro visual)
   ============================================================ */

/* Mini-menú del clip (anclado sobre la barra de escribir) */
.chat-inputbar { position: relative; }
.attach-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 4px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 170px;
  padding: 6px;
  border-radius: 18px;
}
.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s var(--ease);
}
.attach-item:hover { background: var(--glass-strong); }

/* Foto / video: tarjeta con "captura" simulada */
.att-card { padding: 8px 8px 6px; }
.att-shot {
  position: relative;
  width: 220px;
  height: 156px;
  max-width: 100%;
  border: 1px solid var(--edge);
  border-radius: 16px;
  padding: 0;
  background:
    radial-gradient(120% 90% at 20% 15%, var(--accent-soft), transparent 60%),
    radial-gradient(120% 100% at 85% 90%, rgba(255, 255, 255, .10), transparent 55%),
    linear-gradient(150deg, rgba(255, 255, 255, .06), var(--accent-soft));
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .12s var(--ease), filter .2s var(--ease);
}
.att-shot:hover { filter: brightness(1.07); }
.att-shot:active { transform: scale(.98); }
.att-emoji { font-size: 52px; line-height: 1; }
.att-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--glass-strong);
  border: 1px solid var(--edge-hi);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
}
.att-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(4, 5, 8, .55);
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.att-card .msg-time { padding: 0 4px; }

/* Archivo: tarjeta horizontal */
.att-file { min-width: 240px; max-width: 300px; }
.att-file-row { display: flex; align-items: center; gap: 10px; }
.att-file-ico {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: var(--accent-soft);
  border: 1px solid var(--edge);
  display: grid;
  place-items: center;
  font-size: 20px;
}
.att-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.att-file-name {
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-file-size { font-size: 11.5px; color: var(--ink-faint); }
.att-dl {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--glass);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.att-dl:hover { background: var(--glass-strong); border-color: var(--edge-hi); }
.att-dl:active { transform: scale(.9); }

/* Visor fullscreen de foto/video */
.att-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 8, .62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: tr-backdrop-in .22s var(--ease) both;
  transition: opacity .28s var(--ease);
}
.att-viewer-backdrop.is-closing { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .att-viewer-backdrop { animation: none !important; }
}
.att-viewer {
  position: relative;
  width: min(100%, 640px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.att-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}
.att-viewer-shot {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  border: 1px solid var(--edge);
  background:
    radial-gradient(120% 90% at 20% 15%, var(--accent-soft), transparent 60%),
    radial-gradient(120% 100% at 85% 90%, rgba(255, 255, 255, .10), transparent 55%),
    linear-gradient(150deg, rgba(255, 255, 255, .06), var(--accent-soft));
  display: grid;
  place-items: center;
  font-size: clamp(70px, 16vw, 120px);
  line-height: 1;
}
.att-viewer-foot {
  display: flex;
  align-items: center;
  gap: 10px;
}
.att-viewer-bar {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: 1px solid var(--edge);
  overflow: hidden;
}
.att-viewer-fill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--grad-accent, var(--accent));
  border-radius: inherit;
}
.att-viewer.playing .att-viewer-fill { animation: att-progress 3s linear both; }
@keyframes att-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .att-viewer.playing .att-viewer-fill { animation: none !important; }
}
.att-viewer-dur {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   MENÚ CONTEXTUAL DE MENSAJE + DISOLUCIÓN
   ============================================================ */
.msg-menu {
  position: fixed;
  z-index: 90;
  min-width: 160px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 16px;
}
.msg-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  border-radius: 11px;
  cursor: pointer;
  transition: background .15s var(--ease);
}
.msg-menu-item:hover { background: var(--glass-strong); }
.msg-menu-item.is-danger { color: var(--danger); }

/* Las chispas .spark (app.css) se posicionan absolute DENTRO de la burbuja */
.chat-body .bubble.dissolve { position: relative; }

/* ============================================================
   ADENDA E: SELECCIÓN MÚLTIPLE + MODAL DE ELIMINAR + LÁPIDAS
   ============================================================ */

/* Barra de selección: reemplaza al header mientras dura el modo */
.chat-screen.sel-mode .chat-header { display: none; }
.sel-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex: 0 0 auto;
  background: var(--glass-strong);
  border-bottom: 1px solid var(--edge);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
.sel-exit { font-size: 15px; }
.sel-count {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sel-delete {
  padding: 9px 16px;
  font-size: 13.5px;
  border-radius: var(--radius-pill);
  background: rgba(255, 107, 125, .08);
  border: 1px solid rgba(255, 107, 125, .45);
  color: var(--danger);
}
.sel-delete:hover { background: rgba(255, 107, 125, .14); }
.sel-delete:disabled { opacity: .4; cursor: default; }

/* Circulito de check de vidrio al lado de cada burbuja */
.sel-check {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  align-self: center;
  margin-right: 8px;
  border-radius: 50%;
  border: 1px solid var(--edge-hi);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.sel-check:active { transform: scale(.88); }
.sel-check.is-on { background: var(--accent); border-color: var(--accent); }
.chat-screen.sel-mode .bubble[data-mid] { cursor: pointer; }
.bubble.is-selected {
  box-shadow: inset 0 0 0 999px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

/* Lápida: "este mensaje fue eliminado" — fantasmal */
.tomb {
  background: rgba(255, 255, 255, .02);
  border: 1px dashed var(--edge);
}
.tomb-text {
  display: block;
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-faint);
}

/* Modal de eliminar (hereda el patrón espacial de .tr-modal) */
.del-modal { width: min(100%, 360px); gap: 12px; }
.del-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.25;
}
.del-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-faint);
}
.del-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}
.del-actions .btn { width: 100%; }
.del-all {
  background: rgba(255, 107, 125, .08);
  border-color: rgba(255, 107, 125, .45);
  color: var(--danger);
}
.del-all:hover { background: rgba(255, 107, 125, .14); }
.del-cancel { background: transparent; }

/* ============================================================
   DESKTOP (>= 900px): MENOS CUADRADO, MÁS ESPACIAL
   Columna centrada de 800px + header e input flotantes.
   Mobile queda EXACTAMENTE igual.
   ============================================================ */
@media (min-width: 900px) {
  .chat-screen {
    inset: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Header flotante: pill de vidrio suspendida sobre el fondo */
  .chat-header {
    width: min(100% - 32px, 800px);
    margin: 16px auto 0;
    border: 1px solid var(--edge);
    border-radius: 24px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .18),
      0 18px 44px rgba(0, 0, 0, .38);
  }

  /* La barra de selección flota igual que el header al que reemplaza */
  .sel-bar {
    width: min(100% - 32px, 800px);
    margin: 16px auto 0;
    border: 1px solid var(--edge);
    border-radius: 24px;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .18),
      0 18px 44px rgba(0, 0, 0, .38);
  }

  /* Toda la conversación vive en la columna centrada */
  .tr-region {
    width: min(100% - 32px, 800px);
    margin: 0 auto;
    padding: 0 4px;
  }
  .chat-body {
    padding: 22px max(16px, calc((100% - 800px) / 2)) 10px;
    gap: 14px;
  }
  .bubble { border-radius: 20px; }
  .chat-chips {
    width: min(100% - 32px, 800px);
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
  }
  .tr-preview-slot {
    width: min(100% - 32px, 800px);
    margin: 0 auto;
    padding: 0 4px;
  }

  /* Input flotante con glow de acento al foco */
  .chat-inputbar {
    width: min(100% - 32px, 800px);
    margin: 10px auto 18px;
  }
  .chat-inputbar:focus-within {
    border-color: var(--accent);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .18),
      0 0 0 3px var(--accent-soft),
      0 10px 34px -6px var(--accent-glow);
  }
}

/* Adenda G — toggle "Enviar solo lo traducido" (conversación limpia) */
.tr-clean {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin-top: 4px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--edge);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.tr-clean:hover { background: var(--glass-strong); }
.tr-clean.is-on { border-color: var(--accent); background: var(--accent-soft); }
.tr-clean-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tr-clean-title { font-size: 13.5px; font-weight: 650; }
.tr-clean-sub { font-size: 11.5px; color: var(--ink-faint); line-height: 1.45; }
.tr-clean-knob {
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--edge-hi);
  position: relative;
  transition: background .2s var(--ease);
}
.tr-clean-knob::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink-dim);
  transition: transform .22s var(--ease), background .22s var(--ease);
}
.tr-clean.is-on .tr-clean-knob { background: var(--grad-accent); }
.tr-clean.is-on .tr-clean-knob::after { transform: translateX(18px); background: var(--bg); }

/* ---- Bloqueo (anti-spam / anti-acoso) ---------------------- */
.blocked-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  margin: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  padding: 14px 18px;
  border-radius: var(--radius-card);
  background: rgba(255, 107, 125, .08);
  border: 1px solid rgba(255, 107, 125, .35);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.blocked-bar-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-dim); }
.blocked-bar-text b { color: var(--ink); }
.blocked-bar .btn { flex: 0 0 auto; }
@media (min-width: 900px) {
  .blocked-bar { width: min(100% - 32px, 800px); margin-inline: auto; margin-bottom: 18px; }
}
.block-toggle.is-blocked { background: rgba(255, 107, 125, .14); border-color: rgba(255, 107, 125, .5); }
.avatar--blocked { filter: grayscale(1); opacity: .6; }
.chat-sub--blocked { color: var(--danger); }

/* ---- Tildes: entregado / leído -------------------------------- */
.tildes {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  vertical-align: -1px;
  line-height: 1;
}

.tildes-reloj {
  font-size: .72em;
  opacity: .55;
}

.tildes-enviado,
.tildes-entregado {
  color: currentColor;
  opacity: .55;
}

/* Leído: el celeste de GloxPin, igual que el resto de la marca. */
.tildes-leido {
  color: var(--brand, #4fe3cf);
  opacity: 1;
  animation: tildeLeida .4s ease-out;
}

@keyframes tildeLeida {
  from { transform: scale(.7); opacity: .3; }
  to   { transform: scale(1);  opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tildes-leido { animation: none; }
}
