/* Lady of Fortune Psychic Bot - widget styles (scoped with .lof-) */
.lof-launch, .lof-panel {
  --lof-violet: #1F1235;
  --lof-purple: #3D2A5C;
  --lof-lavender: #9B7EBD;
  --lof-gold: #C9A227;
  --lof-gold-light: #E8D48B;
  --lof-bg: #FFFCFA;
  --lof-cream: #F6F1E8;
  --lof-ink: #2A2438;
  --lof-muted: #6B6578;
  --lof-line: rgba(61, 42, 92, 0.14);
  --lof-bot: #F3EEF8;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---------- launcher ---------- */
.lof-launch {
  position: fixed; right: 20px; bottom: 20px; z-index: 9998;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 18px 6px 6px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--lof-violet), var(--lof-purple));
  color: #fff; font-size: 0.92rem; font-weight: 600; letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(31, 18, 53, 0.35);
  transition: transform .25s ease, box-shadow .25s ease;
}
.lof-launch:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(31, 18, 53, 0.45); }
.lof-launch:focus-visible { outline: 3px solid var(--lof-gold); outline-offset: 3px; }
.lof-launch__orb {
  position: relative; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: #120a20; box-shadow: 0 0 0 2px var(--lof-gold);
}
.lof-launch__orb::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid rgba(232, 212, 139, 0.55);
  animation: lof-halo 3.2s ease-in-out infinite;
}
.lof-launch__orb img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.lof-open .lof-launch { opacity: 0; pointer-events: none; }
@keyframes lof-halo { 0%, 100% { transform: scale(0.94); opacity: .9; } 50% { transform: scale(1.08); opacity: .2; } }

/* ---------- panel ---------- */
.lof-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--lof-bg); color: var(--lof-ink);
  border: 1px solid var(--lof-line); border-radius: 22px;
  box-shadow: 0 24px 60px rgba(31, 18, 53, 0.28);
  animation: lof-rise .28s ease;
}
.lof-panel[hidden] { display: none; }
@keyframes lof-rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.lof-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px;
  background: radial-gradient(120% 140% at 0% 0%, var(--lof-purple), var(--lof-violet) 70%);
  color: #fff; border-bottom: 1px solid rgba(201, 162, 39, 0.4);
}
.lof-head__img { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 2px var(--lof-gold); background: #120a20; }
.lof-head__text { flex: 1; min-width: 0; }
.lof-head h2 { margin: 0; font: 600 1.08rem/1.2 'Playfair Display', Georgia, serif; color: #fff; }
.lof-head p { margin: 2px 0 0; font-size: 0.75rem; color: var(--lof-gold-light); letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lof-icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
}
.lof-icon-btn:hover { background: rgba(155, 126, 189, 0.18); }
.lof-icon-btn:focus-visible, .lof-chip:focus-visible, .lof-send:focus-visible, .lof-visit:focus-visible, .lof-btn:focus-visible {
  outline: 2px solid var(--lof-gold); outline-offset: 2px;
}
.lof-visit {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px;
  border: 1px solid rgba(232, 212, 139, 0.6); border-radius: 999px;
  background: transparent; color: var(--lof-gold-light); font-size: 0.75rem; font-weight: 600; cursor: pointer;
}
.lof-visit:hover { background: rgba(201, 162, 39, 0.15); }

/* ---------- conversation ---------- */
.lof-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.lof-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 0.92rem; line-height: 1.55; overflow-wrap: anywhere; }
.lof-panel .lof-msg p, .lof-panel .lof-card p { margin: 0 0 .6em; color: inherit; font-size: inherit; line-height: inherit; max-width: none; }
.lof-panel .lof-card p { margin-bottom: 4px; }
.lof-msg p:last-child { margin-bottom: 0; }
.lof-msg--bot { align-self: flex-start; background: var(--lof-bot); border-bottom-left-radius: 4px; }
.lof-msg--user { align-self: flex-end; background: linear-gradient(135deg, var(--lof-purple), var(--lof-violet)); color: #fff; border-bottom-right-radius: 4px; }
.lof-msg strong { color: inherit; }
.lof-msg--bot strong { color: var(--lof-purple); }
.lof-msg__img { display: block; max-width: 100%; max-height: 180px; border-radius: 10px; margin-bottom: 8px; }
.lof-msg__tag { display: block; font-size: .72rem; opacity: .8; margin-bottom: 4px; }

.lof-typing { display: flex; gap: 5px; padding: 14px 16px; }
.lof-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--lof-lavender); animation: lof-dot 1.2s infinite ease-in-out; }
.lof-typing span:nth-child(2) { animation-delay: .15s; }
.lof-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes lof-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }

.lof-card { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--lof-bg); border: 1px solid rgba(201, 162, 39, 0.45); }
.lof-card p { margin: 0 0 4px; font-size: .86rem; }
.lof-card__title { font: 600 .98rem/1.3 'Playfair Display', Georgia, serif; color: var(--lof-purple); }
.lof-card__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lof-btn {
  display: inline-block; padding: 7px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; text-decoration: none;
  background: var(--lof-gold); color: var(--lof-violet); border: 1px solid var(--lof-gold);
}
.lof-btn--ghost { background: transparent; color: var(--lof-purple); border-color: var(--lof-line); }
.lof-btn:hover { filter: brightness(1.05); }

/* ---------- suggestions + composer ---------- */
.lof-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.lof-chips[hidden] { display: none; }
.lof-chip {
  padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: .8rem; font-weight: 500;
  background: transparent; color: var(--lof-purple); border: 1px solid rgba(155, 126, 189, 0.55);
}
.lof-chip:hover { background: var(--lof-bot); border-color: var(--lof-lavender); }

.lof-preview { display: flex; align-items: center; gap: 8px; margin: 0 16px 8px; padding: 6px; border-radius: 12px; background: var(--lof-cream); font-size: .8rem; color: var(--lof-muted); }
.lof-preview[hidden] { display: none; }
.lof-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.lof-preview span { flex: 1; }
.lof-preview__rm { border: 0; background: transparent; color: var(--lof-muted); cursor: pointer; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; }

.lof-compose { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--lof-line); background: var(--lof-bg); }
.lof-compose .lof-icon-btn { color: var(--lof-purple); }
.lof-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lof-input {
  flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 10px 12px;
  border: 1px solid var(--lof-line); border-radius: 14px; background: #fff; color: var(--lof-ink);
  font: inherit; font-size: .92rem; line-height: 1.4;
}
.lof-input:focus { outline: none; border-color: var(--lof-lavender); box-shadow: 0 0 0 3px rgba(155, 126, 189, 0.25); }
.lof-send {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--lof-gold); color: var(--lof-violet);
}
.lof-send:disabled { opacity: .5; cursor: progress; }
.lof-fine { margin: 0; padding: 6px 16px 10px; font-size: .68rem; color: var(--lof-muted); text-align: center; background: var(--lof-bg); }

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .lof-launch { right: 14px; bottom: 14px; }
  .lof-launch__label { display: none; }
  .lof-launch { padding: 6px; }
  .lof-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .lof-input { font-size: 16px; } /* prevents iOS zoom */
}

/* ---------- dark mode ---------- */
@media (prefers-color-scheme: dark) {
  .lof-panel {
    --lof-bg: #1A1128; --lof-cream: #251a38; --lof-ink: #EEE8F5; --lof-muted: #B3A9C4;
    --lof-line: rgba(232, 212, 139, 0.18); --lof-bot: #2A1E40;
  }
  .lof-input { background: #120a20; }
  .lof-msg--bot strong, .lof-card__title, .lof-chip, .lof-btn--ghost, .lof-compose .lof-icon-btn { color: var(--lof-gold-light); }
}

@media (prefers-reduced-motion: reduce) {
  .lof-launch__orb::after, .lof-typing span, .lof-panel { animation: none; }
  .lof-launch, .lof-log { transition: none; scroll-behavior: auto; }
}

@media print { .lof-launch, .lof-panel { display: none !important; } }
