* {
  box-sizing: border-box;
}
:host {
  margin: 0;
  z-index: 210;
  color: #17271b;
  font:
    16px/1.55 system-ui,
    sans-serif;
}
a {
  color: #245f0c;
  text-underline-offset: 3px;
}
button,
input,
textarea {
  font: inherit;
}
button,
a,
input,
textarea {
  outline-offset: 4px;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}
[hidden] {
  display: none !important;
}
.launcher {
  position: fixed;
  right: 20px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #2f6f0a;
  border-radius: 32px;
  background: white;
  padding: 8px 18px 8px 8px;
  min-height: 58px;
  color: #1a3918;
  box-shadow: 0 5px 20px #17271b20;
  font-weight: 700;
  z-index: 20;
}
.launcher img {
  border-radius: 50%;
}
.panel {
  position: fixed;
  right: 20px;
  bottom: calc(90px + env(safe-area-inset-bottom));
  width: min(410px, calc(100vw - 32px));
  max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  border: 1px solid #cddbc5;
  border-radius: 18px;
  box-shadow: 0 16px 60px #17271b30;
  z-index: 21;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #19351d;
  color: white;
}
.panel h2 {
  font-size: 1rem;
  margin: 0;
}
.panel-head button {
  background: transparent;
  color: white;
  border: 0;
  font-size: 1.6rem;
  min-width: 44px;
  min-height: 44px;
}
.panel-intro {
  padding: 16px 18px 0;
  margin: 0;
  font-weight: 650;
}
.messages {
  overflow: auto;
  min-height: 48px;
  flex: 1;
  padding: 4px 18px 12px;
  overscroll-behavior: contain;
}
.message {
  margin-top: 16px;
}
.visitor {
  background: #eef4e8;
  border-radius: 10px;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.answer {
  overflow-wrap: anywhere;
}
.answer p {
  margin: 10px 0;
}
.answer h3,
.answer h4,
.answer h5,
.answer h6 {
  font-size: 1rem;
  margin: 16px 0 8px;
}
.answer li {
  margin: 5px 0;
}
.answer ul {
  padding-left: 22px;
}
.answer code {
  white-space: normal;
}
#status {
  padding: 0 18px;
  margin: 4px 0;
  color: #4b5f46;
  font-size: 0.85rem;
  min-height: 1.3em;
}
#challenge {
  margin: 6px 18px;
}
form {
  padding: 10px 18px;
  border-top: 1px solid #e3e9de;
}
form > label {
  display: block;
  font-size: 0.85rem;
  font-weight: 650;
}
textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 60px;
  max-height: 130px;
  border: 1px solid #81957b;
  border-radius: 8px;
  padding: 10px;
  margin: 6px 0 10px;
  font-size: 16px;
}
.consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
}
.consent input {
  margin: 3px 0;
  min-width: 18px;
  min-height: 18px;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.actions button {
  border: 1px solid #2f6f0a;
  border-radius: 8px;
  padding: 9px 15px;
  min-height: 44px;
  background: #2f6f0a;
  color: white;
}
.actions #saved {
  background: white;
  color: #245f0c;
}
footer {
  padding: 0 18px 14px;
  font-size: 0.75rem;
  color: #52634d;
}
footer p {
  margin: 0 0 6px;
}
@media (max-width: 600px) {
  .launcher {
    right: 14px;
    padding: 8px;
  }
  .launch-label {
    display: none;
  }
  .panel {
    right: 12px;
    width: calc(100vw - 24px);
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
}
@media (max-height: 620px) {
  .panel {
    bottom: 12px;
    max-height: calc(100dvh - 24px);
  }
  .panel footer p {
    font-size: 0.7rem;
  }
  .panel-intro {
    padding-top: 10px;
  }
  .messages {
    min-height: 32px;
  }
}

.panel {
  overflow-y: auto;
}
.panel > :not(.messages) {
  flex-shrink: 0;
}
.messages {
  flex: 1 0 auto;
  max-height: 40dvh;
}

:host([hidden]) { display: none; }
.launcher { width: 60px; height: 60px; padding: 8px; justify-content: center; z-index: 210; }
.panel { z-index: 211; }