*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #111111;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
}

main {
  text-align: center;
  padding: 2rem 1rem;
  max-width: 420px;
  width: 100%;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: #CBD5E1;
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
}

/* ── Orb ── */

#orb {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  cursor: pointer;
  position: relative;
  background: radial-gradient(circle at 30% 30%, #60a5fa, #2563eb 60%, #1e3a8a 100%);
  box-shadow:
    0 0 20px rgba(37, 99, 235, 0.6),
    0 0 40px rgba(96, 165, 250, 0.4),
    inset 0 0 15px rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
}

#orb::before {
  content: '';
  position: absolute;
  top: 14%;
  left: 16%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.65), transparent 70%);
  filter: blur(3px);
  pointer-events: none;
}

/* States */

#orb[data-state="idle"] {
  animation: orbPulse 3s ease-in-out infinite;
}

#orb[data-state="idle"]:hover {
  box-shadow:
    0 0 30px rgba(37, 99, 235, 0.8),
    0 0 60px rgba(96, 165, 250, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.3);
}

#orb[data-state="connecting"] {
  animation: orbPulse 0.8s ease-in-out infinite;
  cursor: default;
}

#orb[data-state="active-listening"] {
  transform: scale(1.08);
  box-shadow:
    0 0 50px rgba(37, 99, 235, 0.8),
    0 0 100px rgba(96, 165, 250, 0.4),
    inset 0 0 20px rgba(255, 255, 255, 0.3);
  cursor: default;
}

#orb[data-state="active-speaking"] {
  animation: orbSpeak 1.4s ease-in-out infinite;
  cursor: default;
}

#orb[data-state="ended"] {
  filter: brightness(0.4) saturate(0.2);
  cursor: default;
}

#orb[data-state="error"] {
  background: radial-gradient(circle at 30% 30%, #f87171, #dc2626 60%, #7f1d1d);
  box-shadow: 0 0 40px rgba(220, 38, 38, 0.6);
  cursor: default;
}

@keyframes orbPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(37,99,235,0.5), 0 0 40px rgba(96,165,250,0.3), inset 0 0 15px rgba(255,255,255,0.2);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 0 35px rgba(37,99,235,0.8), 0 0 70px rgba(96,165,250,0.5), inset 0 0 20px rgba(255,255,255,0.3);
  }
}

@keyframes orbSpeak {
  0%, 100% { transform: scale(1.04); box-shadow: 0 0 40px rgba(37,99,235,0.7), 0 0 80px rgba(96,165,250,0.4); }
  50% { transform: scale(1.12); box-shadow: 0 0 60px rgba(37,99,235,0.9), 0 0 120px rgba(96,165,250,0.6); }
}

/* ── Status label ── */

#status-label {
  color: #CBD5E1;
  font-size: 0.9rem;
  min-height: 1.4em;
  margin-bottom: 1rem;
}

/* ── Hangup button ── */

#hangup {
  background: transparent;
  color: #DC2626;
  border: 1px solid #DC2626;
  padding: 0.5rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#hangup:hover {
  background: #DC2626;
  color: #ffffff;
}

/* ── Email capture ── */

#email-capture,
#email-sent {
  margin-top: 2rem;
}

#email-capture p {
  color: #CBD5E1;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

#email-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

#email-form input[type="email"] {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #ffffff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#email-form input[type="email"]:focus {
  border-color: #046bd2;
}

#email-form input[type="email"]::placeholder {
  color: #64748b;
}

.gdpr {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: #94a3b8;
  font-size: 0.8rem;
  text-align: left;
}

.gdpr a {
  color: #046bd2;
  text-decoration: none;
}

.gdpr a:hover {
  text-decoration: underline;
}

#email-form button[type="submit"] {
  background: #046bd2;
  color: #ffffff;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#email-form button[type="submit"]:hover {
  background: #045cb4;
}

#email-sent p {
  color: #CBD5E1;
  font-size: 1.1rem;
}

/* ── Responsive ── */

@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  #orb { width: 120px; height: 120px; }
  main { padding: 1.5rem 1rem; }
}

/* ── Embed intro (hidden by default, shown in embed mode) ── */

.embed-intro {
  display: none;
}

/* ── Embed mode (?embed=true) ── */

body.embed {
  background: transparent;
  min-height: unset;
  align-items: center;
}

body.embed main {
  padding: 1rem;
  padding-top: 5rem;
}

/* Hide all typography — pure orb */
body.embed h1,
body.embed .subtitle,
body.embed .embed-intro,
body.embed #status-label {
  display: none;
}

/* Larger orb, centered without bottom margin eating space */
body.embed #orb {
  width: 140px;
  height: 140px;
  margin-bottom: 1rem;
}

/* Email form: light theme for white card */
body.embed #email-form input[type="email"] {
  background: #f8fafc;
  color: #0f172a;
  border-color: #e2e8f0;
}

body.embed #email-form input[type="email"]::placeholder {
  color: #94a3b8;
}

body.embed #email-capture p,
body.embed #email-sent p {
  color: #ffffff;
}

body.embed .gdpr {
  color: #cbd5e1;
}

body.embed #hangup {
  margin-top: 1.5rem;
}

/* In embed, hide the call section when email form is visible */
body.embed #call.hidden-in-embed {
  display: none;
}
