/* Reader Chat — premium mystical tarot UI (shell) */

:root {
  --tc-rc-night: #0c0a0f;
  --tc-rc-night-2: #16121c;
  --tc-rc-ink: #f3ebe0;
  --tc-rc-muted: rgba(243, 235, 224, 0.72);
  --tc-rc-gold: #c9a227;
  --tc-rc-gold-soft: #e8d5a3;
  --tc-rc-parchment: #e8dcc4;
  --tc-rc-parchment-ink: #2a2218;
  --tc-rc-user: #3a2f1f;
  --tc-rc-line: rgba(201, 162, 39, 0.28);
}

/* CTA banner (post-reading / shortcode) */
.tc-reader-chat-cta {
  margin: 1.5rem 0;
  padding: 1.5rem 1.15rem;
  border-radius: 18px;
  border: 1px solid var(--tc-rc-line);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 162, 39, 0.18), transparent 55%),
    linear-gradient(165deg, #141019 0%, #1c1624 50%, #100e14 100%);
  color: var(--tc-rc-ink);
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.tc-reader-chat-cta__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  color: var(--tc-rc-gold);
}

.tc-reader-chat-cta__title {
  margin: 0 0 0.55rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--tc-rc-gold-soft);
  letter-spacing: 0.02em;
}

.tc-reader-chat-cta__body,
.tc-reader-chat-cta__cost {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--tc-rc-muted);
}

.tc-reader-chat-cta__btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.55);
  background: linear-gradient(180deg, #d4b45a 0%, #b8922a 100%);
  color: #1a140a !important;
  font-weight: 700;
  text-decoration: none !important;
  letter-spacing: 0.03em;
}

.tc-reader-chat-cta__btn:hover {
  filter: brightness(1.06);
}

/* Home mini-nav badge */
.tc-app-mini-nav__chat {
  position: relative;
}

.tc-app-mini-nav__chat-badge {
  display: inline-block;
  margin-left: 0.35rem;
  min-width: 1.15rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--tc-rc-gold, #c9a227);
  color: #1a140a;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}

/* Chat shell */
.tc-reader-chat {
  --tc-rc-radius: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: min(100dvh, 760px);
  max-width: 640px;
  margin: 0 auto;
  color: var(--tc-rc-ink);
  border-radius: var(--tc-rc-radius);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(201, 162, 39, 0.12), transparent 45%),
    radial-gradient(ellipse at 80% 100%, rgba(120, 90, 40, 0.1), transparent 40%),
    linear-gradient(180deg, var(--tc-rc-night-2) 0%, var(--tc-rc-night) 100%);
  border: 1px solid var(--tc-rc-line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.tc-reader-chat__veil {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  z-index: 0;
}

.tc-reader-chat__header,
.tc-reader-chat__origin,
.tc-reader-chat__thread,
.tc-reader-chat__error,
.tc-reader-chat__composer,
.tc-reader-chat__buy {
  position: relative;
  z-index: 1;
}

.tc-reader-chat__header {
  padding: 1rem 1.05rem 0.85rem;
  border-bottom: 1px solid var(--tc-rc-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.tc-reader-chat__identity {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.tc-reader-chat__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(201, 162, 39, 0.45);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.08);
}

.tc-reader-chat__avatar--fallback {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #3a3228, #1a1612);
}

.tc-reader-chat__sigil {
  color: var(--tc-rc-gold);
  font-size: 1.35rem;
}

.tc-reader-chat__kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tc-rc-gold);
}

.tc-reader-chat__title {
  margin: 0.15rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--tc-rc-gold-soft);
  font-weight: 700;
}

.tc-reader-chat__status {
  margin: 0.3rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--tc-rc-muted);
}

.tc-reader-chat__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8fbf7a;
  box-shadow: 0 0 8px rgba(143, 191, 122, 0.7);
}

.tc-reader-chat__wallet {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  font-size: 0.82rem;
  color: var(--tc-rc-muted);
}

.tc-reader-chat__balance strong {
  color: var(--tc-rc-gold-soft);
  font-size: 1.05em;
}

.tc-reader-chat__badge {
  display: inline-block;
  margin-left: 0.35rem;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--tc-rc-gold);
  color: #1a140a;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.tc-reader-chat__origin {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin: 0.75rem 0.9rem 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--tc-rc-line);
  background: rgba(232, 220, 196, 0.08);
}

.tc-reader-chat__origin-seal {
  color: var(--tc-rc-gold);
  line-height: 1.4;
  flex-shrink: 0;
}

.tc-reader-chat__origin-text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--tc-rc-parchment);
  font-family: Georgia, "Times New Roman", serif;
}

.tc-reader-chat__thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.9rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.tc-reader-chat__bubble {
  max-width: 86%;
  padding: 0.75rem 0.95rem;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  animation: tcRcIn 0.28s ease-out;
}

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

.tc-reader-chat__bubble--user {
  align-self: flex-end;
  background: linear-gradient(165deg, #4a3b28 0%, var(--tc-rc-user) 100%);
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-bottom-right-radius: 5px;
  color: var(--tc-rc-gold-soft);
}

.tc-reader-chat__bubble--tarot_reader {
  align-self: flex-start;
  background: linear-gradient(165deg, #f0e6d2 0%, var(--tc-rc-parchment) 100%);
  color: var(--tc-rc-parchment-ink);
  border: 1px solid rgba(90, 70, 40, 0.2);
  border-bottom-left-radius: 5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.tc-reader-chat__bubble--system {
  align-self: center;
  max-width: 92%;
  background: transparent;
  border: 0;
  color: var(--tc-rc-muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  text-align: center;
  padding: 0.35rem 0.5rem;
}

.tc-reader-chat__meta {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.68rem;
  opacity: 0.65;
  font-family: system-ui, sans-serif;
}

.tc-reader-chat__bubble--tarot_reader .tc-reader-chat__meta {
  color: rgba(42, 34, 24, 0.65);
}

.tc-reader-chat__composer {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  padding: 0.7rem 0.8rem calc(0.7rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--tc-rc-line);
  background: rgba(12, 10, 15, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  bottom: 0;
}

.tc-reader-chat__composer textarea {
  flex: 1;
  resize: none;
  min-height: 46px;
  max-height: 130px;
  border-radius: 14px;
  border: 1px solid rgba(201, 162, 39, 0.28);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.tc-reader-chat__composer textarea:focus {
  outline: none;
  border-color: rgba(201, 162, 39, 0.55);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.15);
}

.tc-reader-chat__send {
  min-width: 76px;
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #d4b45a 0%, #b8922a 100%);
  color: #1a140a;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.tc-reader-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tc-reader-chat__error {
  margin: 0 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(120, 30, 30, 0.55);
  color: #ffd7d7;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 120, 120, 0.25);
}

.tc-reader-chat__buy {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.tc-reader-chat__shop-btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: var(--tc-rc-gold-soft) !important;
  text-decoration: none !important;
  font-size: 0.88rem;
  font-weight: 600;
}

.tc-reader-chat__shop-btn:hover {
  background: rgba(201, 162, 39, 0.12);
}

@media (min-width: 768px) {
  .tc-reader-chat {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
  }
}
