:root {
  color-scheme: light;
  --ink: #14151a;
  --muted: #7b8190;
  --line: #edf0f6;
  --violet: #5952ff;
  --danger: #d9304f;
  --ok: #26a66d;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(247, 248, 251, 0.9), rgba(255, 255, 255, 0.98) 24%),
    #fff;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.voice-page {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  padding: 36px 18px;
}

.voice-page::before {
  position: absolute;
  inset: 18px;
  pointer-events: none;
  content: "";
  border: 1px solid var(--line);
}

.hero {
  display: grid;
  justify-items: center;
  width: min(760px, 100%);
  margin-top: -20px;
  text-align: center;
}

.avatar-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 174px;
  height: 174px;
  margin-bottom: 46px;
}

.wave-bars {
  position: absolute;
  inset: 0;
  animation: orbitRotate 28s linear infinite;
}

.wave-bars i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: var(--bar-height);
  border-radius: 999px;
  background: rgba(24, 26, 32, 0.28);
  transform:
    translate(-50%, -50%)
    rotate(var(--angle))
    translateY(-80px);
  transform-origin: 50% 50%;
  animation: barBreathe 1.8s ease-in-out infinite;
  animation-delay: var(--delay);
}

.avatar-orbit.connected .wave-bars i {
  background: rgba(89, 82, 255, 0.58);
}

.avatar-orbit.speaking .wave-bars i {
  background: rgba(89, 82, 255, 0.72);
  animation-name: barSpeak;
  animation-duration: 0.72s;
}

.avatar-disc {
  position: relative;
  z-index: 2;
  width: 154px;
  height: 154px;
  overflow: hidden;
  border: 0;
  outline: 6px solid rgba(239, 232, 255, 0.96);
  outline-offset: 0;
  border-radius: 50%;
  background: #efe8ff;
  box-shadow:
    0 18px 40px rgba(89, 82, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  transform-origin: 50% 68%;
  will-change: transform, opacity;
}

.avatar-orbit.peeking .avatar-disc {
  animation: avatarPeekIn 0.82s cubic-bezier(0.22, 0.9, 0.28, 1.12) both;
}

.avatar-orbit.peeking .avatar-disc img {
  animation: avatarHeadPeek 0.82s cubic-bezier(0.22, 0.9, 0.28, 1.12) both;
}

.avatar-disc img {
  position: absolute;
  top: -50px;
  left: 50%;
  width: 300px;
  height: auto;
  max-width: none;
  transform: translateX(-50%);
  animation: avatarFloat 4.5s ease-in-out infinite;
}

.hero-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 4.3vw, 46px);
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: 0;
}

.hero-copy h1 span {
  color: var(--violet);
}

.hero-copy p {
  width: min(650px, 100%);
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.expert-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(430px, 100%);
  margin-top: 34px;
  padding: 4px;
  border: 1px solid #e5e8ee;
  border-radius: 8px;
  background: #f4f6f8;
}

.expert-option {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 56px;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  color: #737a88;
  background: transparent;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.expert-option strong {
  font-size: 15px;
  letter-spacing: 0;
}

.expert-option small {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expert-option.active {
  color: #242731;
  background: #fff;
  box-shadow: 0 4px 12px rgba(31, 35, 44, 0.08);
}

.expert-option:focus-visible {
  outline: 2px solid #5952ff;
  outline-offset: 2px;
}

.expert-option:disabled {
  cursor: wait;
  opacity: 0.64;
}

.hero-actions {
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-top: 34px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 252px;
  min-height: 60px;
  padding: 0 28px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--violet), #514cff);
  box-shadow: 0 16px 34px rgba(89, 82, 255, 0.28);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.primary-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(89, 82, 255, 0.34);
}

.primary-action.active {
  background: linear-gradient(135deg, var(--danger), #a51d36);
  box-shadow: 0 16px 34px rgba(217, 48, 79, 0.24);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.68;
}

.phone-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 22px;
  transform: rotate(-20deg);
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: var(--muted);
  font-size: 14px;
}

.status-line span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(38, 166, 109, 0.12);
}

.status-line.warning span {
  background: #e8a11d;
  box-shadow: 0 0 0 6px rgba(232, 161, 29, 0.14);
}

.device-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(720px, 92vw);
  min-height: 24px;
  color: #697080;
  font-size: 13px;
  text-align: center;
}

.device-status strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.device-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(38, 166, 109, 0.1);
}

.device-status.warning span {
  background: #a1a7b3;
  box-shadow: 0 0 0 5px rgba(123, 129, 144, 0.1);
}

.live-caption {
  width: min(620px, 100%);
  min-height: 46px;
  margin-top: 34px;
  color: #575e6e;
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-line;
}

.agent-result-view[hidden] {
  display: none;
}

.agent-result-view {
  position: fixed;
  z-index: 20;
  inset: 19px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100vh - 38px);
  padding: 26px 34px 24px;
  overflow: auto;
  background: #fbfefd;
}

.agent-result-view.retry {
  background: #fffdfd;
}

.agent-result-view.identity,
.agent-result-view.already {
  background: #fdfdff;
}

.agent-result-view.manual {
  background: #fffefa;
}

.agent-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  color: #17191f;
  font-size: 14px;
}

.agent-result-header strong {
  font-size: 16px;
  letter-spacing: 0;
}

.agent-result-header > span,
.agent-result-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #697080;
}

.agent-result-header i,
.agent-result-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(38, 166, 109, 0.1);
}

.agent-result-content {
  display: grid;
  align-content: center;
  justify-items: center;
  width: min(720px, 100%);
  min-height: 560px;
  margin: 0 auto;
  padding: 30px 0 36px;
  text-align: center;
  animation: resultReveal 0.42s cubic-bezier(0.22, 0.9, 0.28, 1) both;
}

.checkin-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(560px, 100%);
  margin: 0 0 54px;
  padding: 0;
  list-style: none;
}

.checkin-progress li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #a1a7b3;
  font-size: 13px;
  font-weight: 650;
}

.checkin-progress li:not(:last-child)::after {
  position: absolute;
  top: 14px;
  left: calc(50% + 22px);
  width: calc(100% - 44px);
  height: 2px;
  content: "";
  background: #e7eaf0;
}

.checkin-progress li span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  aspect-ratio: 1;
  border: 2px solid #dfe3ea;
  border-radius: 50%;
  color: #8f96a3;
  background: #fff;
  font-size: 12px;
}

.checkin-progress li.active {
  color: #292d36;
}

.checkin-progress li.active span {
  border-color: #5952ff;
  color: #fff;
  background: #5952ff;
  box-shadow: 0 0 0 6px rgba(89, 82, 255, 0.09);
}

.checkin-progress li.complete span {
  border-color: var(--ok);
  color: #fff;
  background: var(--ok);
}

.checkin-progress li.complete:not(:last-child)::after {
  background: rgba(38, 166, 109, 0.38);
}

.agent-result-mark {
  display: grid;
  place-items: center;
  width: 76px;
  aspect-ratio: 1;
  margin-bottom: 28px;
  border-radius: 50%;
  color: #fff;
  background: var(--ok);
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 30px rgba(38, 166, 109, 0.2);
}

.agent-result-mark[hidden] {
  display: none;
}

.agent-result-digits {
  display: grid;
  grid-template-columns: repeat(4, 62px);
  gap: 12px;
  margin-bottom: 30px;
}

.agent-result-digits[hidden] {
  display: none;
}

.agent-result-digits span {
  position: relative;
  height: 72px;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(31, 35, 44, 0.06);
}

.agent-result-digits span::after {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  content: "";
  background: #5952ff;
  transform: translateX(-50%);
  animation: digitListen 1.4s ease-in-out infinite;
}

.agent-result-digits span:nth-child(2)::after { animation-delay: 0.12s; }
.agent-result-digits span:nth-child(3)::after { animation-delay: 0.24s; }
.agent-result-digits span:nth-child(4)::after { animation-delay: 0.36s; }

.agent-result-view.retry .agent-result-digits span {
  border-color: rgba(217, 48, 79, 0.3);
}

.agent-result-view.retry .agent-result-digits span::after {
  background: var(--danger);
}

.agent-result-view.retry .checkin-progress li.active span {
  border-color: var(--danger);
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(217, 48, 79, 0.08);
}

.agent-result-view.manual .agent-result-mark {
  background: #df8a19;
  box-shadow: 0 12px 30px rgba(223, 138, 25, 0.2);
}

.agent-result-view.manual .checkin-progress li.active span {
  border-color: #df8a19;
  background: #df8a19;
  box-shadow: 0 0 0 6px rgba(223, 138, 25, 0.09);
}

.agent-result-view.already .agent-result-mark {
  background: #5952ff;
  box-shadow: 0 12px 30px rgba(89, 82, 255, 0.2);
}

.agent-result-eyebrow {
  margin: 0 0 12px;
  color: #697080;
  font-size: 15px;
  font-weight: 700;
}

.agent-result-content h2 {
  margin: 0;
  color: #17191f;
  font-size: 52px;
  line-height: 1.2;
  letter-spacing: 0;
}

.agent-result-company {
  max-width: 680px;
  margin: 24px 0 0;
  color: #245f51;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.agent-result-body {
  max-width: 620px;
  margin: 18px 0 0;
  color: #697080;
  font-size: 18px;
  line-height: 1.7;
}

.agent-result-meta {
  margin: 16px 0 0;
  color: #9aa1ad;
  font-size: 13px;
  line-height: 1.5;
}

.agent-result-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  min-height: 22px;
  font-size: 13px;
}

@keyframes digitListen {
  0%,
  100% {
    opacity: 0.35;
    transform: translateX(-50%) translateY(0) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px) scale(1);
  }
}

@keyframes resultReveal {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes orbitRotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes barBreathe {
  0%,
  100% {
    height: var(--bar-height);
    opacity: 0.42;
  }
  50% {
    height: calc(var(--bar-height) + 9px);
    opacity: 0.8;
  }
}

@keyframes barSpeak {
  0%,
  100% {
    height: var(--bar-height);
    opacity: 0.48;
  }
  45% {
    height: calc(var(--bar-height) + var(--boost));
    opacity: 1;
  }
}

@keyframes avatarFloat {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-4px);
  }
}

@keyframes avatarPeekIn {
  0% {
    opacity: 0;
    transform: translateY(34px) scale(0.84);
  }
  58% {
    opacity: 1;
    transform: translateY(-7px) scale(1.025);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes avatarHeadPeek {
  0% {
    transform: translateX(-50%) translateY(18px) scale(0.96);
  }
  58% {
    transform: translateX(-50%) translateY(-6px) scale(1.01);
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-orbit.peeking .avatar-disc,
  .avatar-orbit.peeking .avatar-disc img,
  .agent-result-content {
    animation: none;
  }

  .agent-result-digits span::after {
    animation: none;
  }
}

@media (max-width: 760px) {
  .voice-page {
    align-items: start;
    padding-top: 72px;
  }

  .hero {
    margin-top: 0;
  }

  .avatar-orbit {
    width: 158px;
    height: 158px;
    margin-bottom: 36px;
  }

  .wave-bars i {
    transform:
      translate(-50%, -50%)
      rotate(var(--angle))
      translateY(-72px);
    transform-origin: 50% 50%;
  }

  .avatar-disc {
    width: 134px;
    height: 134px;
    outline-width: 5px;
  }

  .avatar-disc img {
    top: -44px;
    width: 262px;
  }

  .hero-copy p {
    font-size: 15px;
  }

  .hero-actions {
    margin-top: 42px;
  }

  .agent-result-view {
    inset: 0;
    min-height: 100vh;
    padding: 22px 18px 20px;
  }

  .agent-result-header > span {
    font-size: 12px;
  }

  .agent-result-content {
    min-height: 500px;
    padding-top: 22px;
  }

  .agent-result-content h2 {
    font-size: 36px;
  }

  .agent-result-company {
    font-size: 22px;
  }

  .agent-result-view.manual .agent-result-content h2 {
    font-size: 32px;
  }

  .checkin-progress {
    margin-bottom: 42px;
  }

  .agent-result-digits {
    grid-template-columns: repeat(4, minmax(48px, 58px));
    gap: 9px;
  }
}

@media (max-width: 460px) {
  .primary-action {
    width: 100%;
    min-width: 0;
  }
}
