/* TOFBOT — floating scripted chatbot */

#tofbot-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: var(--f-mono, monospace);
  color: var(--ink, #111);
}

/* Closed: the acid-green speech-bubble pill */
.tofbot-bubble {
  position: relative;
  padding: 14px 20px;
  border-radius: 999px;
  background: var(--acid, #d9ff3c);
  border: 2px solid #111;
  box-shadow: 4px 4px 0 #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  font-family: var(--f-display, sans-serif);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: #111;
}
.tofbot-bubble:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #111;
}
.tofbot-bubble:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #111;
}
.tofbot-bubble .tofbot-bubble-label {
  line-height: 1;
  position: relative;
  z-index: 1;
}
.tofbot-bubble[aria-expanded="true"] { display: none; }

/* Speech-bubble tail, bottom-right corner */
.tofbot-bubble::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -10px;
  width: 16px;
  height: 10px;
  background: var(--acid, #d9ff3c);
  border: 2px solid #111;
  border-top: none;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.tofbot-pulse {
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  border: 2px solid var(--acid, #d9ff3c);
  animation: tofbot-pulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes tofbot-pulse {
  0%   { transform: scale(1);   opacity: 0.9; }
  100% { transform: scale(1.12); opacity: 0;   }
}
@media (prefers-reduced-motion: reduce) {
  .tofbot-pulse { display: none; }
  .tofbot-bubble, .tofbot-panel { transition: none; }
}

/* Open panel */
.tofbot-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border: 2px solid var(--ink, #111);
  box-shadow: 6px 6px 0 var(--ink, #111);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.tofbot-panel.open { display: flex; }

.tofbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--acid, #d9ff3c);
  border-bottom: 2px solid #111;
  color: #111;
}
.tofbot-title {
  font-family: var(--f-display, sans-serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #111;
}
.tofbot-sub {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 8px;
  color: #111;
}
.tofbot-close {
  background: none;
  border: none;
  color: #111;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
}
.tofbot-close:hover { transform: scale(1.15); }

.tofbot-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  background: #fafafa;
  color: #111;
}

.tofbot-msg {
  max-width: 88%;
  padding: 9px 12px;
  border: 1.5px solid #111;
  border-radius: 2px;
  color: #111;
}
.tofbot-msg.bot {
  background: #fff;
  align-self: flex-start;
}
.tofbot-msg.user {
  background: var(--acid, #d9ff3c);
  align-self: flex-end;
  font-family: var(--f-display, sans-serif);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #111;
}
.tofbot-msg b { font-weight: 700; }
.tofbot-msg a { color: inherit; text-decoration: underline; }

.tofbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 2px;
}
.tofbot-chip {
  background: #fff;
  border: 1.5px solid #111;
  color: #111;
  padding: 6px 10px;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  font-family: var(--f-mono, monospace);
  letter-spacing: 0.02em;
  transition: background 0.15s ease;
}
.tofbot-chip:hover { background: var(--acid, #d9ff3c); }
.tofbot-chip-more {
  background: #111;
  color: #fff;
  font-weight: 700;
}
.tofbot-chip-more:hover { background: var(--acid, #d9ff3c); color: #111; }

.tofbot-msg a {
  color: #111;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  font-weight: 700;
}
.tofbot-msg a:hover { background: var(--acid, #d9ff3c); }

.tofbot-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 10px 12px;
}
.tofbot-typing span {
  width: 6px; height: 6px;
  background: var(--ink, #111);
  border-radius: 50%;
  animation: tofbot-dot 1s infinite ease-in-out;
}
.tofbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.tofbot-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes tofbot-dot {
  0%, 80%, 100% { transform: translateY(0);  opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1;  }
}

.tofbot-inputbar {
  display: flex;
  border-top: 2px solid var(--ink, #111);
  background: #fff;
}
.tofbot-input {
  flex: 1;
  border: none;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  font-family: var(--f-mono, monospace);
  background: transparent;
  color: #111;
}
.tofbot-input::placeholder { color: #666; }
.tofbot-input:focus { outline: none; background: #fafafa; }
.tofbot-send {
  border: none;
  border-left: 2px solid #111;
  background: var(--acid, #d9ff3c);
  color: #111;
  padding: 0 16px;
  cursor: pointer;
  font-family: var(--f-display, sans-serif);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.tofbot-send:hover { filter: brightness(0.95); }

/* Mobile: full-width sheet */
@media (max-width: 520px) {
  #tofbot-root {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  .tofbot-bubble {
    margin-left: auto;
    display: flex;
  }
  .tofbot-panel {
    width: 100%;
    max-height: 70vh;
  }
}
