/* Assistant panel — the Tavus conversation, restyled ("Assistant Panel" in the
   design). A bottom sheet on phones, a floating panel on desktop. */

.ap-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(21, 23, 28, 0.5); }
.ap { position: fixed; z-index: 51; display: flex; flex-direction: column; background: var(--white); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(21, 23, 28, 0.16); overflow: hidden; font-family: var(--font);
  inset: 44px 0 0 0; border-radius: 4px 4px 0 0; }
.ap-handle { flex: none; height: 28px; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
.ap-handle span { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); }
.ap-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 16px 12px; border-bottom: 1px solid var(--line); }
.ap-titles { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.ap-titles h2 { margin: 0; font-weight: 800; font-size: 19px; line-height: 1.3; }
.ap-titles .badge { font-size: 13px; }
.ap-timer { font-weight: 600; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ap-head .icon-btn { margin-inline-end: -8px; color: var(--ink); }
.ap-head .icon-btn i { font-size: 24px; }
.ap-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.ap-foot { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 16px max(0px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 14px; line-height: 1.7; color: var(--muted); }
.ap-foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue); }

.ap-poster { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 30%; border-radius: 4px; background: var(--tint); }
.ap-lead { margin: 16px 0 0; font-weight: 500; font-size: 20px; line-height: 1.8; }
.ap .chips { margin-top: 12px; }
.ap-start { margin-top: 16px; }
.ap-note { margin: 10px 0 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; line-height: 1.7; color: var(--muted); text-align: center; }
.ap-note i { font-size: 18px; }
.ap-alt { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; color: var(--blue); font-weight: 600; font-size: 16px; text-underline-offset: 5px; }
.ap-stack { display: grid; gap: 10px; margin-top: 20px; }

/* device check */
.ap-check { display: grid; gap: 22px; }
.ap-field { display: grid; gap: 8px; }
.ap-field label, .ap-field .lbl { font-weight: 600; font-size: 17px; line-height: 1.7; }
.ap-select { min-height: 48px; width: 100%; border: 1.5px solid var(--line-strong); border-radius: 4px; padding: 0 12px; font-family: var(--font); font-size: 17px; color: var(--ink); background: var(--white); }
.ap-meter { display: flex; gap: 4px; height: 28px; }
.ap-meter span { flex: 1; border-radius: 4px; background: var(--line); transition: background-color 80ms linear; }
.ap-meter span.on { background: var(--blue); }
.ap-switchrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ap-switchrow .sub { font-size: 15px; line-height: 1.7; color: var(--muted); }
.ap-switch { width: 64px; height: 44px; padding: 7px 6px; background: transparent; border: 0; cursor: pointer; flex: none; }
.ap-switch .track { display: block; position: relative; width: 52px; height: 30px; border-radius: 4px; background: var(--line-strong); transition: background-color 150ms ease; }
.ap-switch .knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 4px; background: var(--white); transition: inset-inline-start 150ms var(--ease-out); }
.ap-switch[aria-checked="true"] .track { background: var(--blue); }
.ap-switch[aria-checked="true"] .knob { inset-inline-start: 25px; }
.ap-campreview { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: var(--tint); transform: scaleX(-1); }

/* connecting */
.ap-pulse { aspect-ratio: 3 / 4; animation: ap-pulse 1100ms ease-in-out infinite alternate; }
@keyframes ap-pulse { from { opacity: 1; } to { opacity: 0.7; } }
.ap-status { margin: 18px 0 0; text-align: center; font-weight: 600; font-size: 18px; line-height: 1.7; }

/* live */
.ap-weak { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 4px; margin-bottom: 8px; background: var(--tint); border-radius: 4px; font-weight: 500; font-size: 16px; line-height: 1.7; }
.ap-weak > i { font-size: 22px; flex: none; margin-inline-start: 8px; }
.ap-weak span { flex: 1; }
.ap-weak .icon-btn { flex: none; color: var(--ink); }
.ap-weak .icon-btn i { font-size: 20px; }
.ap-stage { position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: var(--ink); }
.ap-stage video { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.ap-capline { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; min-height: 62px; }
.ap-wave { display: flex; align-items: center; gap: 3px; height: 29px; flex: none; }
.ap-wave span { width: 3px; height: 18px; background: var(--blue); transform: scaleY(0.3); transform-origin: center; }
.ap-wave.on span { animation: ap-wave 420ms ease-in-out infinite alternate; }
.ap-wave.on span:nth-child(2) { animation-duration: 510ms; animation-delay: 70ms; }
.ap-wave.on span:nth-child(3) { animation-duration: 600ms; animation-delay: 140ms; }
.ap-wave.on span:nth-child(4) { animation-duration: 690ms; animation-delay: 210ms; }
@keyframes ap-wave { from { transform: scaleY(0.3); } to { transform: scaleY(1); } }
.ap-cap { flex: 1; min-width: 0; max-height: 62px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.ap-cap p { margin: 0; font-weight: 500; font-size: 18px; line-height: 1.7; }
.ap-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ap-tool { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 2px; background: var(--white); border: 1.5px solid var(--line); border-radius: 4px; color: var(--blue); font-family: var(--font); font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; transition: transform 120ms var(--ease-out), background-color 150ms ease; }
.ap-tool i { font-size: 24px; }
.ap-tool:active { transform: scale(0.97); }
.ap-tool[aria-pressed="true"] { background: var(--tint); border-color: var(--blue); }
.ap-tool.end { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 700; }
@media (hover: hover) { .ap-tool:hover { background: var(--tint); } .ap-tool.end:hover { background: #9A2A1A; } }

/* ended */
.ap-ended-title { margin: 8px 0 0; font-weight: 800; font-size: 26px; line-height: 1.3; }
.ap-fb { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.ap-fb p { margin: 0; font-weight: 600; font-size: 17px; line-height: 1.7; }
.ap-fb .row { display: flex; gap: 8px; margin-top: 10px; }
.ap-fb button { min-width: 88px; min-height: 44px; padding: 0 16px; background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 4px; font-family: var(--font); font-weight: 600; font-size: 16px; color: var(--ink); cursor: pointer; }
.ap-fb button[aria-pressed="true"] { background: var(--tint); border-color: var(--blue); }
.ap-fb .thanks { margin: 10px 0 0; font-weight: 400; font-size: 15px; color: var(--muted); }

/* problems */
.ap-alert { display: grid; gap: 16px; padding-top: 8px; }
.ap-alert .ic { width: 56px; height: 56px; border-radius: 4px; background: var(--tint); display: flex; align-items: center; justify-content: center; }
.ap-alert .ic i { font-size: 30px; }
.ap-alert p { margin: 0; font-weight: 500; font-size: 19px; line-height: 1.8; }

/* minimised floating video */
.ap-mini { position: fixed; z-index: 49; width: 120px; background: var(--ink); border-radius: 4px; overflow: hidden; box-shadow: 0 6px 20px rgba(21, 23, 28, 0.25); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.ap-mini .ap-ministage { height: 150px; }
.ap-mini video { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; pointer-events: none; }
.ap-mini .bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--blue); color: var(--white); font-weight: 600; font-size: 13px; line-height: 1.4; }
.ap-mini .bar .ap-wave { height: 16px; gap: 2px; }
.ap-mini .bar .ap-wave span { width: 2px; height: 12px; background: var(--white); }
.ap-mini .bar .t { white-space: nowrap; overflow: hidden; }

/* floating avatar (pages with <body data-ap-float>): a borderless face at the
   bottom centre, about an eighth of the screen; sized by assistant.js. */
.ap-float { position: fixed; z-index: 45; left: 50%; bottom: 10vh; transform: translateX(-50%); width: var(--fw, 180px); height: var(--fh, 240px); pointer-events: none; }
.ap-float > * { pointer-events: auto; }
.ap-float-stage { position: absolute; inset: 0; overflow: hidden; border-radius: 50% 50% 46% 46% / 40% 40% 60% 60%;
  -webkit-mask-image: radial-gradient(closest-side, #000 74%, transparent 100%); mask-image: radial-gradient(closest-side, #000 74%, transparent 100%); }
.ap-float-stage img, .ap-float-stage video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.ap-float:not(.is-live) .ap-float-poster { animation: ap-pulse 1100ms ease-in-out infinite alternate; }
.ap-float-acts { position: absolute; top: 3%; inset-inline: 3%; display: flex; justify-content: space-between; }
.ap-fbtn { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(10, 11, 15, 0.62); color: #fff; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ap-fbtn i { font-size: 22px; }
.ap-fbtn[aria-pressed="true"] { background: var(--red); border-color: var(--red); }
.ap-float-hear { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--blue); color: #fff; font-family: var(--font); font-weight: 700; font-size: 16px; white-space: nowrap; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.ap-float-hear i { font-size: 20px; }
.ap-float-note { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin: 6px 0 0; display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(10, 11, 15, 0.8); color: #fff; font-size: 14px; line-height: 1.5; white-space: nowrap; }
.ap-float-foot { display: none; }
/* full screen */
.ap-float.is-full { z-index: 70; inset: 0; left: 0; bottom: 0; width: auto; height: auto; transform: none; background: #000; pointer-events: auto; }
.ap-float.is-full .ap-float-stage { border-radius: 0; -webkit-mask-image: none; mask-image: none; }
.ap-float.is-full .ap-float-acts { top: max(12px, env(safe-area-inset-top)); inset-inline: 12px; }
.ap-float.is-full .ap-float-hear { bottom: 50%; }
.ap-float.is-full .ap-float-note { top: auto; bottom: 120px; }
.ap-float.is-full .ap-float-foot { position: absolute; inset: auto 0 0; display: flex; align-items: flex-end; gap: 12px; padding: 48px 16px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent); }
.ap-float-cap { flex: 1; min-width: 0; max-height: 92px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.ap-float-cap p { margin: 0; color: #fff; font-weight: 600; font-size: 20px; line-height: 1.6; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }

/* phones: stay clear of the page's fixed quick bar */
@media (max-width: 899px) { .ap-float:not(.is-full) { bottom: max(10vh, 96px); } }

@media (min-width: 900px) {
  .ap { inset: auto 28px 108px auto; inset-inline-end: 28px; inset-inline-start: auto; width: 420px; max-height: min(760px, calc(100vh - 136px)); border-radius: 4px; }
  .ap-handle { display: none; }
  .ap-scrim { display: none; }
  .ap-poster, .ap-pulse, .ap-stage { aspect-ratio: 16 / 9; }
  .ap-mini { width: 256px; }
  .ap-mini .ap-ministage { height: 144px; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-pulse, .ap-wave.on span, .ap-float-poster { animation: none !important; }
  .ap-tool, .ap-switch .track, .ap-switch .knob { transition: none; }
}
