.coy-assistant {
  --assistant-wine: #6d1029;
  --assistant-wine-dark: #410817;
  --assistant-gold: #c58b2a;
  --assistant-cream: #fffaf1;
  position: fixed;
  left: 18px;
  bottom: 14px;
  z-index: 80;
  font-family: inherit;
}

.coy-assistant *,
.coy-assistant *::before,
.coy-assistant *::after { box-sizing: border-box; }

.coy-assistant-launcher {
  position: relative;
  width: 100px;
  height: 112px;
  display: grid;
  place-items: end center;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  isolation: isolate;
}

.coy-assistant-launcher::before {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 3px;
  height: 30px;
  z-index: -1;
  border-radius: 50%;
  background: rgba(65, 8, 23, .28);
  filter: blur(10px);
}

.coy-assistant-launcher img {
  width: 92px;
  height: 110px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 9px rgba(49, 9, 20, .24));
  transform-origin: 48% 94%;
  animation: coy-mascot-greet 4.6s ease-in-out infinite;
}

.coy-assistant-launcher:hover img,
.coy-assistant-launcher:focus-visible img { transform: translateY(-5px) rotate(-2deg) scale(1.035); }
.coy-assistant-launcher:focus-visible { outline: 3px solid var(--assistant-gold); outline-offset: 4px; border-radius: 22px; }

.coy-assistant-badge {
  position: absolute;
  left: 82px;
  bottom: 74px;
  width: max-content;
  max-width: 150px;
  padding: 8px 11px;
  color: #fff;
  background: var(--assistant-wine-dark);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 13px 13px 13px 3px;
  box-shadow: 0 10px 28px rgba(38, 7, 15, .22);
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  animation: coy-badge-in .5s ease both .6s;
}

.coy-assistant-badge[hidden] { display: none; }

.coy-assistant-panel {
  position: absolute;
  left: 0;
  bottom: 124px;
  width: min(410px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 150px));
  display: grid;
  grid-template-rows: auto minmax(150px, 1fr) auto;
  overflow: hidden;
  color: #241d1f;
  background: #fff;
  border: 1px solid rgba(109,16,41,.18);
  border-radius: 25px;
  box-shadow: 0 24px 70px rgba(53, 8, 20, .3);
  transform-origin: left bottom;
  animation: coy-panel-in .22s ease-out both;
}

.coy-assistant-panel[hidden] { display: none; }

.coy-assistant-head {
  min-height: 82px;
  display: grid;
  grid-template-columns: 57px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 13px 12px 15px;
  color: #fff;
  background:
    radial-gradient(circle at 87% 12%, rgba(234,212,173,.24) 0 1px, transparent 1.5px) 0 0 / 13px 13px,
    linear-gradient(135deg, var(--assistant-wine-dark), var(--assistant-wine) 72%);
  border-bottom: 3px solid var(--assistant-gold);
}

.coy-assistant-avatar {
  width: 55px;
  height: 55px;
  display: grid;
  place-items: end center;
  overflow: hidden;
  background: linear-gradient(160deg, #f7e3bf, #fff8e9);
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 50%;
}

.coy-assistant-avatar img { width: 51px; height: 61px; object-fit: contain; object-position: center bottom; }
.coy-assistant-heading { min-width: 0; }
.coy-assistant-heading strong { display: block; color: #fff; font-size: 1rem; line-height: 1.2; }
.coy-assistant-heading span { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; color: rgba(255,255,255,.82); font-size: .69rem; line-height: 1.2; }
.coy-assistant-heading span::before { content: ""; width: 7px; height: 7px; flex: 0 0 auto; background: #72d79b; border: 2px solid rgba(255,255,255,.42); border-radius: 50%; }

.coy-assistant-close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.coy-assistant-close:hover { background: rgba(255,255,255,.2); }
.coy-assistant-close:focus-visible { outline: 3px solid #f2d49c; outline-offset: 2px; }

.coy-assistant-conversation {
  min-height: 180px;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 0 0, rgba(197,139,42,.08), transparent 32%),
    #fffdf9;
}

.coy-assistant-message { display: flex; margin: 0 0 12px; }
.coy-assistant-message.is-user { justify-content: flex-end; }
.coy-assistant-bubble {
  max-width: 88%;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid #eadfd5;
  border-radius: 16px 16px 16px 5px;
  box-shadow: 0 5px 16px rgba(45,31,34,.06);
  font-size: .86rem;
  line-height: 1.48;
  white-space: pre-wrap;
}
.coy-assistant-message.is-user .coy-assistant-bubble { color: #fff; background: var(--assistant-wine); border-color: var(--assistant-wine); border-radius: 16px 16px 5px 16px; }
.coy-assistant-message.is-loading .coy-assistant-bubble { color: #6b5d60; }
.coy-assistant-dots { letter-spacing: .18em; animation: coy-dots 1s ease-in-out infinite alternate; }

.coy-assistant-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.coy-assistant-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--assistant-wine);
  background: #fff8ec;
  border: 1px solid rgba(197,139,42,.55);
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 800;
  line-height: 1.18;
  text-decoration: none;
}
.coy-assistant-actions a:hover { color: #fff; background: var(--assistant-wine); border-color: var(--assistant-wine); }
.coy-assistant-actions a:focus-visible { outline: 3px solid var(--assistant-gold); outline-offset: 2px; }

.coy-assistant-quick { display: flex; gap: 7px; padding: 0 16px 12px; overflow-x: auto; background: #fffdf9; scrollbar-width: none; }
.coy-assistant-quick::-webkit-scrollbar { display: none; }
.coy-assistant-quick button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 7px 11px;
  color: #53303a;
  background: #fff;
  border: 1px solid #e4d7cf;
  border-radius: 999px;
  font: inherit;
  font-size: .72rem;
  font-weight: 750;
  cursor: pointer;
}
.coy-assistant-quick button:hover { border-color: var(--assistant-gold); background: #fff8ec; }
.coy-assistant-quick button:focus-visible { outline: 3px solid var(--assistant-gold); outline-offset: 2px; }

.coy-assistant-compose { padding: 12px 13px 11px; background: #fff; border-top: 1px solid #eadfd5; }
.coy-assistant-form { display: grid; grid-template-columns: 1fr 44px; align-items: end; gap: 8px; }
.coy-assistant-input {
  width: 100%;
  min-height: 44px;
  max-height: 100px;
  resize: vertical;
  padding: 11px 12px;
  color: #241d1f;
  background: #faf8f5;
  border: 1px solid #d9cec8;
  border-radius: 13px;
  font: inherit;
  font-size: .84rem;
  line-height: 1.35;
}
.coy-assistant-input:focus { outline: 3px solid rgba(197,139,42,.28); border-color: var(--assistant-gold); }
.coy-assistant-send {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: var(--assistant-wine);
  border: 0;
  border-radius: 13px;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
}
.coy-assistant-send:hover { background: var(--assistant-wine-dark); }
.coy-assistant-send:disabled { opacity: .55; cursor: wait; }
.coy-assistant-send:focus-visible { outline: 3px solid var(--assistant-gold); outline-offset: 2px; }
.coy-assistant-note { margin: 7px 1px 0; color: #706469; font-size: .63rem; line-height: 1.35; }

body.high-contrast .coy-assistant-panel,
body.high-contrast .coy-assistant-conversation,
body.high-contrast .coy-assistant-quick,
body.high-contrast .coy-assistant-compose { color: #fff; background: #000; border-color: #fff; }
body.high-contrast .coy-assistant-bubble { color: #000; background: #fff; border-color: #fff; }
body.high-contrast .coy-assistant-message.is-user .coy-assistant-bubble { color: #000; background: #ff0; }
body.high-contrast .coy-assistant-quick button,
body.high-contrast .coy-assistant-actions a { color: #000; background: #ff0; border-color: #ff0; }
body.high-contrast .coy-assistant-note { color: #fff; }

@keyframes coy-mascot-greet {
  0%, 72%, 100% { transform: translateY(0) rotate(0); }
  78% { transform: translateY(-4px) rotate(-1.5deg); }
  84% { transform: translateY(-2px) rotate(1.3deg); }
  90% { transform: translateY(-4px) rotate(-1deg); }
}
@keyframes coy-badge-in { from { opacity: 0; transform: translate(-7px, 7px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes coy-panel-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes coy-dots { from { opacity: .35; } to { opacity: 1; } }

@media (max-width: 620px) {
  .coy-assistant { left: 9px; bottom: 8px; }
  .coy-assistant-launcher { width: 82px; height: 94px; }
  .coy-assistant-launcher img { width: 77px; height: 93px; }
  .coy-assistant-badge { left: 69px; bottom: 61px; }
  .coy-assistant-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 108px;
    width: auto;
    max-height: calc(100dvh - 122px);
    border-radius: 21px;
  }
  .coy-assistant-head { min-height: 72px; grid-template-columns: 49px 1fr auto; padding: 10px 11px; }
  .coy-assistant-avatar { width: 47px; height: 47px; }
  .coy-assistant-avatar img { width: 44px; height: 53px; }
  .coy-assistant-conversation { padding: 13px; }
  .coy-assistant-quick { padding-inline: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .coy-assistant-launcher img,
  .coy-assistant-badge,
  .coy-assistant-panel,
  .coy-assistant-dots { animation: none !important; }
}

@media print { .coy-assistant { display: none !important; } }
