.chat-launcher { position: fixed; z-index: 60; right: 22px; bottom: max(22px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 9px; min-height: 48px; padding: 12px 16px; border: 1px solid #f7d65670; border-radius: 30px; background: #25143ff2; color: var(--yellow); font: 600 13px var(--sans); box-shadow: 0 5px 32px #08031380, 0 0 20px #8f66ff25; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.chat-launcher:hover { transform: translateY(-3px); box-shadow: 0 7px 38px #08031380, 0 0 25px #f7d65625; }
.chat-launcher svg { width: 24px; height: 24px; }
body:has(.chat-launcher) .site-footer { padding-bottom: max(86px, calc(env(safe-area-inset-bottom) + 72px)); }
.chat-panel { position: fixed; inset: auto 22px 84px auto; z-index: 90; margin: 0; width: min(410px, calc(100vw - 28px)); max-width: none; height: min(690px, calc(100dvh - 112px)); max-height: none; padding: 0; border: 1px solid #bca5ff60; border-radius: 18px; color: var(--paper); background: #1b1031; box-shadow: 0 20px 100px #05010db3; overflow: hidden; }
.chat-panel[open] { display: flex; flex-direction: column; animation: chat-open 240ms cubic-bezier(.2,.7,.2,1) both; transform-origin: bottom right; }
.chat-panel[open].chat-closing { animation: chat-close 180ms ease both; pointer-events: none; }
@keyframes chat-open { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes chat-close { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(20px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .chat-panel[open], .chat-panel[open].chat-closing { animation: none; } }
.chat-heading { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; padding: 17px 20px; background: linear-gradient(110deg, #382053, #25143d); border-bottom: 1px solid #bca5ff25; }
.chat-heading strong { font: 600 25px var(--serif); color: var(--yellow); }
.chat-heading p { margin: 4px 0 0; color: #d1c1e4; font-size: 12px; }
.chat-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #bca5ff10; color: var(--paper); font: 28px var(--sans); cursor: pointer; }
.chat-privacy { margin: 0; padding: 11px 18px; font-size: 12px; line-height: 1.5; color: #c4b4d7; border-bottom: 1px solid #bca5ff1c; }
.chat-messages { min-height: 100px; overflow-y: auto; flex: 1 1 auto; padding: 16px; overscroll-behavior: contain; }
.chat-message { width: fit-content; max-width: 94%; border: 1px solid #bca5ff24; background: #302047; border-radius: 12px 12px 12px 3px; padding: 12px 14px; margin-bottom: 12px; overflow-wrap: anywhere; }
.chat-message > strong { display: block; margin-bottom: 5px; font-size: 12px; color: var(--yellow); }
.chat-message > p { margin: 0; font: 14px/1.65 var(--sans); white-space: pre-wrap; }
.chat-user { margin-left: auto; background: #453064; border-radius: 12px 12px 3px 12px; }
.chat-user > strong { color: #e1cff7; }
.chat-sources { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.chat-sources a { color: var(--yellow); font-size: 12px; line-height: 1.5; text-decoration: underline; text-underline-offset: 3px; padding-block: 5px; }
.chat-chips { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; flex-shrink: 0; min-width: 0; padding: 0 16px 10px; }
.chat-chips[hidden] { display: none; }
.chat-chips button { flex: 0 1 auto; max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; border: 1px solid #bca5ff45; border-radius: 20px; padding: 9px 12px; min-height: 44px; background: #bca5ff0d; color: #e6d6f7; font: 14px/1.4 var(--sans); cursor: pointer; }
.chat-status { margin: 0; padding: 0 18px; font: 12px/1.5 var(--sans); color: var(--yellow); }
.chat-status:not(:empty) { padding-block: 9px; }
.chat-form { flex-shrink: 0; margin: 0; padding: 12px 16px; border-top: 1px solid #bca5ff24; }
.chat-form label { display: block; font-size: 12px; margin-bottom: 6px; color: #ddcbed; }
.chat-form textarea { display: block; width: 100%; height: 64px; max-height: 90px; resize: vertical; border: 1px solid #bca5ff50; border-radius: 8px; background: #10091f; color: var(--paper); padding: 10px 12px; font: 16px/1.4 var(--sans); }
.chat-form textarea:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.chat-form-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.chat-count { color: #c4b4d7; font: 12px var(--mono); }
.chat-form button { background: var(--yellow); color: var(--ink); border: 0; border-radius: 6px; min-height: 44px; padding: 9px 22px; font: 600 14px var(--sans); cursor: pointer; }
.chat-panel button:disabled { opacity: .5; cursor: not-allowed; }
.chat-footer { flex-shrink: 0; padding: 0 18px 13px; font: 12px/1.5 var(--sans); color: #b9a8cf; }
.chat-footer p { margin-bottom: 5px; }
.chat-footer a { display: inline-block; margin-right: 15px; color: var(--yellow); padding-block: 5px; }
@media (max-width: 760px) {
  .chat-launcher { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .chat-panel { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); height: min(730px, calc(100dvh - 28px)); }
}
@media (max-height: 650px) {
  .chat-panel { bottom: 12px; height: calc(100dvh - 24px); }
  .chat-heading { padding-block: 8px; }
  .chat-privacy { padding-block: 6px; }
  .chat-chips { display: none; }
  .chat-footer p { margin-block: 0; }
  .chat-messages { min-height: 40px; }
}
@media (max-width: 420px) {
  .chat-launcher { width: 50px; height: 50px; padding: 12px; justify-content: center; }
  .chat-launcher > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-height: 500px) {
  .chat-panel { overflow-y: auto; }
  .chat-messages { flex: 0 0 130px; }
  .chat-privacy, .chat-status { flex-shrink: 0; }
}
