/* Floating launcher */
.vanda-live-launcher{
  position:fixed;right:24px;bottom:calc(var(--footer,0px) + 18px);z-index:80;
  display:flex;align-items:center;gap:12px;border:0;background:none;color:#fff;
  cursor:pointer;font:inherit;padding:0;max-width:calc(100vw - 32px);
}
.vanda-live-bubble{
  display:grid;gap:4px;text-align:left;background:#153f59;padding:14px 18px;
  border-radius:18px 18px 4px 18px;box-shadow:0 8px 28px #07253424;font-size:14px;
}
.vanda-live-bubble small{font-size:12px;color:#d5e9ef}
.vanda-live-bubble strong{font-weight:700}
.vanda-live-avatar{
  position:relative;display:block;width:64px;height:64px;border:3px solid #fff;
  border-radius:50%;box-shadow:0 5px 22px #0003;flex-shrink:0;background:#e9e6dc;
  /* no overflow:hidden — star badge must stick out past the photo circle */
}
.vanda-live-avatar img,
.vanda-live-avatar video{
  display:block;width:100%;height:100%;object-fit:cover;object-position:34% 30%;border-radius:50%;
}
.vanda-live-avatar>span{
  position:absolute;right:-6px;bottom:-6px;z-index:1;background:#cb4a22;border:2px solid #fff;
  border-radius:50%;width:24px;height:24px;display:block;box-shadow:0 2px 8px #0003;
  pointer-events:none;padding:0;margin:0;font-size:0;line-height:0;overflow:visible;
}
/* Glyph via ::before so optical center is independent of text-node metrics */
.vanda-live-avatar>span::before{
  content:"✦";position:absolute;left:50%;top:50%;
  font-size:20px;line-height:1;color:#fff;
  transform:translate(-50%,-54%);
}

/* Dialog shell — showModal() top layer; do NOT z-index ::backdrop (it can block clicks on ×) */
.vanda-live-dialog{
  padding:0;border:0;border-radius:22px;width:min(960px,calc(100vw - 32px));max-width:960px;
  max-height:calc(100dvh - 24px);color:#17313e;background:#fff;box-shadow:0 24px 90px #0005;overflow:auto;
}
.vanda-live-dialog::backdrop{background:#061823a8;backdrop-filter:blur(6px)}
.vanda-live-header{
  padding:23px 28px;display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid #dce5e8;gap:16px;
}
.vanda-live-header p{margin:0 0 5px;font-size:11px;letter-spacing:.16em;font-weight:700;color:#687c85}
.vanda-live-header h2{font-size:26px;line-height:1.15;margin:0;letter-spacing:-.03em}
.vanda-live-header button{
  border:1px solid #dce5e8;border-radius:50%;background:#fff;color:#17313e;
  cursor:pointer;font-size:28px;width:44px;height:44px;flex-shrink:0;
  display:inline-flex;align-items:center;justify-content:center;
  padding:0;line-height:1;margin:0;
}
.vanda-live-header button span{
  display:block;line-height:1;transform:translateY(-1px);
}
.vanda-live-footer{
  position:relative;z-index:1;padding:18px 28px;border-top:1px solid #dce5e8;display:flex;flex-wrap:wrap;
  gap:12px 22px;align-items:center;background:#f7f9f8;
}
.vanda-live-footer p{flex:1 1 100%;font-size:12px;line-height:1.5;margin:0;color:#61747d}
.vanda-live-footer a{
  font-size:13px;font-weight:600;color:#173f52;text-decoration:underline;
  text-underline-offset:3px;cursor:pointer;pointer-events:auto;
}
.vanda-live-footer a:hover{color:#0d2833}
.vanda-live-dialog [hidden]{display:none!important}
.vanda-live-dialog button:focus-visible,
.vanda-live-launcher:focus-visible,
.vanda-live-dialog a:focus-visible{outline:3px solid #e4a04f;outline-offset:4px}

/* Hero CTA */
.vanda-hero-invite{
  display:flex;align-items:center;flex-wrap:wrap;gap:10px 16px;
  margin:18px 0 0;position:relative;z-index:1;max-width:560px;
}
.vanda-hero-invite>span{font-size:13px;line-height:1.45;color:#fff;flex:1 1 180px}
.vanda-hero-button{
  display:inline-flex;align-items:center;gap:9px;min-height:44px;padding:10px 16px;
  border:1px solid #ffffff80;border-radius:30px;background:#102f41;color:#fff;
  font:650 14px/1.2 Arial,Helvetica,sans-serif;cursor:pointer;flex:0 0 auto;
}
.vanda-hero-button>span{
  font-size:18px;line-height:1;display:inline-flex;align-items:center;justify-content:center;
}
.vanda-hero-button:hover{background:#1d4c61}
.vanda-hero-button:focus-visible,[data-vanda-live-open]:focus-visible{outline:3px solid #e4a04f;outline-offset:4px}

/*
  Anam dialog: only style [open] so closed dialogs stay display:none.
  Width floor avoids negative min() (short viewports) → invisible modal + frozen page.
*/
.vanda-anam-dialog[open]{
  display:flex;flex-direction:column;align-items:stretch;
  box-sizing:border-box;
  /* Compact card: max 720px, also capped by viewport height × 3/2 (safe floor 280px) */
  width:min(720px,calc(100vw - 24px),max(280px,calc((100dvh - 240px) * 1.5)));
  max-width:calc(100vw - 24px);
  max-height:calc(100dvh - 24px);
  /* Critical: flex+height:auto on <dialog> stretches to max-height → empty white under footer */
  height:fit-content;min-height:0;
  margin:auto;
  padding:0;
  border:0;
  border-radius:22px;
  color:#17313e;background:#fff;
  box-shadow:0 24px 90px #0005;
  overflow:auto;-webkit-overflow-scrolling:touch;
  opacity:1;visibility:visible;
}
.vanda-anam-dialog::backdrop{background:#06182399;backdrop-filter:none}
.vanda-anam-dialog .vanda-live-header{
  padding:16px 22px;flex:0 0 auto;position:relative;z-index:2;
}
.vanda-anam-dialog .vanda-live-header button[data-anam-close]{
  position:relative;z-index:3;pointer-events:auto;cursor:pointer;
}
.vanda-anam-dialog .vanda-live-header h2{font-size:24px}
.vanda-anam-dialog .vanda-live-footer{flex:0 0 auto}
.vanda-anam-status{padding:10px 22px;margin:0;font-size:13px;line-height:1.5;color:#526771;flex:0 0 auto}
.vanda-anam-stage,
.vanda-anam-inline{
  position:relative;z-index:0;
  display:flex;justify-content:center;align-items:flex-start;
  width:100%;height:fit-content;min-height:0;
  background:#0f1c24;overflow:hidden;
  flex:0 0 auto;
}
.vanda-anam-stage{flex:0 0 auto}
.vanda-anam-inline{
  width:100%;max-width:min(720px,100%);
  margin-inline:auto;
  border:1px solid #e5e7eb;border-radius:12px;
}
.vanda-anam-stage anam-agent,
.vanda-anam-inline anam-agent{
  display:block;width:100%;height:auto;aspect-ratio:3/2;margin:0;
}

@media(max-width:640px){
  .vanda-live-launcher{right:14px;bottom:calc(var(--footer,0px) + 10px);gap:8px}
  .vanda-live-bubble{padding:10px 12px;font-size:12px}
  .vanda-live-avatar{width:50px;height:50px}
  .vanda-live-dialog{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);border-radius:16px}
  .vanda-live-header{padding:16px 20px}
  .vanda-live-header h2{font-size:23px}
  .vanda-live-footer{padding:16px 22px}
  .vanda-hero-invite{gap:8px;margin-top:14px}
  .vanda-hero-invite>span{flex-basis:100%;font-size:12px}
  /* Mobile: hug content height (no empty white under footer); slightly smaller avatar */
  .vanda-anam-dialog[open]{
    width:calc(100vw - 32px);
    max-width:calc(100vw - 32px);
    height:fit-content;min-height:0;
    max-height:calc(100dvh - 48px);
    border-radius:16px;
  }
  .vanda-anam-dialog .vanda-live-header{padding:10px 14px}
  .vanda-anam-dialog .vanda-live-header h2{font-size:18px}
  .vanda-anam-status{padding:6px 14px;font-size:12px;line-height:1.35}
  .vanda-anam-stage anam-agent{
    max-height:min(38dvh,260px);
    width:min(100%,calc(min(38dvh,260px) * 1.5));
    height:auto;
    margin:0 auto;
    flex:0 0 auto;
  }
  .vanda-anam-dialog .vanda-live-footer{padding:10px 14px;gap:8px 14px}
  .vanda-anam-dialog .vanda-live-footer p{font-size:11px}
  .vanda-anam-dialog .vanda-live-footer a{font-size:12px}
  .vanda-anam-inline anam-agent{
    max-height:min(42dvh,280px);
    width:min(100%,calc(min(42dvh,280px) * 1.5));
    margin:0 auto;
  }
}
