:root {
  color-scheme: light;
  --bg: #f5efe8;
  --surface: #fffaf4;
  --surface-strong: #ffffff;
  --surface-soft: rgba(255, 250, 244, 0.84);
  --ink: #1a2230;
  --muted: #677487;
  --line: rgba(26, 34, 48, 0.1);
  --line-strong: rgba(26, 34, 48, 0.14);
  --accent: #f36748;
  --accent-strong: #ea5939;
  --accent-live: #129866;
  --accent-error: #c34b39;
  --cool: #2f64e8;
  --navy: #17243a;
  --navy-soft: #23314b;
  --shadow-xl: 0 30px 80px rgba(54, 37, 14, 0.16);
  --shadow-lg: 0 18px 44px rgba(54, 37, 14, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --title-font: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --ui-font: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(243, 103, 72, 0.14), transparent 26%),
    radial-gradient(circle at left 20%, rgba(47, 100, 232, 0.1), transparent 20%),
    linear-gradient(180deg, #fbf8f3 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--ui-font);
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  filter: blur(18px);
  pointer-events: none;
}

body::before {
  top: 80px;
  right: 6%;
  width: 180px;
  height: 180px;
  background: rgba(243, 103, 72, 0.14);
}

body::after {
  left: 4%;
  bottom: 90px;
  width: 220px;
  height: 220px;
  background: rgba(47, 100, 232, 0.08);
}

.site-demo {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 64px 0 120px;
}

.site-hero {
  max-width: 720px;
}

.site-kicker {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.site-hero h1 {
  margin: 0;
  max-width: 13ch;
  font-family: var(--title-font);
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.site-description {
  max-width: 58ch;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.site-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.site-button,
.button,
.widget-launcher,
.widget-close {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.site-button {
  padding: 14px 18px;
  border-radius: 999px;
  background: rgba(26, 34, 48, 0.06);
  color: var(--ink);
  font-weight: 700;
}

.site-button--primary {
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 14px 30px rgba(234, 89, 57, 0.22);
}

.site-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 18px;
  margin-top: 48px;
}

.site-card {
  min-height: 180px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  background: rgba(255, 251, 246, 0.72);
  box-shadow: 0 14px 34px rgba(54, 37, 14, 0.08);
  backdrop-filter: blur(10px);
}

.site-card--feature {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 243, 233, 0.9)),
    linear-gradient(135deg, rgba(243, 103, 72, 0.12), rgba(47, 100, 232, 0.08));
}

.site-card__tag {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(243, 103, 72, 0.12);
  color: #9f402f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-card h2,
.site-card h3 {
  margin: 18px 0 0;
  line-height: 1.2;
}

.site-card p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.widget-host {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
}

.widget-launcher {
  position: relative;
  z-index: 1002;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 250px;
  padding: 14px 18px 14px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--navy) 0%, #223655 100%);
  color: white;
  box-shadow: 0 20px 40px rgba(17, 28, 46, 0.28);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.widget-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 44px rgba(17, 28, 46, 0.34);
}

.widget-launcher__icon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.16) 35%),
    linear-gradient(135deg, #ff7c59 0%, #f6a98b 48%, #3b64df 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.widget-launcher__icon span {
  position: absolute;
  width: 6px;
  bottom: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  animation: launcherMeter 1.15s ease-in-out infinite;
  animation-play-state: paused;
}

.widget-launcher__icon span:nth-child(1) {
  left: 12px;
  height: 13px;
}

.widget-launcher__icon span:nth-child(2) {
  left: 20px;
  height: 21px;
  animation-delay: 0.16s;
}

.widget-launcher__icon span:nth-child(3) {
  left: 28px;
  height: 16px;
  animation-delay: 0.32s;
}

.widget-launcher__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.widget-launcher__label {
  font-size: 15px;
  font-weight: 700;
}

.widget-launcher__status {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.widget-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(336px, calc(100vw - 20px));
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 200ms ease,
    transform 220ms ease;
  z-index: 1001;
}

.widget-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 23, 35, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.widget-host[data-open="true"] .widget-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.widget-host[data-open="true"] .widget-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.widget-host[data-open="true"] .widget-launcher {
  background: linear-gradient(135deg, #24395a 0%, #314c75 100%);
}

.widget-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  min-height: auto;
  max-height: min(560px, calc(100vh - 96px));
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.97), rgba(255, 247, 239, 0.95));
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(18px);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.widget-header__copy {
  display: grid;
  gap: 2px;
}

.widget-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.widget-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.widget-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
}

.mini-chip {
  padding: 6px 10px;
  background: rgba(26, 34, 48, 0.06);
  color: #29374a;
  font-size: 11px;
}

.widget-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(26, 34, 48, 0.06);
  color: #415066;
  font-size: 20px;
  line-height: 1;
}

.assistant-stage {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0;
}

.voice-orb {
  position: relative;
  width: 56px;
  height: 56px;
}

.voice-orb__ring,
.voice-orb__core {
  position: absolute;
  border-radius: 50%;
}

.voice-orb__ring {
  inset: 6px;
  border: 1px solid rgba(243, 103, 72, 0.16);
  opacity: 0;
  transform: scale(0.92);
}

.voice-orb__ring--delay {
  inset: -4px;
}

.voice-orb__core {
  inset: 8px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.18) 35%),
    linear-gradient(135deg, #ff7f5d 0%, #ffaf87 48%, #4766d3 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 18px 42px rgba(243, 103, 72, 0.24);
}

.voice-orb__core::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
}

.voice-meter {
  display: flex;
  gap: 4px;
  align-items: end;
  height: 14px;
}

.voice-meter span {
  width: 4px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(243, 103, 72, 0.82), rgba(71, 102, 211, 0.86));
  transform-origin: center bottom;
  opacity: 0.55;
  animation: meter 1.2s ease-in-out infinite;
  animation-play-state: paused;
}

.voice-meter span:nth-child(2) {
  animation-delay: 0.12s;
}

.voice-meter span:nth-child(3) {
  animation-delay: 0.24s;
}

.voice-meter span:nth-child(4) {
  animation-delay: 0.36s;
}

.voice-meter span:nth-child(5) {
  animation-delay: 0.48s;
}

.widget-presence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(26, 34, 48, 0.08);
}

.widget-presence__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8ca0bb;
  box-shadow: 0 0 0 4px rgba(140, 160, 187, 0.16);
}

.widget-presence__text {
  color: #334459;
  font-size: 11px;
  font-weight: 700;
}

.button {
  flex: 1;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled,
.site-button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  box-shadow: 0 14px 30px rgba(234, 89, 57, 0.24);
}

.button--secondary {
  background: rgba(26, 34, 48, 0.07);
  color: #273548;
}

.chat-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.chat-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.chat-panel__status {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.chat-panel__hint {
  color: rgba(26, 34, 48, 0.42);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-feed {
  display: grid;
  flex: 1;
  gap: 8px;
  margin-top: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.chat-feed:empty {
  display: none;
}

.chat-empty {
  margin-top: 10px;
  display: grid;
  gap: 12px;
  min-height: 160px;
  place-items: center;
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed rgba(26, 34, 48, 0.14);
  background: rgba(247, 243, 237, 0.78);
  color: rgba(26, 34, 48, 0.46);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.chat-empty__text {
  margin: 0;
  max-width: 220px;
}

.chat-empty[hidden] {
  display: none;
}

.error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(195, 75, 57, 0.18);
  background: rgba(195, 75, 57, 0.08);
  color: #992f1d;
  font-size: 13px;
  line-height: 1.45;
}

.chat-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.chat-message {
  display: grid;
  gap: 6px;
}

.chat-message--client {
  justify-items: end;
}

.chat-message__meta {
  color: rgba(26, 34, 48, 0.44);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-message__bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f7f0e7;
  color: #213042;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(26, 34, 48, 0.06);
}

.chat-message--assistant .chat-message__bubble {
  background: linear-gradient(180deg, #162236 0%, #1d2d47 100%);
  color: #eef4fa;
}

.chat-message--client .chat-message__bubble {
  background: linear-gradient(135deg, rgba(243, 103, 72, 0.12), rgba(243, 103, 72, 0.18));
  color: #7d311f;
}

.chat-message__bubble--streaming::after {
  content: " ";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  animation: bubblePulse 1s ease-in-out infinite;
}

.widget-card[data-status="requesting-session"] .voice-orb__ring,
.widget-card[data-status="requesting-microphone"] .voice-orb__ring,
.widget-card[data-status="connecting"] .voice-orb__ring,
.widget-card[data-status="live"] .voice-orb__ring {
  animation: orbPulse 2.2s ease-out infinite;
}

.widget-card[data-status="requesting-session"] .voice-orb__ring--delay,
.widget-card[data-status="requesting-microphone"] .voice-orb__ring--delay,
.widget-card[data-status="connecting"] .voice-orb__ring--delay,
.widget-card[data-status="live"] .voice-orb__ring--delay {
  animation-delay: 1.05s;
}

.widget-card[data-status="requesting-session"] .voice-meter span,
.widget-card[data-status="requesting-microphone"] .voice-meter span,
.widget-card[data-status="connecting"] .voice-meter span,
.widget-card[data-status="live"] .voice-meter span,
.widget-launcher[data-status="requesting-session"] .widget-launcher__icon span,
.widget-launcher[data-status="requesting-microphone"] .widget-launcher__icon span,
.widget-launcher[data-status="connecting"] .widget-launcher__icon span,
.widget-launcher[data-status="live"] .widget-launcher__icon span {
  animation-play-state: running;
  opacity: 0.92;
}

.widget-card[data-status="live"] .voice-orb__core,
.widget-launcher[data-status="live"] .widget-launcher__icon {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.2) 35%),
    linear-gradient(135deg, #10b577 0%, #65d8a0 45%, #2f64e8 100%);
}

.widget-card[data-status="live"] .widget-presence__dot {
  background: var(--accent-live);
  box-shadow: 0 0 0 4px rgba(18, 152, 102, 0.16);
}

.widget-card[data-status="error"] .voice-orb__core,
.widget-launcher[data-status="error"] .widget-launcher__icon {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.2) 35%),
    linear-gradient(135deg, #c34b39 0%, #f18b56 100%);
}

.widget-card[data-status="error"] .widget-presence__dot {
  background: var(--accent-error);
  box-shadow: 0 0 0 4px rgba(195, 75, 57, 0.16);
}

.widget-card[data-status="connecting"] .widget-presence__dot,
.widget-card[data-status="requesting-session"] .widget-presence__dot,
.widget-card[data-status="requesting-microphone"] .widget-presence__dot {
  background: var(--cool);
  box-shadow: 0 0 0 4px rgba(47, 100, 232, 0.16);
}

.widget-launcher[data-status="live"] {
  box-shadow: 0 22px 44px rgba(18, 152, 102, 0.26);
}

.widget-launcher[data-status="error"] {
  box-shadow: 0 22px 44px rgba(195, 75, 57, 0.22);
}

@keyframes orbPulse {
  0% {
    transform: scale(0.86);
    opacity: 0;
  }

  22% {
    opacity: 0.34;
  }

  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

@keyframes meter {
  0%,
  100% {
    transform: scaleY(0.55);
  }

  50% {
    transform: scaleY(1.9);
  }
}

@keyframes launcherMeter {
  0%,
  100% {
    transform: scaleY(0.7);
  }

  50% {
    transform: scaleY(1.45);
  }
}

@keyframes bubblePulse {
  0%,
  100% {
    transform: scale(0.7);
    opacity: 0.32;
  }

  50% {
    transform: scale(1);
    opacity: 0.8;
  }
}

@media (max-width: 900px) {
  .site-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-demo {
    width: min(100vw - 20px, 560px);
    padding-top: 40px;
    padding-bottom: 120px;
  }

  .widget-host {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .widget-launcher {
    width: 100%;
    min-width: 0;
  }

  .widget-panel {
    right: 0;
    bottom: 72px;
    width: 100%;
  }

  .widget-card {
    padding: 12px;
    border-radius: 20px;
    max-height: min(520px, calc(100vh - 88px));
  }

  .widget-header,
  .chat-panel__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .widget-header__actions {
    width: 100%;
    justify-content: space-between;
  }

  .chat-panel__status {
    justify-items: start;
  }
}
