.guide-widget {
  --guide-ink: #112b24;
  --guide-muted: #466056;
  --guide-jade: #21664f;
  --guide-line: #d5e2d5;
  --guide-surface: #fffef9;
  --guide-panel-gap: 9px;
  --guide-launch-height: 49px;
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  color: var(--guide-ink);
}

.guide-widget [hidden] { display: none !important; }

.guide-widget-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--guide-launch-height);
  padding: 7px 13px 7px 8px;
  border: 1px solid #2d6e54;
  border-radius: 999px;
  background: #204f3d;
  box-shadow: 0 7px 20px #183d2b32;
  color: #fffef6;
  font-size: 15px;
  font-weight: 760;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: #a8ceaa36;
  transition: background-color .2s, border-color .2s, box-shadow .26s ease-out;
}

.guide-widget-launch:hover, .guide-widget-launch[aria-expanded=true] { background: #173d2e; box-shadow: 0 7px 24px #173b2c3b; }

.guide-widget-mark {
  position: relative;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: #dfeeaa;
  color: #203e2c;
}

.guide-widget-mark::before {
  content: "";
  position: absolute;
  inset: 9px 7px 8px;
  border: 1.7px solid currentColor;
  border-radius: 6px 6px 6px 2px;
}

.guide-widget-mark::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 2px;
  top: 15px;
  left: 11px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 4px 0 currentColor, 8px 0 currentColor;
}

.guide-widget-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--guide-panel-gap));
  width: min(414px, 100vw - 36px);
  height: min(578px, calc(100vh - 97px));
  height: min(578px, calc(var(--guide-visible-height, 100dvh) - 97px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #c6d9c9;
  border-radius: 20px;
  background: var(--guide-surface);
  box-shadow: 0 18px 54px #19362b40;
  animation: guide-widget-enter .22s cubic-bezier(.24, .67, .34, 1) both;
}

@keyframes guide-widget-enter {
  from { opacity: .55; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.guide-widget-header {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr) 41px 41px;
  align-items: center;
  gap: 7px;
  padding: 12px 10px 12px 13px;
  border-bottom: 1px solid var(--guide-line);
  background: linear-gradient(106deg, #eef4df, #f8faf1 68%);
}

.guide-widget-avatar { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid #d7e5ce; border-radius: 13px; background: #fffef7; }
.guide-widget-avatar img { display: block; border-radius: 7px; }
.guide-widget-heading h2 { color: var(--guide-ink); font-size: 20px; letter-spacing: -.035em; }
.guide-widget-heading p { margin-top: 2px; color: var(--guide-muted); font-size: 12px; line-height: 1.35; }

.guide-widget-control {
  display: grid;
  place-items: center;
  position: relative;
  width: 41px;
  height: 41px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #476556;
  background: transparent;
  cursor: pointer;
}
.guide-widget-control:hover:not(:disabled) { border-color: #d4e2ce; background: #eaf2e2; color: var(--guide-ink); }
.guide-widget-control:disabled { opacity: .45; cursor: default; }

.guide-widget-clear-mark {
  position: relative;
  width: 11px;
  height: 13px;
  margin-top: 3px;
  border: 1.5px solid currentColor;
  border-radius: 1px 1px 3px 3px;
}
.guide-widget-clear-mark::before { content: ""; position: absolute; inset: -4px -3px auto; height: 1.5px; border-radius: 2px; background: currentColor; }
.guide-widget-clear-mark::after { content: ""; position: absolute; top: -6px; left: 2px; width: 5px; height: 1.5px; border-radius: 2px; background: currentColor; }
.guide-widget-close-mark { position: relative; width: 17px; height: 17px; }
.guide-widget-close-mark::before, .guide-widget-close-mark::after {
  content: ""; position: absolute; inset: 8px 0 auto; height: 1.5px; border-radius: 2px; background: currentColor; transform: rotate(45deg);
}
.guide-widget-close-mark::after { transform: rotate(-45deg); }

.guide-widget-transcript {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 15px;
  background: linear-gradient(#f9faf3, #f6f8f0);
  scrollbar-color: #a1baab transparent;
  scrollbar-width: thin;
}
.guide-widget-transcript:focus-visible { outline: 2px solid #99753a; outline-offset: -3px; }
.guide-widget-intro p { color: var(--guide-ink); font-size: 15px; font-weight: 740; margin-bottom: 3px; line-height: 1.5; }
.guide-widget-intro .guide-widget-sources { color: var(--guide-muted); font-size: 13px; font-weight: 500; margin-bottom: 12px; }
.guide-widget-intro ul { display: grid; gap: 7px; padding: 0; list-style: none; }
.guide-widget-intro button {
  min-height: 42px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d4e2d4;
  border-radius: 9px;
  text-align: start;
  background: #fffef9;
  color: #295a47;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.45;
  cursor: pointer;
}
.guide-widget-intro button:hover { background: #edf4e8; border-color: #abc6b2; }

.guide-widget-messages { display: grid; gap: 13px; min-width: 0; }
.guide-widget-turn { display: grid; gap: 7px; min-width: 0; }
.guide-widget-question, .guide-widget-reply, .guide-widget-wait {
  min-width: 0;
  max-width: 96%;
  padding: 9px 10px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.guide-widget-question {
  justify-self: end;
  border-radius: 11px 11px 3px 11px;
  color: #f9fff7;
  background: var(--guide-jade);
}
.guide-widget-reply, .guide-widget-wait {
  justify-self: start;
  border: 1px solid var(--guide-line);
  border-radius: 11px 11px 11px 3px;
  color: var(--guide-ink);
  background: var(--guide-surface);
}
.guide-widget-reply:empty { display: none; }
.guide-widget-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  list-style: none;
  margin-top: 7px;
  padding: 6px 0 0;
  border-top: 1px solid #e3eae0;
}
.guide-widget-links a { display: inline-flex; align-items: center; min-height: 33px; font-weight: 740; white-space: normal; }
.guide-widget-wait { display: flex; align-items: center; gap: 7px; width: fit-content; margin-top: 7px; color: var(--guide-muted); }
.guide-widget-wait span { width: 7px; height: 7px; border-radius: 50%; background: #92a988; animation: guide-widget-wait 1s ease-out infinite alternate; }
@keyframes guide-widget-wait { to { opacity: .35; } }

.guide-widget-retry {
  min-height: 36px;
  margin-top: 5px;
  padding: 3px 10px;
  border: 1px solid #bed2be;
  border-radius: 6px;
  background: #eef4e9;
  color: var(--guide-jade);
  font-weight: 720;
  cursor: pointer;
}

.guide-widget-compose { padding: 10px 12px 8px; border-top: 1px solid var(--guide-line); background: var(--guide-surface); }
.guide-widget-compose form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 6px; }
.guide-widget-compose textarea {
  width: 100%;
  min-height: 43px;
  max-height: 104px;
  padding: 8px 9px;
  overflow: auto;
  resize: vertical;
  font-size: 16px;
  line-height: 1.5;
}
.guide-widget-send {
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--guide-jade);
  border-radius: 8px;
  background: var(--guide-jade);
  color: #fff;
  font-weight: 740;
  cursor: pointer;
}
.guide-widget-send:hover:not(:disabled) { background: #144735; }
.guide-widget-send:disabled { border-color: #d7e4d6; background: #e7eee2; color: #55685e; cursor: default; }
.guide-widget-note, .guide-widget-note div { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; }
.guide-widget-note { justify-content: space-between; margin-top: 4px; color: var(--guide-muted); font-size: 11px; line-height: 1.35; }
.guide-widget-note a { display: inline-flex; align-items: center; min-height: 30px; font-size: 12px; font-weight: 720; white-space: nowrap; }

@media (max-width: 760px) {
  .guide-widget {
    --guide-panel-gap: 8px;
    --guide-launch-height: 46px;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--guide-keyboard-offset, 0px));
  }
  .guide-widget-launch { gap: 6px; padding: 6px 10px 6px 6px; font-size: 13px; }
  .guide-widget-mark { width: 29px; height: 29px; }
  .guide-widget-mark::before { inset: 7px 6px 7px; }
  .guide-widget-mark::after { top: 13px; left: 10px; }
  .guide-widget-panel {
    width: min(414px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    height: min(540px, calc(var(--guide-visible-height, 100dvh) - 83px - env(safe-area-inset-bottom, 0px)));
    border-radius: 16px;
  }
  .guide-widget-header { grid-template-columns: 36px minmax(0, 1fr) 40px 40px; padding: 8px; gap: 5px; }
  .guide-widget-avatar { width: 36px; height: 36px; border-radius: 10px; }
  .guide-widget-avatar img { width: 28px; height: 28px; }
  .guide-widget-heading h2 { font-size: 18px; }
  .guide-widget-control { width: 40px; height: 40px; }
  .guide-widget-transcript { padding: 11px; }
  .guide-widget-compose { padding: 8px 9px 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .guide-widget-panel, .guide-widget-wait span { animation: none; }
  .guide-widget-launch { transition: none; }
}
