/* Chat de Tarot (Esmeralda) — adaptado a la paleta de Tarotsi */
.ct-page { max-width: 780px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.ct-header { text-align: center; margin-bottom: 1.4rem; }
.ct-title { font-family: 'Literata', Georgia, serif; color: var(--ink); font-size: 2rem; margin: 0 0 .5rem; }
.ct-intro { color: var(--muted); max-width: 46rem; margin: 0 auto; line-height: 1.55; }

.ct-window {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  min-height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  box-shadow: var(--shadow);
}

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

.ct-msg {
  max-width: 85%;
  padding: .6rem .85rem;
  border-radius: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: ct-in .25s ease both;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
}
.ct-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #a5643f, var(--copper));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ct-msg.assistant {
  align-self: flex-start;
  background: #223249;
  border: 1px solid var(--line);
  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; border: 1px solid var(--line); box-shadow: var(--shadow); }
.ct-cards figcaption { font-size: .72rem; margin-top: .3rem; color: #e0c688; font-family: 'Literata', Georgia, serif; }

/* Indicador de "escribiendo…" */
.ct-typing { display: flex; gap: .3rem; padding: .7rem .5rem 0; }
.ct-typing[hidden] { display: none; } /* display:flex pisa al atributo hidden */
.ct-typing span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--sage);
  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: 10px;
  padding: .65rem .8rem;
  font: inherit;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
}
.ct-input:focus { outline: 2px solid var(--sage); }
.ct-send {
  white-space: nowrap;
  font-family: 'Literata', Georgia, serif;
  letter-spacing: .03em;
  background: var(--copper);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: .65rem 1.2rem;
  cursor: pointer;
  transition: filter .18s ease;
}
.ct-send:hover { filter: brightness(1.12); }
.ct-send:disabled { opacity: .55; cursor: progress; }

.ct-actions { text-align: center; margin-top: .8rem; }
.ct-restart {
  background: transparent;
  color: var(--sage);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .5rem 1.1rem;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  transition: background .18s ease;
}
.ct-restart:hover { background: var(--sage-2); }
.ct-restart:disabled { opacity: .55; }
.ct-disclaimer { text-align: center; font-size: .8rem; color: var(--muted); opacity: .8; 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; }
  .ct-title { font-size: 1.5rem; }
}

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