
/* ahelp — contextual help panel (droide visual standards) */
.ahelp-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card, #111518);
    border-left: 3px solid var(--accent-blue, #818cf8);
    z-index: 1000;
    transition: right 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 35px rgba(0,0,0,0.5);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}
.ahelp-panel.open { right: 0; }

.ahelp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1em 1.25em;
    border-bottom: 2px solid var(--accent-blue, #818cf8);
    flex-shrink: 0;
    background: var(--bg, #0c1014);
}
.ahelp-panel-header h3 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--text-bright, #ffffff);
}

.ahelp-btn-close {
    background: none;
    border: 1px solid transparent;
    color: var(--text-subtle, #8a9aa8);
    cursor: pointer;
    padding: 0.33em;
    border-radius: 0.33em;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2em;
    min-height: 2em;
}
.ahelp-btn-close:hover {
    color: var(--text, #e8edf2);
    background: var(--bg-hover, #1c2428);
    border-color: var(--border-bright, #2a3640);
}
.ahelp-btn-close:focus-visible {
    outline: 2px solid var(--accent-blue, #818cf8);
    outline-offset: 2px;
}

.ahelp-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5em 1.25em;
    font-size: 1.06em;
    line-height: 1.7;
    color: var(--text, #e8edf2);
}
.ahelp-panel-body::-webkit-scrollbar { width: 0.33em; }
.ahelp-panel-body::-webkit-scrollbar-track { background: transparent; }
.ahelp-panel-body::-webkit-scrollbar-thumb { background: var(--border-bright, #2a3640); border-radius: 0.17em; }

.ahelp-panel-body h1,
.ahelp-panel-body h2,
.ahelp-panel-body h3 {
    color: var(--text-bright, #ffffff);
    font-weight: 700;
    line-height: 1.3;
}
.ahelp-panel-body h1 {
    font-size: 1.25em;
    margin: 1.5em 0 0.75em 0;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--accent-blue, #818cf8);
}
.ahelp-panel-body h2 {
    font-size: 1.1em;
    margin: 1.5em 0 0.5em 0;
    padding-bottom: 0.375em;
    border-bottom: 1px solid var(--border, #1c2428);
    color: var(--accent-blue, #818cf8);
}
.ahelp-panel-body h3 {
    font-size: 1em;
    margin: 1.25em 0 0.5em 0;
}
.ahelp-panel-body h1:first-child,
.ahelp-panel-body h2:first-child { margin-top: 0; }

.ahelp-panel-body p { margin: 0.5em 0; }
.ahelp-panel-body ul, .ahelp-panel-body ol { padding-left: 1.25em; margin: 0.5em 0; }
.ahelp-panel-body li { margin: 0.375em 0; }

.ahelp-panel-body code {
    background: rgba(129,140,248,0.15);
    color: var(--accent-blue, #818cf8);
    padding: 0.125em 0.375em;
    border-radius: 0.22em;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.9em;
}
.ahelp-panel-body pre {
    background: var(--bg-surface, #161b22);
    border: 1px solid var(--border, #1c2428);
    border-radius: 0.44em;
    padding: 1em;
    overflow-x: auto;
    margin: 0.75em 0;
}
.ahelp-panel-body pre code {
    background: none;
    padding: 0;
    font-size: 0.94em;
    line-height: 1.6;
    color: var(--text, #e8edf2);
}
.ahelp-panel-body strong { color: var(--text-bright, #ffffff); font-weight: 600; }
.ahelp-panel-body a { color: var(--accent-blue, #818cf8); text-decoration: none; }
.ahelp-panel-body a:hover { text-decoration: underline; }

.ahelp-panel-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 0.94em;
}
.ahelp-panel-body th {
    text-align: left;
    padding: 0.5em 0.75em;
    border-bottom: 2px solid var(--border-bright, #2a3640);
    color: var(--text-bright, #ffffff);
    font-weight: 600;
    white-space: nowrap;
}
.ahelp-panel-body td {
    padding: 0.5em 0.75em;
    border-bottom: 1px solid var(--border, #1c2428);
    color: var(--text, #e8edf2);
}
.ahelp-panel-body tr:last-child td { border-bottom: none; }

.ahelp-panel-body blockquote {
    border-left: 3px solid var(--accent-gold, #daa04a);
    margin: 0.75em 0;
    padding: 0.75em 1em;
    background: rgba(218,160,74,0.08);
    border-radius: 0 0.44em 0.44em 0;
    color: var(--text, #e8edf2);
    font-size: 1em;
}

/* ? trigger button */
.ahelp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(129,140,248,0.12);
    border: 1px solid rgba(129,140,248,0.25);
    color: var(--accent-blue, #818cf8);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    vertical-align: middle;
    margin-left: 6px;
    line-height: 1;
    font-family: system-ui, -apple-system, sans-serif;
}
.ahelp-btn:hover {
    background: rgba(129,140,248,0.25);
    border-color: var(--accent-blue, #818cf8);
    color: var(--text-bright, #ffffff);
}
.ahelp-btn:focus-visible {
    outline: 2px solid var(--accent-blue, #818cf8);
    outline-offset: 2px;
}

/* Standalone help page layout */
.ahelp-page-layout {
    display: grid;
    grid-template-columns: 12.22em 1fr;
    gap: 2em;
    max-width: 61.11em;
    margin: 0 auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ahelp-toc {
    position: sticky;
    top: 4.44em;
    align-self: start;
    max-height: calc(100vh - 5.56em);
    overflow-y: auto;
    padding-right: 1em;
    border-right: 1px solid var(--border, #1c2428);
}
.ahelp-toc a {
    display: block;
    padding: 0.5em 0.75em;
    color: var(--text-subtle, #8a9aa8);
    text-decoration: none;
    font-size: 0.94em;
    border-radius: 0.33em;
}
.ahelp-toc a:hover { color: var(--text, #e8edf2); background: var(--bg-hover, #1c2428); }
.ahelp-toc a.active { color: var(--accent-blue, #818cf8); background: rgba(129,140,248,0.1); }
.ahelp-toc .ahelp-toc-child { padding-left: 1.5em; font-size: 0.88em; }

/* Mobile */
@media (max-width: 768px) {
    .ahelp-panel { width: 100vw; right: -100vw; }
    .ahelp-page-layout { grid-template-columns: 1fr; }
    .ahelp-toc { position: static; border-right: none; border-bottom: 1px solid var(--border, #1c2428); padding-bottom: 1em; margin-bottom: 1em; }
    .ahelp-btn { width: 28px; height: 28px; font-size: 16px; }
}

/* Print: hide panel and buttons */
@media print { .ahelp-panel, .ahelp-btn { display: none !important; } }
