/* chat.css — live-chat UI layer. Sits on theme.css variables:
   --bg-0 (deep aubergine), --gold, --rose, --ink. Mobile-first, single column. */

.chat-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- header ---- */
.chat-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(13, 10, 26, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(232, 184, 75, 0.25);
}
.chat-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold, #e8b84b);
}
.chat-head strong {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: var(--ink, #f4f0ff);
}
.chat-status {
  font-size: 0.78rem;
  color: rgba(216, 205, 240, 0.65);
}
.chat-status.is-online::before,
.chat-status.is-typing::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #59d98c;
  margin-right: 6px;
  box-shadow: 0 0 6px rgba(89, 217, 140, 0.8);
}
.chat-status.is-connecting::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #b9a7d8;
  margin-right: 6px;
  animation: chatPulse 1.2s ease-in-out infinite;
}
@keyframes chatPulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---- log ---- */
.chat-log {
  flex: 1;
  padding: 18px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  scrollbar-width: none; /* auto-scrolled chat: bar only flickers in during bubble overflow */
}
.chat-log::-webkit-scrollbar { display: none; }
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: bubbleIn 0.35s ease;
}
.chat-row.no-anim { animation: none; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-mini-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(232, 184, 75, 0.5);
}
.chat-bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink, #f4f0ff);
  overflow-wrap: anywhere;
}
.from-seer .chat-bubble {
  background: rgba(46, 32, 84, 0.85);
  border: 1px solid rgba(232, 184, 75, 0.22);
  border-bottom-left-radius: 4px;
}
.from-seer .chat-bubble em { color: var(--gold, #e8b84b); font-style: italic; }
.from-seer .chat-bubble strong { color: var(--gold, #e8b84b); }
.from-user {
  justify-content: flex-end;
}
.from-user .chat-bubble {
  background: linear-gradient(135deg, rgba(232, 184, 75, 0.92), rgba(212, 158, 47, 0.92));
  color: #241537;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

/* typing indicator */
.is-typing .chat-bubble, .chat-row.is-typing .chat-bubble { padding: 14px 16px; }
.chat-bubble .dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(216, 205, 240, 0.7);
  margin: 0 2px;
  animation: dotBounce 1.2s infinite;
}
.chat-bubble .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-bubble .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* chart embed bubble */
.chart-bubble {
  max-width: 92%;
  padding: 10px;
  background: rgba(13, 10, 26, 0.9);
  border: 1px solid rgba(232, 184, 75, 0.4);
}
.chart-bubble svg { width: 100%; height: auto; }

/* ---- input dock ---- */
.chat-dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(13, 10, 26, 0) 0%, rgba(13, 10, 26, 0.95) 30%);
}
.chat-dock:empty { padding: 6px; }

.chat-input-form {
  display: flex;
  gap: 8px;
}
.chat-input {
  flex: 1;
  padding: 13px 16px;
  border-radius: 24px;
  border: 1px solid rgba(232, 184, 75, 0.45);
  background: rgba(46, 32, 84, 0.9);
  color: var(--ink, #f4f0ff);
  font-size: 1rem;
  outline: none;
}
.chat-input:focus { border-color: var(--gold, #e8b84b); }
.chat-input.is-bad { border-color: #e0607a; }
.chat-input-hint {
  display: none;
  font-size: 0.82rem;
  color: #e8a0b0;
  padding: 0 6px 8px;
}
.chat-input-hint.show { display: block; }
.chat-send {
  padding: 0 22px;
  border: none;
  border-radius: 24px;
  background: var(--gold, #e8b84b);
  color: #241537;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
}

.chat-choices {
  display: grid;
  gap: 8px;
}
.chat-choices.two-up { grid-template-columns: 1fr 1fr; }
.chat-choice {
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(232, 184, 75, 0.5);
  background: rgba(46, 32, 84, 0.92);
  color: var(--ink, #f4f0ff);
  font-size: 0.96rem;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.chat-choice:active { transform: scale(0.98); }
.chat-choice:hover { border-color: var(--gold, #e8b84b); }
.choice-label { display: block; font-weight: 600; }
.choice-sub { display: block; font-size: 0.8rem; color: rgba(216, 205, 240, 0.65); margin-top: 2px; }

.chat-cta {
  display: block;
  text-align: center;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e8b84b, #d49e2f);
  color: #241537 !important;
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(232, 184, 75, 0.35);
  animation: ctaGlow 2s ease-in-out infinite;
}
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 6px 24px rgba(232, 184, 75, 0.35); }
  50% { box-shadow: 0 6px 34px rgba(232, 184, 75, 0.6); }
}

/* ---- lander helpers ---- */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  margin-bottom: 10px;
}
.lead { font-size: 1.05rem; line-height: 1.6; }

/* ---- lander chart-generation panel ---- */
.gen-panel {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}
.gen-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}
.gen-form input {
  padding: 15px 18px;
  border-radius: 12px;
  border: 1px solid rgba(232, 184, 75, 0.45);
  background: rgba(46, 32, 84, 0.9);
  color: var(--ink, #f4f0ff);
  font-size: 1.05rem;
  outline: none;
  width: 100%;
}
.gen-form input:focus { border-color: var(--gold, #e8b84b); }
.gen-form label {
  text-align: left;
  font-size: 0.85rem;
  color: rgba(216, 205, 240, 0.75);
  margin-bottom: -6px;
}
.gen-status {
  margin-top: 14px;
  font-size: 0.95rem;
  color: rgba(216, 205, 240, 0.85);
  min-height: 1.4em;
}
/* 3D treatment for the status line ("Calculating your 22 arcana…"):
   .status-3d = perspective flip-up entrance (re-add the class to replay it
   when the text changes); .status-live = slow 3D sway + gold glow loop that
   runs while the chart is still calculating. */
.gen-status.status-3d {
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--gold-strong, #f4d9a0);
  letter-spacing: 0.02em;
  animation: statusFlip3d 0.9s cubic-bezier(0.2, 1.25, 0.35, 1) both;
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}
.gen-status.status-3d.status-live {
  animation: statusFlip3d 0.9s cubic-bezier(0.2, 1.25, 0.35, 1) both,
             statusSway3d 2.8s ease-in-out 0.9s infinite;
}
@keyframes statusFlip3d {
  0%   { opacity: 0; transform: perspective(420px) rotateX(82deg) translateY(16px) scale(0.86);
         text-shadow: 0 0 0 rgba(232, 184, 75, 0); }
  55%  { opacity: 1; transform: perspective(420px) rotateX(-12deg) translateY(-3px) scale(1.06);
         text-shadow: 0 6px 18px rgba(232, 184, 75, 0.45); }
  78%  { transform: perspective(420px) rotateX(5deg) translateY(1px) scale(0.99); }
  100% { opacity: 1; transform: perspective(420px) rotateX(0deg) translateY(0) scale(1);
         text-shadow: 0 2px 10px rgba(232, 184, 75, 0.25); }
}
@keyframes statusSway3d {
  0%, 100% { transform: perspective(420px) rotateX(0deg) scale(1);
             text-shadow: 0 2px 10px rgba(232, 184, 75, 0.25); }
  50%      { transform: perspective(420px) rotateX(9deg) translateY(-2px) scale(1.025);
             text-shadow: 0 8px 22px rgba(232, 184, 75, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .gen-status.status-3d,
  .gen-status.status-3d.status-live { animation: none; }
}
.seer-online-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(232, 184, 75, 0.45);
  background: rgba(46, 32, 84, 0.75);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  animation: bubbleIn 0.4s ease;
}
.seer-online-card img {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold, #e8b84b);
}
.seer-online-card .online-dot {
  color: #59d98c;
  font-size: 0.82rem;
}
