:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --ink: #111114;
  --muted: #777982;
  --soft: #a8abb3;
  --line: rgba(17, 17, 20, 0.1);
  --line-strong: rgba(17, 17, 20, 0.16);
  --blue: #007aff;
  --green: #30d158;
  --red: #ff3b30;
  --shadow: rgba(19, 24, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.95), transparent 330px),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 58%, #efeff3 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vh, 28px) clamp(18px, 4vw, 48px);
}

.hero {
  width: min(100%, 640px);
  min-height: min(700px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto auto minmax(190px, 0.86fr) auto;
  align-items: center;
  gap: clamp(14px, 2.6vh, 24px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand,
.status,
.form {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 20px 70px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.brand {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 13px 6px 7px;
  border-radius: 999px;
  color: rgba(17, 17, 20, 0.9);
  font-size: 14px;
  font-weight: 650;
}

.mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 780;
}

.status {
  min-height: 38px;
  max-width: min(50vw, 280px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  color: rgba(17, 17, 20, 0.78);
  font-size: 13px;
  font-weight: 590;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status::before {
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.14);
  content: "";
}

.intro {
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(44px, 8vw, 76px);
  line-height: 0.95;
  font-weight: 710;
  letter-spacing: 0;
}

.agent-stage {
  display: grid;
  place-items: center;
  min-height: clamp(200px, 32vh, 290px);
}

.agent-orb {
  position: relative;
  width: clamp(190px, 34vw, 270px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  animation: agent-breathe 5s ease-in-out infinite;
}

.agent-orb::before,
.agent-orb::after,
.orb-shell,
.orb-sheen,
.voice-line {
  position: absolute;
  content: "";
}

.agent-orb::before {
  inset: -28%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 122, 255, 0.1), transparent 58%);
  filter: blur(4px);
  opacity: 0.7;
}

.agent-orb::after {
  inset: 7%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.95);
}

.orb-shell {
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 25%, rgba(255, 255, 255, 0.98), transparent 30%),
    radial-gradient(circle at 62% 70%, rgba(0, 122, 255, 0.14), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(226, 229, 235, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.86);
  box-shadow:
    0 38px 90px rgba(52, 64, 86, 0.18),
    0 14px 34px rgba(52, 64, 86, 0.14),
    inset 0 -20px 50px rgba(178, 187, 205, 0.28);
}

.orb-sheen {
  inset: 10%;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), transparent 38%),
    radial-gradient(circle at 48% 55%, rgba(17, 17, 20, 0.08), transparent 43%);
  filter: blur(0.2px);
}

.voice-line {
  left: 50%;
  top: 50%;
  width: 7px;
  height: 40px;
  border-radius: 999px;
  background: rgba(17, 17, 20, 0.64);
  transform: translate(-50%, -50%);
  opacity: 0.72;
  animation: voice-level 1.8s ease-in-out infinite;
}

.line-one {
  height: 22px;
  margin-left: -42px;
  animation-delay: -0.5s;
}

.line-two {
  height: 50px;
  margin-left: -22px;
  animation-delay: -0.9s;
}

.line-three {
  height: 66px;
  background: var(--blue);
  opacity: 0.86;
  animation-delay: -0.2s;
}

.line-four {
  height: 50px;
  margin-left: 22px;
  animation-delay: -1.1s;
}

.line-five {
  height: 22px;
  margin-left: 42px;
  animation-delay: -0.7s;
}

.form {
  width: min(100%, 590px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(132px, 0.72fr) auto;
  gap: 8px;
  margin: 0 auto;
  padding: 8px;
  border-radius: 26px;
}

.form[hidden] {
  display: none;
}

.referral-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

label {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 9px 12px;
  border-radius: 20px;
  background: rgba(247, 247, 250, 0.72);
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 31px;
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  font-weight: 610;
}

input::placeholder {
  color: rgba(17, 17, 20, 0.34);
}

select {
  appearance: none;
  padding-right: 19px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(17, 17, 20, 0.5) 50%),
    linear-gradient(135deg, rgba(17, 17, 20, 0.5) 50%, transparent 50%);
  background-position: calc(100% - 10px) 50%, calc(100% - 5px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.2);
  outline-offset: 3px;
}

.actions {
  display: contents;
}

button {
  min-width: 96px;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 20px;
  background: var(--ink);
  color: white;
  font-size: 16px;
  font-weight: 690;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(17, 17, 20, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex: 0 0 auto;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(17, 17, 20, 0.22);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.hangup-button {
  background: var(--red);
}

.hangup-button[hidden] {
  display: none;
}

.shell[data-call-state="working"] .agent-orb,
.shell[data-call-state="active"] .agent-orb {
  animation-duration: 3s;
}

.shell[data-call-state="active"] .voice-line {
  animation-duration: 0.9s;
}

.shell[data-call-state="active"] .status::before {
  animation: status-pulse 1.5s ease-in-out infinite;
}

.shell[data-call-state="ending"] .status::before,
.shell[data-call-state="error"] .status::before {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.14);
}

@keyframes agent-breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-6px) scale(1.018);
  }
}

@keyframes voice-level {
  0%,
  100% {
    transform: translate(-50%, -50%) scaleY(0.62);
  }
  50% {
    transform: translate(-50%, -50%) scaleY(1.05);
  }
}

@keyframes status-pulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 16px;
  }

  .hero {
    min-height: calc(100vh - 32px);
    grid-template-rows: auto auto minmax(190px, 0.8fr) auto;
    gap: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .status {
    max-width: 48vw;
  }

  h1 {
    font-size: clamp(42px, 15vw, 64px);
  }

  .agent-stage {
    min-height: 210px;
  }

  .agent-orb {
    width: clamp(180px, 54vw, 240px);
  }

  .form {
    grid-template-columns: 1fr;
    border-radius: 25px;
  }

  .referral-form {
    grid-template-columns: 1fr;
  }

  label {
    min-height: 70px;
  }

  button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .brand {
    padding-right: 10px;
  }

  .status {
    max-width: 42vw;
    padding: 0 10px;
  }

  .agent-stage {
    min-height: 190px;
  }
}
