:root {
  color-scheme: dark;
  --cyan: #10dfff;
  --blue: #0866ff;
  --deep: #03050c;
  --mouth-open: 0;
  --mouth-scale: 0.4;
  --life-x: 0px;
  --life-y: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #000;
  overflow: hidden;
}

body {
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.stage {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 51% 50%, rgba(0, 111, 255, 0.22), transparent 28%),
    radial-gradient(circle at 18% 46%, rgba(215, 240, 255, 0.14), transparent 10%),
    linear-gradient(180deg, #000 0%, #010208 47%, #000 100%);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent 13%, transparent 87%, rgba(255, 255, 255, 0.04)),
    radial-gradient(ellipse at center, transparent 0 44%, rgba(0, 0, 0, 0.72) 78%);
  pointer-events: none;
}

.hologram {
  position: relative;
  width: min(92vw, 92dvh, 900px);
  aspect-ratio: 1;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(86, 90, 102, 0.75), rgba(24, 27, 37, 0.98)),
    #10131d;
  box-shadow:
    0 0 38px rgba(0, 174, 255, 0.42),
    0 0 118px rgba(0, 78, 255, 0.36),
    inset 0 0 52px rgba(0, 0, 0, 0.72);
  isolation: isolate;
  transform: translate3d(var(--life-x), var(--life-y), 0);
  animation: living-breath 5.8s ease-in-out infinite;
}

.hologram::before {
  content: "";
  position: absolute;
  inset: -8%;
  background:
    radial-gradient(ellipse at 49% 49%, rgba(25, 210, 255, 0.24), transparent 36%),
    radial-gradient(ellipse at 55% 76%, rgba(0, 95, 255, 0.42), transparent 36%);
  filter: blur(20px);
  opacity: 0.92;
  pointer-events: none;
  z-index: 1;
}

.avatar-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.18) contrast(1.06) brightness(1.02);
  z-index: 2;
  transform-origin: 50% 58%;
}

.source-exact {
  background: #1f222c;
  animation: none;
  transform: none;
  box-shadow:
    0 0 24px rgba(0, 128, 255, 0.22),
    inset 0 0 36px rgba(0, 0, 0, 0.52);
}

.source-exact::before,
.source-exact .screen-light,
.source-exact .binary-flow,
.source-exact .iris,
.source-exact .life-mask {
  display: none;
}

.source-exact .avatar-video {
  filter: none;
}

.source-exact .scanlines {
  opacity: 0.08;
}

.source-exact .edge-glow {
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.34),
    inset 0 -22px 28px rgba(0, 0, 0, 0.58);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.35));
}

.binary-flow,
.scanlines,
.edge-glow,
.screen-light,
.iris,
.life-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.binary-flow {
  z-index: 3;
  mix-blend-mode: screen;
  opacity: 0.34;
}

.scanlines {
  z-index: 4;
  opacity: 0.42;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.12) 0,
      rgba(255, 255, 255, 0.12) 1px,
      transparent 1px,
      transparent 5px
    ),
    linear-gradient(90deg, transparent 0 46%, rgba(255, 255, 255, 0.12) 50%, transparent 54%);
  animation: scan 4.2s linear infinite;
}

.edge-glow {
  z-index: 5;
  box-shadow:
    inset 0 0 44px rgba(6, 26, 45, 0.72),
    inset 0 -34px 40px rgba(0, 7, 18, 0.88);
  background:
    radial-gradient(ellipse at 48% 50%, transparent 38%, rgba(0, 223, 255, 0.11) 56%, transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 8%, transparent 87%, rgba(0, 0, 0, 0.6));
}

.iris {
  z-index: 7;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 43%, transparent 0 16%, rgba(35, 245, 255, 0.1) 17%, transparent 22%),
    radial-gradient(circle at 50% 43%, rgba(12, 218, 255, 0.2), transparent 42%);
  transition: opacity 180ms ease;
}

.life-mask {
  z-index: 9;
  mix-blend-mode: screen;
}

.eye-focus {
  position: absolute;
  top: 40.4%;
  width: 8%;
  height: 2.7%;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(222, 255, 255, 0.85), rgba(63, 237, 255, 0.28) 45%, transparent 72%);
  filter: blur(0.8px) drop-shadow(0 0 10px rgba(30, 233, 255, 0.86));
  opacity: 0.42;
  animation: eye-search 7.4s ease-in-out infinite;
}

.eye-focus.left {
  left: 39.2%;
}

.eye-focus.right {
  left: 52.6%;
  animation-delay: -0.18s;
}

.blink-line {
  position: absolute;
  left: 37.6%;
  top: 40.2%;
  width: 24%;
  height: 4.5%;
  background:
    linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.42), transparent),
    linear-gradient(180deg, transparent 0 42%, rgba(0, 4, 12, 0.86) 43% 58%, transparent 59%);
  opacity: 0;
  filter: blur(0.4px);
  animation: blink 6.8s infinite;
}

.mouth-light {
  position: absolute;
  left: 45.5%;
  top: 57.2%;
  width: 10.4%;
  height: 3.8%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(232, 255, 255, 0.94), rgba(31, 238, 255, 0.68) 26%, rgba(0, 126, 255, 0.25) 54%, transparent 76%);
  opacity: 0.28;
  filter: blur(0.4px) drop-shadow(0 0 10px rgba(20, 235, 255, 0.86));
  transform: scaleX(0.76) scaleY(var(--mouth-scale));
  transition: transform 62ms linear, opacity 62ms linear;
}

.core-pulse {
  position: absolute;
  left: 45%;
  top: 66%;
  width: 10%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(145, 251, 255, 0.5), rgba(0, 135, 255, 0.12) 46%, transparent 72%);
  opacity: 0.36;
  filter: blur(4px);
  animation: core-life 3.2s ease-in-out infinite;
}

.screen-light {
  z-index: 6;
  opacity: 0.45;
  filter: blur(16px);
}

.screen-light.left {
  inset: 11% auto auto -8%;
  width: 19%;
  height: 43%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.7), transparent);
  animation: breathe-left 5s ease-in-out infinite;
}

.screen-light.right {
  inset: 0 -7% auto auto;
  width: 15%;
  height: 30%;
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.32), transparent);
}

.hologram.is-glitch .avatar-video {
  transform: translateX(1px) scale(1.002);
  filter: saturate(1.4) contrast(1.14) brightness(1.1);
}

.hologram.is-glitch .edge-glow {
  background:
    linear-gradient(90deg, rgba(255, 0, 120, 0.15), transparent 24%, transparent 70%, rgba(0, 229, 255, 0.2)),
    radial-gradient(ellipse at 48% 50%, transparent 38%, rgba(0, 223, 255, 0.16) 56%, transparent 72%);
}

.hologram.is-listening {
  box-shadow:
    0 0 44px rgba(35, 238, 255, 0.56),
    0 0 138px rgba(0, 78, 255, 0.48),
    inset 0 0 60px rgba(0, 0, 0, 0.7);
}

.hologram.is-listening .iris {
  opacity: 0.75;
  animation: iris-pulse 1.15s ease-in-out infinite;
}

.hologram.is-speaking .edge-glow {
  background:
    radial-gradient(ellipse at 50% 55%, rgba(65, 248, 255, 0.18), transparent 42%),
    radial-gradient(ellipse at 48% 50%, transparent 34%, rgba(0, 223, 255, 0.2) 58%, transparent 74%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 8%, transparent 87%, rgba(0, 0, 0, 0.6));
}

.hologram.is-speaking .avatar-video {
  animation: speaking-body 900ms ease-in-out infinite;
}

.hologram.is-speaking .mouth-light {
  opacity: 0.86;
}

.source-exact.is-speaking .avatar-video {
  animation: none;
}

.source-exact.is-speaking .edge-glow {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.36));
}

.hologram.is-thinking .binary-flow {
  opacity: 0.5;
}

.hologram.is-thinking .eye-focus {
  opacity: 0.72;
  animation-duration: 2.2s;
}

.hologram.is-seeing::after {
  content: "";
  position: absolute;
  inset: 10% 19% 3%;
  border: 1px solid rgba(106, 246, 255, 0.24);
  border-top-color: rgba(186, 255, 255, 0.62);
  filter: drop-shadow(0 0 10px rgba(24, 230, 255, 0.55));
  z-index: 8;
  pointer-events: none;
  animation: sight-frame 2.6s linear infinite;
}

.camera-feed {
  position: fixed;
  right: clamp(12px, 3vw, 28px);
  bottom: clamp(88px, 12vh, 132px);
  width: clamp(118px, 18vw, 220px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid rgba(71, 228, 255, 0.34);
  background: #02050b;
  opacity: 0;
  filter: saturate(0.2) hue-rotate(145deg) contrast(1.3) brightness(0.72);
  mix-blend-mode: screen;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 12;
}

.stage.camera-on .camera-feed {
  opacity: 0.62;
  transform: translateY(0);
}

.vision-sampler {
  display: none;
}

.caption {
  position: fixed;
  left: 50%;
  bottom: clamp(126px, 16vh, 180px);
  width: min(86vw, 860px);
  min-height: 1.3em;
  margin: 0;
  transform: translateX(-50%);
  color: #fff;
  font-size: clamp(20px, 3.1vw, 34px);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.9),
    0 0 16px rgba(0, 0, 0, 0.8);
  z-index: 14;
}

.media-status {
  position: fixed;
  left: 50%;
  bottom: clamp(176px, 22vh, 236px);
  width: min(92vw, 760px);
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
}

.media-pill {
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(76, 228, 255, 0.32);
  border-radius: 999px;
  color: rgba(238, 253, 255, 0.82);
  background: rgba(0, 9, 20, 0.68);
  font: 600 12px/1.2 Arial, "PingFang SC", sans-serif;
  box-shadow: 0 0 14px rgba(0, 199, 255, 0.12);
}

.media-pill[data-state="pending"] {
  color: #fff4c5;
  border-color: rgba(255, 210, 91, 0.48);
}

.media-pill[data-state="ok"] {
  color: #d6fff4;
  border-color: rgba(82, 255, 194, 0.58);
  background: rgba(0, 58, 42, 0.62);
}

.media-pill[data-state="warn"],
.media-pill[data-state="error"] {
  color: #ffe1e1;
  border-color: rgba(255, 104, 104, 0.56);
  background: rgba(62, 0, 18, 0.62);
}

.controls {
  position: fixed;
  left: 50%;
  bottom: clamp(24px, 5vh, 48px);
  display: flex;
  gap: 12px;
  transform: translateX(-50%);
  z-index: 15;
}

.control-button {
  min-width: 74px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(93, 230, 255, 0.56);
  border-radius: 999px;
  color: #f5feff;
  background: rgba(0, 15, 30, 0.78);
  box-shadow: 0 0 20px rgba(0, 199, 255, 0.24);
  font: 700 16px/1 Arial, "PingFang SC", sans-serif;
  cursor: pointer;
}

.control-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.listen-button.is-active {
  color: #001218;
  background: rgba(94, 243, 255, 0.92);
}

.chat-form {
  position: fixed;
  left: 50%;
  bottom: clamp(72px, 10vh, 104px);
  width: min(84vw, 560px);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 15;
}

.chat-form.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.chat-input {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(76, 228, 255, 0.46);
  border-radius: 999px;
  outline: none;
  color: #eefdff;
  background: rgba(0, 9, 20, 0.78);
  padding: 0 18px;
  font: 600 16px/1 Arial, "PingFang SC", sans-serif;
  box-shadow: 0 0 20px rgba(0, 199, 255, 0.18);
}

.chat-input::placeholder {
  color: rgba(238, 253, 255, 0.48);
}

@keyframes scan {
  from {
    transform: translateY(-18px);
  }
  to {
    transform: translateY(18px);
  }
}

@keyframes living-breath {
  0%,
  100% {
    filter: brightness(1);
  }
  45% {
    filter: brightness(1.055);
  }
  60% {
    filter: brightness(0.985);
  }
}

@keyframes speaking-body {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-0.35%) scale(1.003);
  }
}

@keyframes eye-search {
  0%,
  100% {
    transform: translateX(-2px);
  }
  38% {
    transform: translateX(2px);
  }
  62% {
    transform: translateX(0);
  }
}

@keyframes blink {
  0%,
  7%,
  48%,
  51%,
  100% {
    opacity: 0;
    transform: scaleY(0.12);
  }
  49.2%,
  49.9% {
    opacity: 0.92;
    transform: scaleY(1);
  }
}

@keyframes core-life {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.22;
  }
  50% {
    transform: scale(1.12);
    opacity: 0.46;
  }
}

@keyframes iris-pulse {
  0%,
  100% {
    transform: scale(0.98);
    filter: brightness(0.9);
  }
  50% {
    transform: scale(1.02);
    filter: brightness(1.25);
  }
}

@keyframes sight-frame {
  0% {
    clip-path: inset(0 0 93% 0);
    opacity: 0.3;
  }
  45% {
    clip-path: inset(44% 0 49% 0);
    opacity: 0.82;
  }
  100% {
    clip-path: inset(93% 0 0 0);
    opacity: 0.3;
  }
}

@keyframes breathe-left {
  0%,
  100% {
    opacity: 0.27;
    transform: translateX(0);
  }
  50% {
    opacity: 0.52;
    transform: translateX(10%);
  }
}

@media (max-width: 520px) {
  .hologram {
    width: min(100vw, 100dvh);
  }

  .camera-feed {
    right: 8px;
    bottom: 150px;
    width: 96px;
    opacity: 0.2;
  }

  .caption {
    bottom: 126px;
  }
}

.privacy-note {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  margin: 0;
  padding: 0 12px;
  width: max-content;
  max-width: 92vw;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(150, 205, 235, 0.5);
  text-align: center;
  pointer-events: none;
  z-index: 6;
}
