/* Cheppu — shared, isolated chatbot styles */
#cheppu-root {
  --cheppu-ink: #102f35;
  --cheppu-muted: #677476;
  --cheppu-teal: #0f7976;
  --cheppu-teal-dark: #095f5d;
  --cheppu-cream: #f7f1e7;
  --cheppu-paper: #fffdf8;
  --cheppu-line: rgba(16, 47, 53, 0.14);
  --cheppu-warm: #d38b47;
  --cheppu-shadow: 0 24px 70px rgba(7, 31, 36, 0.23), 0 4px 18px rgba(7, 31, 36, 0.13);
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 2147483000;
  color: var(--cheppu-ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  color-scheme: light;
}

#cheppu-root *,
#cheppu-root *::before,
#cheppu-root *::after {
  box-sizing: border-box;
}

#cheppu-root button,
#cheppu-root input,
#cheppu-root a {
  font: inherit;
}

.cheppu-launcher {
  position: relative;
  display: grid;
  width: 62px;
  height: 62px;
  margin-left: auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 20px;
  background: var(--cheppu-ink);
  box-shadow: 0 12px 30px rgba(6, 36, 40, 0.29);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.cheppu-launcher:hover {
  transform: translateY(-2px) rotate(-1deg);
  background: #0d3a41;
  box-shadow: 0 16px 38px rgba(6, 36, 40, 0.34);
}

.cheppu-launcher:focus-visible,
.cheppu-close:focus-visible,
.cheppu-chip:focus-visible,
.cheppu-send:focus-visible,
.cheppu-link:focus-visible,
.cheppu-input:focus-visible {
  outline: 3px solid rgba(211, 139, 71, 0.62);
  outline-offset: 3px;
}

.cheppu-launcher img {
  width: 46px;
  height: 46px;
  display: block;
}

.cheppu-launcher .cheppu-close-mark {
  display: none;
  width: 22px;
  height: 22px;
  position: relative;
}

.cheppu-launcher .cheppu-close-mark::before,
.cheppu-launcher .cheppu-close-mark::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 1px;
  width: 2px;
  height: 22px;
  border-radius: 2px;
  background: var(--cheppu-cream);
}

.cheppu-launcher .cheppu-close-mark::before { transform: rotate(45deg); }
.cheppu-launcher .cheppu-close-mark::after { transform: rotate(-45deg); }
.cheppu-launcher[aria-expanded="true"] img { display: none; }
.cheppu-launcher[aria-expanded="true"] .cheppu-close-mark { display: block; }

.cheppu-teaser {
  position: absolute;
  right: 74px;
  bottom: 8px;
  width: max-content;
  max-width: min(260px, calc(100vw - 110px));
  padding: 11px 15px;
  border: 1px solid var(--cheppu-line);
  border-radius: 16px 16px 4px 16px;
  background: var(--cheppu-paper);
  color: var(--cheppu-ink);
  box-shadow: 0 9px 28px rgba(10, 47, 53, 0.16);
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.cheppu-teaser.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cheppu-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(402px, calc(100vw - 32px));
  height: min(650px, calc(100vh - 116px));
  min-height: 430px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 28px;
  background: var(--cheppu-paper);
  box-shadow: var(--cheppu-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 190ms ease, transform 220ms cubic-bezier(.2,.75,.25,1), visibility 190ms;
}

.cheppu-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.cheppu-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 18px 18px 17px;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% -40%, rgba(34, 153, 146, 0.55), transparent 48%),
    var(--cheppu-ink);
  color: var(--cheppu-cream);
}

.cheppu-header::after {
  content: "";
  position: absolute;
  right: 54px;
  bottom: -15px;
  width: 92px;
  height: 34px;
  border: 1px solid rgba(247, 241, 231, 0.11);
  border-radius: 50%;
  transform: rotate(-10deg);
}

.cheppu-avatar {
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.cheppu-heading {
  min-width: 0;
  flex: 1;
}

.cheppu-heading strong {
  display: block;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: 0.01em;
}

.cheppu-heading span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: rgba(247, 241, 231, 0.73);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cheppu-heading span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #59cfab;
  box-shadow: 0 0 0 3px rgba(89, 207, 171, 0.13);
}

.cheppu-close {
  position: relative;
  z-index: 1;
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(247, 241, 231, 0.18);
  border-radius: 12px;
  background: rgba(247, 241, 231, 0.08);
  color: var(--cheppu-cream);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.cheppu-close:hover { background: rgba(247, 241, 231, 0.16); transform: rotate(2deg); }
.cheppu-close svg { width: 17px; height: 17px; }

.cheppu-log {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 17px 14px;
  background:
    linear-gradient(rgba(255, 253, 248, 0.93), rgba(255, 253, 248, 0.93)),
    radial-gradient(circle at 1px 1px, rgba(15, 121, 118, 0.16) 1px, transparent 0);
  background-size: auto, 18px 18px;
  overscroll-behavior: contain;
  scrollbar-color: rgba(15, 121, 118, 0.28) transparent;
  scrollbar-width: thin;
}

.cheppu-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 0 13px;
  animation: cheppu-in 180ms ease both;
}

.cheppu-message.is-user { justify-content: flex-end; }

.cheppu-mini-avatar {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.cheppu-bubble-wrap { max-width: 86%; min-width: 0; }

.cheppu-bubble {
  padding: 11px 13px;
  border: 1px solid var(--cheppu-line);
  border-radius: 5px 17px 17px 17px;
  background: var(--cheppu-cream);
  color: var(--cheppu-ink);
  box-shadow: 0 2px 0 rgba(16, 47, 53, 0.025);
  overflow-wrap: anywhere;
}

.cheppu-message.is-user .cheppu-bubble {
  border-color: var(--cheppu-teal);
  border-radius: 17px 5px 17px 17px;
  background: var(--cheppu-teal);
  color: #fff;
}

.cheppu-bubble p { margin: 0; }
.cheppu-bubble p + p { margin-top: 7px; }
.cheppu-bubble strong { font-weight: 750; }
.cheppu-bubble code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(16, 47, 53, 0.09);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.86em;
}

.cheppu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.cheppu-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(15, 121, 118, 0.28);
  border-radius: 10px;
  background: var(--cheppu-paper);
  color: var(--cheppu-teal-dark);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
}

.cheppu-link:hover { border-color: var(--cheppu-teal); background: #edf7f4; color: var(--cheppu-ink); }

.cheppu-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -2px 0 14px 33px;
}

.cheppu-chip {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(15, 121, 118, 0.25);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--cheppu-teal-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.15;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.cheppu-chip:hover { background: #e9f5f2; border-color: var(--cheppu-teal); transform: translateY(-1px); }

.cheppu-composer {
  padding: 12px 13px 13px;
  border-top: 1px solid var(--cheppu-line);
  background: var(--cheppu-paper);
}

.cheppu-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 43px;
  gap: 8px;
  align-items: center;
}

.cheppu-input {
  width: 100%;
  min-width: 0;
  height: 43px;
  padding: 0 14px;
  border: 1px solid rgba(16, 47, 53, 0.2);
  border-radius: 14px;
  background: #fff;
  color: var(--cheppu-ink);
  font-size: 14px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.cheppu-input::placeholder { color: #879092; }
.cheppu-input:focus { border-color: var(--cheppu-teal); box-shadow: 0 0 0 3px rgba(15, 121, 118, 0.11); }

.cheppu-send {
  display: grid;
  width: 43px;
  height: 43px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: var(--cheppu-warm);
  color: #fff;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.cheppu-send:hover { background: #bd7434; transform: translateY(-1px); }
.cheppu-send svg { width: 19px; height: 19px; }

.cheppu-note {
  margin: 7px 4px 0;
  color: var(--cheppu-muted);
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
}

.cheppu-note a { color: var(--cheppu-teal-dark); text-underline-offset: 2px; }

@keyframes cheppu-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  #cheppu-root { right: 14px; bottom: 14px; }
  .cheppu-launcher { width: 58px; height: 58px; border-radius: 18px; }
  .cheppu-launcher img { width: 43px; height: 43px; }
  .cheppu-panel {
    position: fixed;
    inset: auto 8px 82px 8px;
    width: auto;
    height: min(74vh, 650px);
    min-height: 410px;
    border-radius: 24px;
    transform-origin: bottom center;
  }
  .cheppu-teaser { right: 68px; bottom: 6px; }
  .cheppu-log { padding-inline: 14px; }
  .cheppu-bubble-wrap { max-width: 88%; }
  .cheppu-suggestions { margin-left: 0; }
}

@media (max-height: 610px) and (min-width: 561px) {
  .cheppu-panel { height: calc(100vh - 96px); min-height: 360px; bottom: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  #cheppu-root *,
  #cheppu-root *::before,
  #cheppu-root *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .cheppu-panel, .cheppu-launcher, .cheppu-close, .cheppu-chip, .cheppu-link, .cheppu-input { border: 1px solid ButtonText; }
}
