.guide-chat {
  --guide-ink: var(--ink, #173a42);
  --guide-muted: var(--muted, #65787a);
  --guide-navy: var(--navy, #143743);
  --guide-yellow: var(--yellow, #ffea00);
  --guide-accent: var(--teal, #a87500);
  --guide-line: var(--line, #dce8e1);
  --guide-paper: var(--paper, #fffdf6);
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 40;
  color: var(--guide-ink);
  font-family: "DM Sans", Arial, sans-serif;
}

.guide-launcher {
  position: relative;
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  padding: 0;
  border: 1px solid #e7cc4e;
  border-radius: 50%;
  background: var(--guide-paper);
  box-shadow: 0 12px 30px #1038462e, 0 0 0 6px #fff9;
  cursor: pointer;
  animation: guide-float 4s ease-in-out infinite;
  transition: transform .2s, box-shadow .2s, opacity .2s;
}

.guide-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 17px 36px #10384638, 0 0 0 7px #fff9;
}

.guide-launcher:focus-visible,
.guide-close:focus-visible,
.guide-form button:focus-visible,
.guide-suggestions button:focus-visible,
.guide-contact a:focus-visible {
  outline: 3px solid var(--guide-yellow);
  outline-offset: 3px;
}

.guide-chat.is-open .guide-launcher {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.guide-launcher-art {
  display: block;
  width: 86px;
  height: 86px;
  overflow: hidden;
}

.guide-launcher-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.guide-chat-badge {
  position: absolute;
  top: 2px;
  right: -1px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--guide-yellow);
  color: var(--guide-ink);
  font-size: 13px;
  box-shadow: 0 3px 8px #12374630;
}

.guide-nudge {
  position: absolute;
  right: 108px;
  bottom: 21px;
  width: max-content;
  max-width: 220px;
  padding: 10px 13px;
  border: 1px solid #e7d57c;
  border-radius: 8px 8px 2px 8px;
  background: var(--guide-paper);
  color: var(--guide-ink);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 6px 24px #16394217;
  transition: opacity .2s, transform .2s;
}

.guide-chat.is-open .guide-nudge {
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
}

.guide-chat.is-over-demo .guide-launcher,
.guide-chat.is-over-demo .guide-nudge {
  visibility: hidden;
  pointer-events: none;
}

.guide-dialog {
  position: fixed;
  inset: auto max(22px, env(safe-area-inset-right)) max(126px, calc(env(safe-area-inset-bottom) + 104px)) auto;
  z-index: 41;
  width: min(392px, calc(100vw - 32px));
  max-width: none;
  max-height: min(680px, calc(var(--guide-vh, 100dvh) - 148px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--guide-line);
  border-radius: 12px;
  background: var(--guide-paper);
  box-shadow: 0 22px 80px #0e34433b;
  color: var(--guide-ink);
}

.guide-dialog::backdrop {
  background: #102d3815;
}

.guide-panel {
  display: flex;
  flex-direction: column;
  min-height: min(390px, calc(var(--guide-vh, 100dvh) - 148px));
  height: auto;
  max-height: calc(var(--guide-vh, 100dvh) - 148px);
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 3px solid var(--guide-yellow);
  background: var(--guide-navy);
  color: #fff;
}

.guide-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid #e7d57c;
  border-radius: 50%;
  background: var(--guide-paper);
}

.guide-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.guide-heading {
  min-width: 0;
  flex: 1;
}

.guide-heading h2 {
  margin: 0;
  font: 700 16px/1.25 "Manrope", "DM Sans", sans-serif;
  letter-spacing: -.02em;
}

.guide-heading p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  color: #e4e9df;
  font-size: 11px;
}

.guide-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--guide-yellow);
  box-shadow: 0 0 0 3px #ffea0027;
}

.guide-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #ffffff2b;
  border-radius: 7px;
  background: #ffffff12;
  color: #fff;
  font: 300 27px/1 Arial, sans-serif;
  cursor: pointer;
}

.guide-close:hover {
  border-color: var(--guide-yellow);
  background: #ffffff20;
}

.guide-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 11px;
  min-height: 105px;
  padding: 16px 16px 12px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #c9bd81 transparent;
  scrollbar-width: thin;
}

.guide-message {
  max-width: 92%;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.guide-message--guide {
  align-self: flex-start;
  border: 1px solid var(--guide-line);
  border-bottom-left-radius: 2px;
  background: #fff;
  color: var(--guide-ink);
}

.guide-message--user {
  align-self: flex-end;
  border: 1px solid #eadb8a;
  border-bottom-right-radius: 2px;
  background: #fff5c2;
  color: #173a42;
}

.guide-message a {
  color: var(--guide-accent);
  font-weight: 700;
  text-underline-offset: 2px;
}

.guide-quick-contact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding: 8px 11px;
  border: 1px solid #d7bd30;
  border-radius: 6px;
  background: var(--guide-yellow);
  color: #173a42;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.guide-quick-contact:hover {
  background: #fff35c;
}

.guide-suggestions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  padding: 2px 14px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.guide-suggestions::-webkit-scrollbar {
  display: none;
}

.guide-suggestions button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #e4dcae;
  border-radius: 6px;
  background: #fff;
  color: var(--guide-ink);
  font: 600 11px/1.2 "DM Sans", Arial, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}

.guide-suggestions button:hover {
  border-color: #d1b82f;
  background: #fff7ce;
}

.guide-form {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0 14px;
  padding: 7px 7px 7px 13px;
  border: 1px solid #d9dfcf;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 3px 11px #1d50520c;
}

.guide-form:focus-within {
  border-color: #c7ae17;
  box-shadow: 0 0 0 3px #ffea0038;
}

.guide-form input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--guide-ink);
  font: 400 13px "DM Sans", Arial, sans-serif;
}

.guide-form input::placeholder {
  color: #879392;
}

.guide-form button {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--guide-yellow);
  color: #173a42;
  font: 700 22px/1 Arial, sans-serif;
  cursor: pointer;
}

.guide-form button:hover {
  background: #f1db00;
}

.guide-contact {
  flex: 0 0 auto;
  margin: 10px 14px 13px;
  text-align: center;
  color: var(--guide-muted);
  font-size: 11px;
}

.guide-contact a {
  color: var(--guide-accent);
  font-weight: 700;
  text-underline-offset: 2px;
}

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

@keyframes guide-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (max-width: 600px) {
  .guide-chat {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .guide-launcher { width: 78px; height: 78px; }
  .guide-launcher-art { width: 72px; height: 72px; }
  .guide-nudge { right: 88px; bottom: 16px; max-width: 185px; font-size: 11px; }
  .guide-dialog {
    inset: auto max(8px, env(safe-area-inset-right)) max(100px, calc(env(safe-area-inset-bottom) + 88px)) auto;
    width: min(410px, calc(100vw - 16px));
    max-height: calc(var(--guide-vh, 100dvh) - 112px);
    border-radius: 10px;
  }
  .guide-panel {
    height: auto;
    max-height: calc(var(--guide-vh, 100dvh) - 112px);
    min-height: min(310px, calc(var(--guide-vh, 100dvh) - 112px));
  }
  .guide-header { padding: 12px 13px; }
  .guide-messages { padding: 14px 13px 10px; }
  .guide-suggestions { padding-right: 12px; padding-left: 12px; }
  .guide-form { margin-right: 12px; margin-left: 12px; }
  .guide-contact { margin-bottom: 10px; }
}

@media (max-height: 520px) and (max-width: 800px) {
  .guide-dialog {
    bottom: calc(env(safe-area-inset-bottom) + 76px);
    max-height: calc(var(--guide-vh, 100dvh) - 88px);
  }
  .guide-panel {
    height: auto;
    max-height: calc(var(--guide-vh, 100dvh) - 88px);
    min-height: 0;
  }
  .guide-suggestions { padding-bottom: 7px; }
  .guide-contact { margin-top: 6px; margin-bottom: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .guide-launcher, .guide-nudge { transition: none; }
  .guide-launcher { animation: none; }
}

html[dir="rtl"] .guide-chat {
  right: auto;
  left: max(22px, env(safe-area-inset-left));
  font-family: Cairo, "DM Sans", sans-serif;
}

html[dir="rtl"] .guide-dialog {
  right: auto;
  left: max(22px, env(safe-area-inset-left));
}

html[dir="rtl"] .guide-nudge {
  right: auto;
  left: 108px;
  border-radius: 8px 8px 8px 2px;
}

@media (max-width: 600px) {
  html[dir="rtl"] .guide-chat { left: max(14px, env(safe-area-inset-left)); }
  html[dir="rtl"] .guide-dialog {
    inset: auto auto max(100px, calc(env(safe-area-inset-bottom) + 88px)) max(8px, env(safe-area-inset-left));
  }
  html[dir="rtl"] .guide-nudge { left: 88px; }
}

@media (max-height: 520px) and (max-width: 800px) {
  html[dir="rtl"] .guide-dialog {
    inset: auto auto calc(env(safe-area-inset-bottom) + 76px) max(8px, env(safe-area-inset-left));
  }
}
