.support-widget {
  --support-ink: #171510;
  --support-muted: #625b54;
  --support-paper: #fffdfb;
  --support-line: rgba(23, 21, 16, 0.12);
  --support-brand: #8f5c3a;
  --support-gold: #d9b274;
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1000;
  color: var(--support-ink);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.support-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--support-brand), #6f492f);
  box-shadow: 0 12px 30px rgba(29, 26, 23, 0.24);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.support-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(29, 26, 23, 0.3);
}

.support-launcher:focus-visible,
.support-close:focus-visible,
.support-send:focus-visible,
.support-input:focus-visible {
  outline: 3px solid #d9b274;
  outline-offset: 3px;
}

.support-launcher svg {
  width: 21px;
  height: 21px;
  flex: none;
}

.support-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100dvh - 110px - env(safe-area-inset-bottom)));
  min-height: min(380px, calc(100dvh - 130px));
  overflow: hidden;
  border: 1px solid rgba(23, 21, 16, 0.14);
  border-radius: 22px;
  background: var(--support-paper);
  box-shadow: 0 22px 70px rgba(29, 26, 23, 0.24);
}

.support-panel[hidden] {
  display: none;
}

.support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px;
  background: #071610;
  color: #fff;
}

.support-heading {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 400;
}

.support-subheading {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.support-close {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.support-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
}

.support-message {
  max-width: 88%;
  padding: 11px 13px;
  border: 1px solid var(--support-line);
  border-radius: 16px 16px 16px 4px;
  background: #f6f1eb;
  color: var(--support-ink);
  font-size: 0.92rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.support-message[data-role="user"] {
  align-self: flex-end;
  border-color: transparent;
  border-radius: 16px 16px 4px 16px;
  background: #efe3d7;
}

.support-message[data-role="status"] {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--support-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.support-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.support-suggestion {
  padding: 8px 10px;
  border: 1px solid rgba(143, 92, 58, 0.3);
  border-radius: 999px;
  background: #fff;
  color: var(--support-brand);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.support-suggestion:hover {
  background: #f6f1eb;
}

.support-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--support-line);
  background: var(--support-paper);
}

.support-input {
  width: 100%;
  min-height: 44px;
  max-height: 100px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid var(--support-line);
  border-radius: 13px;
  background: #fff;
  color: var(--support-ink);
  font: inherit;
  font-size: 0.92rem;
}

.support-send {
  min-height: 44px;
  padding: 0 15px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #b77b51, #8f5c3a);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.support-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

.support-email {
  padding: 0 14px 12px;
  background: var(--support-paper);
  color: var(--support-muted);
  font-size: 0.78rem;
  text-align: center;
}

.support-email a {
  color: var(--support-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 540px) {
  .support-widget {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .support-launcher {
    min-height: 50px;
    padding: 0 16px;
    font-size: 0.9rem;
  }

  .support-panel {
    right: 0;
    width: min(380px, calc(100vw - 28px));
    max-height: min(520px, calc(100dvh - 96px - env(safe-area-inset-bottom)));
    min-height: min(360px, calc(100dvh - 112px));
    border-radius: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .support-launcher {
    transition: none;
  }
}
