:root {
  --mhc-primary: #5b2633;
  --mhc-primary-dark: #431b25;
  --mhc-accent: #b79a6b;
  --mhc-surface: #ffffff;
  --mhc-surface-muted: #f4f1ed;
  --mhc-text: #221f20;
  --mhc-text-muted: #625d5f;
  --mhc-border: #d8d1cd;
  --mhc-focus: #1b67a5;
  --mhc-shadow: 0 18px 48px rgba(32, 24, 27, 0.22);
  --mhc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ece8e2;
  color: var(--mhc-text);
  font-family: var(--mhc-font);
}

.demo-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background:
    linear-gradient(90deg, rgba(91, 38, 51, 0.96), rgba(67, 27, 37, 0.88)),
    #5b2633;
}

.demo-intro {
  width: min(760px, 100%);
  color: #fff;
}

.demo-kicker {
  margin: 0 0 12px;
  color: #e1cfad;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.demo-intro h1 {
  max-width: 680px;
  margin: 0 0 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 7vw, 5.2rem);
  font-weight: 500;
  line-height: 0.98;
}

.demo-intro p {
  max-width: 620px;
  font-size: 1.08rem;
  line-height: 1.7;
}

.demo-intro a {
  color: #fff;
  text-underline-offset: 4px;
}

.mhc-widget,
.mhc-widget button,
.mhc-widget input {
  font-family: var(--mhc-font);
}

.mhc-launcher {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 99998;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: var(--mhc-primary);
  box-shadow: 0 8px 28px rgba(28, 18, 21, 0.28);
  color: #fff;
  cursor: pointer;
  font-size: 0.96rem;
  font-weight: 700;
}

.mhc-launcher:hover {
  background: var(--mhc-primary-dark);
}

.mhc-window {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px));
  z-index: 99999;
  display: flex;
  width: min(390px, calc(100vw - 32px));
  height: min(660px, calc(100dvh - 120px));
  min-height: 430px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--mhc-border);
  border-radius: 10px;
  background: var(--mhc-surface);
  box-shadow: var(--mhc-shadow);
  color: var(--mhc-text);
}

.mhc-window[hidden],
.mhc-launcher[hidden] {
  display: none !important;
}

.mhc-header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  background: var(--mhc-primary);
  color: #fff;
}

.mhc-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.25;
}

.mhc-header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.mhc-icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 1.2rem;
}

.mhc-icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mhc-notice {
  margin: 0;
  padding: 9px 16px;
  border-bottom: 1px solid var(--mhc-border);
  background: #f3eee6;
  color: #4d4541;
  font-size: 0.77rem;
  line-height: 1.4;
}

.mhc-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--mhc-surface-muted);
  scroll-behavior: smooth;
}

.mhc-message {
  max-width: 92%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border: 1px solid var(--mhc-border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.94rem;
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.mhc-message--user {
  margin-left: auto;
  border-color: var(--mhc-primary);
  background: var(--mhc-primary);
  color: #fff;
}

.mhc-widget[dir="rtl"] .mhc-message--user {
  margin-right: auto;
  margin-left: 0;
}

.mhc-widget[dir="rtl"] .mhc-choice,
.mhc-widget[dir="rtl"] .mhc-message {
  text-align: right;
}

.mhc-message p {
  margin: 0;
}

.mhc-message-links {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mhc-message a {
  color: #6d2639;
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.mhc-choices {
  display: grid;
  gap: 8px;
  margin: 12px 0 4px;
}

.mhc-choice,
.mhc-nav-button {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #b9ada7;
  border-radius: 6px;
  background: #fff;
  color: var(--mhc-primary-dark);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: left;
}

.mhc-choice:hover,
.mhc-nav-button:hover {
  border-color: var(--mhc-primary);
  background: #f8f2f3;
}

.mhc-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--mhc-border);
  background: #fff;
}

.mhc-nav-button {
  text-align: center;
}

.mhc-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--mhc-border);
  background: #fff;
}

.mhc-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #9c9290;
  border-radius: 6px;
  background: #fff;
  color: var(--mhc-text);
  font-size: 1rem;
}

.mhc-send {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--mhc-primary);
  border-radius: 6px;
  background: var(--mhc-primary);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
}

.mhc-send:hover {
  background: var(--mhc-primary-dark);
}

.mhc-launcher:focus-visible,
.mhc-widget button:focus-visible,
.mhc-widget input:focus-visible,
.mhc-widget a:focus-visible {
  outline: 3px solid var(--mhc-focus);
  outline-offset: 2px;
}

.mhc-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 520px) {
  .mhc-launcher {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .mhc-window {
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .mhc-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  .mhc-log {
    scroll-behavior: auto;
  }
}

@media (prefers-contrast: more) {
  :root {
    --mhc-border: #6d6663;
  }

  .mhc-message,
  .mhc-choice,
  .mhc-nav-button,
  .mhc-input {
    border-width: 2px;
  }
}
