/* Tarot-Chat Rider-Waite (Esmeralda).
   Piel NOCTURNA (2026-08-08): mismos selectores y maquetación que la
   versión de WordPress, pero con la paleta del tema — noche #0a0816,
   oro #c9a45c / #e9c87f, lila de la sección chat #d8a8e8. Autónomo:
   valores en duro, sin variables del tema (con su mismo resultado).
   Incluye el mazo interactivo de 78 cartas boca abajo (.ct-deck). */
.ct-page { max-width: 760px; margin: 0 auto; }
.ct-intro { color: #9a92b0; max-width: 46rem; margin: 0 auto 1.2rem; line-height: 1.55; text-align: center; }

.ct-window {
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(201, 164, 92, .30);
  border-radius: 16px;
  padding: 1rem;
  min-height: 320px;
  max-height: 60vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
}

.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;
  color: #f0ebf6;
  font-size: 1rem;
}
.ct-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #46306b, #5a3f85);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ct-msg.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .10);
  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-flipin .55s ease both; animation-delay: var(--d, 0s); perspective: 600px; }
.ct-cards img { width: 88px; border-radius: 8px; border: 1px solid rgba(201, 164, 92, .45); box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.ct-cards figcaption { font-size: .72rem; margin-top: .3rem; color: #d8a8e8; font-family: Georgia, 'Times New Roman', serif; }
/* Posición de la carta en la tirada (pasado / presente / futuro) */
.ct-cards__pos {
  display: block;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #c9a45c;
  margin-bottom: .1rem;
}
/* Las cartas elegidas entran girando, como si se voltearan sobre la mesa */
@keyframes ct-flipin {
  from { opacity: 0; transform: rotateY(95deg) translateY(4px); }
  to   { opacity: 1; transform: rotateY(0) translateY(0); }
}

/* ── Mazo interactivo: 78 dorsos en abanico desplazable ─────────────── */
.ct-deck { align-self: stretch; margin: .4rem 0 .2rem; animation: ct-in .3s ease both; }
.ct-deck__hint {
  text-align: center;
  font-size: .85rem;
  color: #d8a8e8;
  margin: 0 0 .45rem;
}
/* Cartas repartidas sobre la mesa: sin solapado ni scroll — se centran
   solas y saltan de fila cuando no caben (robusto dentro de cualquier
   tema y en cualquier ancho de pantalla). */
.ct-deck__strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem .45rem;
  padding: .7rem .2rem .8rem;
}
.ct-deck__card {
  flex: 0 0 auto;
  width: 56px;
  height: 95px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(201, 164, 92, .55);
  border-radius: 6px;
  background: #182448;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  transition: transform .16s ease, box-shadow .16s ease, opacity .3s ease;
}
/* El dorso es una <img> dentro del botón (así el hover no lo pisa). */
.ct-deck__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  border-radius: inherit;
}
.ct-deck__card:hover img, .ct-deck__card.sel img { filter: brightness(1.12); }
.ct-deck__card:hover, .ct-deck__card:focus-visible { transform: translateY(-8px); z-index: 2; outline: none; }
.ct-deck__card.sel {
  transform: translateY(-14px);
  box-shadow: 0 0 0 2px #c9a45c, 0 8px 18px rgba(0, 0, 0, .5);
  z-index: 3;
}
/* Numerito del orden de elección (1, 2, 3) */
.ct-deck__card.sel::after {
  content: attr(data-n);
  position: absolute;
  top: -9px;
  right: -7px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #c9a45c;
  color: #1a1108;
  font-size: .7rem;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
}
/* Elección completa: el resto del mazo se apaga mientras llega la lectura */
.ct-deck.done .ct-deck__card:not(.sel) { opacity: .4; pointer-events: none; }
.ct-deck.done .ct-deck__card.sel { pointer-events: none; }

/* 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: #d8a8e8;
  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(0, 0, 0, .38);
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  color-scheme: dark;
}
.ct-input::placeholder { color: #9a92b0; }
.ct-input:focus { outline: 2px solid #e9c87f; }
.ct-input:disabled { opacity: .55; cursor: not-allowed; }
.ct-send {
  white-space: nowrap;
  background: linear-gradient(180deg, #f3d9a4, #d9a05c);
  color: #2a1420;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  padding: .65rem 1.3rem;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .4);
  transition: filter .18s ease;
}
.ct-send:hover { filter: brightness(1.07); }
.ct-send:disabled { opacity: .55; cursor: progress; }

.ct-actions { text-align: center; margin-top: .8rem; }
.ct-restart {
  background: transparent;
  color: #e9c87f;
  border: 1px solid rgba(201, 164, 92, .40);
  border-radius: 12px;
  padding: .5rem 1.1rem;
  cursor: pointer;
  font-size: .95rem;
  transition: background .18s ease;
}
.ct-restart:hover { background: rgba(201, 164, 92, .12); }
.ct-restart:disabled { opacity: .55; }
.ct-disclaimer { text-align: center; font-size: .8rem; color: #7d7591; 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; }
  /* En móvil: dos filas de 6 cartas, centradas */
  .ct-deck__strip { gap: .45rem .35rem; }
  .ct-deck__card { width: 44px; height: 75px; }
}

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