.help-launcher {
  position: fixed; left: 18px; bottom: calc(87px + env(safe-area-inset-bottom, 0px));
  z-index: 25; display: grid; place-items: center; width: 56px; height: 56px;
  padding: 15px; border: 1px solid var(--border-color); border-radius: 50%; background: var(--bg-secondary);
  color: var(--text-primary); box-shadow: 0 4px 18px color-mix(in srgb, var(--text-primary) 18.82%, transparent); cursor: pointer;
}
.help-launcher svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.help-launcher:hover { background: var(--bg-secondary); }
.help-launcher:focus-visible { outline: 3px solid var(--accent-green); outline-offset: 4px; }
#helpDialog {
  position: fixed; inset: auto auto calc(82px + env(safe-area-inset-bottom, 0px)) 18px;
  margin: 0; padding: 0; width: min(400px, calc(100vw - 36px)); max-width: none;
  max-height: min(690px, calc(100dvh - 110px - env(safe-area-inset-bottom, 0px)));
  background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 16px;
  box-shadow: 0 20px 65px color-mix(in srgb, var(--text-primary) 33.33%, transparent); overflow: auto;
}
#helpDialog[open] { display: flex; flex-direction: column; }
#helpDialog::backdrop { background: color-mix(in srgb, var(--text-primary) 40.00%, transparent); backdrop-filter: blur(2px); }
#helpDialog .help-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; padding: 20px; background: var(--bg-secondary); color: var(--text-primary); }
#helpDialog .help-header p { margin: 0 0 6px; color: var(--border-color); font: 500 9px/1.4 Manrope, Arial, sans-serif; letter-spacing: 1.4px; }
#helpDialog .help-header h2 { margin: 0; color: var(--bg-main); font: 500 28px/1.15 "Cormorant Garamond", Georgia, serif; letter-spacing: 0; }
#helpDialog .help-close { align-self: flex-start; flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid color-mix(in srgb, var(--border-color) 40.00%, transparent); border-radius: 50%; background: transparent; color: var(--border-color); font-size: 27px; }
#helpDialog .help-messages { flex: 1 1 230px; min-height: 110px; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 4px; scroll-behavior: auto; }
#helpDialog .help-message { width: fit-content; max-width: 94%; padding: 13px 15px; margin-bottom: 12px; border-radius: 12px; font: 500 14px/1.65 Manrope, Arial, sans-serif; overflow-wrap: anywhere; }
#helpDialog .help-message p { margin: 0; }
#helpDialog .help-answer { background: var(--bg-main); border: 1px solid var(--border-color); border-bottom-left-radius: 3px; }
#helpDialog .help-user { margin-left: auto; background: var(--bg-secondary); color: var(--text-primary); border-bottom-right-radius: 3px; }
#helpDialog .help-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#helpDialog .help-links a, #helpDialog .help-links button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 11px; border: 1px solid var(--border-color); border-radius: 7px; background: var(--border-color); color: var(--text-primary); font-size: 18px; text-decoration: none; }
#helpDialog .help-links a { font-family: "Cormorant Garamond", Georgia, serif; }
#helpDialog .help-topics { display: flex; flex-wrap: wrap; gap: 7px; flex-shrink: 0; padding: 12px 16px; border-top: 1px solid var(--border-color); }
#helpDialog .help-topics button { min-height: 40px; padding: 6px 11px; background: transparent; border: 1px solid var(--border-color); border-radius: 20px; color: var(--text-primary); font-size: 18px; line-height: 1.3; }
#helpDialog .help-topics button:hover, #helpDialog .help-links a:hover, #helpDialog .help-links button:hover { background: var(--border-color); }
#helpDialog .help-form { flex-shrink: 0; padding: 0 16px 8px; }
#helpDialog .help-input-label { display: block; margin: 0 0 6px; font: 500 11px/1.4 Manrope, Arial, sans-serif; }
#helpDialog .help-form > div { display: flex; gap: 8px; }
#helpDialog .help-form input { flex: 1; min-width: 0; min-height: 46px; width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-main); color: var(--text-primary); font: 400 16px/1.4 Arial, sans-serif; }
#helpDialog .help-form button { flex: 0 0 46px; width: 46px; min-height: 46px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-secondary); color: var(--text-primary); font-size: 25px; }
#helpDialog .help-note { flex-shrink: 0; margin: 0; padding: 2px 16px 14px; color: var(--accent-green); font: 500 10px/1.6 Manrope, Arial, sans-serif; text-align: center; }
#helpDialog .help-note a { color: var(--text-primary); text-decoration: underline; }
#helpDialog :is(button, a, input):focus-visible { outline: 2px solid var(--accent-green); outline-offset: 3px; }
@media (max-width: 650px) {
  .help-launcher { left: 14px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  #helpDialog { left: 12px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 24px); max-height: calc(100dvh - 100px - env(safe-area-inset-bottom, 0px)); }
  #helpDialog .help-header { padding: 16px; }
  #helpDialog .help-header h2 { font-size: 26px; }
}
@media (max-height: 520px) { #helpDialog { inset: 8px auto 8px 12px; max-height: calc(100dvh - 16px); } #helpDialog .help-topics { max-height: 95px; overflow-y: auto; flex-shrink: 1; } }

/* Use the bottom contact bar as the chat entry point where it is available. */
.contact-dock .dock-help {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 0; min-height: 49px; padding: 13px 16px; margin: 0;
  border: 0; border-radius: 0; background: var(--bg-secondary); color: var(--text-primary);
  font-size: 22px; line-height: 1.3; text-align: center; cursor: pointer;
}
.contact-dock .dock-help:hover { filter: brightness(1.15); }
.contact-dock .dock-help:focus-visible { outline: 3px solid var(--border-color); outline-offset: -4px; }
@media (max-width: 650px) {
  .contact-dock .dock-help { min-height: 48px; padding: 12px 8px; gap: 8px; font-size: 20px; }
  .contact-dock .dock-help svg { width: 18px; height: 18px; }
}

#helpDialog .help-message p { white-space: pre-line; }
#helpDialog .help-topics { max-height: 145px; overflow-y: auto; flex-shrink: 0; }
#helpDialog .help-more { width: 100%; }
#helpDialog .help-more summary { padding: 8px 2px; cursor: pointer; color: var(--text-primary); font-size: 19px; }
#helpDialog .help-more > div { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 0; }
