:root {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, .78);
  --panel-strong: rgba(255,255,255,.92);
  --ink: #111827;
  --muted: #667085;
  --line: #e7ebf2;
  --blue: #2d5bff;
  --blue-2: #87a4ff;
  --dark: #0f172a;
  --shadow: 0 28px 80px rgba(17, 24, 39, .12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 15%, rgba(45, 91, 255, .15), transparent 20%),
    radial-gradient(circle at 20% 8%, rgba(15, 23, 42, .05), transparent 20%),
    linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 40px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  gap: 26px;
  align-items: center;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(14px);
}

.hero-copy { padding: 18px 14px 18px 10px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 78px);
  line-height: .95;
  letter-spacing: -.07em;
}

h1 span { color: var(--blue); }

.lead {
  margin: 20px 0 0;
  max-width: 700px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.chips button,
.secondary,
.primary,
.mic-btn {
  font-family: inherit;
}

.chips button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.85);
  color: #1f2937;
  border-radius: 999px;
  padding: 11px 15px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}

.chips button:hover { transform: translateY(-2px); border-color: var(--blue); }

.avatar-shell { min-height: 620px; display: grid; place-items: center; }
.avatar-stage {
  position: relative;
  width: 100%;
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(248,251,255,.72));
  border: 1px solid rgba(255,255,255,.8);
}
.aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
}
.aura-1 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(45,91,255,.18), rgba(45,91,255,0));
}
.aura-2 {
  width: 500px; height: 500px;
  border: 1px solid rgba(45,91,255,.12);
  box-shadow: inset 0 0 40px rgba(45,91,255,.04);
}
.aura-2::before,
.aura-2::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  border: 1px dashed rgba(15,23,42,.12);
}
.aura-2::after { inset: 72px; }

.avatar-card {
  position: relative;
  width: min(390px, calc(100% - 32px));
  border-radius: 28px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.78));
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 35px 70px rgba(17,24,39,.18);
  transform-style: preserve-3d;
  transition: transform .14s ease-out, box-shadow .2s ease;
}
.avatar-card:hover { box-shadow: 0 38px 90px rgba(17,24,39,.22); }

.avatar-image-wrap {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #fcfdff, #edf2fb);
}

#avatarImage {
  display: block;
  width: 100%;
  height: auto;
  transform: translateZ(16px) scale(1.01);
  user-select: none;
  -webkit-user-drag: none;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 26% 20%, rgba(255,255,255,.18), transparent 20%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.06));
  pointer-events: none;
}

.status-pill {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

#statusDot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 6px rgba(22,163,74,.14);
}

.voice-bars {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 34px;
  opacity: 0;
  transition: opacity .2s ease;
}
.voice-bars span {
  width: 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8aa3ff, #2d5bff);
  height: 10px;
}
.avatar-card.speaking .voice-bars { opacity: 1; }
.avatar-card.speaking .voice-bars span:nth-child(1) { animation: bars 0.75s ease-in-out infinite; }
.avatar-card.speaking .voice-bars span:nth-child(2) { animation: bars 0.55s ease-in-out .12s infinite; }
.avatar-card.speaking .voice-bars span:nth-child(3) { animation: bars 0.7s ease-in-out .06s infinite; }
.avatar-card.speaking .voice-bars span:nth-child(4) { animation: bars 0.6s ease-in-out .14s infinite; }
.avatar-card.speaking .voice-bars span:nth-child(5) { animation: bars 0.8s ease-in-out .1s infinite; }

.chat-panel {
  margin-top: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
}
.panel-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
}
.panel-head p { margin: 0; color: var(--muted); }
.toggles { display: flex; gap: 10px; flex-wrap: wrap; }
.secondary {
  border: 1px solid var(--line);
  background: white;
  color: #334155;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.secondary.active { border-color: var(--blue); color: var(--blue); }

.messages {
  height: 330px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 4px 18px;
}
.message {
  width: min(780px, 92%);
  padding: 15px 17px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: white;
  color: #334155;
  line-height: 1.6;
}
.message strong { display: block; margin-bottom: 4px; }
.message p { margin: 0; }
.message.assistant strong { color: var(--blue); }
.message.user {
  margin-left: auto;
  background: linear-gradient(180deg, #182033, #0f172a);
  color: white;
  border-color: #182033;
}
.message.user strong,
.message.user p { color: white; }

.composer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.composer input {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 15px;
  outline: none;
}
.composer input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(45,91,255,.12);
}
.primary,
.mic-btn {
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  min-width: 58px;
  cursor: pointer;
  font-weight: 800;
}
.primary {
  background: var(--blue);
  color: white;
}
.mic-btn {
  background: #101827;
  color: white;
}
.disclaimer {
  margin: 12px 6px 0;
  font-size: 12px;
  color: var(--muted);
}

@keyframes bars {
  0%, 100% { height: 10px; }
  50% { height: 34px; }
}

@media (max-width: 980px) {
  .hero-card { grid-template-columns: 1fr; }
  .avatar-shell { min-height: 520px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 20px, 1240px); }
  .hero-card, .chat-panel { border-radius: 24px; }
  .avatar-stage { min-height: 500px; }
  .composer { grid-template-columns: 1fr; }
  .primary, .mic-btn { min-height: 48px; }
  h1 { font-size: 42px; }
}
