/* Экран звонка «Спарринга»: тёмная студия поверх любой страницы. Фон — размытое окружение клиента из его фотопортрета,
   акцент — цвет персонажа (--persona). */
.sp-call-root {
  --bg: #0b0c10; --bg2: #14151b; --panel: rgba(255, 255, 255, .07); --panel2: rgba(255, 255, 255, .11);
  --line: rgba(255, 255, 255, .12); --text: #f4f1ec; --muted: rgba(244, 241, 236, .62); --ok: #3fcf8e; --warn: #f0b13a; --danger: #ff4f3d;
  --persona: #3d6bff; --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  position: fixed; inset: 0; z-index: 1000; color: var(--text); color-scheme: dark; overflow: hidden;
  font: 16px/1.5 "Golos Text", -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased;
  background: radial-gradient(70vmax 50vmax at 50% -10%, color-mix(in srgb, var(--persona) 26%, transparent), transparent 70%), linear-gradient(var(--bg), var(--bg2));
}
.spc-bg { position: absolute; inset: -8%; background: center / cover no-repeat; filter: blur(46px) saturate(1.15) brightness(.42); transform: scale(1.1); opacity: .95;
  animation: spc-drift 24s ease-in-out infinite alternate; }
.spc-bg:not([style*="url"]) { display: none; }
.sp-call-root::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 30%, transparent 30%, rgba(5, 6, 9, .65)), linear-gradient(180deg, rgba(5, 6, 9, .35), transparent 30%, transparent 60%, rgba(5, 6, 9, .7)); }
@keyframes spc-drift { to { transform: scale(1.18) translate(-1.5%, 1%); } }
html.spc-open, html.spc-open body { overflow: hidden; }
.sp-call-root[hidden], .sp-call-root [hidden] { display: none !important; }
.sp-call-root * { box-sizing: border-box; }
.sp-call-root button { font: inherit; color: inherit; }
.sp-call-root svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-call-root .muted { color: var(--muted); }

.spc { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  animation: spc-fade .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes spc-fade { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.spc-top { width: 100%; max-width: 760px; display: flex; align-items: center; gap: 12px; }
.spc-title { flex: 1; min-width: 0; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spc-timer { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.spc-timer i { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: spc-blink 1.6s infinite; }
.spc-icon { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: background .2s; }
.spc-icon:hover { background: var(--panel2); }
.spc-icon:focus-visible, .spc-round:focus-visible, .spc-btn:focus-visible { outline: 2px solid var(--persona); outline-offset: 3px; }

.spc-stage { position: relative; width: min(440px, 84vw, 44dvh); aspect-ratio: 1; margin: auto 0 4px; display: grid; place-items: center; }
.spc-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.spc-portrait { width: 56%; aspect-ratio: 1; border-radius: 50%; position: relative; z-index: 1;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--persona) 25%, transparent), 0 30px 80px -24px var(--persona); }
.spc-portrait .avatar { width: 100%; height: 100%; display: block; border-radius: 50%; }
.avatar.photo { object-fit: cover; background: #d9d3c9; }
.spc-portrait:has(.photo) { --lvl: 0; transform: scale(calc(1 + var(--lvl) * .035)); transition: transform .08s linear;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .14), 0 0 0 calc(5px + var(--lvl) * 12px) color-mix(in srgb, var(--persona) calc(18% + var(--lvl) * 42%), transparent),
              0 40px 90px -30px rgba(0, 0, 0, .9); }

.spc-name { font: 600 clamp(24px, 3.4vw, 32px)/1.15 var(--display); letter-spacing: -.035em; text-align: center; }
.spc-role { color: var(--muted); font-size: 15px; text-align: center; margin-top: 4px; max-width: 520px; }
.spc-status { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-height: 34px; margin-top: 14px; padding: 6px 16px; border-radius: 999px;
  font-size: 15px; font-weight: 600; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.spc-status .dots span { animation: spc-blink 1.2s infinite; }
.spc-status .dots span:nth-child(2) { animation-delay: .2s; } .spc-status .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes spc-blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.spc-hint { color: var(--muted); font-size: 14.5px; text-align: center; min-height: 22px; margin-top: 8px; max-width: 520px; }
.spc-caps { width: 100%; max-width: 640px; min-height: 96px; margin: 8px auto 0; display: grid; gap: 8px; align-content: start; }
.spc-caps p { margin: 0; padding: 10px 16px; border-radius: 18px; background: rgba(10, 11, 15, .5); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: spc-cap .35s cubic-bezier(.2, .8, .2, 1); }
.spc-caps p:empty { display: none; }
@keyframes spc-cap { from { opacity: 0; transform: translateY(6px); } }
.cap-bot { font-size: 17px; line-height: 1.45; justify-self: start; max-width: 92%; }
.cap-user { color: var(--muted); font-size: 15px; justify-self: end; max-width: 86%; background: color-mix(in srgb, var(--persona) 22%, rgba(10, 11, 15, .5)) !important; }
.cap-bot::before, .cap-user::before { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .55; margin-bottom: 2px; }
.cap-bot::before { content: "ИИ-клиент"; }
.cap-user::before { content: "Вы"; }

.spc-actions { display: flex; gap: 30px; align-items: flex-start; justify-content: center; margin: 18px 0 22px; }
.spc-round { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; transition: transform .15s, background .2s; }
.spc-round::after { content: attr(data-label); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.spc-round:active { transform: scale(.93); }
.spc-round.ghost { background: var(--panel2); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.spc-round.ghost:hover { background: rgba(255, 255, 255, .17); }
.spc-round.ghost.on { background: color-mix(in srgb, var(--persona) 45%, transparent); }
.spc-round.danger { width: 74px; height: 74px; margin-top: -7px; background: var(--danger); color: #fff; box-shadow: 0 16px 38px -12px var(--danger); }
.spc-round.danger svg { width: 30px; height: 30px; }
.spc-round.danger::after { top: calc(100% + 1px); }

.spc-panel { position: fixed; right: 16px; top: 72px; bottom: 130px; width: min(400px, calc(100vw - 32px)); overflow-y: auto; z-index: 5;
  padding: 18px 20px; border-radius: 24px; background: rgba(14, 15, 20, .82); border: 1px solid var(--line);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); font-size: 14.5px; animation: spc-fade .3s ease; }
.spc-panel h3 { margin: 0 0 8px; font: 600 17px var(--display); letter-spacing: -.02em; }
.spc-panel h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.spc-panel p { margin: 6px 0; } .spc-panel ul { margin: 4px 0; padding-left: 18px; }

/* ── сообщение вместо alert ── */
.spc-note { width: min(480px, 100%); margin: auto; text-align: center; padding: 36px 28px 28px; }
.spc-note-ic { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.spc-note-ic svg { width: 28px; height: 28px; }
.spc-note h2 { margin: 0; font: 600 23px/1.2 var(--display); letter-spacing: -.03em; }
.spc-note p { margin: 12px 0 0; color: var(--muted); }
.spc-note .spc-res-actions { justify-content: center; }
[data-view=notice] { display: flex; align-items: center; justify-content: center; }

/* ── разбор ── */
.spc-result { display: block; overflow-y: auto; padding-top: max(28px, env(safe-area-inset-top)); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
.spc-card { width: min(800px, 100%); margin: 0 auto; padding: 28px; border-radius: 32px; background: rgba(16, 17, 22, .72); border: 1px solid var(--line);
  backdrop-filter: blur(28px) saturate(1.2); -webkit-backdrop-filter: blur(28px) saturate(1.2); box-shadow: 0 40px 100px -40px rgba(0, 0, 0, .9); }
.spc-res-head { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.spc-res-av .avatar { width: 64px; height: 64px; border-radius: 50%; display: block; box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); }
.spc-kicker { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 650; }
.spc-res-head h2 { margin: 4px 0 0; font: 600 26px/1.15 var(--display); letter-spacing: -.035em; }
.spc-res-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.spc-btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 13px 22px; cursor: pointer; font-weight: 650; transition: background .2s, transform .15s; }
.spc-btn:active { transform: scale(.97); }
.spc-btn.primary { color: #fff; border: 0; background: #e5432e; box-shadow: 0 14px 30px -14px #e5432e; }
.spc-btn:hover { filter: brightness(1.08); }
.loading { display: flex; gap: 6px; margin: 18px 0 8px; }
.loading span { width: 10px; height: 10px; border-radius: 50%; background: var(--persona); animation: spc-blink 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
.spc-box { margin-top: 16px; padding: 14px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.spc-box summary { cursor: pointer; font-weight: 600; }
.spc-transcript { margin-top: 10px; max-height: 340px; overflow-y: auto; font-size: 14.5px; }
.spc-transcript p { margin: 6px 0; }
.spc-toast { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 18px; border-radius: 999px; background: #1d1f27; border: 1px solid var(--line); transition: .25s; pointer-events: none; z-index: 20;
  max-width: calc(100vw - 32px); text-align: center; }
.spc-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-height: 720px) { .spc-stage { width: min(300px, 70vw, 36dvh); } .spc-caps { min-height: 64px; } .spc-status { margin-top: 8px; } }
@media (max-width: 560px) { .spc-card { padding: 20px 18px; border-radius: 26px; } .spc-actions { gap: 26px; } .cap-bot { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .sp-call-root *, .spc-bg { animation: none !important; transition: none !important; } }
