/* Сем — вікно чату. Кольори й шрифти беруться з токенів сторінки (--bg, --ink, --action...). */
.sem { --sem-bg: var(--bg); --sem-ink: var(--ink); display: flex; flex-direction: column; height: 100%; min-height: 0;
  background: var(--sem-bg); color: var(--sem-ink); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  font: 400 15px/1.45 var(--font-text); text-align: left; }
.sem__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sem__av { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--action); color: var(--action-ink); font: 500 16px/1 var(--font-display); }
.sem__who { display: grid; line-height: 1.25; }
.sem__who b { font-weight: 500; font-size: 16px; }
.sem__who span { font-size: 13px; color: var(--muted); }
.sem__who span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2f9e5b; margin-right: 6px; vertical-align: .05em; }
.sem__close { margin-left: auto; width: 44px; height: 44px; border: 0; background: transparent; color: inherit; font-size: 26px; line-height: 1; cursor: pointer; border-radius: var(--r-sm); }
.sem__log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.sem__msg { display: flex; flex-direction: column; max-width: 86%; gap: 3px; }
.sem__msg--bot { align-self: flex-start; }
.sem__msg--me { align-self: flex-end; align-items: flex-end; }
.sem__bubble { padding: 10px 13px; border-radius: 16px; background: var(--surface); white-space: pre-line; }
.sem__msg--bot .sem__bubble { border-bottom-left-radius: 5px; }
.sem__msg--me .sem__bubble { background: var(--action); color: var(--action-ink); border-bottom-right-radius: 5px; }
.sem__bubble b { font-weight: 500; }
.sem__time { font-size: 13px; color: var(--muted); padding: 0 4px; }
.sem__msg--typing .sem__bubble { display: flex; gap: 4px; padding: 13px 14px; }
.sem__msg--typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .5; animation: sem-dot 1s infinite ease-in-out; }
.sem__msg--typing i:nth-child(2) { animation-delay: .15s; } .sem__msg--typing i:nth-child(3) { animation-delay: .3s; }
@keyframes sem-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-3px); opacity: 1; } }
.sem__msg { animation: sem-in .28s ease-out both; }
@keyframes sem-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sem__tg { display: flex; gap: 10px; align-items: flex-start; align-self: stretch; padding: 10px 12px; border-radius: 12px;
  background: #e8f3fb; color: #17324a; border: 1px solid #c9e1f2; font-size: 14px; animation: sem-in .3s ease-out both; }
.sem__tg-ic { width: 24px; height: 24px; flex: none; border-radius: 50%; background: #2a9fd8; color: #fff; display: grid; place-items: center; }
.sem__tg div { display: grid; gap: 2px; }
.sem__tg b { font-weight: 500; }
.sem__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.sem__chips:empty { display: none; }
.sem__chip { min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: inherit;
  font: 500 14px/1.2 var(--font-text); cursor: pointer; transition: background .15s, transform .12s; }
.sem__chip:hover { background: var(--bg); transform: translateY(-1px); }
.sem__chip:active { transform: translateY(0) scale(.98); }
.sem__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.sem__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sem__in { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: inherit; font: 400 16px var(--font-text); }
.sem__in:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.sem__send { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--action); color: var(--action-ink); display: grid; place-items: center; cursor: pointer; transition: transform .12s; }
.sem__send:hover { transform: translateY(-1px); } .sem__send:active { transform: scale(.96); }

/* вбудований у секцію */
.sem-frame { height: min(620px, 100%); min-height: 520px; }
.ground-inverse .sem { --line: rgba(255,255,255,.14); }

/* плаваюча кнопка й панель */
.sem-launch { position: fixed; right: 24px; bottom: calc(24px + var(--bar, 0px)); z-index: 30; height: 56px; padding: 0 20px 0 8px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg); font: 500 16px/1 var(--font-text); cursor: pointer;
  box-shadow: 0 8px 28px rgba(0,0,0,.22); transition: transform .15s; }
.sem-launch:hover { transform: translateY(-2px); } .sem-launch:active { transform: scale(.98); }
.sem-launch .sem__av { width: 40px; height: 40px; }
.sem-launch .sem-launch__dot { position: absolute; left: 38px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: #2f9e5b; border: 2px solid var(--ink); }
.sem--float { position: fixed; right: 24px; bottom: calc(92px + var(--bar, 0px)); z-index: 31; width: 380px; height: min(600px, calc(100svh - 140px));
  box-shadow: 0 18px 60px rgba(0,0,0,.25); }
.sem--float[hidden] { display: none; }
.sem-open .sem-launch { opacity: 0; pointer-events: none; }
@media (max-width: 639px) {
  .sem-launch { right: 16px; bottom: calc(16px + var(--bar, 0px)); height: 52px; padding: 0 6px; }
  .sem-launch span.sem-launch__txt { display: none; }
  .sem--float { inset: 0; width: auto; height: 100svh; border-radius: 0; }
  .sem-frame { min-height: 480px; height: 480px; }
}
@media (prefers-reduced-motion: reduce) { .sem__msg, .sem__tg { animation: none; } .sem__msg--typing i { animation: none; } }
/* на телефоні: секція Сема на два екрани, плаваюча кнопка не перекриває текст (у героя є кнопка до чату) */
@media (max-width: 639px) { section#sem { --hm: 2; } .sem-launch { display: none; } }
