:root {
  --crocheta-rosa: #E8C7E1;
  --crocheta-fucsia: #F25F9D;
  --crocheta-uva: #7F4F6B;
  --crocheta-arena: #FFCB8E;
  --crocheta-bg: #fff;
  --crocheta-text: #2a1a25;
  --crocheta-muted: #6e5a66;
  --crocheta-shadow: 0 12px 32px rgba(127,79,107,0.18);
}

#crocheta-fab {
  position: fixed;
  top: 50%; right: 1.25rem;
  margin-top: -30px;
  z-index: 9990;
  width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--crocheta-fucsia), #c8377a);
  color: #fff; font-size: 1.65rem; cursor: pointer;
  display: grid; place-items: center;
  box-shadow:
    0 18px 36px -10px rgba(242,95,157,0.55),
    0 4px 12px -4px rgba(127,79,107,0.35),
    inset 0 0 0 2px rgba(255,255,255,0.18);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .25s ease, box-shadow .25s ease;
  isolation: isolate;
}
#crocheta-fab:hover { transform: scale(1.08) rotate(-6deg); box-shadow: 0 22px 44px -10px rgba(242,95,157,0.7), 0 6px 16px -4px rgba(127,79,107,0.45); }
#crocheta-fab:active { transform: scale(.94); }
#crocheta-fab.hidden { opacity: 0; pointer-events: none; transform: scale(.6) translateX(20px); }
.crocheta-fab-glyph { position: relative; z-index: 2; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18)); }
.crocheta-fab-pulse {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--crocheta-fucsia);
  z-index: 0; opacity: .55;
  animation: crochetaPulse 2.4s ease-out infinite;
}
@keyframes crochetaPulse {
  0%   { transform: scale(1);    opacity: .55; }
  70%  { transform: scale(1.6);  opacity: 0; }
  100% { transform: scale(1.6);  opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .crocheta-fab-pulse { animation: none; opacity: 0; } }

#crocheta-panel {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9991;
  width: min(380px, calc(100vw - 2rem)); height: min(560px, calc(100vh - 2rem));
  background: var(--crocheta-bg); color: var(--crocheta-text);
  border-radius: 18px; box-shadow: var(--crocheta-shadow);
  display: none; flex-direction: column; overflow: hidden;
  font-family: 'Quicksand', system-ui, sans-serif;
}
#crocheta-panel.open { display: flex; animation: crochetaIn .25s ease; }
@keyframes crochetaIn { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.crocheta-header {
  background: linear-gradient(135deg, var(--crocheta-fucsia), var(--crocheta-uva));
  color: #fff; padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between;
}
.crocheta-title { display: flex; align-items: center; gap: .65rem; }
.crocheta-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 1.1rem; }
.crocheta-title strong { font-family: 'Outfit', system-ui, sans-serif; font-weight: 600; display: block; }
.crocheta-title small { opacity: .85; font-size: .75rem; }
.crocheta-close { background: transparent; border: 0; color: #fff; font-size: 1rem; cursor: pointer; padding: .25rem .5rem; }

.crocheta-messages { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; background: #fbf6f9; }
.crocheta-msg { max-width: 85%; padding: .65rem .85rem; border-radius: 14px; font-size: .92rem; line-height: 1.4; }
.crocheta-msg p { margin: 0 0 .35rem; }
.crocheta-msg p:last-child { margin-bottom: 0; }
.crocheta-msg-user { align-self: flex-end; background: var(--crocheta-fucsia); color: #fff; border-bottom-right-radius: 4px; }
.crocheta-msg-bot  { align-self: flex-start; background: #fff; border: 1px solid #f1e5ec; border-bottom-left-radius: 4px; }

.crocheta-typing { display: flex; gap: 4px; align-items: center; padding: .85rem 1rem; }
.crocheta-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--crocheta-fucsia); opacity: .35; animation: dot 1s infinite; }
.crocheta-typing span:nth-child(2) { animation-delay: .15s; }
.crocheta-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%,80%,100% { opacity: .25 } 40% { opacity: 1 } }

.crocheta-cards { display: grid; grid-template-columns: 1fr; gap: .45rem; margin-top: .55rem; }
.crocheta-card { display: flex; gap: .55rem; padding: .45rem; border-radius: 10px; background: #fbf6f9; border: 1px solid #f1e5ec; color: var(--crocheta-text); text-decoration: none; align-items: center; }
.crocheta-card:hover { background: var(--crocheta-rosa); }
.crocheta-card img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: 0 0 52px; }
.crocheta-card-body { display: flex; flex-direction: column; gap: .15rem; }
.crocheta-card-body strong { font-size: .85rem; font-family: 'Outfit', system-ui, sans-serif; }
.crocheta-card-body small { font-size: .75rem; color: var(--crocheta-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crocheta-premium { display: inline-block; font-size: .65rem; padding: 2px 6px; border-radius: 6px; background: var(--crocheta-arena); color: var(--crocheta-uva); font-weight: 700; margin-right: 4px; }

.crocheta-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.crocheta-chip { background: var(--crocheta-rosa); border: 0; border-radius: 999px; padding: .35rem .7rem; font-size: .78rem; cursor: pointer; color: var(--crocheta-uva); }
.crocheta-chip:hover { background: var(--crocheta-fucsia); color: #fff; }

.crocheta-input-wrap { display: flex; gap: .4rem; padding: .65rem .75rem; background: #fff; border-top: 1px solid #f1e5ec; }
#crocheta-input { flex: 1; border: 1px solid #f1e5ec; border-radius: 10px; padding: .55rem .75rem; font-size: .9rem; outline: none; font-family: inherit; }
#crocheta-input:focus { border-color: var(--crocheta-fucsia); }
.crocheta-send { border: 0; background: var(--crocheta-fucsia); color: #fff; padding: 0 .9rem; border-radius: 10px; cursor: pointer; font-size: 1rem; }
.crocheta-send.disabled { opacity: .35; cursor: not-allowed; }
.crocheta-send.active:hover { filter: brightness(1.06); }

.koah-ad-slot:empty { display: none; }

@media (max-width: 480px) {
  #crocheta-panel { width: calc(100vw - 1rem); height: calc(100vh - 1rem); right: .5rem; bottom: .5rem; border-radius: 14px; }
  #crocheta-fab { right: .85rem; width: 54px; height: 54px; margin-top: -27px; }
}

/* =========================================================
   EMBED MODE — prominent hero on home
   ========================================================= */

.crocheta-embed {
  position: relative;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
  font-family: 'Quicksand', system-ui, sans-serif;
  color: var(--crocheta-uva);
  background:
    radial-gradient(120% 80% at 80% 0%, #ffe9d3 0%, transparent 55%),
    radial-gradient(95% 90% at 5% 110%, #fcd0e6 0%, transparent 55%),
    linear-gradient(180deg, #fdf3f8 0%, #fbe9ee 100%);
  border-bottom: 1px solid rgba(127,79,107,0.08);
}

.crocheta-embed-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.crocheta-embed-pattern {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0.18; mix-blend-mode: multiply;
}
.crocheta-embed-orb {
  position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: .55;
}
.crocheta-embed-orb--1 { top: -90px; right: -60px; width: 280px; height: 280px; background: #FFCB8E; }
.crocheta-embed-orb--2 { bottom: -120px; left: -80px; width: 360px; height: 360px; background: #E8C7E1; }
.crocheta-embed-orb--3 { top: 30%; left: 45%; width: 220px; height: 220px; background: #F25F9D; opacity: .18; }

.crocheta-embed-inner {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 4rem 1.25rem 4.5rem;
  display: flex; flex-direction: column; gap: 1.75rem;
}

.crocheta-embed-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem 1.75rem;
  align-items: center;
}

.crocheta-embed-avatar {
  position: relative;
  width: 112px; height: 112px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.crocheta-embed-avatar-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 90deg, #F25F9D, #FFCB8E, #E8C7E1, #F25F9D);
  padding: 4px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: crochetaSpin 14s linear infinite;
}
.crocheta-embed-avatar-glyph {
  position: relative; z-index: 1;
  width: 88px; height: 88px;
  display: grid; place-items: center;
  background: #fff;
  border-radius: 50%;
  font-size: 2.4rem;
  box-shadow:
    0 14px 32px -10px rgba(127,79,107,0.35),
    inset 0 0 0 1px rgba(242,95,157,0.18);
  animation: crochetaBob 5s ease-in-out infinite;
}
@keyframes crochetaSpin { to { transform: rotate(360deg); } }
@keyframes crochetaBob  { 50% { transform: translateY(-4px); } }

.crocheta-embed-copy { min-width: 0; }
.crocheta-embed-eyebrow {
  display: inline-block;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  font-size: .72rem;
  color: var(--crocheta-fucsia);
  margin-bottom: .6rem;
}
.crocheta-embed-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--crocheta-uva);
  margin: 0 0 .55rem;
}
.crocheta-embed-title em {
  font-style: normal;
  background: linear-gradient(120deg, var(--crocheta-fucsia) 0%, #b8407a 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.crocheta-embed-subtitle {
  margin: 0;
  color: rgba(127,79,107,0.78);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.5;
  max-width: 56ch;
}
.crocheta-embed-subtitle strong {
  color: var(--crocheta-fucsia);
  font-weight: 700;
}

/* form */
.crocheta-embed-form { margin: 0; }
.crocheta-embed-field {
  position: relative;
  display: flex; align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: .55rem .55rem .55rem 1.5rem;
  box-shadow:
    0 24px 48px -22px rgba(127,79,107,0.45),
    0 6px 14px -10px rgba(242,95,157,0.35),
    inset 0 0 0 1px rgba(242,95,157,0.12);
  transition: box-shadow .25s ease, transform .25s ease;
}
.crocheta-embed-field:focus-within {
  box-shadow:
    0 28px 56px -22px rgba(127,79,107,0.55),
    0 8px 18px -8px rgba(242,95,157,0.5),
    inset 0 0 0 2px var(--crocheta-fucsia);
  transform: translateY(-2px);
}
.crocheta-embed-field input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font: 500 clamp(1rem, 1.6vw, 1.15rem) 'Quicksand', system-ui, sans-serif;
  color: var(--crocheta-uva);
  padding: .85rem 0;
}
.crocheta-embed-field input::placeholder {
  color: rgba(127,79,107,0.45);
  font-weight: 500;
}
.crocheta-embed-send {
  flex-shrink: 0;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--crocheta-fucsia), #c8377a);
  color: #fff;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, filter .18s ease;
  box-shadow: 0 10px 22px -6px rgba(242,95,157,0.55);
}
.crocheta-embed-send.disabled {
  background: linear-gradient(135deg, #f1e5ec, #e8d3df);
  color: #b69eb0; cursor: not-allowed;
  box-shadow: none;
}
.crocheta-embed-send.active:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.06); }
.crocheta-embed-send svg { transform: translateX(1px); }

/* chips row */
.crocheta-embed-chips {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.crocheta-embed-chip {
  background: #fff;
  border: 1px solid rgba(242,95,157,0.22);
  color: var(--crocheta-uva);
  font: 600 .85rem 'Quicksand', system-ui, sans-serif;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 4px 10px -6px rgba(127,79,107,0.25);
}
.crocheta-embed-chip:hover {
  background: var(--crocheta-fucsia);
  border-color: var(--crocheta-fucsia);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -10px rgba(242,95,157,0.55);
}
.crocheta-embed-chip:active { transform: translateY(0); }

/* thread (messages container) */
.crocheta-embed-thread {
  display: flex; flex-direction: column; gap: .75rem;
  margin-top: .5rem;
  padding: 1.25rem;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 14px 36px -22px rgba(127,79,107,0.25);
  animation: crochetaThreadIn .35s ease both;
}
.crocheta-embed-thread[data-empty="true"] { display: none; }

@keyframes crochetaThreadIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.crocheta-embed-thread .crocheta-msg {
  max-width: 88%;
  padding: .8rem 1rem;
  border-radius: 16px;
  font-size: .95rem;
  line-height: 1.5;
}
.crocheta-embed-thread .crocheta-msg p { margin: 0 0 .4rem; }
.crocheta-embed-thread .crocheta-msg p:last-child { margin-bottom: 0; }
.crocheta-embed-thread .crocheta-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--crocheta-fucsia), #c8377a);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 10px 22px -12px rgba(242,95,157,0.6);
}
.crocheta-embed-thread .crocheta-msg-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(242,95,157,0.12);
  border-bottom-left-radius: 6px;
  box-shadow: 0 8px 20px -16px rgba(127,79,107,0.4);
}
.crocheta-embed-thread .crocheta-typing { padding: 1rem 1.15rem; }
.crocheta-embed-thread .crocheta-cards {
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  margin-top: .7rem;
}
@media (max-width: 640px) {
  .crocheta-embed-thread .crocheta-cards { grid-template-columns: 1fr; }
}
.crocheta-embed-thread .crocheta-card {
  background: #fdf3f8;
  border-color: rgba(242,95,157,0.15);
}
.crocheta-embed-thread .crocheta-card:hover {
  background: var(--crocheta-rosa);
  transform: translateY(-2px);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Embed: tablet & mobile ---- */
@media (max-width: 768px) {
  .crocheta-embed-inner { padding: 2.5rem 1rem 3rem; gap: 1.4rem; }
  .crocheta-embed-intro {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
    gap: 1rem;
  }
  .crocheta-embed-avatar { width: 92px; height: 92px; }
  .crocheta-embed-avatar-glyph { width: 72px; height: 72px; font-size: 2rem; }
  .crocheta-embed-subtitle { max-width: 100%; }
  .crocheta-embed-field { padding: .45rem .45rem .45rem 1.25rem; }
  .crocheta-embed-send { width: 46px; height: 46px; }
  .crocheta-embed-orb--1 { width: 200px; height: 200px; }
  .crocheta-embed-orb--2 { width: 240px; height: 240px; }
}

@media (max-width: 480px) {
  .crocheta-embed-inner { padding: 2rem .9rem 2.5rem; }
  .crocheta-embed-chips { justify-content: center; }
  .crocheta-embed-chip { font-size: .8rem; padding: .5rem .95rem; }
  .crocheta-embed-thread { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .crocheta-embed-avatar-ring,
  .crocheta-embed-avatar-glyph,
  .crocheta-embed-thread { animation: none !important; }
  .crocheta-embed-field:focus-within { transform: none; }
}

