:root {
  color-scheme: dark;
  --background: #060914;
  --surface: rgba(17, 24, 47, 0.82);
  --surface-strong: #11182f;
  --surface-soft: #171f3a;
  --foreground: #f7f8ff;
  --muted: #9ba7c5;
  --border: rgba(171, 188, 230, 0.16);
  --primary: #8b5cf6;
  --primary-soft: rgba(139, 92, 246, 0.2);
  --success: #32d583;
  --success-strong: #12b76a;
  --danger: #f04438;
  --ring: #bba7ff;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--foreground);
  background:
    radial-gradient(circle at 15% 0%, rgba(105, 65, 198, 0.28), transparent 34rem),
    radial-gradient(circle at 100% 35%, rgba(30, 98, 172, 0.18), transparent 30rem),
    var(--background);
}

button { font: inherit; }

button, [role="button"] { cursor: pointer; }

button:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 4px;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.phone {
  width: min(100%, 480px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(20, 28, 54, 0.96), rgba(8, 12, 28, 0.98));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.phone__topbar {
  display: grid;
  grid-template-columns: 44px 1fr 48px;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, #9369ff, #4f46e5);
  font-weight: 800;
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 3px;
  color: #aeb9d5;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
}

.secure-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: #dfe5f7;
  font-size: 13px;
  font-weight: 600;
}

.secure-label svg, .lab-notice svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: #dfe5f7;
  background: rgba(255, 255, 255, 0.04);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.icon-button:hover { background: rgba(255, 255, 255, 0.1); }
.icon-button svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.call-stage {
  min-height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 42px 24px 30px;
  text-align: center;
}

.avatar-wrap {
  position: relative;
  width: 122px;
  height: 122px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
}

.avatar {
  position: relative;
  z-index: 2;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(193, 179, 255, .32);
  border-radius: 50%;
  color: #ded5ff;
  background: linear-gradient(145deg, rgba(140, 92, 246, .38), rgba(79, 70, 229, .16));
  box-shadow: 0 0 50px rgba(124, 58, 237, .27), inset 0 1px 0 rgba(255,255,255,.16);
}

.avatar svg { width: 37px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; }

.pulse {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(139, 92, 246, .34);
  border-radius: 50%;
  opacity: 0;
}

.is-active .pulse { animation: pulse 2s ease-out infinite; }
.is-active .pulse--two { animation-delay: 1s; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin: 0 0 10px;
  color: #b6c0d9;
  font-size: 13px;
  font-weight: 650;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(50, 213, 131, .12);
}

.status-dot[data-state="processing"]::before { background: #fdb022; box-shadow: 0 0 0 4px rgba(253, 176, 34, .12); }
.status-dot[data-state="recording"]::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(240, 68, 56, .14); }

h1 { margin: 0; font-size: clamp(28px, 8vw, 36px); line-height: 1.1; letter-spacing: -.035em; }
.phone-number { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.call-timer { min-height: 27px; margin-top: 14px; color: #c5cee5; font-size: 18px; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity 180ms ease; }
.call-timer.is-visible { opacity: 1; }

.waveform {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 12px 0 5px;
}

.waveform span {
  width: 3px;
  height: 7px;
  border-radius: 10px;
  background: linear-gradient(#bda8ff, #6554e8);
  opacity: .25;
}

.waveform.is-moving span { animation: wave .8s ease-in-out infinite alternate; opacity: .9; }
.waveform.is-moving span:nth-child(2n) { animation-delay: -.4s; }
.waveform.is-moving span:nth-child(3n) { animation-delay: -.2s; }

.instruction { max-width: 340px; min-height: 46px; margin: 0 0 20px; color: #aab5d0; font-size: 14px; line-height: 1.55; }

.call-actions { min-height: 78px; display: flex; align-items: center; justify-content: center; gap: 28px; }
.call-button {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .3);
  transition: filter 180ms ease, transform 180ms ease, opacity 180ms ease;
}
.call-button:hover { filter: brightness(1.1); }
.call-button:active { transform: scale(.96); }
.call-button svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.call-button--start { background: linear-gradient(145deg, #3be092, #079455); box-shadow: 0 14px 38px rgba(18, 183, 106, .32); }
.call-button--speak { background: linear-gradient(145deg, #9b78ff, #6941c6); box-shadow: 0 14px 38px rgba(124, 58, 237, .34); }
.call-button--end { width: 58px; height: 58px; background: linear-gradient(145deg, #f97066, #d92d20); }
.call-button--end svg { transform: rotate(135deg); }
.button-caption { min-height: 21px; margin: 7px 0 0; color: #d8def0; font-size: 13px; font-weight: 650; }
.is-hidden { display: none !important; }

.transcript {
  margin: 0 16px 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, .035);
}
.transcript__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.privacy-pill { flex: none; padding: 7px 9px; border-radius: 100px; color: #9ce6bf; background: rgba(18, 183, 106, .13); font-size: 11px; font-weight: 700; }
.messages { min-height: 68px; max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-top: 18px; scrollbar-color: #4a5577 transparent; }
.empty-message { margin: 0; color: #8f9ab7; font-size: 13px; line-height: 1.5; }
.message { max-width: 88%; padding: 11px 13px; border-radius: 15px; font-size: 14px; line-height: 1.45; text-align: left; }
.message--assistant { align-self: flex-start; color: #ebe7ff; background: rgba(139, 92, 246, .18); border-bottom-left-radius: 4px; }
.message--user { align-self: flex-end; color: #f8fbff; background: #26304e; border-bottom-right-radius: 4px; }
.message__label { display: block; margin-bottom: 4px; color: #aeb8d2; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

.lab-notice { display: flex; gap: 10px; margin: 4px 20px 22px; color: #8f9ab7; font-size: 12px; line-height: 1.45; }
.lab-notice svg { flex: none; margin-top: 2px; }
.lab-notice p { margin: 0; }
.lab-notice strong { color: #cbd3e7; }

@keyframes pulse { 0% { transform: scale(.72); opacity: .65; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes wave { from { height: 7px; } to { height: 31px; } }

@media (max-width: 520px) {
  .app-shell { padding: 0; }
  .phone { min-height: 100dvh; border: 0; border-radius: 0; }
  .call-stage { min-height: 485px; padding-top: 32px; }
}

@media (max-height: 760px) and (orientation: landscape) {
  .app-shell { display: block; }
  .phone { width: min(100%, 880px); margin: 0 auto; }
  .call-stage { min-height: 380px; padding: 24px; }
  .avatar-wrap { width: 90px; height: 90px; margin-bottom: 12px; }
  .avatar { width: 70px; height: 70px; }
}

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