/* Help box on the HaruVista pages (haruvista-help.js). HaruVista blue, light and dark. */
.hv-help-launcher,
.hv-help-panel {
  --hv-help-accent: #1967d2;
  --hv-help-accent-soft: #e8f1fd;
  --hv-help-on-accent: #ffffff;
  --hv-help-surface: #ffffff;
  --hv-help-shadow: 0 18px 48px -12px rgb(15 28 54 / 28%), 0 4px 14px rgb(15 28 54 / 10%);
}
:root[data-theme="dark"] .hv-help-launcher,
:root[data-theme="dark"] .hv-help-panel {
  --hv-help-accent: #8ab4f8;
  --hv-help-accent-soft: #1b2b44;
  --hv-help-on-accent: #062e6f;
  --hv-help-surface: #221f1c;
  --hv-help-shadow: 0 22px 56px -12px rgb(0 0 0 / 60%), 0 4px 16px rgb(0 0 0 / 40%);
}

.hv-help-launcher {
  position: fixed;
  z-index: 20;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 16px 7px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--hv-help-accent);
  color: var(--hv-help-on-accent);
  box-shadow: var(--hv-help-shadow);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.hv-help-launcher[hidden] { display: none; }
.hv-help-launcher svg { width: 22px; height: 22px; flex: none; }
.hv-help-launcher-label { display: grid; gap: 2px; text-align: start; line-height: 1.25; }
.hv-help-launcher-hint { font-size: 12px; font-weight: 500; }
.hv-help-launcher:hover { filter: brightness(1.06); }
.hv-help-launcher:focus-visible,
.hv-help-panel :focus-visible { outline: 3px solid var(--hv-help-accent); outline-offset: 2px; }
.hv-help-launcher:focus-visible { outline-color: var(--text); }

.hv-help-panel {
  position: fixed;
  z-index: 21;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  margin: 0;
  width: min(390px, calc(100vw - 32px));
  /* A 1280x720 laptop at 150% leaves about 600px of browser viewport; keep the header and input on screen. */
  height: min(580px, calc(100vh - 32px));
  height: min(580px, calc(100dvh - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--hv-help-surface);
  color: var(--text);
  box-shadow: var(--hv-help-shadow);
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}
.hv-help-panel[hidden] { display: none; }

.hv-help-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--line);
}
.hv-help-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; }
.hv-help-identity { flex: 1; min-width: 0; }
/* The page's own h2 style capitalizes; the box's title keeps its case. */
.hv-help-head h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.35; letter-spacing: 0; text-transform: none; }
.hv-help-subtitle { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.hv-help-badge {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--hv-help-accent-soft);
  color: var(--hv-help-accent);
  font-size: 12px;
  font-weight: 700;
  vertical-align: 2px;
}
.hv-help-icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.hv-help-icon-button:hover { background: var(--hv-help-accent-soft); color: var(--text); }
.hv-help-icon-button svg { width: 20px; height: 20px; }

.hv-help-shortcuts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 8px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.hv-help-shortcuts .hv-help-small-button {
  min-height: 40px;
  padding-inline: 5px;
  color: var(--hv-help-accent);
  font-weight: 600;
}
.hv-help-shortcuts .hv-help-small-button:hover { background: var(--hv-help-accent-soft); }
.hv-help-shortcuts .hv-help-small-button[aria-pressed="true"] {
  border-color: var(--hv-help-accent);
  background: var(--hv-help-accent-soft);
}
.hv-help-shortcuts .hv-help-small-button:disabled { opacity: .55; cursor: default; }

.hv-help-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 6px;
  overscroll-behavior: contain;
}
.hv-help-intro { margin: 0 0 12px; color: var(--muted); }
.hv-help-intro p { margin: 0; }
.hv-help-disclosure { margin-top: 6px !important; font-size: 13px; line-height: 1.45; }
.hv-help-label { margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.hv-help-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.hv-help-chip {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.hv-help-chip:hover { border-color: var(--hv-help-accent); color: var(--hv-help-accent); }
.hv-help-chip:disabled { opacity: .55; cursor: default; }

.hv-help-turn { margin: 0 0 12px; }
.hv-help-turn-user { display: flex; justify-content: flex-end; }
.hv-help-bubble {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hv-help-turn-user .hv-help-bubble { background: var(--hv-help-accent); color: var(--hv-help-on-accent); border-bottom-right-radius: 4px; }
.hv-help-turn-guide { display: flex; align-items: flex-start; gap: 8px; }
.hv-help-turn-avatar { flex: none; width: 28px; height: 28px; margin-top: 2px; border-radius: 50%; }
.hv-help-turn-body { flex: 1; min-width: 0; }
.hv-help-turn-guide .hv-help-bubble { max-width: 100%; background: var(--hv-help-accent-soft); border-top-left-radius: 4px; }
.hv-help-thinking { color: var(--muted); }
.hv-help-sources-label { margin: 8px 0 0; }
.hv-help-sources { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; }
.hv-help-sources li { margin: 2px 0; }
.hv-help-sources a,
.hv-help-actions a,
.hv-help-foot a { color: var(--hv-help-accent); }
.hv-help-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 0; font-size: 14px; }
.hv-help-actions p { flex-basis: 100%; margin: 0; color: var(--muted); }
.hv-help-email {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--hv-help-accent);
  color: var(--hv-help-on-accent) !important;
  font-weight: 600;
  text-decoration: none;
}
.hv-help-small-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.hv-help-small-button:hover { border-color: var(--hv-help-accent); }
.hv-help-status { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--hv-help-accent-soft); color: var(--text); font-size: 14px; }

.hv-help-form { padding: 8px 12px 6px; border-top: 1px solid var(--line); }
.hv-help-input-row { display: flex; align-items: flex-end; gap: 8px; }
.hv-help-form textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  overflow-y: hidden;
}
.hv-help-form textarea:focus { border-color: var(--hv-help-accent); outline: none; }
.hv-help-send {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--hv-help-accent);
  color: var(--hv-help-on-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.hv-help-send:disabled { opacity: .5; cursor: default; }
.hv-help-form[hidden] { display: none; }
.hv-help-notice { margin: 6px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.hv-help-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px 10px;
  font-size: 13px;
}
button.hv-help-email { border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.hv-help-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--hv-help-accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Support forms, shown in the conversation's place. */
.hv-help-report { display: grid; gap: 10px; padding-bottom: 6px; }
.hv-help-feedback { gap: 8px; }
.hv-help-report h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.hv-help-report .hv-help-intro,
.hv-help-report .hv-help-notice,
.hv-help-report .hv-help-status { margin: 0; }
.hv-help-field { display: grid; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.hv-help-field textarea,
.hv-help-field input,
.hv-help-field select {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
}
.hv-help-field textarea { min-height: 44px; resize: vertical; }
.hv-help-field textarea:focus,
.hv-help-field input:focus,
.hv-help-field select:focus { border-color: var(--hv-help-accent); outline: none; }
.hv-help-app { min-width: 0; margin: 0; padding: 0; border: 0; }
.hv-help-app legend { margin-bottom: 4px; padding: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
/* Windows takes the longest example ("Windows 11"), the version and the scale are short. */
.hv-help-app-row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, .8fr); gap: 6px; }
.hv-help-app-row .hv-help-field { align-content: end; font-size: 12px; font-weight: 500; }
.hv-help-app-row input { padding: 7px 8px; font-size: 14px; }
.hv-help-hint { margin: -4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.hv-help-app .hv-help-hint { margin-top: 6px; }
.hv-help-report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.hv-help-mail-app { color: var(--hv-help-accent); font-size: 14px; }

.hv-help-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Phones: the box fills the screen and the launcher steps aside. */
@media (max-width: 560px) {
  .hv-help-launcher { padding-inline: 12px 14px; font-size: 14px; }
  .hv-help-panel {
    inset: 0;
    width: auto;
    height: auto;
    border: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.hv-help-open .hv-help-launcher { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .hv-help-panel:not([hidden]) { animation: hv-help-rise .16s ease-out; }
  @keyframes hv-help-rise { from { opacity: 0; transform: translateY(8px); } }
}

@media print {
  .hv-help-launcher, .hv-help-panel { display: none !important; }
}
