/* Ассистент Synapse: капсула и ответ над строкой (web/syn-talk.js).

   Владелец 04.11.2026 по образцу «liquid glass + mesh gradient»: справа от
   строки — капсула, внутри течёт градиент, надпись «Ассистент Synapse». Цвета
   свои — терракота, персик, тёплый розовый, янтарь, — без неона. Градиент
   показывает состояние: в покое течёт медленно, слушает — дышит, думает —
   бежит, говорит — бьётся. Ответ — карточкой над строкой, а не окном. */

/* ---------------- капсула ---------------- */
.syn-cap{
  position: relative; isolation: isolate; overflow: hidden; flex: none;
  height: 44px; min-width: 196px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  /* Цвета — от выбранной темы (владелец 04.11.2026): основа — акцент,
     притушенный почти до чёрного, волна — акцент и два соседних оттенка. */
  --cap-a: var(--accent, #e05f3b);
  --cap-b: color-mix(in oklab, var(--cap-a) 62%, #ffd27a);
  --cap-c: color-mix(in oklab, var(--cap-a) 60%, #ff5fa2);
  background: radial-gradient(120% 140% at 50% 0%, color-mix(in oklab, var(--cap-a) 24%, #15100e) 0%,
              color-mix(in oklab, var(--cap-a) 10%, #0c0909) 70%);
  color: #fff; font: inherit; font-size: 15px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(0,0,0,.25),
              0 10px 26px -12px color-mix(in srgb, var(--cap-a) 70%, transparent);
  transition: transform .18s ease, box-shadow .2s ease, min-width .3s ease;
}
.syn-cap:hover{ transform: translateY(-1px) }
.syn-cap:active{ transform: scale(.97) }
.syn-cap .cap-txt{ position: relative; z-index: 2; text-shadow: 0 1px 8px rgba(40, 12, 4, .55);
  max-width: 260px; overflow: hidden; text-overflow: ellipsis }
/* Стекло: блик сверху и мягкая кромка. */
.syn-cap::after{
  content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,.06) 42%, rgba(255,255,255,0) 60%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.syn-cap .cap-flow{ position: absolute; inset: -30% -10%; z-index: 0; filter: blur(9px) saturate(1.25) }
/* Тёмный верх, цветная волна снизу — как в образце. */
.syn-cap .cap-flow i{ position: absolute; width: 62%; height: 90%; border-radius: 50%; opacity: 1;
  animation: cap-drift var(--cap-speed, 9s) ease-in-out infinite }
.syn-cap .cap-flow i:nth-child(1){ left: -12%; top: 48%; background: var(--cap-a); animation-delay: 0s }
.syn-cap .cap-flow i:nth-child(2){ left: 24%; top: 58%; background: var(--cap-b); animation-delay: calc(var(--cap-speed, 9s) * -.33) }
.syn-cap .cap-flow i:nth-child(3){ left: 56%; top: 44%; background: var(--cap-c); animation-delay: calc(var(--cap-speed, 9s) * -.66) }
@keyframes cap-drift{
  0%   { transform: translate(0, 0) scale(1) }
  33%  { transform: translate(28%, -18%) scale(1.15) }
  66%  { transform: translate(-22%, 12%) scale(.92) }
  100% { transform: translate(0, 0) scale(1) }
}
html[data-syn="listening"] .syn-cap{ --cap-speed: 4s; animation: cap-breathe 2.4s ease-in-out infinite }
html[data-syn="thinking"] .syn-cap, html[data-syn="working"] .syn-cap{ --cap-speed: 2.2s }
html[data-syn="speaking"] .syn-cap{ --cap-speed: 1.6s; animation: cap-beat .9s ease-in-out infinite }
html[data-syn="paused"] .syn-cap .cap-flow{ filter: blur(14px) grayscale(.8) }
@keyframes cap-breathe{ 0%,100%{ box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 10px 26px -12px color-mix(in srgb, var(--cap-a) 70%, transparent) }
  50%{ box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 0 0 6px color-mix(in srgb, var(--cap-a) 22%, transparent), 0 10px 26px -12px color-mix(in srgb, var(--cap-a) 70%, transparent) } }
@keyframes cap-beat{ 0%,100%{ transform: scale(1) } 45%{ transform: scale(1.035) } }

/* В строке: поле, стрелка, капсула. Строка чуть шире, чтобы капсула влезла. */
.composer:not(.syn-float){ width: min(760px, calc(100% - 32px)) }
.say .syn-cap{ margin-left: 6px }

/* Без строки — длинная капсула по центру. */
.composer.syn-float{ display: flex; justify-content: center; pointer-events: none; background: none; box-shadow: none }
.composer.syn-float .syn-cap{ pointer-events: auto; width: min(420px, 100%); height: 52px; font-size: 16px }

/* Телефон: в строке — коротко, без слова «Ассистент». */
@media (max-width: 600px){
  .say .syn-cap{ min-width: 0; width: 104px; padding: 0 12px; height: 40px; font-size: 14px }
  .say .syn-cap .cap-txt{ max-width: 84px }
  .composer.syn-float .syn-cap{ height: 48px }
}

/* ---------------- ответ над строкой ---------------- */
#syn-talk{
  position: fixed; z-index: 45; left: 50%; bottom: 96px;
  padding: 14px 16px 12px; border-radius: 22px;
  background: var(--card); color: var(--fg);
  box-shadow: 0 18px 48px -18px rgba(60, 25, 12, .38), 0 0 0 1px color-mix(in srgb, var(--fg) 7%, transparent);
  opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .22s cubic-bezier(.22,.61,.36,1);
  max-height: 46vh; display: flex; flex-direction: column; gap: 6px;
}
#syn-talk.on{ opacity: 1; transform: none }
#syn-talk .st-head{ display: flex; align-items: center; gap: 8px; min-height: 22px }
#syn-talk .st-state{ font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-text, var(--accent)) }
#syn-talk.st-done .st-state{ display: none }
#syn-talk{ position: fixed }
#syn-talk .st-x, #syn-talk .st-fold{ width: 28px; height: 28px; border-radius: 999px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--accent-tint); color: var(--fg); flex: none }
#syn-talk .st-fold{ margin-left: auto }
#syn-talk .st-x svg{ width: 14px; height: 14px }
#syn-talk .st-fold svg{ width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round }
/* Свёрнуто: одна строка — состояние и последнее сообщение. */
#syn-talk.is-fold .st-log, #syn-talk.is-fold .st-err, #syn-talk.is-fold .st-acts{ display: none }
#syn-talk .st-peek{ flex: 1; min-width: 0; border: 0; padding: 0; background: none; color: var(--muted, #8a7a72); font: inherit; font-size: 13.5px;
  text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
#syn-talk .st-peek[hidden]{ display: none }
#syn-talk.is-fold .st-state{ flex: none }
#syn-talk p{ margin: 0 }
#syn-talk .st-err:empty{ display: none }
/* Последние три сообщения: свои — справа, тоном акцента; Syn — слева. */
#syn-talk .st-log{ display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; min-height: 0; padding: 2px }
#syn-talk .st-msg{ flex: none }
#syn-talk .st-log:empty{ display: none }
#syn-talk .st-msg{ max-width: 88%; padding: 9px 12px 6px; border-radius: 16px; display: flex; flex-direction: column; gap: 3px }
#syn-talk .st-msg p{ font-size: 14.5px; line-height: 1.42; white-space: pre-line; overflow-wrap: anywhere }
#syn-talk .st-msg.me{ align-self: flex-end; background: var(--accent-tint); border-bottom-right-radius: 6px }
#syn-talk .st-msg.syn{ align-self: flex-start; background: color-mix(in srgb, var(--fg) 5%, transparent); border-bottom-left-radius: 6px }
#syn-talk .st-msg.live p{ color: var(--muted, #8a7a72); font-style: italic }
#syn-talk .st-did{ font-size: 12px; color: var(--accent-text, var(--accent)) }
#syn-talk .st-meta{ align-self: flex-end; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted, #8a7a72); font-variant-numeric: tabular-nums }
#syn-talk .st-copy{ width: 22px; height: 22px; padding: 0; border: 0; border-radius: 7px; background: none; cursor: pointer;
  display: grid; place-items: center; color: inherit; opacity: .75 }
#syn-talk .st-copy:hover{ opacity: 1; background: color-mix(in srgb, var(--fg) 8%, transparent) }
#syn-talk .st-copy svg{ width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8 }
#syn-talk .st-err{ font-size: 13.5px; color: var(--bad, #c0392b) }
#syn-talk .st-acts{ display: flex; gap: 14px; justify-content: flex-end; margin-top: 2px }
#syn-talk .st-link{ border: 0; background: none; padding: 4px 0; cursor: pointer; font: inherit; font-size: 13px;
  font-weight: 600; color: var(--accent-text, var(--accent)) }
#syn-talk .st-link[hidden]{ display: none }

.syn-top .st-open{ margin-left: auto; margin-right: 6px }

@media (prefers-reduced-motion: reduce){
  .syn-cap, .syn-cap .cap-flow i{ animation: none !important }
}

/* Черновик и деньги в карточке над строкой: подтвердить или сказать, что поменять. */
/* Карточка лежит под репликой во всю ширину окна, а не внутри пузыря:
   окно и карточка — две плоскости, без рамки в рамке. Список не прокручивается
   отдельно: прокручивается само окно (владелец 19.11). */
#syn-talk .st-card{ flex: none; align-self: stretch }
#syn-talk .st-card .syn-fin{ margin: 0; padding: 14px 16px 12px; border: 0; border-radius: 16px;
  background: color-mix(in srgb, var(--fg) 6%, transparent); box-shadow: none }
#syn-talk .st-card .syn-fin b{ font-size: 15px; line-height: 1.3; margin-bottom: 6px }
#syn-talk .st-card .syn-fin ul{ margin: 4px 0 10px; padding: 0; font-size: 14px; line-height: 1.45 }
#syn-talk .st-card .syn-fin ul li{ font-size: 14px; color: var(--fg) }
#syn-talk .syn-steps{ margin: 2px 0 8px; padding: 0; list-style: none; counter-reset: step }
#syn-talk .syn-steps li{ counter-increment: step; display: grid; grid-template-columns: 20px 1fr; gap: 6px;
  padding: 4px 0; font-size: 14.5px; line-height: 1.35; color: var(--fg) }
#syn-talk .syn-steps li::before{ content: counter(step); font-weight: 700; color: var(--accent-text, var(--accent));
  font-variant-numeric: tabular-nums }
#syn-talk .syn-today{ margin: 0 0 12px; padding-top: 10px; border-top: 1px solid var(--line, rgba(0,0,0,.1));
  font-size: 14.5px; line-height: 1.35; font-weight: 600 }
#syn-talk .syn-today span{ display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--accent-text, var(--accent)) }
#syn-talk .st-card .syn-none-acts{ display: flex; gap: 8px; margin-top: 4px }
#syn-talk .st-card .syn-none-acts .btn{ padding: 9px 18px; font-size: 14px }
#syn-talk .st-card .syn-fin-done{ font-size: 13px; color: var(--muted, #8a7a72) }
#syn-talk .st-card .syn-draft-hint{ margin-top: 8px }
/* Реплика Syn — просто текст на окне; пузырь остаётся только у своих слов. */
#syn-talk .st-msg.syn{ background: none; padding: 2px 4px 0 }
#syn-talk .st-short{ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer }
.syn-draft-hint{ margin: 6px 0 0; font-size: 12px; color: var(--muted, #8a7a72) }
#syn-talk{ max-height: 60vh }
#syn-talk .syn-draft ul, .syn-fin.syn-draft ul{ list-style: none; padding-left: 0 }

/* Браузер заблокировал звук медитации: заметно, над капсулой. */
#med-unmute{
  position: fixed; z-index: 46; left: 50%; transform: translateX(-50%); bottom: calc(112px + env(safe-area-inset-bottom));
  height: 44px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--on-accent, #fff); font: inherit; font-size: 15px; font-weight: 650;
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--accent) 80%, transparent);
}
@media (min-width: 1040px){
  #med-unmute{ left: calc(var(--rail-edge, 0px) + (100vw / var(--scale, 1) - var(--rail-edge, 0px)) / 2) }
}
