:root {
  color-scheme: dark;
  --background: #080a10;
  --panel: rgba(16, 20, 30, 0.86);
  --panel-strong: #121722;
  --line: rgba(255, 255, 255, 0.09);
  --muted: #8d96a8;
  --text: #f7f8fb;
  --accent: #9d8cff;
  --accent-bright: #c3b8ff;
  --accent-soft: rgba(157, 140, 255, 0.16);
  --green: #72e1b4;
  --danger: #ff5e6c;
  --shadow: 0 34px 100px rgba(0, 0, 0, 0.48);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 48% -8%, rgba(118, 93, 255, 0.17), transparent 36rem),
    linear-gradient(160deg, #0b0e16 0%, var(--background) 56%, #07090e 100%);
}

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

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(195, 184, 255, 0.78);
  outline-offset: 4px;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-one {
  top: 15%;
  left: -12rem;
  width: 28rem;
  height: 28rem;
  background: #735cff;
}

.ambient-two {
  right: -10rem;
  bottom: -8rem;
  width: 24rem;
  height: 24rem;
  background: #3b9b9c;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  height: 76px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--text);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #0c0e15;
  background: linear-gradient(145deg, #e9e5ff, #a99aff);
  box-shadow: 0 8px 24px rgba(157, 140, 255, 0.24);
}

.private-badge,
.connection-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #bbc2cf;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  font-weight: 650;
}

.private-badge {
  padding: 8px 12px;
}

.private-badge span {
  color: var(--green);
  font-size: 8px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logout-button {
  padding: 8px 4px;
  border: 0;
  color: #7e8797;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

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

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 28px auto 44px;
}

.call-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.call-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 650px;
  padding: 58px 42px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 37%, rgba(157, 140, 255, 0.12), transparent 16rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), transparent);
}

.connection-pill {
  position: absolute;
  top: 28px;
  padding: 8px 13px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #737b89;
}

body[data-phase="connecting"] .status-dot,
body[data-phase="thinking"] .status-dot {
  background: #ffd17b;
  box-shadow: 0 0 12px rgba(255, 209, 123, 0.65);
}

body[data-phase="listening"] .status-dot,
body[data-phase="speaking"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 12px rgba(114, 225, 180, 0.65);
}

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

.avatar {
  position: relative;
  z-index: 2;
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 44px;
  color: rgba(255, 255, 255, 0.92);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 44%),
    linear-gradient(145deg, #9e8cff, #5d4fc8 62%, #35305f);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.3),
    0 24px 56px rgba(73, 58, 162, 0.42);
  font-size: 29px;
  font-weight: 760;
  letter-spacing: -0.05em;
}

.pulse-ring {
  position: absolute;
  z-index: 1;
  width: 148px;
  height: 148px;
  border: 1px solid rgba(157, 140, 255, 0.38);
  border-radius: 50%;
  opacity: 0;
}

body[data-phase="speaking"] .pulse-ring,
body[data-phase="listening"] .pulse-ring {
  animation: pulse 2.1s ease-out infinite;
}

body[data-phase="speaking"] .pulse-two,
body[data-phase="listening"] .pulse-two {
  animation-delay: 0.75s;
}

@keyframes pulse {
  0% { opacity: 0.6; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.35); }
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent-bright);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.18em;
}

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

h1 {
  margin-bottom: 13px;
  font-size: clamp(31px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.call-subtitle {
  max-width: 420px;
  min-height: 46px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.timer {
  margin: 0 0 29px;
  color: #dce0e9;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.start-button {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-width: 184px;
  min-height: 54px;
  padding: 0 24px;
  border: 0;
  border-radius: 17px;
  color: #11121a;
  background: linear-gradient(145deg, #ddd7ff, #9f90ff);
  box-shadow: 0 15px 38px rgba(132, 112, 255, 0.28);
  cursor: pointer;
  font-weight: 760;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 19px 45px rgba(132, 112, 255, 0.36);
}

.start-button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

.phone-icon,
.hangup-icon {
  display: inline-block;
  font-size: 22px;
  transform: rotate(-42deg);
}

.call-controls {
  display: flex;
  gap: 24px;
  align-items: center;
}

.call-controls[hidden],
.primary-action[hidden] {
  display: none;
}

.round-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  min-width: 74px;
  border: 0;
  color: #c8ced8;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.control-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 19px;
  color: #f0f2f7;
  background: rgba(255, 255, 255, 0.075);
  font-size: 19px;
  transition: background 150ms ease, transform 150ms ease;
}

.round-control:hover .control-icon {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.round-control[aria-pressed="true"] .control-icon {
  color: #151720;
  background: #e3dfff;
}

.hangup-control .control-icon {
  color: white;
  background: var(--danger);
  box-shadow: 0 12px 28px rgba(255, 64, 80, 0.23);
}

.transcript-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 34px 30px;
  border-left: 1px solid var(--line);
  background: rgba(6, 9, 14, 0.34);
}

.transcript-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.transcript-heading h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.035em;
}

.text-button {
  padding: 7px 0 7px 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

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

.transcript {
  display: flex;
  min-height: 350px;
  max-height: 558px;
  flex: 1;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 24px 4px 10px;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.empty-transcript {
  display: grid;
  flex: 1;
  place-content: center;
  color: #687183;
  text-align: center;
  font-size: 12px;
}

.wave-glyph {
  margin-bottom: 10px;
  color: #7569bd;
  font-size: 24px;
  letter-spacing: -0.2em;
}

.turn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: appear 180ms ease-out;
}

.turn-role {
  color: #737d90;
  font-size: 10px;
  font-weight: 730;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.turn-text {
  width: fit-content;
  max-width: 92%;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px 16px 16px 16px;
  color: #dce0e8;
  background: rgba(255, 255, 255, 0.046);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.turn[data-role="assistant"] {
  align-items: flex-end;
}

.turn[data-role="assistant"] .turn-text {
  border-color: rgba(157, 140, 255, 0.2);
  border-radius: 16px 6px 16px 16px;
  background: var(--accent-soft);
}

.turn[data-role="assistant"] .turn-role {
  color: #9d91d4;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.privacy-note {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  margin: 18px auto 0;
  color: #6f7786;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.privacy-note span {
  color: #7f72c7;
  font-size: 8px;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100% - 44px));
  padding: 13px 16px;
  border: 1px solid rgba(255, 94, 108, 0.28);
  border-radius: 13px;
  color: #ffdadd;
  background: rgba(57, 17, 23, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  font-size: 13px;
}

noscript {
  display: block;
  padding: 20px;
  color: white;
  text-align: center;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-shell {
  width: min(430px, calc(100% - 32px));
  padding: 40px 0;
}

.login-card {
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.login-brand {
  margin-bottom: 38px;
}

.login-card h1 {
  margin-bottom: 12px;
  font-size: 34px;
}

.login-copy {
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.field-label {
  display: block;
  margin: 17px 0 8px;
  color: #c7ccd6;
  font-size: 12px;
  font-weight: 650;
}

.login-card input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: rgba(4, 7, 12, 0.5);
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-card input:focus {
  border-color: rgba(157, 140, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(157, 140, 255, 0.1);
}

.login-button {
  width: 100%;
  margin-top: 28px;
}

.login-error {
  min-height: 20px;
  margin: 14px 0 0;
  color: #ff9aa3;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 820px) {
  .page-shell {
    margin-top: 10px;
  }

  .call-panel {
    grid-template-columns: 1fr;
  }

  .call-stage {
    min-height: 610px;
  }

  .transcript-panel {
    min-height: 410px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .transcript {
    min-height: 310px;
    max-height: 420px;
  }
}

@media (max-width: 520px) {
  .site-header,
  .page-shell {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    height: 64px;
  }

  .private-badge {
    display: none;
  }

  .login-card {
    padding: 34px 26px;
  }

  .call-panel {
    border-radius: 22px;
  }

  .call-stage {
    min-height: 570px;
    padding: 58px 24px 38px;
  }

  .connection-pill {
    top: 20px;
  }

  .avatar-wrap {
    width: 160px;
    height: 160px;
    margin-bottom: 22px;
  }

  .avatar {
    width: 116px;
    height: 116px;
    border-radius: 38px;
  }

  .pulse-ring {
    width: 128px;
    height: 128px;
  }

  .transcript-panel {
    padding: 28px 22px;
  }

  .privacy-note {
    align-items: flex-start;
    padding: 0 10px;
  }
}

@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;
  }
}
