/* Kylo AI side panel on kylo.gg/guides (with /js/kylo-ai-panel.js). The chat inside is /css/kylo-ai-chat.css.
   Wide screens (1100 px and up): the panel is docked on the right and the page moves over to make room.
   Narrower screens: the panel covers the page (full screen) and "Back to guide" closes it. */
:root { --kai-w: clamp(360px, 30vw, 440px); }

.kai-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 10050;
  width: var(--kai-w); max-width: 100vw;
  display: flex; flex-direction: column;
  background: #111317; border-left: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.35);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.kai-panel[hidden] { display: none; }
.kai-head {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding: 12px 12px 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.kai-head img { width: 30px; height: 30px; flex-shrink: 0; }
.kai-title { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.kai-title strong { display: block; color: #fff; font-size: 15px; font-weight: 700; }
.kai-title span { display: block; color: #9a9aa3; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kai-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; border: 0;
  display: grid; place-items: center; background: transparent; color: #b8bcc2; cursor: pointer; text-decoration: none;
}
.kai-icon:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.kai-icon:focus-visible { outline: 2px solid #6aa2ff; outline-offset: 1px; }
.kai-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kai-back { display: none; }
.kai-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.kai-status { margin: auto; padding: 24px; color: #9a9aa3; font-size: 14px; text-align: center; line-height: 1.5; }
.kai-status a { color: #6aa2ff; }

/* Docked (wide screens): the page makes room for the panel, and the guide's "on this page" column hides. */
@media (min-width: 1100px) {
  html.kai-open body { padding-right: var(--kai-w) !important; }
  html.kai-open .gbdoc { grid-template-columns: 240px minmax(0, 1fr); }
  html.kai-open .gbdoc-toc { display: none; }
}
@media (min-width: 1100px) and (max-width: 1279px) {
  html.kai-open .gbdoc { grid-template-columns: 200px minmax(0, 1fr); gap: 20px; }
  html.kai-open .gbdoc-main { padding: 26px 24px; }
}

/* Full screen (narrow screens): covers the page; "Back to guide" closes it. */
@media (max-width: 1099px) {
  .kai-panel { width: 100%; left: 0; border-left: 0; box-shadow: none; }
  .kai-back { display: grid; }
  .kai-panel .ae-panelchat .ae-chat { width: 100%; max-width: 840px; margin: 0 auto; }
  html.kai-open, html.kai-open body { overflow: hidden !important; }
}
@media (max-width: 767px) {
  .kai-head { padding: 10px 8px 10px 10px; }
}
