/* template chat and R3 component styles */
.bfa { --bfa-ink: var(--ink, #0d0d0b); --bfa-text: var(--text, #34322e); --bfa-muted: var(--muted, #5f5b55); --bfa-bg: var(--bg, #f7f5f2);
  --bfa-paper: var(--paper, #fff); --bfa-stone: var(--stone, #efebe6); --bfa-line: var(--line, rgba(13,13,11,.12)); --bfa-accent: var(--accent, #9b3c61);
  --bfa-soft: var(--accent-soft, #f1e0e6); --bfa-r: 4px; --bfa-r2: 4px; --bfa-gold: #c9a27a; --bfa-on: #2fa86a;
  --bfa-sb: env(safe-area-inset-bottom, 0px); --bfa-sr: env(safe-area-inset-right, 0px); --bfa-lift: 0px;
  font-family: var(--body, 'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif); color: var(--bfa-text);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.bfa *, .bfa *::before, .bfa *::after { box-sizing: border-box; }
.bfa [hidden] { display: none !important; }
.bfa button { font: inherit; color: inherit; }
.bfa :focus-visible { outline: 2px solid var(--bfa-accent); outline-offset: 2px; }
.bfa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* launcher: highlighted "Ask Viola anything" card */
.bfa-launch { position: fixed; z-index: 80; right: calc(18px + var(--bfa-sr)); bottom: max(calc(18px + var(--bfa-sb)), var(--bfa-lift));
  display: inline-flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px 0 10px; border: 1px solid rgba(201,162,122,.55); border-radius: var(--bfa-r);
  background: var(--bfa-ink); color: #fff !important; cursor: pointer; text-align: left;
  box-shadow: 0 0 0 4px rgba(201,162,122,.14), 0 14px 34px -10px rgba(13,13,11,.45); transition: background-color .2s, border-color .2s, bottom .25s ease, transform .2s; }
.bfa-launch:hover { border-color: var(--bfa-gold); transform: translateY(-1px); }
.bfa-launch-tx { display: flex; flex-direction: column; line-height: 1.15; }
.bfa-launch-t { font-family: var(--heading, 'Playfair Display', Georgia, serif); font-size: 17px; font-style: italic; letter-spacing: .01em; color: #fff; }
.bfa-launch-s { margin-top: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(243,231,218,.72); }
.bfa.is-open .bfa-launch { display: none; }
/* avatar with online dot */
.bfa-av { position: relative; flex: none; display: inline-grid; line-height: 0; }
.bfa-av svg { display: block; }
.bfa-dot { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--bfa-on); border: 2px solid var(--bfa-ink); }
.bfa-dot::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--bfa-on); opacity: 0; animation: bfa-ping 2.4s ease-out infinite; }

/* teaser: pop-up message bubbles above the launcher */
.bfa-teaser { position: fixed; z-index: 81; right: calc(18px + var(--bfa-sr)); bottom: calc(max(calc(18px + var(--bfa-sb)), var(--bfa-lift)) + 74px);
  display: flex; align-items: flex-start; width: min(320px, calc(100vw - 36px)); background: var(--bfa-paper); border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-r); box-shadow: 0 18px 44px -14px rgba(13,13,11,.3); }
.bfa-teaser::after { content: ''; position: absolute; right: 30px; bottom: -7px; width: 12px; height: 12px; background: var(--bfa-paper); border-right: 1px solid var(--bfa-line); border-bottom: 1px solid var(--bfa-line); transform: rotate(45deg); }
.bfa-teaser.is-in { animation: bfa-pop .36s cubic-bezier(.2,.8,.2,1) both; }
.bfa-teaser-msg { flex: 1; display: flex; align-items: flex-start; gap: 12px; text-align: left; background: none; border: 0; padding: 14px 4px 14px 14px; color: var(--bfa-ink); cursor: pointer; }
.bfa-teaser .bfa-dot { border-color: var(--bfa-paper); width: 11px; height: 11px; }
.bfa-teaser-tx { display: flex; flex-direction: column; min-width: 0; }
.bfa-teaser-t { font-weight: 600; font-size: 14.5px; line-height: 1.3; color: var(--bfa-ink); }
.bfa-teaser-s { margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--bfa-muted); }
.bfa-teaser-x { flex: none; width: 36px; height: 36px; margin: 6px 6px 0 0; display: grid; place-items: center; background: none; border: 0; border-radius: var(--bfa-r); color: var(--bfa-muted); cursor: pointer; }
.bfa-teaser-x:hover { background: var(--bfa-stone); color: var(--bfa-ink); }

/* panel */
.bfa-panel { position: fixed; z-index: 95; right: calc(20px + var(--bfa-sr)); bottom: calc(20px + var(--bfa-sb)); width: 400px; height: min(660px, calc(100vh - 110px));
  display: flex; flex-direction: column; background: var(--bfa-bg); border: 1px solid var(--bfa-line); border-radius: var(--bfa-r2); overflow: hidden;
  box-shadow: 0 30px 70px -20px rgba(13,13,11,.4), 0 2px 6px rgba(13,13,11,.06); animation: bfa-in .26s ease both; }
.bfa-panel.is-full { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
.bfa-panel.is-full .bfa-log, .bfa-panel.is-full .bfa-chips, .bfa-panel.is-full .bfa-form, .bfa-panel.is-full .bfa-foot { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
.bfa-head { display: flex; align-items: center; gap: 14px; padding: 14px 10px 14px 16px; background: var(--bfa-ink); color: #fff; flex: none; border-bottom: 1px solid rgba(201,162,122,.35); }
.bfa-mark { width: 42px; height: 42px; }
.bfa-id { flex: 1; min-width: 0; }
.bfa-title { margin: 0; font-family: var(--heading, 'Playfair Display', Georgia, serif); font-weight: 400; font-size: 21px; line-height: 1.15; color: #fff; }
.bfa-sub { margin: 3px 0 0; font-size: 12px; color: rgba(255,255,255,.72); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bfa-online { color: #8fdcb2; font-weight: 600; }
.bfa-ib { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: none; border: 0; border-radius: var(--bfa-r); color: #fff !important; cursor: pointer; }
.bfa-ib:hover { background: rgba(255,255,255,.12); }

.bfa-log { flex: 1; background: linear-gradient(180deg, var(--bfa-stone), var(--bfa-bg) 160px); overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.bfa-msg { max-width: 92%; animation: bfa-in .2s ease both; }
.bfa-msg p { margin: 0 0 8px; overflow-wrap: anywhere; }
.bfa-msg p:last-child { margin-bottom: 0; }
.bfa-bot { align-self: flex-start; background: var(--bfa-paper); border: 1px solid var(--bfa-line); border-radius: var(--bfa-r); padding: 12px 14px; color: var(--bfa-text); box-shadow: 0 6px 18px -12px rgba(13,13,11,.25); }
.bfa-user { align-self: flex-end; background: var(--bfa-ink); color: #fff; border-radius: var(--bfa-r); padding: 10px 14px; }
.bfa-step { padding-left: 2px; margin-bottom: 4px !important; }
.bfa-items { list-style: none; margin: 10px 0 2px; padding: 0; border-top: 1px solid var(--bfa-line); }
.bfa-items li { border-bottom: 1px solid var(--bfa-line); }
.bfa-items .bfa-grp { padding: 10px 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--bfa-muted); border-bottom: 0; }
.bfa-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; color: var(--bfa-ink) !important; text-decoration: none; }
.bfa-item:hover b { color: var(--bfa-accent); }
.bfa-item-l, .bfa-hand-l { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bfa-item b, .bfa-hand-l b { font-weight: 600; font-size: 14px; }
.bfa-item small, .bfa-hand-l small { color: var(--bfa-muted); font-size: 13px; }
.bfa-item svg, .bfa-hand-row svg, .bfa-link svg { flex: none; color: var(--bfa-muted); }
.bfa-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bfa-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--bfa-ink); border-radius: var(--bfa-r);
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bfa-ink) !important; text-decoration: none; background: transparent; }
.bfa-link:hover { border-color: var(--bfa-accent); color: var(--bfa-accent) !important; }
.bfa-link.is-primary { background: var(--bfa-ink); color: #fff !important; }
.bfa-link.is-primary svg { color: #fff; }
.bfa-link.is-primary:hover { background: var(--bfa-accent); border-color: var(--bfa-accent); color: #fff !important; }
.bfa-hand { margin-top: 12px; border: 1px solid var(--bfa-line); border-radius: var(--bfa-r); background: var(--bfa-bg); }
.bfa-hand-h { margin: 0 !important; padding: 10px 14px 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--bfa-muted); }
.bfa-hand-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--bfa-line); color: var(--bfa-ink) !important; text-decoration: none; min-height: 48px; }
.bfa-hand-row:hover b { color: var(--bfa-accent); }
.bfa-typing { display: inline-flex; align-items: center; gap: 5px; padding: 12px 16px; }
.bfa-typing-n { font-style: normal; font-size: 12.5px; color: var(--bfa-muted); margin-right: 4px; }
.bfa-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--bfa-muted); animation: bfa-dot 1s infinite ease-in-out; }
.bfa-typing span:nth-child(2) { animation-delay: .15s; } .bfa-typing span:nth-child(3) { animation-delay: .3s; }

.bfa-chips { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 10px; max-height: 136px; overflow-y: auto; }
.bfa-chip { padding: 7px 11px; min-height: 36px; border: 1px solid var(--bfa-line); border-radius: 3px; background: var(--bfa-paper); font-size: 13px; color: var(--bfa-ink); cursor: pointer; text-align: left; line-height: 1.3; }
.bfa-chip:hover { border-color: var(--bfa-ink); background: var(--bfa-soft); }
/* connecting state */
.bfa-connect { margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 12px; animation: bfa-in .3s ease both; transition: opacity .18s, transform .18s; }
.bfa-connect.is-out { opacity: 0; transform: translateY(-6px); }
.bfa-av-l { margin-bottom: 18px; }
.bfa-av-l .bfa-dot { width: 14px; height: 14px; border-color: var(--bfa-bg); }
.bfa-av-l::before { content: ''; position: absolute; inset: -8px; border: 1px solid var(--bfa-gold); border-radius: 6px; animation: bfa-ring 1.2s ease-out infinite; }
.bfa-connect-t { margin: 0; font-family: var(--heading, 'Playfair Display', Georgia, serif); font-size: 21px; line-height: 1.25; color: var(--bfa-ink); }
.bfa-connect-s { margin: 6px 0 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--bfa-muted); }
.bfa-ell i { display: inline-block; width: 3px; height: 3px; margin-left: 3px; border-radius: 50%; background: currentColor; vertical-align: middle; animation: bfa-dot 1s infinite ease-in-out; }
.bfa-ell i:nth-child(2) { animation-delay: .15s; } .bfa-ell i:nth-child(3) { animation-delay: .3s; }
.bfa-form { flex: none; display: flex; gap: 8px; padding: 10px 16px 8px; border-top: 1px solid var(--bfa-line); background: var(--bfa-bg); }
.bfa-in { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 1px solid var(--bfa-line); border-radius: var(--bfa-r); background: var(--bfa-paper); color: var(--bfa-ink); font: inherit; font-size: 16px; }
.bfa-in:focus { outline: none; border-color: var(--bfa-ink); }
.bfa-send { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--bfa-r); background: var(--bfa-ink); color: #fff !important; cursor: pointer; }
.bfa-send:hover:not([disabled]) { background: var(--bfa-accent); }
.bfa-send[disabled] { opacity: .4; cursor: default; }
.bfa-foot { flex: none; margin: 0; padding: 0 16px calc(10px + var(--bfa-sb)); font-size: 11.5px; color: var(--bfa-muted); }
html.bfa-lock, html.bfa-lock body { overflow: hidden; }

@media (max-width: 640px) {
  .bfa-launch { right: calc(12px + var(--bfa-sr)); bottom: max(calc(12px + var(--bfa-sb)), var(--bfa-lift)); height: 54px; gap: 10px; padding: 0 14px 0 8px; }
  .bfa-launch .bfa-av svg { width: 34px; height: 34px; }
  .bfa-launch-t { font-size: 15.5px; }
  .bfa-launch-s { font-size: 9.5px; letter-spacing: .12em; }
  .bfa-teaser { right: calc(12px + var(--bfa-sr)); bottom: calc(max(calc(12px + var(--bfa-sb)), var(--bfa-lift)) + 66px); width: min(300px, calc(100vw - 24px)); }
  .bfa-panel { inset: 0; width: auto; height: auto; height: 100dvh; border: 0; border-radius: 0; }
  .bfa-fs { display: none; }
  .bfa-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .bfa-msg { max-width: 96%; }
}
@keyframes bfa-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bfa-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes bfa-ping { 0% { opacity: .7; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(2.2); } }
@keyframes bfa-ring { 0% { opacity: .9; transform: scale(.92); } 100% { opacity: 0; transform: scale(1.18); } }
@keyframes bfa-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .bfa *, .bfa *::before, .bfa *::after, .bfa-panel, .bfa-teaser.is-in { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .bfa-typing span { opacity: .6; }
}
@media print { .bfa { display: none !important; } }
@media (max-width: 380px) { .bfa-launch-s { display: none; } .bfa-launch { height: 50px; } }

/* R3: virtual guide tag, joined line, sound button */
.bfa-tag { display: inline-block; vertical-align: 1px; margin-right: 6px; padding: 1px 6px; border: 1px solid rgba(201,162,122,.6); border-radius: 3px; font-family: var(--body, 'Inter Tight', system-ui, sans-serif); font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #e9d3bd; line-height: 1.5; white-space: nowrap; }
.bfa-sys { align-self: center; margin: 2px 0 4px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--bfa-muted, #5f5b55); animation: bfa-in .3s ease both; }
.bfa-sys span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #3fa66b; vertical-align: 1px; }
.bfa-foot-r3 { display: flex; align-items: center; gap: 8px; }
.bfa-foot-r3 p { margin: 0; flex: 1; }
.bfa-mute { flex: none; width: 44px; height: 44px; margin: -8px -10px -8px 0; display: grid; place-items: center; background: none; border: 0; border-radius: 4px; color: var(--bfa-muted, #5f5b55); cursor: pointer; }
.bfa-mute:hover { color: var(--bfa-ink, #0d0d0b); }
.bfa-mute[aria-pressed=true] { color: var(--accent, #9b3c61); }
