:root {
  color-scheme: dark;
  --bg: #07120f;
  --panel: rgba(16, 36, 30, 0.72);
  --ink: #f4f7f5;
  --muted: #95a79f;
  --green: #98f5ba;
  --green-strong: #42df7d;
  --red: #fa675f;
  --line: rgba(164, 233, 190, 0.14);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 34%, rgba(54, 154, 96, 0.19), transparent 35%),
    radial-gradient(circle at 0 100%, rgba(32, 101, 73, 0.22), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100%, 520px);
  height: 100dvh;
  min-height: 570px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 22px max(18px, env(safe-area-inset-bottom));
}

.topbar { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 11px; }
.topbar h1 { margin: 3px 0 0; font-size: 17px; line-height: 1.2; font-weight: 620; letter-spacing: -.01em; }
.eyebrow { margin: 0; color: var(--green); font-size: 9px; line-height: 1; font-weight: 760; letter-spacing: .17em; }

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(152, 245, 186, .34);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(152,245,186,.17), rgba(152,245,186,.03));
}
.brand-mark::before, .brand-mark::after, .brand-mark span {
  content: "";
  position: absolute;
  left: 9px;
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: var(--green);
  transform: rotate(-53deg);
  box-shadow: 0 0 9px rgba(152,245,186,.35);
}
.brand-mark::before { top: 13px; }
.brand-mark span { top: 18px; left: 11px; width: 14px; }
.brand-mark::after { top: 23px; }

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.035);
  font-size: 28px;
  line-height: 1;
  color: #a6b4ae;
}

.conversation { display: flex; min-height: 0; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.state-copy { min-height: 107px; width: 100%; }
.state-label { margin: 0 0 11px; color: var(--green); font-size: 10px; font-weight: 760; letter-spacing: .16em; }
.state-copy h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 8vw, 42px); font-weight: 500; letter-spacing: -.035em; }
.stateHint { max-width: 360px; margin: 13px auto 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

.orb-wrap { position: relative; display: grid; place-items: center; width: 230px; height: 230px; margin: 8px 0 3px; }
.orbit { position: absolute; border: 1px solid rgba(152,245,186,.11); border-radius: 50%; transition: transform .4s, opacity .4s; }
.orbit-one { width: 190px; height: 190px; }
.orbit-two { width: 225px; height: 225px; border-style: dashed; animation: rotate 28s linear infinite; }
.voice-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(190,255,215,.32);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(209,255,225,.18), transparent 24%),
    radial-gradient(circle at 50% 58%, rgba(83,239,140,.35), rgba(25,102,65,.14) 52%, rgba(8,32,24,.94) 73%);
  box-shadow: inset 0 0 38px rgba(109,241,158,.13), 0 0 54px rgba(50,210,111,.12);
  transition: transform .3s, box-shadow .3s;
}
.wave-bars { display: flex; align-items: center; gap: 5px; height: 42px; }
.wave-bars i { display: block; width: 4px; height: 12px; border-radius: 9px; background: var(--green); box-shadow: 0 0 9px rgba(152,245,186,.42); transform-origin: center; }
.wave-bars i:nth-child(2), .wave-bars i:nth-child(4) { height: 24px; }
.wave-bars i:nth-child(3) { height: 37px; }

.is-listening .voice-orb, .is-speaking .voice-orb { box-shadow: inset 0 0 44px rgba(109,241,158,.22), 0 0 75px rgba(66,223,125,.29); }
.is-listening .orbit-one, .is-speaking .orbit-one { animation: pulse 2s ease-in-out infinite; }
.is-listening .wave-bars i { animation: listen .75s ease-in-out infinite alternate; }
.is-listening .wave-bars i:nth-child(2) { animation-delay: -.2s; }
.is-listening .wave-bars i:nth-child(3) { animation-delay: -.45s; }
.is-listening .wave-bars i:nth-child(4) { animation-delay: -.1s; }
.is-speaking .wave-bars i { animation: speak .48s ease-in-out infinite alternate; }
.is-speaking .wave-bars i:nth-child(2) { animation-delay: -.35s; }
.is-speaking .wave-bars i:nth-child(3) { animation-delay: -.15s; }
.is-speaking .wave-bars i:nth-child(4) { animation-delay: -.4s; }
.is-thinking .orbit-two { animation-duration: 3s; border-color: rgba(152,245,186,.36); }
.has-error .voice-orb { border-color: rgba(250,103,95,.5); box-shadow: 0 0 55px rgba(250,103,95,.14); }

.transcript { width: 100%; min-height: 80px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); backdrop-filter: blur(10px); text-align: left; }
.transcript-speaker { margin: 0 0 6px; color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.transcriptText { display: -webkit-box; overflow: hidden; margin: 0; color: #d8e1dd; font-size: 14px; line-height: 1.42; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.latency { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: #82968d; font-size: 11px; }
.latency-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-strong); box-shadow: 0 0 8px rgba(66,223,125,.7); }

.controls { text-align: center; }
.start-button {
  display: inline-flex;
  width: min(100%, 330px);
  height: 58px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 18px;
  background: var(--green);
  color: #092014;
  font-weight: 720;
  box-shadow: 0 13px 35px rgba(66,223,125,.18);
}
.call-icon { position: relative; display: block; width: 18px; height: 18px; border: 3px solid currentColor; border-top-color: transparent; border-right-color: transparent; border-radius: 4px 4px 10px 4px; transform: rotate(-45deg); }
.call-icon::after { content: ""; position: absolute; right: -5px; bottom: -5px; width: 7px; height: 5px; border-radius: 2px; background: currentColor; }
.call-controls { display: flex; align-items: center; justify-content: center; gap: 24px; }
.round-button, .hangup-button { display: grid; place-items: center; width: 54px; height: 54px; padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; background: rgba(255,255,255,.07); font-size: 12px; font-weight: 760; }
.hangup-button { width: 66px; height: 66px; border: 0; background: var(--red); box-shadow: 0 10px 30px rgba(250,103,95,.22); }
.mic-icon { width: 12px; height: 20px; border: 2px solid currentColor; border-radius: 8px; }
.mic-icon::after { content: ""; display: block; width: 19px; height: 11px; margin: 10px 0 0 -5.5px; border-bottom: 2px solid currentColor; border-left: 2px solid currentColor; border-right: 2px solid currentColor; border-radius: 0 0 10px 10px; }
.hangup-icon { width: 28px; height: 14px; border-top: 6px solid #fff; border-radius: 50% 50% 0 0; transform: rotate(180deg); }
.captions-on { color: var(--green); border-color: rgba(152,245,186,.4); }
.is-muted { color: var(--red); }
.privacy-note { margin: 14px 0 0; color: #62756c; font-size: 10px; }
.lock-icon { display: inline-block; width: 8px; height: 7px; margin-right: 4px; border: 1px solid currentColor; border-radius: 2px; }

[hidden] { display: none !important; }
button:active { transform: scale(.97); }

@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.07); opacity: .55; } }
@keyframes listen { to { transform: scaleY(.45); } }
@keyframes speak { from { transform: scaleY(.35); } to { transform: scaleY(1.18); } }

@media (max-height: 680px) {
  .app-shell { padding-top: max(12px, env(safe-area-inset-top)); }
  .orb-wrap { width: 180px; height: 180px; margin: 0; }
  .voice-orb { width: 125px; height: 125px; }
  .orbit-one { width: 155px; height: 155px; }
  .orbit-two { width: 180px; height: 180px; }
  .state-copy { min-height: 88px; }
  .state-copy h2 { font-size: 29px; }
  .stateHint { margin-top: 8px; }
}

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