/* The chat: inline on /ask, and inside the shadow tree of the button other sites load. Tokens come from tokens.css; the
   look is the site's (DESIGN.md): one weight, hierarchy by size, red button, underlined links. No motion here. */
.ask-log {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}
.ask-log .msg {
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--surface);
  color: var(--ink);
  font: 500 16px/1.55 var(--font);
  font-synthesis: none;
  overflow-wrap: anywhere;
}
.ask-log .msg p {
  margin: 0;
  white-space: pre-wrap;
}
.ask-log .msg-user {
  background: var(--raised);
  color: var(--muted);
}
.ask-log .msg-state {
  background: transparent;
  color: var(--muted);
  padding-left: 0;
}
.ask-log .msg-err {
  color: var(--accent-soft);
}
.ask-log .msg a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.ask-log ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
.ask-hint {
  color: var(--subtle);
  margin: 0;
}
.ask-chat label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.ask-chat .ask-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ask-chat input {
  flex: 1 1 10rem;
  min-width: 0;
  height: 56px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
}
.ask-chat .btn,
.ask-open,
.ask-close,
.ask-tour-btn {
  font: inherit;
  cursor: pointer;
}
.ask-chat .btn,
.ask-open {
  height: 56px;
  padding: 0 40px;
  font-size: 18px;
  color: var(--on-fill);
  background: var(--fill);
  border: 1px solid var(--fill-outline);
  border-radius: var(--radius);
}
.ask-chat .btn:hover,
.ask-open:hover {
  background: var(--fill-hover);
}
.ask-chat .btn:active,
.ask-open:active {
  background: var(--fill-press);
}
.ask-chat .btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.ask-chat .note {
  color: var(--subtle);
  font-size: 14px;
  margin: 24px 0 0;
}
.ask-tour-btn,
.ask-close {
  background: none;
  border: 0;
  padding: 8px 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

/* The walkthrough card: an ordinary block above the chat, never an overlay. */
.tour {
  background: var(--surface);
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 32px 0 24px;
  color: var(--ink);
  font: 500 16px/1.55 var(--font);
  font-synthesis: none;
}
.tour h2 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  padding: 0;
}
.tour h2::after {
  content: none;
}
.tour p {
  margin: 0 0 12px;
  font-size: 16px;
}
.tour .tour-count {
  color: var(--muted);
  font-size: 14px;
}
.tour .tour-dots {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
}
.tour .tour-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--input-line);
}
.tour .tour-dots span.on {
  background: var(--accent);
}
.tour .tour-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}
.tour .btn {
  height: auto;
  min-height: 40px;
  font: inherit;
  font-size: 16px;
  color: var(--on-fill);
  background: var(--fill);
  border: 1px solid var(--fill-outline);
  border-radius: var(--radius);
  padding: 0 16px;
  cursor: pointer;
}

/* The button other sites load (inside its shadow tree). */
.ask-open {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2147483000;
}
.ask-panel {
  position: fixed;
  right: 1rem;
  bottom: 4.5rem;
  z-index: 2147483000;
  width: min(24rem, calc(100% - 2rem));
  max-height: min(34rem, calc(100% - 6rem));
  overflow: auto;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
  padding: 1rem;
  font: 500 16px/1.55 var(--font);
  font-synthesis: none;
}
.ask-panel[hidden] {
  display: none;
}
.ask-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (max-width: 760px) {
  .ask-chat .ask-row {
    flex-direction: column;
  }
  .ask-chat input {
    flex: none;
    width: 100%;
  }
  .ask-chat .ask-row .btn {
    width: 100%;
  }
}
