/* The madgicx.com voice guide (templates/_voice_guide.html). Every rule is scoped to .mvg so the
   host page and the widget cannot leak into each other; the widget is fixed, so it never moves
   page content. Looks (landing/voice_guide.py LOOKS), each one fixed palette like a chat bubble:
   crystal - dark glass; closes to one pill
   dock    - the same card; closes to a bar with the orb, the two starters and a mic
   glass   - light, with the Workspace Ads Manager blurred under Madgicx violet behind the orb
   The orb is a WebGL crystal drawn by voice-guide.js (.mvg-orb is its CSS stand-in without
   WebGL). --mvg-level (0..1) is the live audio level; the orb, the glow and the wave follow it. */

@font-face {
  font-family: "MVG Aeonik";
  src: url("https://fb-ad-01.s3.ap-southeast-1.amazonaws.com/madgicx/static/20261101-v1/sites/madgicx/87fb4f27c5-aeonik-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "MVG Inter";
  src: url("https://fb-ad-01.s3.ap-southeast-1.amazonaws.com/madgicx/static/20261101-v1/sites/madgicx/b7fc407ee2-inter-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "MVG Inter";
  src: url("https://fb-ad-01.s3.ap-southeast-1.amazonaws.com/madgicx/static/20261101-v1/sites/madgicx/c2cf397b9f-inter-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@property --mvg-sweep {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.mvg {
  --mvg-surface: rgba(11, 11, 15, 0.9);
  --mvg-text: #f2f2f6;
  --mvg-soft: #cbcbd5;
  --mvg-muted: #8a8a97;
  --mvg-glass: rgba(255, 255, 255, 0.055);
  --mvg-glass-hover: rgba(255, 255, 255, 0.1);
  --mvg-edge: rgba(255, 255, 255, 0.09);
  --mvg-highlight: rgba(255, 255, 255, 0.07);
  --mvg-link: #a9c8ff;
  --mvg-focus: rgba(110, 160, 255, 0.55);
  --mvg-send: linear-gradient(135deg, #4f8dff, #6b4cf0);
  --mvg-shadow: 0 34px 80px -30px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.4);
  --mvg-display: "MVG Aeonik", "Aeonik Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mvg-body: "MVG Inter", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mvg-level: 0;
  --mvg-system: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  position: fixed;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483000;
  /* The closed pill uses system type; the brand fonts download only when the card opens. */
  font-family: var(--mvg-system);
  font-size: 15px;
  line-height: 1.45;
  color: var(--mvg-text);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}
.mvg[data-look="crystal"],
.mvg[data-look="dock"] { color-scheme: dark; }
.mvg[data-look="glass"] {
  --mvg-surface: rgba(255, 255, 255, 0.96);
  --mvg-text: #161a2c;
  --mvg-soft: #3b4058;
  --mvg-muted: #6a6f8a;
  --mvg-glass: rgba(22, 26, 44, 0.04);
  --mvg-glass-hover: rgba(22, 26, 44, 0.08);
  --mvg-edge: #e4e3f0;
  --mvg-highlight: rgba(255, 255, 255, 0.9);
  --mvg-link: #5942c9;
  --mvg-focus: rgba(89, 66, 201, 0.45);
  --mvg-send: linear-gradient(135deg, #5942c9, #3c299e);
  --mvg-shadow: 0 34px 80px -30px rgba(36, 23, 107, 0.45), 0 2px 8px rgba(22, 26, 44, 0.08);
  color-scheme: light;
}
.mvg *,
.mvg *::before,
.mvg *::after { box-sizing: border-box; }
.mvg [hidden] { display: none !important; }
.mvg button { font: inherit; color: inherit; }
.mvg svg { display: block; }

/* ---------- the orb ---------- */
.mvg-orb-slot { position: relative; display: grid; place-items: center; flex: none; }
.mvg-orb-slot-sm { width: 46px; height: 46px; }
/* The canvas is larger than the sphere: its outer ring is the halo. */
.mvg-orb-slot-lg { width: 176px; height: 176px; margin: -14px 0 -26px; }
.mvg-crystal { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.mvg-orb-slot.has-crystal .mvg-crystal { display: block; }
.mvg-orb-slot.has-crystal .mvg-orb { display: none; }
.mvg-orb {
  width: 66%;
  height: 66%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0) 22%),
    radial-gradient(circle at 50% 78%, rgba(120, 190, 255, 0.85), rgba(120, 190, 255, 0) 55%),
    radial-gradient(circle at 50% 50%, #3a7bff 0%, #1239b8 55%, #050f3d 100%);
  box-shadow:
    inset 0 0 0 1px rgba(160, 200, 255, 0.45),
    inset 0 -6px 14px rgba(110, 170, 255, 0.35),
    0 0 26px rgba(60, 120, 255, 0.55);
  transform: scale(calc(1 + var(--mvg-level) * 0.18));
}

/* ---------- closed: pill or dock ---------- */
.mvg-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--mvg-edge);
  border-radius: 999px;
  background: var(--mvg-surface);
  box-shadow: inset 0 1px 0 var(--mvg-highlight), var(--mvg-shadow);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
  transition: transform 220ms ease, box-shadow 220ms ease;
}
/* The lit lower edge, as on the reference recorder pill. */
.mvg-bar::after,
.mvg-panel::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(79, 141, 255, 0), #4f8dff 14%, #8b5cf6 34%, #f0509f 56%, #ff9d5c 74%, #2dd4bf 88%, rgba(45, 212, 191, 0));
  filter: blur(1px);
  opacity: 0.7;
  pointer-events: none;
}
.mvg-bar::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -12px;
  height: 22px;
  z-index: -1;
  border-radius: 50%;
  background: linear-gradient(90deg, #4f8dff, #8b5cf6, #f0509f, #ff9d5c, #2dd4bf);
  filter: blur(16px);
  opacity: 0.32;
  pointer-events: none;
}
.mvg-launcher {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px 0 0;
  border: 0;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  text-align: left;
}
.mvg-launcher-text { display: flex; flex-direction: column; line-height: 1.2; }
.mvg-launcher-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.mvg-launcher-sub { margin-top: 3px; font-size: 12px; color: var(--mvg-muted); }
.mvg[data-look="glass"] .mvg-launcher .mvg-orb-slot {
  border-radius: 50%;
  background:
    linear-gradient(150deg, rgba(89, 66, 201, 0.72), rgba(60, 41, 158, 0.55)),
    url("https://fb-ad-01.s3.ap-southeast-1.amazonaws.com/madgicx/static/20261101-v1/sites/madgicx/295038e2ac-look-a-ads-manager-thumb.webp") center / cover;
}
.mvg-bar-chips,
.mvg-bar-mic { display: none !important; }
.mvg[data-look="dock"] .mvg-bar-chips { display: flex !important; gap: 6px; }
.mvg[data-look="dock"] .mvg-bar-mic { display: grid !important; }
.mvg[data-look="dock"] .mvg-launcher { padding: 0 4px 0 0; }
.mvg[data-look="dock"] .mvg-launcher-text { display: none; }
.mvg[data-look="dock"] .mvg-bar { gap: 8px; padding-right: 6px; }

/* ---------- shared controls ---------- */
.mvg-chip {
  border: 1px solid var(--mvg-edge);
  border-radius: 999px;
  background: var(--mvg-glass);
  color: var(--mvg-soft);
  font-size: 13px !important;
  line-height: 1.3;
  padding: 9px 15px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.mvg-chip:hover { background: var(--mvg-glass-hover); color: var(--mvg-text); }
.mvg-icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--mvg-edge);
  border-radius: 50%;
  background: var(--mvg-glass-hover);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}
.mvg-icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.mvg[data-look="glass"] .mvg-icon-btn:hover { background: rgba(22, 26, 44, 0.12); }
.mvg-icon-btn svg { width: 18px; height: 18px; }

/* ---------- open: the card ---------- */
.mvg-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 396px;
  max-height: min(680px, calc(100vh - 40px));
  border: 1px solid var(--mvg-edge);
  border-radius: 30px;
  background: var(--mvg-surface);
  box-shadow: inset 0 1px 0 var(--mvg-highlight), var(--mvg-shadow);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  backdrop-filter: blur(30px) saturate(1.4);
  overflow: hidden;
  isolation: isolate;
  font-family: var(--mvg-body);
}
.mvg-panel > :not(.mvg-glow) { position: relative; z-index: 1; }
.mvg-panel::after { z-index: 2; left: 12%; right: 12%; bottom: 0; opacity: calc(0.5 + var(--mvg-level) * 0.5); }

/* Spectral light rising from the bottom edge; brighter and wider while the guide speaks. */
.mvg-glow {
  position: absolute;
  left: -18%;
  right: -18%;
  bottom: -26%;
  height: 64%;
  z-index: 0;
  pointer-events: none;
  background: conic-gradient(
    from calc(270deg + var(--mvg-sweep)) at 50% 100%,
    #2f6bff 0deg,
    #6d4dff 36deg,
    #c14dff 68deg,
    #ff4f9a 96deg,
    #ff9d5c 124deg,
    #2dd4bf 156deg,
    #2f6bff 180deg,
    rgba(47, 107, 255, 0) 181deg
  );
  filter: blur(38px) saturate(1.25);
  opacity: calc(0.4 + var(--mvg-level) * 0.55);
  -webkit-mask-image: radial-gradient(72% 82% at 50% 100%, #000 22%, transparent 72%);
  mask-image: radial-gradient(72% 82% at 50% 100%, #000 22%, transparent 72%);
  transform-origin: 50% 100%;
  transform: scaleY(calc(0.92 + var(--mvg-level) * 0.4));
  transition: opacity 220ms ease;
}
.mvg[data-look="glass"] .mvg-glow { opacity: calc(0.22 + var(--mvg-level) * 0.45); filter: blur(42px) saturate(1.1); }

.mvg-hero { display: flex; flex-direction: column; }
.mvg[data-look="glass"] .mvg-hero {
  padding-bottom: 8px;
  color: #ffffff;
  background:
    linear-gradient(165deg, rgba(89, 66, 201, 0.84) 0%, rgba(60, 41, 158, 0.66) 55%, rgba(143, 116, 255, 0.42) 100%),
    url("https://fb-ad-01.s3.ap-southeast-1.amazonaws.com/madgicx/static/20261101-v1/sites/madgicx/2b2e16bc61-look-a-ads-manager.webp") center 30% / cover;
}
.mvg-top { display: flex; align-items: center; gap: 8px; padding: 16px 16px 0 22px; }
.mvg-logo { display: block; flex: none; width: 88px; height: 15px; margin-right: auto; opacity: 0.94; }
.mvg-disclosure {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 4px;
  border: 1px solid var(--mvg-edge);
  border-radius: 999px;
  background: var(--mvg-glass);
  color: var(--mvg-soft);
  font-size: 11px;
}
.mvg-ai {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0b0b0f;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.mvg-disclosure a { color: inherit; text-decoration: none; }
.mvg-disclosure a:hover { text-decoration: underline; }
/* "Talk to a person": opens Intercom. It shrinks before the logo or the close button do, and a
   long label wraps to a second line instead of being cut. */
.mvg .mvg-person {
  display: -webkit-box;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  padding: 4px 11px;
  border: 1px solid var(--mvg-edge);
  border-radius: 14px;
  background: var(--mvg-glass);
  color: var(--mvg-soft);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease;
}
.mvg .mvg-person:hover { background: var(--mvg-glass-hover); color: var(--mvg-text); }
.mvg .mvg-person:disabled { opacity: 0.6; cursor: progress; }
.mvg-close { width: 34px; height: 34px; }
.mvg-close svg { width: 16px; height: 16px; }
.mvg[data-look="glass"] .mvg-hero .mvg-disclosure,
.mvg[data-look="glass"] .mvg-hero .mvg-person,
.mvg[data-look="glass"] .mvg-hero .mvg-close {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}
.mvg-stage { display: grid; place-items: center; padding-top: 4px; }

/* ---------- conversation ---------- */
.mvg-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 28px 10px;
  overflow-y: auto;
  min-height: 0;
  text-align: center;
  scrollbar-width: none;
  /* A line scrolled up under the orb fades out instead of being cut. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
}
.mvg-log::-webkit-scrollbar { display: none; }
.mvg-msg { margin: 0; overflow-wrap: anywhere; }
.mvg-msg-agent {
  font-family: var(--mvg-display);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.38;
  letter-spacing: -0.012em;
  color: var(--mvg-text);
  text-wrap: pretty;
}
/* Earlier lines recede so the newest one reads like a caption. */
.mvg-log > .mvg-msg-agent:not(:last-of-type) { font-size: 15px; color: var(--mvg-muted); }
/* On a voice call the orb leads (Yahav 21.10): it grows with air around it, and the transcript shows
   about a paragraph and a half (six lines); older lines fade out above and stay scrollable. */
.mvg[data-voice] .mvg-stage { padding: 14px 0 12px; }
.mvg[data-voice] .mvg-orb-slot-lg { width: 216px; height: 216px; margin: -6px 0 -8px; }
.mvg[data-voice] .mvg-log {
  max-height: 172px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
}
.mvg-msg-user {
  align-self: center;
  max-width: 90%;
  padding: 8px 15px;
  border: 1px solid var(--mvg-edge);
  border-radius: 18px;
  background: var(--mvg-glass);
  color: var(--mvg-soft);
  font-size: 14px;
}
.mvg-msg a { color: var(--mvg-link); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
/* The agent's show_link button: an <a>, not a <p>, so the reply above it keeps the caption size. */
.mvg .mvg-button {
  align-self: center;
  max-width: 90%;
  padding: 10px 18px;
  border: 1px solid var(--mvg-edge);
  border-radius: 999px;
  background: var(--mvg-glass);
  color: var(--mvg-link);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background 160ms ease, color 160ms ease;
}
.mvg .mvg-button:hover { background: var(--mvg-glass-hover); color: var(--mvg-text); text-decoration: none; }

.mvg-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 4px 22px 10px; }
.mvg-starters .mvg-chip { white-space: normal; }
.mvg-status { margin: 0; padding: 0 22px; min-height: 18px; text-align: center; font-size: 12px; color: var(--mvg-muted); }

.mvg-form { padding: 8px 14px 16px; }
.mvg-compose,
.mvg-recorder {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 56px;
  padding: 0 6px 0 22px;
  border: 1px solid var(--mvg-edge);
  border-radius: 999px;
  background: var(--mvg-glass);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.mvg-compose:focus-within { border-color: var(--mvg-focus); box-shadow: 0 0 0 4px rgba(110, 160, 255, 0.12); }
.mvg-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--mvg-text);
  font: inherit;
  font-size: 15px;
}
.mvg-input::placeholder { color: var(--mvg-muted); }
/* Host pages style focused inputs (the research page draws a green box); the compose row shows focus instead. */
.mvg .mvg-input:focus,
.mvg .mvg-input:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; }
.mvg-send { display: none; border: 0; background: var(--mvg-send); color: #ffffff !important; }
.mvg.has-text .mvg-send { display: grid; }
.mvg.has-text .mvg-mic-btn { display: none; }

/* While voice is on, the field becomes the recorder: mic, elapsed time, live wave, stop. */
.mvg-recorder { display: none; gap: 14px; padding-left: 20px; }
.mvg[data-voice] .mvg-compose { display: none; }
.mvg[data-voice] .mvg-recorder { display: flex; }
/* The recorder's mic is the mute toggle: muted draws a slash and stills the wave. */
.mvg-rec-mic {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin-left: -8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mvg-muted);
  cursor: pointer;
}
.mvg-rec-mic:hover { background: rgba(255, 255, 255, 0.1); color: var(--mvg-text); }
.mvg-rec-mic svg { width: 20px; height: 20px; }
.mvg-mute-slash { display: none; }
.mvg[data-muted] .mvg-mute-slash { display: inline; }
.mvg[data-muted] .mvg-rec-mic { color: #ff8a8a; }
.mvg[data-muted] .mvg-wave { opacity: 0.35; }
.mvg-retry {
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--mvg-link);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.mvg-timer {
  min-width: 3.2em;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--mvg-soft);
}
.mvg-wave { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; height: 26px; }
.mvg-wave i {
  display: block;
  width: 3px;
  height: calc(4px + var(--mvg-level) * var(--k, 0.6) * 22px);
  border-radius: 3px;
  background: linear-gradient(180deg, #9cc2ff, #6b4cf0);
  transition: height 80ms linear;
}
.mvg-wave i:nth-child(1), .mvg-wave i:nth-child(9) { --k: 0.35; }
.mvg-wave i:nth-child(2), .mvg-wave i:nth-child(8) { --k: 0.6; }
.mvg-wave i:nth-child(3), .mvg-wave i:nth-child(7) { --k: 0.85; }
.mvg-wave i:nth-child(4), .mvg-wave i:nth-child(6) { --k: 1; }
.mvg-wave i:nth-child(5) { --k: 0.75; }
.mvg-stop {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--mvg-edge);
  border-radius: 50%;
  background: var(--mvg-glass-hover);
  cursor: pointer;
}
.mvg-stop span { width: 14px; height: 14px; border-radius: 4px; background: var(--mvg-text); opacity: 0.9; }

.mvg-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.mvg button:focus-visible,
.mvg a:focus-visible { outline: 2px solid var(--mvg-focus); outline-offset: 2px; }

/* ---------- placement ---------- */
@media (min-width: 768px) {
  .mvg[data-look="dock"] { left: 50%; right: auto; transform: translateX(-50%); }
}
@media (max-width: 480px) {
  .mvg { right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .mvg-launcher { padding: 0; }
  .mvg-launcher-text { display: none; }
  .mvg[data-look="dock"] .mvg-bar-chips { display: none !important; }
  .mvg-panel {
    position: fixed;
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: calc(100dvh - 24px);
    border-radius: 28px;
  }
  .mvg-orb-slot-lg { width: 150px; height: 150px; margin: -12px 0 -22px; }
  .mvg-msg-agent { font-size: 18px; }
  .mvg[data-voice] .mvg-orb-slot-lg { width: 196px; height: 196px; margin: -4px 0 -6px; }
  .mvg[data-voice] .mvg-log { max-height: 160px; }
  /* A thumb-sized close (44 px touch target, Yahav 21.10), kept apart from "Talk to a person". */
  .mvg-close { width: 44px; height: 44px; margin-left: 4px; }
  .mvg-close svg { width: 20px; height: 20px; }
  .mvg-top { gap: 6px; padding: 14px 12px 0 18px; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .mvg-bar:hover { transform: translateY(-2px); }
  .mvg-orb-slot-lg { transition: width 360ms ease, height 360ms ease, margin 360ms ease; }
  .mvg-panel:not([hidden]) { animation: mvg-rise 280ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  /* The light only moves while a voice conversation runs. */
  .mvg[data-voice] .mvg-glow { animation: mvg-sweep 9s ease-in-out infinite alternate; }
}
@keyframes mvg-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}
@keyframes mvg-sweep {
  from { --mvg-sweep: -16deg; }
  to { --mvg-sweep: 16deg; }
}
