/* Uncommon Co. brand — from uncommonco.agency */
:root {
  --uc-bg: #12251c;
  --uc-panel: #1b3327;
  --uc-accent: #e8395f;
  --uc-accent-hover: #b71a3c;
  --uc-sage: #c3cfb6;
  --uc-sage-mid: #8fa382;
  --uc-text: #edeee6;
  --uc-muted: #8fa382;
  --uc-bot: #1b3327;
  --uc-user: #58665a;
  --uc-border: #58665a;
  --uc-cream: #edeee6;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--uc-cream); color: #12251c; }
.demo { padding: 2rem; max-width: 40rem; }
.uc-launcher {
  position: fixed; right: 1.25rem; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); z-index: 9999;
  min-width: 3.5rem; height: 3.5rem; padding: 0 1rem;
  border-radius: 999px; border: none;
  background: var(--uc-accent); color: #fff; font-weight: 700; font-size: .85rem;
  cursor: pointer; box-shadow: 0 8px 24px rgba(18, 37, 28, .35);
  letter-spacing: .02em;
}
.uc-launcher:hover { background: var(--uc-accent-hover); }
.uc-panel {
  position: fixed; right: 1.25rem; bottom: 5.25rem; z-index: 9999;
  width: min(380px, calc(100vw - 1.5rem));
  height: min(560px, calc(100dvh - 7rem));
  max-height: calc(100dvh - 7rem);
  background: var(--uc-bg); color: var(--uc-text); border-radius: 16px;
  display: none; flex-direction: column; overflow: hidden;
  box-shadow: 0 16px 48px rgba(18, 37, 28, .4); border: 1px solid var(--uc-border);
  --uc-vv-offset: 0px;
  --uc-vv-height: 100dvh;
}
.uc-panel.open { display: flex; }
.uc-header {
  padding: .9rem 1rem; background: var(--uc-panel); border-bottom: 1px solid var(--uc-border);
  display: flex; justify-content: space-between; align-items: center;
}
.uc-header strong { font-size: .95rem; color: var(--uc-sage); }
.uc-header span { display: block; color: var(--uc-muted); font-size: .75rem; margin-top: .15rem; }
.uc-close { background: transparent; border: none; color: var(--uc-muted); font-size: 1.25rem; cursor: pointer; }
.uc-close:hover { color: var(--uc-cream); }
.uc-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .65rem; }
.uc-bubble {
  max-width: 90%; padding: .65rem .8rem; border-radius: 12px; font-size: .9rem; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.uc-bubble.assistant {
  align-self: flex-start; background: var(--uc-panel);
  border: 1px solid rgba(195, 207, 182, .25);
}
.uc-bubble.visitor {
  align-self: flex-end; background: var(--uc-user); color: var(--uc-cream);
}
.uc-bubble a { color: var(--uc-sage); }
.uc-footer { border-top: 1px solid var(--uc-border); padding: .75rem; background: var(--uc-panel); }
.uc-contact { display: none; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
.uc-contact.show { display: flex; }
.uc-contact label { font-size: .72rem; color: var(--uc-muted); }
.uc-contact input[type="text"],
.uc-contact input[type="email"],
.uc-contact input[type="tel"] {
  width: 100%; padding: .45rem .55rem; border-radius: 8px; border: 1px solid var(--uc-border);
  background: var(--uc-bg); color: var(--uc-text);
}
.uc-contact input:focus {
  outline: 2px solid var(--uc-sage-mid); outline-offset: 1px;
}
.uc-consent { font-size: .78rem; color: var(--uc-muted); display: none; gap: .4rem; align-items: flex-start; }
.uc-consent.show { display: flex; }
.uc-row { display: flex; gap: .4rem; }
.uc-row input {
  flex: 1; padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--uc-border);
  background: var(--uc-bg); color: var(--uc-text);
}
.uc-row button {
  padding: .55rem .9rem; border: none; border-radius: 8px; background: var(--uc-accent);
  color: #fff; font-weight: 600; cursor: pointer;
}
.uc-row button:hover { background: var(--uc-accent-hover); }
.uc-row button:disabled { opacity: .5; cursor: wait; }
.uc-done { display: none; padding: 1rem; font-size: .9rem; color: var(--uc-text); }
.uc-done.show { display: block; }
.uc-done a { color: var(--uc-accent); font-weight: 600; }

.uc-suggestions {
  display: flex; flex-wrap: wrap; gap: .4rem;
  align-self: flex-start; max-width: 100%;
  margin-top: .15rem;
}
.uc-chip {
  appearance: none; border: 1px solid var(--uc-border);
  background: var(--uc-panel); color: var(--uc-text);
  border-radius: 999px; padding: .4rem .75rem;
  font-size: .78rem; line-height: 1.25; cursor: pointer;
  text-align: left; transition: border-color .15s, background .15s;
}
.uc-chip:hover, .uc-chip:focus-visible {
  border-color: var(--uc-accent); background: #243040;
  outline: none;
}
.uc-chip:disabled { opacity: .5; cursor: wait; }

.uc-typing {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 1.2rem; padding: .75rem 1rem;
}
.uc-typing span {
  width: .45rem; height: .45rem; border-radius: 50%;
  background: var(--uc-sage-mid); opacity: .45;
  animation: uc-typing-bounce 1.2s infinite ease-in-out;
}
.uc-typing span:nth-child(2) { animation-delay: .15s; }
.uc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes uc-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Mobile: full-bleed sheet that tracks the visual viewport (iOS keyboard) */
@media (max-width: 640px) {
  .uc-launcher.uc-hidden-when-open {
    display: none !important;
  }
  .uc-panel.open {
    left: 0;
    right: 0;
    top: var(--uc-vv-top, 0px);
    bottom: auto;
    width: 100%;
    height: var(--uc-vv-height, 100dvh);
    max-height: var(--uc-vv-height, 100dvh);
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .uc-footer {
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
  }
  .uc-row input,
  .uc-row button,
  .uc-chip {
    font-size: 16px; /* prevents iOS focus zoom */
  }
  .uc-chip { font-size: .95rem; }
}

@media (max-width: 640px) {
  html.uc-chat-open,
  html.uc-chat-open body {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }
  html.uc-chat-open .uc-messages {
    touch-action: pan-y;
  }
}
