/* CHG-MERIDIAN Guide: Avatar-Kreis unten rechts und Gesprächsfenster in der Mitte. Farben aus CHGMeridian.min.css. */
#chg-guide {
  --cg-navy: #080593;
  --cg-ink: #1b1e4f;
  --cg-deep: #282b5d;
  --cg-blue: #2052e4;
  --cg-pink: #ff2063;
  --cg-red: #e00038;
  --cg-green: #19c37d;
  --cg-white: #ffffff;
  --cg-bubble: 116px;
  --cg-gap: 28px;
  font-family: Poppins, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#chg-guide *,
#chg-guide *::before,
#chg-guide *::after {
  box-sizing: border-box;
}
#chg-guide button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Kreis unten rechts ---------- */
.cg-launcher {
  position: fixed;
  right: var(--cg-gap);
  bottom: var(--cg-gap);
  z-index: 2147483000;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  pointer-events: none;
}
.cg-bubble {
  position: relative;
  width: var(--cg-bubble);
  height: var(--cg-bubble);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--cg-white);
  box-shadow: 0 14px 34px rgba(8, 5, 147, 0.32), 0 3px 8px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.4) translateY(30px);
  transition: transform 0.55s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.35s ease, box-shadow 0.25s ease;
}
#chg-guide[data-arrived="1"] .cg-bubble {
  opacity: 1;
  transform: none;
}
.cg-bubble:hover {
  transform: scale(1.06) !important;
  box-shadow: 0 18px 40px rgba(8, 5, 147, 0.4), 0 3px 8px rgba(0, 0, 0, 0.2);
}
.cg-bubble:focus-visible {
  outline: 3px solid var(--cg-blue);
  outline-offset: 5px;
}
.cg-bubble-media {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  overflow: hidden;
  background: #dfe4f5 url("guide-face.jpg") center / cover no-repeat;
}
.cg-bubble-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* pulsierender Ring in CHG-Pink */
.cg-bubble::before,
.cg-bubble::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 3px solid var(--cg-pink);
  opacity: 0;
  pointer-events: none;
}
#chg-guide[data-arrived="1"] .cg-bubble::before {
  animation: cg-pulse 2.6s ease-out 0.8s infinite;
}
#chg-guide[data-arrived="1"] .cg-bubble::after {
  animation: cg-pulse 2.6s ease-out 2.1s infinite;
}
@keyframes cg-pulse {
  0% {
    transform: scale(1);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}
.cg-badge {
  position: absolute;
  left: -2px;
  bottom: 2px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cg-pink);
  border: 3px solid var(--cg-white);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(224, 0, 56, 0.35);
}
.cg-badge svg {
  width: 17px;
  height: 17px;
  fill: var(--cg-white);
}

/* Sprechblase neben dem Kreis */
.cg-teaser {
  position: relative;
  max-width: 270px;
  margin-bottom: 18px;
  padding: 14px 38px 14px 18px;
  border-radius: 18px 18px 4px 18px;
  background: var(--cg-white);
  color: var(--cg-ink);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 12px 30px rgba(27, 30, 79, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateX(14px) scale(0.96);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#chg-guide[data-teaser="1"] .cg-teaser {
  opacity: 1;
  transform: none;
}
#chg-guide:not([data-teaser="1"]) .cg-teaser {
  pointer-events: none;
}
.cg-teaser strong {
  display: block;
  color: var(--cg-navy);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}
.cg-teaser-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8a8db0;
  font-size: 18px;
  line-height: 24px;
  padding: 0;
}
.cg-teaser-close:hover {
  background: #f0f1f8;
  color: var(--cg-ink);
}

/* Während des Gesprächs ist der Kreis weg */
#chg-guide[data-state="connecting"] .cg-launcher,
#chg-guide[data-state="live"] .cg-launcher,
#chg-guide[data-state="error"] .cg-launcher,
#chg-guide[data-state="ended"] .cg-launcher,
#chg-guide[data-state="closing"] .cg-launcher {
  visibility: hidden;
}

/* ---------- Gesprächsfenster ---------- */
.cg-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#chg-guide[data-state="connecting"] .cg-layer,
#chg-guide[data-state="live"] .cg-layer,
#chg-guide[data-state="error"] .cg-layer,
#chg-guide[data-state="ended"] .cg-layer,
#chg-guide[data-state="closing"] .cg-layer {
  display: flex;
}
.cg-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 30, 79, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
#chg-guide[data-open="1"] .cg-backdrop {
  opacity: 1;
}
.cg-panel {
  position: relative;
  /* ungefähr die halbe Seite: halbe Breite, Bühne 16:9, nie höher als ~74 % des Fensters */
  width: min(54vw, calc((74vh - 132px) * 16 / 9), 1040px);
  min-width: 520px;
  border-radius: 26px;
  background: var(--cg-ink);
  color: var(--cg-white);
  box-shadow: 0 30px 80px rgba(8, 5, 40, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  padding: 14px 14px 16px;
  opacity: 0;
  transform: scale(0.12);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.3s ease;
}
#chg-guide[data-open="1"] .cg-panel {
  opacity: 1;
  transform: none;
}
.cg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 12px 8px;
}
.cg-head-face {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: url("guide-face.jpg") center / cover;
  border: 2px solid rgba(255, 255, 255, 0.9);
  flex: none;
}
.cg-head-text {
  flex: 1;
  min-width: 0;
}
.cg-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.cg-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.4;
}
.cg-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5b400;
  flex: none;
}
#chg-guide[data-state="live"] .cg-status::before {
  background: var(--cg-green);
  box-shadow: 0 0 0 0 rgba(25, 195, 125, 0.6);
  animation: cg-live 1.8s infinite;
}
#chg-guide[data-state="error"] .cg-status::before {
  background: var(--cg-pink);
}
#chg-guide[data-state="ended"] .cg-status::before {
  background: #9a9cc0;
}
@keyframes cg-live {
  0% {
    box-shadow: 0 0 0 0 rgba(25, 195, 125, 0.6);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(25, 195, 125, 0);
  }
}
.cg-timer {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.cg-timer[hidden] {
  display: none;
}
.cg-timer.cg-warn {
  color: var(--cg-white);
  background: var(--cg-red);
}
.cg-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--cg-white);
  display: grid;
  place-items: center;
  padding: 0;
  flex: none;
}
.cg-close:hover {
  background: rgba(255, 255, 255, 0.2);
}
.cg-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.cg-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #0d0f33;
}
.cg-stage img,
.cg-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cg-poster {
  filter: saturate(0.9);
  transition: opacity 0.6s ease, filter 0.6s ease;
}
#chg-guide[data-state="connecting"] .cg-poster,
#chg-guide[data-state="error"] .cg-poster,
#chg-guide[data-state="ended"] .cg-poster {
  filter: blur(6px) brightness(0.55);
}
.cg-video {
  opacity: 0;
  transition: opacity 0.6s ease;
}
#chg-guide[data-video="1"] .cg-video {
  opacity: 1;
}
#chg-guide[data-video="1"] .cg-poster {
  opacity: 0;
}
.cg-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  font-size: 15px;
  line-height: 1.5;
  color: var(--cg-white);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
  transition: opacity 0.4s ease;
}
#chg-guide[data-video="1"] .cg-overlay {
  opacity: 0;
  pointer-events: none;
}
.cg-overlay small {
  display: block;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  max-width: 420px;
}
.cg-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--cg-white);
  animation: cg-spin 0.9s linear infinite;
}
#chg-guide[data-state="error"] .cg-spinner,
#chg-guide[data-state="ended"] .cg-spinner {
  display: none;
}
@keyframes cg-spin {
  to {
    transform: rotate(360deg);
  }
}
.cg-retry {
  border: 0;
  border-radius: 999px;
  padding: 11px 26px;
  background: var(--cg-white);
  color: var(--cg-navy);
  font-size: 15px;
  font-weight: 600;
}
.cg-retry[hidden] {
  display: none;
}

.cg-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 14px;
}
.cg-mic {
  position: relative;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--cg-white);
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.2s ease;
}
.cg-mic:hover {
  background: rgba(255, 255, 255, 0.2);
}
.cg-mic svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  position: relative;
}
/* Pegelanzeige: Ring wächst mit der eigenen Lautstärke */
.cg-mic::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--cg-green);
  opacity: var(--cg-level-o, 0);
  transform: scale(var(--cg-level-s, 1));
  transition: transform 0.08s linear, opacity 0.08s linear;
}
.cg-mic[aria-pressed="true"] {
  background: var(--cg-white);
  color: var(--cg-red);
}
.cg-mic .cg-mic-off {
  display: none;
}
.cg-mic[aria-pressed="true"] .cg-mic-on {
  display: none;
}
.cg-mic[aria-pressed="true"] .cg-mic-off {
  display: block;
}
.cg-end {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--cg-red);
  color: var(--cg-white);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s ease;
}
.cg-end:hover {
  background: #bd0044;
}
.cg-end svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.cg-hint {
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  padding-top: 10px;
}

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 720px) {
  #chg-guide {
    --cg-bubble: 84px;
    --cg-gap: 16px;
  }
  .cg-badge {
    width: 28px;
    height: 28px;
    border-width: 2px;
  }
  .cg-badge svg {
    width: 13px;
    height: 13px;
  }
  .cg-teaser {
    max-width: 210px;
    font-size: 13px;
    margin-bottom: 10px;
  }
  .cg-teaser strong {
    font-size: 14px;
  }
  .cg-layer {
    padding: 12px;
  }
  .cg-panel {
    width: 100%;
    min-width: 0;
    border-radius: 22px;
    padding: 10px 10px 12px;
  }
  .cg-stage {
    aspect-ratio: 4 / 5;
    max-height: calc(100dvh - 200px);
    width: 100%;
  }
  .cg-end {
    padding: 0 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #chg-guide *,
  #chg-guide *::before,
  #chg-guide *::after {
    animation: none !important;
    transition: none !important;
  }
}
