/* https://site.invalid/style/chapter-helper.css */
@scope (html[data-site-styles~="f146d02eede68b96"]) {/* Chapter help alone owns the bottom-right corner. Canvas remains white. */
#iot-chapter-helper:where(:scope, *) { --help-ink: #183b3a; --help-bg: #fff; --help-link: #185e5b; --help-card: #f3f6f5; --help-muted: #46545a; }
#iot-chapter-helper .iot-chapter-helper__launcher:where(:scope, *) {
  position: fixed; right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom)); z-index: 1090;
  width: 90px; height: 130px; margin: 0; padding: 0; border: 0;
  border-radius: 0; background: transparent; box-shadow: none; cursor: pointer;
}
#iot-chapter-helper .iot-chapter-helper__launcher img:where(:scope, *) { display: block; width: 100%; height: 100%; object-fit: contain; background: transparent; border: 0; border-radius: 0; }
#iot-chapter-helper[data-passthrough="true"] .iot-chapter-helper__launcher:where(:scope, *) { opacity: .25; pointer-events: none; }
/* Phones: a small guide (about 44 px wide), faint and click-through over reading text, with room at the end of the page. */
@media (max-width: 700px) {
  #iot-chapter-helper .iot-chapter-helper__launcher:where(:scope, *) {
    width: 44px; height: 64px;
    right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom));
    transition: opacity .18s ease;
  }
  #iot-chapter-helper[data-passthrough="true"] .iot-chapter-helper__launcher:where(:scope, *) { opacity: .12; }
  body:has(#iot-chapter-helper) #quarto-content:where(:scope, *) { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
}
#iot-chapter-helper button:focus-visible:where(:scope, *), #iot-chapter-helper a:focus-visible:where(:scope, *) { outline: 3px solid #226b69; outline-offset: 4px; }
#iot-chapter-help-dialog:where(:scope, *) {
  color: var(--help-ink); background: var(--help-bg); border: 2px solid var(--help-link);
  border-radius: 12px; padding: 20px; width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px); overflow: auto; box-sizing: border-box;
}
#iot-chapter-help-dialog:where(:scope, *)::backdrop { background: rgb(0 0 0 / .45); }
#iot-chapter-help-dialog a:where(:scope, *) { color: var(--help-link); text-decoration: none; }
#iot-chapter-help-dialog :is(p, li, h3):where(:scope, *) { color: inherit; }
#iot-chapter-help-dialog [data-help-close]:where(:scope, *) { color: var(--help-bg); background: var(--help-link); border: 0; padding: 10px 16px; border-radius: 999px; cursor: pointer; }
#iot-chapter-help-dialog [data-help-close]:where(:scope, *) { float: right; }
#iot-chapter-help-dialog h2:where(:scope, *) { color: inherit; }
@media (prefers-color-scheme: dark) {
  #iot-chapter-helper:where(:scope, *) { --help-ink: #f1f7f6; --help-bg: #162f30; --help-link: #a9e4db; --help-card: #203f40; --help-muted: #c4d8d5; }
  #iot-chapter-helper button:focus-visible:where(:scope, *), #iot-chapter-helper a:focus-visible:where(:scope, *) { outline-color: var(--help-link); }
}
@media print { #iot-chapter-helper:where(:scope, *) { display: none; } }

#iot-chapter-help-dialog :is(a, button):focus-visible:where(:scope, *) { outline-color: var(--help-link); }
/* Late runtime notices and staff controls must also leave the helper corner.
   Keep their functions available; sign-in nudges already use normal flow. */
body:has(#iot-chapter-helper) .milestone-notification:where(:scope, *) {
  inset: max(12px, env(safe-area-inset-top)) 12px auto auto;
  max-width: min(28rem, calc(100vw - 24px)); box-sizing: border-box;
}
body:has(#iot-chapter-helper) #admin-portal-context-launcher:where(:scope, *) {
  inset: max(12px, env(safe-area-inset-top)) auto auto 12px;
}
body:has(#iot-chapter-helper) .back-to-top:where(:scope, *) { position: static; margin: 1rem; }
/* Legacy flagging is superseded here by the consolidated feedback routes. */
body:has(#iot-chapter-helper) #content-flag-btn:where(:scope, *) { display: none !important; }

/* Helper cards use renderSidePanel; these are scoped token/fit overrides. */
#iot-chapter-help-dialog .iot-chapter-helper__greeting:where(:scope, *) { display: flex; align-items: center; gap: 12px; clear: both; margin: 0 0 12px; }
#iot-chapter-help-dialog .iot-chapter-helper__greeting img:where(:scope, *) { flex: none; object-fit: contain; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
#iot-chapter-help-dialog .iot-chapter-helper__greeting h2:where(:scope, *) { margin: 0; padding: 0; border: 0; font-size: clamp(.95rem, 2.5vw, 1.2rem); line-height: 1.35; }
#iot-chapter-help-dialog .iot-side-panel:where(:scope, *) { --lab-accent: var(--help-link) !important; margin: 10px 0 0; background: var(--help-card); color: var(--help-ink); }
#iot-chapter-help-dialog .iot-side-panel__type:where(:scope, *) { color: var(--help-link); }
#iot-chapter-help-dialog .iot-side-panel__description:where(:scope, *) { color: var(--help-muted); }
#iot-chapter-help-dialog .iot-side-panel__open:where(:scope, *) { background: var(--help-link); color: var(--help-bg); min-height: 36px; height: auto; padding: 8px 13px; white-space: normal; }
#iot-chapter-help-dialog .iot-side-panel__open:hover:where(:scope, *) { background: var(--help-ink); }
#iot-chapter-help-dialog :is(a, button, summary):where(:scope, *) { text-decoration: none !important; border-bottom: 0; background-image: none; }
#iot-chapter-help-dialog :is(a, button, summary, select, textarea, input):focus-visible:where(:scope, *) { outline: 3px solid var(--help-link); outline-offset: 3px; }
#iot-chapter-help-dialog .iot-chapter-helper__secondary:where(:scope, *) { margin: 5px 0 12px; font-size: .82rem; }
#iot-chapter-help-dialog :is(.iot-chapter-helper__notice, [data-help-ai-unavailable]):where(:scope, *) { color: var(--help-muted); font-size: .8rem; line-height: 1.5; margin: 12px 0 0; }
#iot-chapter-help-dialog [hidden]:where(:scope, *) { display: none !important; }
#iot-chapter-help-dialog .iot-ask-ai-control:where(:scope, *) { margin: 0; }
#iot-chapter-help-dialog .iot-ask-ai-trigger:where(:scope, *)::before { content: none; }
/* Keep prompt controls inside the native modal's top layer and focus boundary. */
#iot-chapter-help-dialog .iot-ask-ai-panel:where(:scope, *) {
  --flat-surface: var(--help-bg); --flat-text: var(--help-ink); --flat-text-muted: var(--help-muted);
  --flat-control-bg: var(--help-card); --flat-border-strong: var(--help-link);
  --ask-ai-action-teal: #185e5b;
  position: static; inset: auto; width: 100%; max-width: 100%; max-height: none;
  margin-top: 10px; box-shadow: none; overflow: visible;
}
#iot-chapter-help-dialog .iot-ask-ai-panel :is(h3, p, label, legend):where(:scope, *) { color: var(--help-ink); }
#iot-chapter-help-dialog .iot-ask-ai-logo:where(:scope, *) { background: #185e5b; color: #fff; }
#iot-chapter-help-dialog .iot-ask-ai-actions:where(:scope, *) { flex-wrap: wrap; }
#iot-chapter-help-dialog .iot-ask-ai-tiles:where(:scope, *) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#iot-chapter-help-dialog .iot-ask-ai-tile[aria-checked="true"]:where(:scope, *) { border-color: var(--help-link); box-shadow: inset 0 0 0 2px var(--help-link); }
#iot-chapter-help-dialog #iot-chapter-help-tips:where(:scope, *) { color: var(--help-ink); padding-left: 24px; font-size: .9rem; }
/* Remove the chapter footer's empty related-content reservation (21/31rem)
   and the feedback unit's clamp(2.6rem, 7vw, 5rem) top margin. */
body:has(#iot-chapter-helper) .iot-chapter-end > .rc-container--pending:where(:scope, *) { min-block-size: 0; }
body:has(#iot-chapter-helper) .iot-chapter-end > #chapter-feedback:where(:scope, *) { margin-block-start: 1rem; }
}
