/* Chat con la tarotista */
.ct-app { max-width: 760px; margin: 0 auto; }

.ct-window {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  padding: 1rem;
  min-height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.ct-messages { display: flex; flex-direction: column; gap: .65rem; }

.ct-msg {
  max-width: 85%;
  padding: .6rem .85rem;
  border-radius: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: ct-in .25s ease both;
}
.ct-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #7b2cff, #a04dff);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ct-msg.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, .08);
  border-bottom-left-radius: 4px;
}
.ct-msg.assistant::before { content: '🔮 '; }

/* Cursor parpadeante mientras el texto se va "escribiendo" */
.ct-msg.assistant.is-typing::after {
  content: '▍';
  animation: ct-cursor .8s steps(1) infinite;
  opacity: .8;
}
@keyframes ct-cursor { 50% { opacity: 0; } }

@keyframes ct-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tirada de cartas dentro del chat */
.ct-cards {
  align-self: center;
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: .35rem 0;
}
.ct-cards figure { margin: 0; text-align: center; width: 88px; animation: ct-in .4s ease both; animation-delay: var(--d, 0s); }
.ct-cards img { width: 88px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.ct-cards figcaption { font-size: .72rem; margin-top: .3rem; opacity: .85; }

/* Indicador de "escribiendo…" */
.ct-typing { display: flex; gap: .3rem; padding: .7rem .5rem 0; }
/* display:flex pisa al atributo hidden del UA stylesheet: hay que reafirmarlo. */
.ct-typing[hidden] { display: none; }
.ct-typing span {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  animation: ct-dot 1.1s ease-in-out infinite;
}
.ct-typing span:nth-child(2) { animation-delay: .18s; }
.ct-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes ct-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* Formulario */
.ct-form { display: flex; gap: .6rem; margin-top: .9rem; align-items: flex-end; }
.ct-input {
  flex: 1;
  resize: none;
  border-radius: 12px;
  padding: .65rem .8rem;
  font: inherit;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .15);
  color: inherit;
}
.ct-input:focus { outline: 2px solid #7b2cff; }
.ct-send { white-space: nowrap; font-family: 'Cinzel', 'Times New Roman', serif; letter-spacing: .04em; }
.ct-send:disabled { opacity: .6; cursor: progress; }

.ct-actions { text-align: center; margin-top: .8rem; }
.ct-disclaimer { text-align: center; font-size: .8rem; opacity: .65; margin-top: 1rem; }

@media (max-width: 560px) {
  .ct-window { max-height: 55vh; }
  .ct-msg { max-width: 92%; }
  .ct-cards figure, .ct-cards img { width: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .ct-msg, .ct-cards figure { animation: none; }
  .ct-window { scroll-behavior: auto; }
}
