/* pearl-fix1 (24 Oct 2026): chat polish shared by PRSXA and Pearl AI.
 * a) dark mode: cards drawn with the --pxs-* colours (checklists, forms in answers) were white with light text */
/* fix1b: only inside the chat messages, so the Settings panel keeps its own dark colours (pearl-suite.css) */
html[data-theme="dark"] #messages{
  --pxs-surface:var(--app-bubble-ai,#0f2550);
  --pxs-line:var(--app-border,rgba(255,255,255,.14));
  --pxs-muted:var(--app-text-dim,#94a3b8);
  --pxs-hover:rgba(255,255,255,.06);
}
html[data-theme="dark"] .pfm-form,html[data-theme="dark"] .pfm-ck{color:var(--app-text,#e5e7eb)}
html[data-theme="dark"] .pfm-form input:not([type=checkbox]):not([type=radio]),
html[data-theme="dark"] .pfm-form select,html[data-theme="dark"] .pfm-form textarea{background:var(--app-bg,#071a3d);color:var(--app-text,#e5e7eb)}

/* b) code and change boxes with their own scroll: at the end of the box the wheel/trackpad carries on scrolling the chat
      (they used overscroll-behavior:contain, which stopped the page from moving) */
html body .apxed-diff,html body .apxed-code{overscroll-behavior-y:auto!important;overscroll-behavior-x:contain}

/* c) long code: the bar with Copy / Download / Preview stays at the top of the code box while you scroll through it,
      and "Show less" stays at the bottom of the screen while the full code is open */
@supports (overflow:clip){
  .bubble .md-code{overflow:clip}
  /* fix1c: the chat area has padding (24px, 16px on phones, measured into --fx1-pt / --fx1-pb by pearl-fix1.js); sticking at
     top:0 left that strip open and code showed above the bar. The bars now stick at the very edge of the chat area. */
  .bubble .md-code > .md-code-head{position:sticky;top:calc(-1 * var(--fx1-pt, 24px));z-index:3}
  .bubble .md-code.pcp-fold.pcp-open > .pcp-more{position:sticky;bottom:calc(-1 * var(--fx1-pb, 24px));z-index:3;text-align:left;padding-left:16px}
  /* "Show less" sits at the left, so the centred "Latest" button never covers it */
  /* the light code themes give that bar a see-through tint: make it solid while it floats over the code */
  html:not([data-theme="dark"]):is(.pse-cl-github,.pse-cl-atom,.pse-cl-solarized) .bubble .md-code.pcp-fold.pcp-open > .pcp-more{background:#fff}
}
