/* Help keeps the shared shell and uses its ordinary hideable left panel for
 * one instruction index beside one reading column. */
body.ui-version-v2 .help-page {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  color: var(--ink-primary);
  font-family: var(--font-interface);
}
body.ui-version-v2 .help-page[hidden] { display: none; }
body.ui-version-v2.help-page-open :is(#chatActive, #chatTitleText, .v2-sticky-header,
  #statusContextControl, .status-right, #shellPanelToggle) {
  display: none !important;
}
body.ui-version-v2.help-page-open .main-layout > .v2-memory-sidebar,
body.ui-version-v2.help-page-open #sidebar > :not(.help-page-bar, .chat-sidebar-close-rail) {
  display: none !important;
}
body.ui-version-v2.help-page-open .chat-area::before,
body.ui-version-v2.help-page-open .chat-area::after { display: none; }
body.ui-version-v2.help-page-open #shellSettingsButton { margin-left: auto; }

body.ui-version-v2 .help-title-text { display: none; color: var(--ink-muted); font-size: .78rem; font-weight: 550; }
body.ui-version-v2.help-page-open .top-bar-left .app-title { display: flex !important; }
body.ui-version-v2.help-page-open .help-title-text { display: inline; }

/* Help is the compact accented destination in the mode menu. */
body.ui-version-v2 .shell-mode-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body.ui-version-v2 #shellModeHelp {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 20px;
  margin: 0 -4px 0 0;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: var(--lime-strong);
  color: var(--lime-strong-on);
  font: 650 .66rem/1 var(--font-interface);
  letter-spacing: .02em;
  text-transform: none;
  cursor: pointer;
}
body.ui-version-v2 #shellModeHelp:is(:hover, :focus-visible) {
  outline: none;
  background: var(--lime-default);
  color: var(--lime-strong-on);
}
body.ui-version-v2 #shellModeHelp[aria-checked="true"] {
  background: var(--lime-default);
  color: var(--lime-strong-on);
}

/* The article owns the page scroll. Its index occupies the shell's regular
 * left panel, including that panel's collapse and mobile drawer behavior. */
body.ui-version-v2 .help-page-scroll {
  --help-gutter: max(18px, calc((100% - 760px) / 2));
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  outline: none;
  scroll-behavior: smooth;
}
body.ui-version-v2 .help-page-bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  box-sizing: border-box;
  padding: 18px 12px 12px;
  color: var(--ink-primary);
}
body.ui-version-v2 .help-page-bar[hidden] { display: none; }
body.ui-version-v2 .help-page-index {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: color-mix(in srgb, var(--ink-primary) 28%, transparent) transparent;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}
body.ui-version-v2 .help-page-index[hidden] { display: none; }
body.ui-version-v2 .help-page-index a {
  flex: none;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-secondary);
  font: 600 .75rem/1.3 var(--font-interface);
  text-decoration: none;
  overflow-wrap: anywhere;
}
body.ui-version-v2 .help-page-index a:is(:hover, :focus-visible) {
  outline: none;
  background: color-mix(in srgb, var(--ink-primary) 6%, transparent);
  color: var(--ink-primary);
}
body.ui-version-v2 .help-page-index a[aria-current="true"] {
  background: color-mix(in srgb, var(--lime-strong) 12%, transparent);
  color: var(--ink-primary);
  box-shadow: inset 3px 0 0 var(--lime-default);
}
body.ui-version-v2 .help-page-status {
  flex: 0 0 auto;
  min-width: 0;
  color: var(--ink-muted);
  font-size: .7rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
body.ui-version-v2 .help-page-status:empty { display: none; }
body.ui-version-v2 .help-page-status[data-tone="success"] { color: var(--lime-default); }
body.ui-version-v2 .help-page-status[data-tone="error"] { color: var(--status-error, #b42318); }
body.ui-version-v2 :is(.help-page-edit, .help-page-save, .help-page-secondary, .help-page-cancel) {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--ink-primary) 16%, transparent);
  border-radius: 5px;
  background: var(--surface-default);
  color: var(--ink-primary);
  font: 650 .72rem/1.2 var(--font-interface);
  cursor: pointer;
}
body.ui-version-v2 .help-page-edit { flex: none; width: 100%; margin-top: auto; }
body.ui-version-v2 :is(.help-page-edit, .help-page-secondary, .help-page-cancel):is(:hover, :focus-visible) {
  border-color: var(--lime-default);
  color: var(--lime-default);
}
body.ui-version-v2 .help-page-save {
  border-color: var(--lime-strong);
  background: var(--lime-strong);
  color: var(--lime-strong-on);
}
body.ui-version-v2 :is(.help-page-save, .help-page-cancel):disabled { opacity: .5; cursor: wait; }

body.ui-version-v2 .help-markdown {
  padding: 30px var(--help-gutter) 80px;
  overflow-wrap: anywhere;
}
body.ui-version-v2 .help-markdown > h1 {
  margin: 0 0 10px;
  font-family: var(--font-v2-display);
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.02em;
}
body.ui-version-v2 .help-markdown > h1 + p {
  max-width: 62ch;
  margin: 0 0 30px;
  color: var(--ink-secondary);
  font-size: .98rem;
  line-height: 1.6;
}
body.ui-version-v2 .help-markdown h2 {
  margin: 40px 0 12px;
  padding-top: 26px;
  border-top: 1px solid color-mix(in srgb, var(--ink-primary) 10%, transparent);
  color: var(--ink-primary);
  font-family: var(--font-v2-display);
  font-size: 1.22rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.01em;
  scroll-margin-top: 18px;
}
body.ui-version-v2 .help-markdown h2:first-of-type { margin-top: 0; }
body.ui-version-v2 .help-markdown h3 {
  margin: 26px 0 8px;
  color: var(--ink-primary);
  font-size: .95rem;
  font-weight: 700;
  scroll-margin-top: 18px;
}
body.ui-version-v2 .help-markdown :is(p, li) {
  max-width: 68ch;
  color: var(--ink-secondary);
  font-size: .9rem;
  line-height: 1.65;
}
body.ui-version-v2 .help-markdown p { margin: 0 0 12px; }
body.ui-version-v2 .help-markdown :is(ul, ol) { margin: 0 0 14px; padding-left: 21px; }
body.ui-version-v2 .help-markdown li { margin: 4px 0; }
body.ui-version-v2 .help-markdown strong { color: var(--ink-primary); font-weight: 680; }
body.ui-version-v2 .help-markdown a { color: var(--lime-strong); text-underline-offset: 2px; }
body.ui-version-v2 .help-markdown table { width: 100%; margin: 4px 0 16px; border-collapse: collapse; font-size: .84rem; }
body.ui-version-v2 .help-markdown :is(th, td) { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border-default); text-align: left; vertical-align: top; }
body.ui-version-v2 .help-markdown :is(th, td):first-child { min-width: 6.5em; }
body.ui-version-v2 .help-markdown th { color: var(--ink-primary); font-weight: 680; }
body.ui-version-v2 .help-markdown td { color: var(--ink-secondary); line-height: 1.5; }

body.ui-version-v2 .help-page-editor { padding: 24px var(--help-gutter) 40px; }
body.ui-version-v2 .help-page-editor label { display: block; margin-bottom: 9px; font-size: .76rem; font-weight: 700; }
body.ui-version-v2 .help-page-editor textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(100dvh - 250px);
  resize: vertical;
  padding: 15px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--surface-default);
  color: var(--ink-primary);
  font: 13px/1.55 ui-monospace, "SFMono-Regular", Consolas, monospace;
  tab-size: 2;
}
body.ui-version-v2 .help-page-editor textarea:focus { border-color: var(--lime-default); outline: 2px solid color-mix(in srgb, var(--lime-default) 22%, transparent); }
body.ui-version-v2 .help-page-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (max-width: 768px) {
  body.ui-version-v2 .help-page-bar { gap: 7px; padding: 14px 10px 10px; }
  body.ui-version-v2 .help-page-index a { padding: 7px 8px; font-size: .69rem; }
  body.ui-version-v2 .help-page-scroll { --help-gutter: max(13px, var(--safe-right, 0px)); }
  body.ui-version-v2 .help-markdown { padding-top: 22px; padding-bottom: 56px; }
  body.ui-version-v2 .help-markdown > h1 { font-size: 1.4rem; }
  body.ui-version-v2 .help-markdown > h1 + p { margin-bottom: 24px; font-size: .9rem; }
  body.ui-version-v2 .help-markdown h2 { margin-top: 32px; padding-top: 22px; scroll-margin-top: 14px; }
  body.ui-version-v2 .help-markdown h3 { scroll-margin-top: 14px; }
  body.ui-version-v2 .help-page-editor { padding-top: 16px; }
  body.ui-version-v2 .help-page-editor textarea { min-height: calc(100dvh - 210px); }
}
