:root {
  color-scheme: dark;
  --ui-bg: #0e1016;
  --ui-panel: #161922;
  --ui-header: #1a1e28;
  --ui-border: rgba(255, 255, 255, 0.22);
  --ui-text: rgba(255, 255, 255, 0.96);
  --ui-text-muted: rgba(255, 255, 255, 0.78);
  --ui-accent: #9ad4f5;
  --help-zoom: 1;
  --help-body-size: 16px;
  --help-body-lh: 1.6;
}

html[data-theme="light"] {
  color-scheme: light;
  --ui-bg: #e4e8f0;
  --ui-panel: #ffffff;
  --ui-header: #f0f3f8;
  --ui-border: rgba(0, 0, 0, 0.22);
  --ui-text: rgba(0, 0, 0, 0.92);
  --ui-text-muted: rgba(0, 0, 0, 0.72);
  --ui-accent: #1d4ed8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--ui-bg);
  color: var(--ui-text);
}

.help-page {
  max-width: 980px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ui-panel);
  border-left: 1px solid var(--ui-border);
  border-right: 1px solid var(--ui-border);
}

.help-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-header);
}

.help-header-main h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ui-text);
}

.help-header-sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ui-text-muted);
}

.help-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.help-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 4px;
}

.help-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: min(280px, 100%);
  height: 36px;
  padding: 0 0 0 10px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.08);
  gap: 6px;
  overflow: hidden;
}

html[data-theme="light"] .help-search {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.22);
}

.help-search-icon {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
  color: var(--ui-text-muted);
  opacity: 0.9;
}

.help-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ui-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  height: 100%;
  padding: 0 4px 0 0;
  /* Hide native search clear so our flush × is the only control */
  -webkit-appearance: none;
  appearance: none;
}

.help-search input::-webkit-search-cancel-button,
.help-search input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.help-search input::placeholder {
  color: var(--ui-text-muted);
  opacity: 0.85;
}

.help-search-clear {
  flex: 0 0 auto;
  align-self: stretch;
  width: 36px;
  height: auto;
  margin: 0;
  padding: 0;
  border: none;
  border-left: 1px solid var(--ui-border);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ui-text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.help-search-clear:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ui-text);
}

html[data-theme="light"] .help-search-clear {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .help-search-clear:hover {
  background: rgba(0, 0, 0, 0.08);
}

.help-search-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--ui-text-muted);
  white-space: nowrap;
}

.help-header-actions button,
.help-toolbar-link {
  min-width: 42px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}

html[data-theme="light"] .help-header-actions button,
html[data-theme="light"] .help-toolbar-link {
  background: rgba(0, 0, 0, 0.04);
}

.help-header-actions button:hover,
.help-toolbar-link:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.36);
}

html[data-theme="light"] .help-header-actions button:hover,
html[data-theme="light"] .help-toolbar-link:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.28);
}

#help-tabs {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-header);
  padding: 0 16px;
  gap: 2px;
}

.help-tab {
  padding: 11px 12px 10px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.72);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 4px 4px 0 0;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  text-decoration: none;
  white-space: nowrap;
}

.help-tab:hover { color: rgba(255, 255, 255, 0.95); background: rgba(255, 255, 255, 0.06); }
.help-tab.active { color: #ffffff; border-bottom-color: #7ec8f0; }
.help-tab-link { display: inline-flex; align-items: center; }
.help-tab--inactive,
.help-tab--inactive:hover { opacity: 0.4; cursor: not-allowed; background: none; }

#help-body {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  zoom: var(--help-zoom, 1);
  color: var(--ui-text);
  font-size: var(--help-body-size);
  line-height: var(--help-body-lh);
}

.kbd {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.85em;
  font-family: monospace;
  color: var(--ui-text);
}

.help-sec {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ui-text);
  margin: 10px 0 4px;
  line-height: 1.25;
}

/* Editor Help collapsible section panels */
.help-panel {
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

html[data-theme="light"] .help-panel {
  background: rgba(37, 99, 235, 0.035);
  border-color: rgba(0, 0, 0, 0.16);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.help-panel-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid transparent;
}

.help-panel-summary::-webkit-details-marker { display: none; }
.help-panel-summary::marker { content: ''; }

.help-panel[open] > .help-panel-summary {
  border-bottom-color: var(--ui-border);
}

.help-panel-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ui-text);
  line-height: 1.25;
}

.help-panel-chevron {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ui-accent);
  font-size: 14px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.help-panel:not([open]) > .help-panel-summary .help-panel-chevron {
  transform: rotate(-90deg);
}

.help-panel-body {
  padding: 4px 8px 10px;
}

.help-panel-body .help-table {
  margin: 0;
}

.help-panel-body .help-table td:last-child {
  border-bottom-color: var(--ui-border);
}

tr.help-search-hit td {
  background: rgba(126, 200, 240, 0.14);
}

html[data-theme="light"] tr.help-search-hit td {
  background: rgba(37, 99, 235, 0.1);
}

.help-search-empty {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px dashed var(--ui-border);
}

.help-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.help-table td {
  padding: 10px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--ui-border);
}
.help-table td:first-child { width: 36%; white-space: nowrap; color: var(--ui-text); }
.help-table td:last-child { color: var(--ui-text-muted); line-height: 1.55; }
.help-table td:last-child strong { color: var(--ui-text); font-weight: 700; }
.help-table .kbd { margin-right: 4px; color: var(--ui-text); }
.help-menu-item { font-weight: 650; color: var(--ui-text); }
.help-foot { font-size: 14px; color: var(--ui-text-muted); margin-top: 2px; line-height: 1.55; }
.help-foot strong { color: var(--ui-text); font-weight: 700; }

.help-tab-panel { display: flex; flex-direction: column; gap: 16px; }
.help-tab-panel[hidden] { display: none; }

/* Artist Manual launch — keep prior typography (exclude from Help body bump) */
.help-manual-launch {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 8px;
}

.help-manual-intro {
  margin: 0;
  font-size: 17px;
  color: var(--ui-text-muted);
  line-height: 1.6;
  max-width: 42rem;
}

.help-manual-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.help-manual-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ui-text);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.help-manual-btn--primary {
  border-color: rgba(126, 200, 240, 0.45);
  background: rgba(126, 200, 240, 0.14);
  color: var(--ui-accent);
}

.help-manual-btn:hover,
.help-manual-btn--primary:hover {
  border-color: rgba(126, 200, 240, 0.55);
  color: var(--ui-accent);
  background: rgba(126, 200, 240, 0.2);
}

html[data-theme="light"] .help-manual-btn {
  background: rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .help-manual-btn--primary {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: #2563eb;
}

html[data-theme="light"] .help-manual-btn:hover,
html[data-theme="light"] .help-manual-btn--primary:hover {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.14);
}

.help-manual-btn--disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dashed;
  pointer-events: none;
}

.ar-guide-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  margin: 4px 0;
  background: rgba(99, 179, 255, 0.14);
  border: 1px solid rgba(99, 179, 255, 0.4);
  border-radius: 10px;
}
.ar-guide-icon { width: 48px; height: 48px; flex: 0 0 48px; }
.ar-guide-hero-title { font-size: 18px; font-weight: 700; color: var(--ui-text); margin-bottom: 4px; }
.ar-guide-hero-sub { font-size: 15px; color: var(--ui-text-muted); line-height: 1.55; }

.ar-guide-callout {
  font-size: 15px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid;
}
.ar-guide-callout--info {
  background: rgba(99, 179, 255, 0.16);
  border-color: #7ec8f0;
  color: var(--ui-text);
}
.ar-guide-callout--info strong { color: var(--ui-text); font-weight: 700; }
.ar-guide-callout--info a {
  color: #b8ddff;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(184, 221, 255, 0.55);
  text-underline-offset: 2px;
}
.ar-guide-callout--info a:hover { color: #dff0ff; text-decoration-color: #dff0ff; }

/* Vertical workflow strip (World + Image-target) */
.ar-guide-flow {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 2px 0 4px;
}

.ar-guide-step-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.ar-guide-flow-arrow {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
  color: var(--ui-accent);
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  user-select: none;
}

.ar-guide-flow-arrow span {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(126, 200, 240, 0.45);
  background: rgba(126, 200, 240, 0.12);
}

/* Legacy step list (if any remain) */
.ar-guide-steps { display: flex; flex-direction: column; gap: 0; }
.ar-guide-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 8px 10px 0;
  border-bottom: 1px solid var(--ui-border);
}
.ar-guide-step:last-child { border-bottom: none; }

.ar-guide-step-num {
  flex: 0 0 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 50%;
  background: rgba(99, 179, 255, 0.28);
  color: #dff0ff;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid rgba(126, 200, 240, 0.4);
}

.ar-guide-step-body { flex: 1; font-size: 15px; color: var(--ui-text); line-height: 1.55; min-width: 0; }
.ar-guide-step-body strong { color: var(--ui-text); display: block; margin-bottom: 4px; font-weight: 700; font-size: 16px; }
.ar-guide-step-body p { margin: 4px 0 0; color: var(--ui-text-muted); }
.ar-guide-step-body code {
  font-family: monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ui-text);
}

.ar-guide-tip {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 200, 80, 0.16);
  border-left: 3px solid rgba(255, 200, 80, 0.85);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: var(--ui-text);
  line-height: 1.5;
}
.ar-guide-tip strong { color: var(--ui-text); font-weight: 700; }
.ar-guide-tip a {
  color: #ffe08a;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(255, 224, 138, 0.55);
  text-underline-offset: 2px;
}
.ar-guide-tip a:hover { color: #fff0b8; text-decoration-color: #fff0b8; }

.ar-guide-link {
  display: inline-block;
  margin: 6px 0;
  font-size: 15px;
  color: #b8ddff;
  text-decoration: none;
  border-bottom: 1px solid rgba(184, 221, 255, 0.55);
  transition: border-color 0.12s, color 0.12s;
}
.ar-guide-link:hover { color: #dff0ff; border-bottom-color: #dff0ff; }
.ar-guide-page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
.ar-guide-page-nav .ar-guide-link { margin: 0; }
.ar-guide-nav-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 15px;
  color: var(--ui-text-muted);
  line-height: 1.65;
}
.ar-guide-nav-list li { margin: 4px 0; }

.help-figure {
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.04);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.help-figure img {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 0 auto;
}
.help-figure figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ui-text-muted);
  text-align: center;
  line-height: 1.4;
}

.ar-guide-code {
  display: block;
  margin: 6px 0;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  font-family: monospace;
  font-size: 14px;
  color: var(--ui-text);
  word-break: break-all;
}
#help-body pre { margin: 6px 0; }
#help-body pre > .ar-guide-code {
  white-space: pre;
  word-break: normal;
  overflow-x: auto;
  line-height: 1.5;
}

#help-body code:not(.ar-guide-code) {
  font-family: monospace;
  font-size: 0.92em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ui-text);
}
#help-body a {
  color: var(--ui-accent);
  text-decoration: underline;
  text-decoration-color: rgba(154, 212, 245, 0.55);
  text-underline-offset: 2px;
}
#help-body a:hover { text-decoration-color: var(--ui-accent); }

/* Light theme contrast */
html[data-theme="light"] .help-tab { color: rgba(0, 0, 0, 0.68); }
html[data-theme="light"] .help-tab:hover { color: rgba(0, 0, 0, 0.9); background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .help-tab.active { color: rgba(0, 0, 0, 0.95); border-bottom-color: #1d4ed8; }
html[data-theme="light"] .kbd {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.22);
  color: rgba(0, 0, 0, 0.88);
}
html[data-theme="light"] .help-table td { border-bottom-color: rgba(0, 0, 0, 0.16); }
html[data-theme="light"] .ar-guide-hero {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.38);
}
html[data-theme="light"] .ar-guide-callout--info {
  background: rgba(37, 99, 235, 0.1);
  border-color: #1d4ed8;
}
html[data-theme="light"] .ar-guide-callout--info a { color: #1d4ed8; text-decoration-color: rgba(29, 78, 216, 0.45); }
html[data-theme="light"] .ar-guide-callout--info a:hover { color: #1e40af; text-decoration-color: #1e40af; }
html[data-theme="light"] .ar-guide-step { border-bottom-color: rgba(0, 0, 0, 0.16); }
html[data-theme="light"] .ar-guide-step-card {
  background: rgba(37, 99, 235, 0.04);
  border-color: rgba(0, 0, 0, 0.18);
}
html[data-theme="light"] .ar-guide-flow-arrow { color: #1d4ed8; }
html[data-theme="light"] .ar-guide-flow-arrow span {
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.1);
}
html[data-theme="light"] .ar-guide-step-num {
  background: rgba(37, 99, 235, 0.16);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.35);
}
html[data-theme="light"] .ar-guide-step-body code {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.16);
  color: rgba(0, 0, 0, 0.9);
}
html[data-theme="light"] .ar-guide-tip {
  background: rgba(180, 120, 0, 0.12);
  border-left-color: #b45309;
}
html[data-theme="light"] .ar-guide-tip a { color: #1d4ed8; text-decoration-color: rgba(29, 78, 216, 0.4); }
html[data-theme="light"] .ar-guide-tip a:hover { color: #1e40af; text-decoration-color: #1e40af; }
html[data-theme="light"] .ar-guide-link { color: #1d4ed8; border-bottom-color: rgba(29, 78, 216, 0.4); }
html[data-theme="light"] .ar-guide-link:hover { color: #1e40af; border-bottom-color: #1e40af; }
html[data-theme="light"] .help-figure {
  background: rgba(37, 99, 235, 0.04);
  border-color: rgba(0, 0, 0, 0.18);
}
html[data-theme="light"] .ar-guide-code {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.18);
  color: rgba(0, 0, 0, 0.9);
}
html[data-theme="light"] #help-body code:not(.ar-guide-code) {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.16);
  color: rgba(0, 0, 0, 0.9);
}
html[data-theme="light"] #help-body a { color: #1d4ed8; text-decoration-color: rgba(29, 78, 216, 0.4); }
html[data-theme="light"] #help-body a:hover { color: #1e40af; text-decoration-color: #1e40af; }

@media print {
  body { background: #fff; }
  .help-page { border: none; max-width: none; }
  .help-header-actions, #help-tabs { display: none !important; }
  .help-tab-panel[hidden] { display: flex !important; }
  #help-body { zoom: 1; padding: 0; }
  .ar-guide-flow-arrow { color: #1d4ed8; }
}
