:root {
  --bg1: #0b0e1a;
  --bg2: #141a33;
  --line: rgba(255, 255, 255, 0.10);
  --accent: #6c8cff;
  --accent-2: #29e0c8;
  --text: #eef0fb;
  --muted: #9aa0bd;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 700px at 20% -10%, #26306a 0%, transparent 55%),
    radial-gradient(900px 700px at 90% 10%, #1c8f81 0%, transparent 50%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
}
/* Обычная страница-предпросмотр центрирует виджет. */
body:not(.embed) { display: grid; place-items: center; min-height: 100vh; }

/* Встраивание на сайт: фон полностью прозрачный, клики проходят сквозь всё, кроме виджета. */
body.embed { background: transparent !important; display: grid; place-items: center; min-height: 100vh; pointer-events: none; }
body.embed .widget { pointer-events: auto; }

/* ---- Позиционирование ---- */
.widget.pos-center { position: relative; }
.widget.pos-bottom-right { position: fixed; right: 22px; bottom: 22px; }
.widget.pos-bottom-left  { position: fixed; left: 22px;  bottom: 22px; }
.widget.pos-top-right    { position: fixed; right: 22px; top: 22px; }
.widget.pos-top-left     { position: fixed; left: 22px;  top: 22px; }

/* ---- Контент виджета: без рамки, прозрачно, по центру колонкой ---- */
.card {
  background: none; border: 0; box-shadow: none; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}

h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.hint { margin: -6px 0 0; color: var(--muted); font-size: 12px; }

/* ---- Шар ---- */
.orb {
  width: 96px; height: 96px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, var(--accent), #34407f 72%);
  box-shadow: 0 12px 40px rgba(108, 140, 255, 0.45);
  transition: transform .2s ease, box-shadow .35s ease;
}
.orb:hover { transform: translateY(-2px) scale(1.03); }
.orb.has-avatar { background-size: cover; background-position: center; }
.orb::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid transparent; transition: border-color .3s ease;
}
.orb[data-state="connecting"] { animation: pulse 1.2s infinite; }
.orb[data-state="listening"]  { box-shadow: 0 0 0 6px rgba(41,224,200,.16), 0 12px 40px rgba(41,224,200,.35); }
.orb[data-state="listening"]::after { border-color: rgba(41,224,200,.6); }
.orb[data-state="speaking"]   { animation: pulse .8s infinite; }
.orb[data-state="speaking"]::after { border-color: rgba(108,140,255,.6); }

.orb-label { font-size: 13px; font-weight: 700; color: #fff; padding: 0 8px; text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(108,140,255,.45), 0 12px 40px rgba(108,140,255,.3); }
  70%  { box-shadow: 0 0 0 24px rgba(108,140,255,0), 0 12px 40px rgba(108,140,255,.3); }
  100% { box-shadow: 0 0 0 0 rgba(108,140,255,0), 0 12px 40px rgba(108,140,255,.3); }
}

/* ---- Кнопка (опционально) ---- */
.call-btn {
  border: 0; border-radius: 14px; padding: 12px 26px;
  background: linear-gradient(135deg, var(--accent), #8a6cff);
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
  box-shadow: 0 10px 26px rgba(108, 140, 255, 0.4);
}
.call-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.call-btn.active { background: linear-gradient(135deg, #e0466b, #b5324f); box-shadow: 0 10px 26px rgba(224, 70, 107, 0.4); }

.status { color: var(--muted); font-size: 12px; min-height: 16px; }

/* ---- Лента диалога (опционально; со своим полупрозрачным фоном для читаемости) ---- */
.transcript {
  width: min(320px, 80vw); text-align: left; max-height: 220px; overflow-y: auto;
  font-size: 14px; line-height: 1.45; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border-radius: 16px; background: rgba(12,14,26,.55); backdrop-filter: blur(8px);
}
.transcript::-webkit-scrollbar { width: 6px; }
.transcript::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 6px; }
.transcript .line { padding: 9px 13px; border-radius: 14px; max-width: 90%; animation: rise .2s ease; }
.transcript .user { background: linear-gradient(135deg, var(--accent), #7b74ff); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.transcript .assistant { background: rgba(255,255,255,.06); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 5px; }
.transcript .tool { align-self: center; background: rgba(138,108,255,.16); color: var(--muted); font-size: 12px; }
.transcript .role { font-size: 10.5px; opacity: .7; display: block; margin-bottom: 2px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
