/* Demo-Anruf im Browser: Auslöser und Gesprächsfenster (dialog.vdlg). Logik: demo.js.
   Kommt ohne andere Datei aus: Farben und Schrift kommen aus styles.css bzw. wartung.css, sonst gelten die Werte hier.
   Dieselbe Datei liegt in site/ und in wartung/ (Live-Seite bis zum Livegang von site/); Änderungen in beide. */

.vdlg, .talk {
  --v-deep: var(--petrol-deep, #07343a);
  --v-pist: var(--pist, #c8dd8a);
  --v-dim: var(--on-dark-muted, #a9c3c2);
  --v-font: var(--font, "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif);
  --v-ease: var(--ease, cubic-bezier(.2, .7, .2, 1));
}
html.is-locked { overflow: hidden; scrollbar-gutter: stable; }

/* ---------- Auslöser ---------- */
/* Ohne JavaScript gibt es kein Gespräch, also auch keinen Knopf. */
.talk { display: none; position: relative; margin: 36px auto 0; }
.js .talk { display: block; }
.btn--talk { gap: 10px; padding: 19px 30px 19px 26px; border: 0; font-family: var(--v-font); font-size: 18px; font-weight: 600; line-height: 24px; cursor: pointer; box-shadow: 0 16px 40px -12px rgba(7, 52, 58, .45); }
.btn--talk svg { width: 20px; height: 20px; }
.btn--talk:hover svg { transform: none; }
.talk__hint { margin: 12px 0 0; font: 600 13px/1.4 var(--v-font); color: var(--muted, #5a6b6e); text-align: center; }
.cta .btn--talk { box-shadow: none; }
.cta .talk__hint { color: var(--v-dim); }
.player__alt button { padding: 0; border: 0; background: none; font: 600 14px/1.5 var(--v-font); color: var(--petrol, #0b4f55); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.player__alt button:hover { text-decoration-thickness: 2px; }

/* ---------- Gesprächsfenster ---------- */
.vdlg { width: min(calc(100% - 32px), 680px); height: min(640px, calc(100dvh - 48px)); max-width: none; max-height: none; margin: auto; padding: 0; border: 0; border-radius: 32px; background: linear-gradient(180deg, #0a3d44 0%, var(--v-deep) 55%, #052a2f 100%); color: #fff; box-shadow: 0 2px 6px rgba(7, 52, 58, .06), 0 40px 80px -30px rgba(7, 52, 58, .35); font-family: var(--v-font); overflow: hidden auto; overscroll-behavior: contain; isolation: isolate; }
.vdlg[open] { display: flex; flex-direction: column; animation: vdlg-in .3s var(--v-ease); }
.vdlg::backdrop { background: rgba(4, 30, 34, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.vdlg[open]::backdrop { animation: vdlg-fade .3s ease; }
.vdlg.is-closing { animation: vdlg-out .2s ease forwards; }
.vdlg.is-closing::backdrop { animation: vdlg-fade-out .2s ease forwards; }
/* Schein hinter der Tonspur: wird heller, wenn Sara spricht (--glow setzt demo.js) */
.vdlg::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 46% at 50% 40%, rgba(200, 221, 138, .22), transparent 72%); opacity: var(--glow, .25); pointer-events: none; }
.vdlg :focus-visible { outline: 2px solid var(--v-pist); outline-offset: 3px; }
.vdlg svg { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vdlg__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.vdlg__head { flex: none; display: flex; align-items: center; gap: 14px; padding: 22px 20px 0 26px; }
.vdlg__ava { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--v-pist); color: var(--v-deep); font: 800 19px/1 var(--v-font); }
.vdlg__id { flex: 1; min-width: 0; }
.vdlg__status { margin: 0; font: 800 20px/1.25 var(--v-font); letter-spacing: -.02em; }
.vdlg__sub { margin: 2px 0 0; overflow: hidden; font: 500 13.5px/1.4 var(--v-font); color: var(--v-dim); white-space: nowrap; text-overflow: ellipsis; }
.vdlg__timer { flex: none; font: 600 15px/1 var(--v-font); font-variant-numeric: tabular-nums; color: var(--v-dim); }
.vdlg__close { width: 40px; height: 40px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; transition: background-color .2s; }
.vdlg__close:hover { background: rgba(255, 255, 255, .18); }
.vdlg__close svg { width: 18px; height: 18px; }

/* Tonspur: oben Sara, unten der Besucher; rechts ist „jetzt“ */
.vdlg__scope { position: relative; flex: 1 1 0; min-height: 96px; margin-top: 6px; }
.vdlg__scope canvas { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20%); mask-image: linear-gradient(90deg, transparent 0, #000 20%); }
.vdlg[data-state="ended"] .vdlg__scope canvas { -webkit-mask-image: none; mask-image: none; }

/* Die Zeile, die gerade gesprochen wird. Die Höhe ist für drei Zeilen reserviert, damit nichts springt. */
.vdlg__cue { flex: none; padding: 4px 26px 0; }
.vdlg__who { min-height: 1em; margin: 0 0 10px; font: 800 11.5px/1 var(--v-font); letter-spacing: .07em; text-transform: uppercase; color: var(--v-dim); }
.vdlg__who.is-ai { color: var(--v-pist); }
.vdlg__line { min-height: 4.2em; margin: 0; font: 600 clamp(19px, 2.4vw, 24px)/1.4 var(--v-font); letter-spacing: -.015em; text-wrap: balance; overflow-wrap: break-word; }
.vdlg__line.is-new { animation: vdlg-line .32s var(--v-ease); }

.vdlg__try { flex: none; margin: 14px 26px 0; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .1); }
.vdlg__try p { margin: 0 0 8px; font: 700 13px/1.4 var(--v-font); color: var(--v-dim); }
.vdlg__try ul { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
.vdlg__try li { font: 500 14.5px/1.45 var(--v-font); color: rgba(255, 255, 255, .88); }

.vdlg__bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 20px 26px 26px; }
.vbtn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 52px; padding: 0 24px 0 20px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .1); font: 600 16px/1 var(--v-font); color: #fff; white-space: nowrap; cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s, transform .25s var(--v-ease); }
.vbtn:hover { background: rgba(255, 255, 255, .17); }
.vbtn:active { transform: scale(.98); }
.vbtn svg { width: 19px; height: 19px; }
.vbtn--mute .i-off, .vbtn--mute[aria-pressed="true"] .i-on { display: none; }
.vbtn--mute[aria-pressed="true"] .i-off { display: block; }
.vbtn--mute[aria-pressed="true"] { background: #fff; color: var(--v-deep); }
.vbtn--end { background: #c9382b; }
.vbtn--end:hover { background: #d94a3c; }
.vbtn--end svg { transform: rotate(135deg); }
.vbtn--main, .vbtn--line { padding-inline: 24px; }
.vbtn--main { background: var(--v-pist); color: var(--v-deep); }
.vbtn--main:hover { background: #d4e69c; }
.vbtn--line { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.vbtn--line:hover { background: rgba(255, 255, 255, .08); }

/* Was je Zustand zu sehen ist: Verbinden (connecting, waiting), Gespräch (live), danach (ended), Fehler (error) */
.vdlg:not([data-state="live"]) .vbtn--mute { display: none; }
.vdlg[data-state="ended"] .vbtn--end, .vdlg[data-state="error"] .vbtn--end { display: none; }
.vdlg:not([data-state="ended"]):not([data-state="error"]) [data-anruf-termin],
.vdlg:not([data-state="ended"]):not([data-state="error"]) [data-anruf-neu] { display: none; }
.vdlg[data-state="ended"] .vdlg__try, .vdlg[data-state="error"] .vdlg__try { display: none; }
.vdlg:not([data-state="live"]):not([data-state="ended"]) .vdlg__timer { display: none; }
/* Betont ist nach dem Gespräch der Termin, nach einem Fehler „Noch einmal“. Ohne Terminknopf immer „Noch einmal“. */
.vdlg[data-state="error"] [data-anruf-termin] { order: 2; background: transparent; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
.vdlg[data-state="error"] [data-anruf-termin]:hover { background: rgba(255, 255, 255, .08); }
.vdlg[data-state="error"] [data-anruf-neu] { background: var(--v-pist); color: var(--v-deep); box-shadow: none; }
.vdlg[data-state="error"] [data-anruf-neu]:hover { background: #d4e69c; }
.vdlg:not(:has([data-anruf-termin])) [data-anruf-neu] { background: var(--v-pist); color: var(--v-deep); box-shadow: none; }
.vdlg:not(:has([data-anruf-termin])) [data-anruf-neu]:hover { background: #d4e69c; }

@keyframes vdlg-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes vdlg-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes vdlg-fade { from { opacity: 0; } }
@keyframes vdlg-fade-out { to { opacity: 0; } }
@keyframes vdlg-line { from { opacity: 0; transform: translateY(8px); } }

/* Niedrige Fenster: die Beispielfragen weichen dem Gespräch */
@media (max-height: 560px) {
  .vdlg__try { display: none; }
}
/* Handy: das Gespräch füllt den Bildschirm */
@media (max-width: 640px) {
  .vdlg { width: 100%; height: 100dvh; margin: 0; border-radius: 0; }
  .vdlg__head { padding: calc(16px + env(safe-area-inset-top, 0px)) 14px 0 20px; }
  .vdlg__status { font-size: 18px; }
  .vdlg__sub { white-space: normal; }
  .vdlg__cue { padding-inline: 20px; }
  .vdlg__line { min-height: 5.6em; }
  .vdlg__try { margin-inline: 20px; }
  .vdlg__try ul { grid-template-columns: 1fr; }
  .vdlg__bar { padding: 18px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .vdlg__bar > * { flex: 1 1 0; }
  .talk .btn--talk { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .vdlg[open], .vdlg[open]::backdrop, .vdlg.is-closing, .vdlg.is-closing::backdrop, .vdlg__line.is-new { animation: none; }
}
