:root {
  --cf-ink-950: #0c0a09;
  --cf-ink-900: #1c1917;
  --cf-ink-700: #44403c;
  --cf-ink-300: #d4cec5;
  --cf-ink-100: #f5f3f0;
  --cf-gold-300: #ebc878;
  --cf-gold-400: #e0ad45;
  --cf-gold-500: #ca8a04;
  --cf-shadow: 0 8px 16px rgba(28, 25, 23, 0.08), 0 24px 48px -12px rgba(28, 25, 23, 0.28);
}

.cf-root { position: fixed; bottom: 24px; right: 24px; z-index: 2147483000;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.cf-hidden { display: none !important; }

.cf-fab {
  width: 64px; height: 64px; border-radius: 9999px; border: none; cursor: pointer;
  background: var(--cf-ink-900); color: var(--cf-gold-300);
  box-shadow: var(--cf-shadow); display: flex; align-items: center; justify-content: center;
  ring: 1px; outline: 1px solid rgba(202,138,4,0.3); transition: transform .2s cubic-bezier(.23,1,.32,1);
}
.cf-fab:hover { transform: translateY(-2px) scale(1.04); }
.cf-fab:active { transform: scale(.96); }

.cf-panel {
  position: absolute; bottom: 80px; right: 0; width: min(94vw, 380px);
  height: min(72vh, 580px); display: flex; flex-direction: column;
  background: rgba(250,249,247,.92); backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid rgba(212,206,197,.7); border-radius: 24px; overflow: hidden;
  box-shadow: var(--cf-shadow); animation: cf-in .35s cubic-bezier(.16,1,.3,1);
}
@keyframes cf-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.cf-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; color: #fff;
  background:
    radial-gradient(600px 200px at 90% -40%, rgba(202,138,4,.25), transparent 60%),
    var(--cf-ink-950);
}
.cf-id { display: flex; align-items: center; gap: 10px; }
.cf-dot { width: 9px; height: 9px; border-radius: 9999px; background: var(--cf-gold-400);
  box-shadow: 0 0 0 0 rgba(224,173,69,.6); }
.cf-title { font-family: "Playfair Display", Georgia, serif; font-size: 15px; font-weight: 600; line-height: 1.2; }
.cf-sub { font-size: 11px; color: var(--cf-ink-300); margin-top: 2px; }
.cf-x { background: none; border: none; color: var(--cf-ink-300); font-size: 22px; cursor: pointer; line-height: 1; }
.cf-x:hover { color: #fff; }

.cf-body { padding: 14px 14px 6px; text-align: center;
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.cf-orb { position: relative; width: 52px; height: 52px; margin: 2px auto 8px; flex: 0 0 auto; }
.cf-orb span {
  position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 9999px;
  background: radial-gradient(circle at 50% 40%, var(--cf-gold-300), var(--cf-gold-500));
  opacity: .9;
}
.cf-orb span:nth-child(2) { filter: blur(8px); opacity: .35; }
.cf-orb span:nth-child(3) { transform: scale(.6); background: var(--cf-ink-900); opacity: 1; }
.cf-orb.cf-live span:nth-child(1) { animation: cf-pulse 2.4s ease-in-out infinite; }
.cf-orb.cf-speak span:nth-child(2) { animation: cf-pulse 1s ease-in-out infinite; }
@keyframes cf-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.cf-status { font-size: 12px; color: var(--cf-ink-500); min-height: 16px; flex: 0 0 auto; }
/* Chat transcript — fills the panel and scrolls smoothly (iMessage / Telegram style) */
.cf-caption { margin-top: 10px; flex: 1 1 auto; min-height: 0; overflow-y: auto;
  scroll-behavior: smooth; text-align: left; display: flex; flex-direction: column; gap: 7px;
  padding: 2px 2px 4px; -webkit-overflow-scrolling: touch; }
.cf-caption::-webkit-scrollbar { width: 6px; }
.cf-caption::-webkit-scrollbar-thumb { background: rgba(168,160,151,.5); border-radius: 9999px; }
.cf-caption .cf-u, .cf-caption .cf-a {
  font-size: 13.5px; line-height: 1.45; padding: 8px 13px; border-radius: 18px;
  max-width: 84%; word-wrap: break-word; box-shadow: 0 1px 1px rgba(28,25,23,.05);
  animation: cf-msg .2s ease-out both; }
@keyframes cf-msg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cf-caption .cf-u { align-self: flex-end; background: var(--cf-ink-900); color: #fff; border-bottom-right-radius: 5px; }
.cf-caption .cf-a { align-self: flex-start; background: #fff; color: var(--cf-ink-900);
  border: 1px solid var(--cf-ink-100); border-bottom-left-radius: 5px; }

.cf-foot { padding: 14px 18px 18px; }
.cf-talk {
  width: 100%; padding: 13px; border: none; border-radius: 9999px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--cf-ink-950);
  background: linear-gradient(90deg, var(--cf-gold-400), var(--cf-gold-500));
  transition: transform .14s cubic-bezier(.23,1,.32,1), filter .2s; }
.cf-talk:hover { filter: brightness(1.05); }
.cf-talk:active { transform: scale(.98); }

@media (prefers-reduced-motion: reduce) {
  .cf-panel, .cf-orb span { animation: none !important; }
  .cf-fab, .cf-talk { transition: none !important; }
}
