:root {
  color-scheme: light;
  --navy-950: #071e27;
  --navy-900: #0d2934;
  --navy-800: #163946;
  --cream-50: #fdfbf5;
  --cream-100: #f6f1e6;
  --cream-200: #e8dfcf;
  --teal-300: #74d4c7;
  --teal-400: #3bb9aa;
  --teal-500: #199d91;
  --coral: #c96552;
  --ink: #18343d;
  --muted: #62757a;
  --shadow: 0 24px 70px rgba(10, 39, 49, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--cream-50);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 83% 8%, rgba(116, 212, 199, 0.18), transparent 26rem),
    radial-gradient(circle at 8% 68%, rgba(232, 223, 207, 0.7), transparent 25rem),
    var(--cream-50);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(25, 157, 145, 0.38);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: white;
  background: var(--navy-950);
  border-radius: 0.5rem;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.5rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--navy-950);
  font-size: 1.15rem;
  font-weight: 760;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 2rem;
  height: 2rem;
  background: var(--navy-900);
  border-radius: 50%;
}

.brand-mark span {
  width: 2px;
  background: var(--teal-300);
  border-radius: 99px;
}

.brand-mark span:nth-child(1) { height: 0.45rem; }
.brand-mark span:nth-child(2) { height: 0.9rem; }
.brand-mark span:nth-child(3) { height: 0.6rem; }

.header-actions,
.phone-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.phone-link {
  color: var(--navy-800);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

.phone-link svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.text-button {
  padding: 0.35rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
}

.text-button:hover {
  color: var(--navy-900);
}

.page-shell {
  width: min(1180px, calc(100% - 3rem));
  margin: 3.5rem auto 4rem;
}

.page-shell:focus {
  outline: none;
}

.intro {
  width: min(720px, 100%);
  margin-bottom: 2.6rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--teal-500);
  font-size: 0.73rem;
  font-weight: 780;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 1rem;
  color: var(--navy-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.intro-copy {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.state-panel,
.login-card {
  min-height: 240px;
  padding: clamp(2rem, 5vw, 4rem);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(22, 57, 70, 0.09);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
}

.state-panel {
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.state-panel h2,
.login-card h2,
.transcript-card h2 {
  margin-bottom: 0.65rem;
  color: var(--navy-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.state-panel p,
.login-card p {
  max-width: 480px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.state-icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.2rem;
  color: var(--teal-500);
  border: 1px solid var(--cream-200);
  border-radius: 50%;
  font-size: 1.5rem;
}

.loading-ring {
  width: 2rem;
  height: 2rem;
  margin-bottom: 1rem;
  border: 2px solid var(--cream-200);
  border-top-color: var(--teal-500);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
  align-items: end;
  gap: 3rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--navy-800);
  font-size: 0.82rem;
  font-weight: 700;
}

.field-row {
  display: flex;
  gap: 0.65rem;
}

.field-row input,
.text-form input {
  min-width: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--cream-200);
  border-radius: 0.8rem;
}

.field-row input {
  flex: 1;
  padding: 0.82rem 0.95rem;
}

.primary-button {
  padding: 0.82rem 1.2rem;
  color: white;
  background: var(--navy-900);
  border: 0;
  border-radius: 0.8rem;
  cursor: pointer;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--navy-800);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.form-error,
.session-error {
  color: #9f3f32 !important;
  font-size: 0.82rem;
}

.form-error {
  margin-top: 0.75rem !important;
}

.voice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 1.25rem;
}

.voice-card,
.transcript-card {
  overflow: hidden;
  border: 1px solid rgba(22, 57, 70, 0.1);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
}

.voice-card {
  display: flex;
  min-height: 570px;
  padding: clamp(1.5rem, 4vw, 3rem);
  flex-direction: column;
  align-items: center;
  background: var(--navy-900);
}

.voice-presence {
  display: grid;
  flex: 1;
  min-height: 245px;
  place-items: center;
}

.voice-orb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.36rem;
  width: clamp(9.8rem, 22vw, 13rem);
  aspect-ratio: 1;
  color: var(--teal-300);
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.17), transparent 34%),
    linear-gradient(145deg, rgba(62, 186, 172, 0.34), rgba(5, 25, 33, 0.35));
  border: 1px solid rgba(116, 212, 199, 0.2);
  border-radius: 50%;
  box-shadow:
    inset 0 0 45px rgba(116, 212, 199, 0.13),
    0 20px 65px rgba(3, 18, 23, 0.38);
  transition: opacity 180ms ease, transform 280ms ease, box-shadow 280ms ease;
}

.voice-orb::before,
.voice-orb::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(116, 212, 199, 0.16);
  border-radius: 50%;
  inset: -0.9rem;
}

.voice-orb::after {
  border-color: rgba(116, 212, 199, 0.08);
  inset: -1.8rem;
}

.voice-orb > span {
  width: 0.27rem;
  height: 1.1rem;
  background: currentColor;
  border-radius: 99px;
  opacity: 0.76;
}

.voice-orb > span:nth-child(2),
.voice-orb > span:nth-child(4) { height: 2rem; }
.voice-orb > span:nth-child(3) { height: 3rem; }

.voice-orb.is-connecting {
  animation: breathe 1.4s ease-in-out infinite;
}

.voice-orb.is-listening > span {
  animation: listen 1.25s ease-in-out infinite;
}

.voice-orb.is-listening > span:nth-child(2) { animation-delay: -0.2s; }
.voice-orb.is-listening > span:nth-child(3) { animation-delay: -0.4s; }
.voice-orb.is-listening > span:nth-child(4) { animation-delay: -0.6s; }
.voice-orb.is-listening > span:nth-child(5) { animation-delay: -0.8s; }

.voice-orb.is-speaking {
  transform: scale(1.045);
  box-shadow:
    inset 0 0 58px rgba(116, 212, 199, 0.24),
    0 0 70px rgba(59, 185, 170, 0.18),
    0 20px 65px rgba(3, 18, 23, 0.38);
}

.voice-orb.is-speaking > span {
  animation: speak 480ms ease-in-out infinite alternate;
}

.voice-orb.is-speaking > span:nth-child(2) { animation-delay: -160ms; }
.voice-orb.is-speaking > span:nth-child(3) { animation-delay: -320ms; }
.voice-orb.is-speaking > span:nth-child(4) { animation-delay: -80ms; }
.voice-orb.is-muted {
  opacity: 0.52;
}

.voice-state {
  min-height: 5.6rem;
  text-align: center;
}

.status-label {
  margin-bottom: 0.35rem;
  color: white;
  font-size: 1.1rem;
  font-weight: 730;
}

.status-detail {
  margin-bottom: 0;
  color: rgba(240, 248, 245, 0.62);
  font-size: 0.86rem;
  line-height: 1.5;
}

.session-error {
  margin: 0.55rem 0 0;
  color: #ffb4a7 !important;
}

.call-controls {
  display: flex;
  min-height: 3.5rem;
  margin: 1.2rem 0 1.3rem;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.call-button,
.round-button {
  color: var(--navy-950);
  background: var(--teal-300);
  border: 0;
  cursor: pointer;
}

.call-button:hover,
.round-button:hover:not(:disabled) {
  background: #92e2d7;
  transform: translateY(-1px);
}

.call-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.9rem 1.3rem;
  border-radius: 99px;
  font-weight: 760;
}

.call-button svg,
.round-button svg,
.text-form button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

.round-button {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  place-items: center;
  border-radius: 50%;
}

.round-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.stop-control {
  color: white;
  background: var(--coral);
}

.stop-control:hover:not(:disabled) {
  background: #df7460;
}

#mute-button .mic-off {
  display: none;
}

#mute-button[aria-pressed="true"] .mic-on {
  display: none;
}

#mute-button[aria-pressed="true"] .mic-off {
  display: block;
}

.text-form {
  display: flex;
  width: 100%;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  gap: 0.6rem;
}

.text-form input {
  flex: 1;
  padding: 0.82rem 0.95rem;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.13);
}

.text-form input::placeholder {
  color: rgba(255, 255, 255, 0.46);
}

.text-form input:disabled {
  opacity: 0.55;
}

.text-form button {
  display: grid;
  width: 2.9rem;
  place-items: center;
  color: var(--navy-950);
  background: var(--cream-50);
  border: 0;
  border-radius: 0.8rem;
  cursor: pointer;
}

.text-form button:disabled {
  cursor: default;
  opacity: 0.36;
}

.transcript-card {
  display: flex;
  min-height: 570px;
  max-height: 670px;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.74);
}

.transcript-header {
  display: flex;
  padding: 1.8rem 2rem 1.25rem;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid rgba(22, 57, 70, 0.08);
}

.transcript-header .eyebrow {
  margin-bottom: 0.35rem;
}

.transcript-header h2 {
  margin: 0;
  font-size: 1.65rem;
}

.transcript {
  display: flex;
  flex: 1;
  padding: 1.5rem 2rem 2rem;
  flex-direction: column;
  gap: 1.35rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--cream-200) transparent;
}

.empty-transcript {
  display: grid;
  flex: 1;
  min-height: 300px;
  place-content: center;
  color: #89979a;
  text-align: center;
}

.empty-transcript span {
  height: 3rem;
  color: var(--cream-200);
  font-family: Georgia, serif;
  font-size: 5rem;
  line-height: 1;
}

.empty-transcript p {
  margin: 0;
  font-size: 0.9rem;
}

.turn {
  width: min(86%, 34rem);
}

.turn-user {
  align-self: flex-end;
}

.turn-assistant {
  align-self: flex-start;
}

.turn-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.turn-user .turn-label {
  text-align: right;
}

.turn-content {
  margin: 0;
  padding: 0.9rem 1.05rem;
  color: var(--ink);
  background: var(--cream-100);
  border-radius: 1rem 1rem 1rem 0.25rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.turn-user .turn-content {
  color: white;
  background: var(--navy-800);
  border-radius: 1rem 1rem 0.25rem 1rem;
}

.turn.is-streaming .turn-content::after {
  display: inline-block;
  width: 0.4rem;
  height: 0.9rem;
  margin-left: 0.2rem;
  vertical-align: -0.08rem;
  background: currentColor;
  border-radius: 2px;
  content: "";
  opacity: 0.45;
  animation: blink 900ms steps(2, jump-none) infinite;
}

footer {
  width: min(1180px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 0 0 2rem;
  color: #819095;
  font-size: 0.75rem;
  text-align: center;
}

footer p {
  margin: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.035); opacity: 0.78; } }
@keyframes listen { 50% { transform: scaleY(0.48); } }
@keyframes speak { to { transform: scaleY(1.75); } }
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 860px) {
  .page-shell {
    margin-top: 2.5rem;
  }

  .voice-layout,
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-card {
    align-items: start;
    gap: 2rem;
  }

  .transcript-card {
    min-height: 460px;
  }
}

@media (max-width: 560px) {
  .site-header,
  .page-shell,
  footer {
    width: min(100% - 1.5rem, 1180px);
  }

  .site-header {
    padding-top: 1rem;
  }

  .phone-link span {
    display: none;
  }

  .page-shell {
    margin-top: 2rem;
  }

  .intro {
    margin-bottom: 2rem;
  }

  .voice-card {
    min-height: 535px;
    border-radius: 1.2rem;
  }

  .voice-presence {
    min-height: 225px;
  }

  .transcript-card {
    border-radius: 1.2rem;
  }

  .transcript-header {
    padding: 1.4rem 1.25rem 1rem;
  }

  .transcript {
    padding: 1.25rem;
  }

  .field-row {
    flex-direction: column;
  }
}

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