/* Help chooser + sidenav-anchored user guides */

#help-chooser-body.help-chooser-body,
#help-chooser-body.app-settings-modal-body {
    width: 220px !important;
    max-width: 220px !important;
    padding: 8px 12px 14px;
}

#help-chooser-body .autosave-modal-header--close-only {
    position: absolute;
    top: 2px;
    right: 4px;
    margin: 0;
    z-index: 1;
}

.help-chooser-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help-chooser-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: #111;
    font-size: 0.88rem;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.help-chooser-action:hover {
    background: #f8fbff;
    color: #0084ff;
}

.help-chooser-action-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.help-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: flex-start;
    z-index: 10020;
    pointer-events: none;
}

.help-modal.is-open {
    display: flex;
}

.help-modal-backdrop {
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: auto;
}

.help-modal-dialog {
    position: fixed;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(680px, calc(100vw - 24px));
    min-height: 360px;
    max-height: min(56vh, 520px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    pointer-events: auto;
    animation: appSettingsModalFadeIn 0.2s ease;
}

.help-modal-dialog.is-menu-open {
    overflow: visible;
}

.help-modal-dialog.is-menu-open .help-topic-body {
    overflow: visible;
}

.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    flex-shrink: 0;
}

.help-modal-back {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
}

.help-modal-back-icon {
    width: 22px;
    height: 22px;
    display: block;
}

.help-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.help-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 2px 6px;
}

.help-modal-close:hover {
    color: #333;
}

.help-topic-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 240px;
    overflow: hidden;
}

.help-topic-selector {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    padding: 4px 16px 12px;
}

.help-topic-pill-wrap {
    position: relative;
    display: inline-grid;
    justify-items: stretch;
}

.help-topic-pill-size-anchor,
.help-topic-pill {
    grid-area: 1 / 1;
}

.help-topic-pill-size-anchor {
    visibility: hidden;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    font-size: 0.98rem;
    font-weight: 600;
    white-space: nowrap;
    box-sizing: border-box;
}

.help-topic-pill-size-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.help-topic-body.is-empty .help-topic-pill-wrap::before {
    content: '';
    position: absolute;
    inset: -24px -36px;
    border-radius: 999px;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 132, 255, 0.18) 0%,
        rgba(0, 132, 255, 0.08) 40%,
        transparent 72%
    );
    filter: blur(8px);
    pointer-events: none;
    z-index: 0;
}

.help-topic-pill {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 12px 28px;
    border: 2px solid #e2e8f0;
    box-sizing: border-box;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.help-topic-pill:hover {
    border-color: #0084ff;
    background: #f8fbff;
    color: #0084ff;
    box-shadow: 0 4px 14px rgba(0, 132, 255, 0.15);
}

.help-topic-pill[aria-expanded="true"] {
    border-color: #0084ff;
    background: #eff6ff;
    color: #0084ff;
    box-shadow: 0 4px 14px rgba(0, 132, 255, 0.18);
}

.help-topic-pill-icon {
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
    flex: 0 0 auto;
    object-fit: contain;
}

.help-topic-pill-label {
    white-space: nowrap;
}

.help-topic-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    min-width: 100%;
    max-width: min(440px, calc(100vw - 48px));
    max-height: min(36vh, 280px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.12);
}

.help-topic-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.help-topic-menu-item:hover,
.help-topic-menu-item:focus-visible {
    background: #f1f5f9;
    color: #0084ff;
    outline: none;
}

.help-topic-menu-item[aria-selected="true"] {
    background: #eff6ff;
    color: #0084ff;
    font-weight: 600;
}

.help-topic-menu-icon {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
    flex: 0 0 auto;
    object-fit: contain;
}

.help-modal-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 20px 16px;
}

.help-topic-body.is-empty .help-modal-panel {
    display: none;
}

.help-modal-panel.is-topic-swap {
    animation: helpPanelFadeIn 0.4s ease;
}

@keyframes helpPanelFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .help-modal-panel.is-topic-swap {
        animation: none !important;
        opacity: 1 !important;
    }
}

.help-panel-heading {
    margin: 12px 0 8px;
    font-size: 1.15rem;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
}

.help-composer-replica {
    display: flex;
    justify-content: center;
    margin: 4px 0 16px;
    pointer-events: none;
}

.help-composer-replica:has(+ .help-intro-text) {
    margin-bottom: 0;
}

.help-composer-replica + .help-intro-text {
    margin-top: 0;
}

.help-intro-text {
    margin: 10px 0 8px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: #444;
}

.help-composer-replica-frame {
    width: 100%;
    max-width: 380px;
    height: 78px;
    overflow: hidden;
}

.help-composer-replica-frame.is-filled {
    height: 78px;
}

.help-composer-replica-scale {
    width: 138.89%;
    transform: scale(0.72);
    transform-origin: top left;
}

.help-composer-box {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    border: 1.5px solid transparent;
    border-radius: 20px;
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(135deg, #c7d2fe, #93c5fd, #a5b4fc) border-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.help-composer-textarea {
    width: 100%;
    margin: 0;
    padding: 14px 18px 48px;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    font-family: inherit;
    color: #111827;
    background: transparent;
    resize: none;
    outline: none;
    min-height: 90px;
    overflow: hidden;
    line-height: 1.5;
    box-sizing: border-box;
}

.help-composer-send {
    position: absolute;
    right: 12px;
    bottom: 8px;
    display: flex;
    align-items: center;
}

.help-composer-send-btn {
    width: 29px;
    height: 29px;
    border-radius: 50%;
    background-color: #808080;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-composer-send-btn.is-active {
    background: linear-gradient(118deg, #1d4ed8 0%, #2563eb 40%, #0ea5e9 100%);
}

.help-composer-send-icon {
    width: 14px;
    height: 14px;
    filter: brightness(0) invert(1);
    opacity: 1;
}

.help-mode-pill-replica {
    display: flex;
    justify-content: center;
    margin: 4px 0 16px;
    pointer-events: none;
}

.help-mode-pill {
    --mode-accent: #64748b;
    --mode-accent-soft: #f8fafc;
    --mode-accent-glow: rgba(100, 116, 139, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1.5px solid var(--mode-accent);
    border-radius: 50px;
    background: var(--mode-accent-soft);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--mode-accent) 25%, transparent),
                0 0 10px var(--mode-accent-glow);
    color: var(--mode-accent);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.help-mode-pill-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 1;
    filter: none;
}

.help-mode-pill-label {
    white-space: nowrap;
}

.help-mode-picker-caret {
    width: 12px;
    height: 12px;
    opacity: 0.7;
    flex-shrink: 0;
}

.help-mode-picker[data-mode="reception"] {
    --mode-accent: #a16207;
    --mode-accent-soft: #fffbeb;
    --mode-accent-glow: rgba(161, 98, 7, 0.28);
}
.help-mode-picker[data-mode="deep_search"] {
    --mode-accent: #0084ff;
    --mode-accent-soft: #eff6ff;
    --mode-accent-glow: rgba(0, 132, 255, 0.35);
}
.help-mode-picker[data-mode="claim_check"] {
    --mode-accent: #16a34a;
    --mode-accent-soft: #f0fdf4;
    --mode-accent-glow: rgba(22, 163, 74, 0.32);
}
.help-mode-picker[data-mode="scholar_search"] {
    --mode-accent: #d97706;
    --mode-accent-soft: #fffbeb;
    --mode-accent-glow: rgba(217, 119, 6, 0.32);
}
.help-mode-picker[data-mode="litintel"] {
    --mode-accent: #7c3aed;
    --mode-accent-soft: #f5f3ff;
    --mode-accent-glow: rgba(124, 58, 237, 0.32);
}
.help-mode-picker[data-mode="peruse"] {
    --mode-accent: #0891b2;
    --mode-accent-soft: #ecfeff;
    --mode-accent-glow: rgba(8, 145, 178, 0.32);
}
.help-mode-picker[data-mode="write_review"] {
    --mode-accent: #e11d48;
    --mode-accent-soft: #fff1f2;
    --mode-accent-glow: rgba(225, 29, 72, 0.28);
}
.help-mode-picker[data-mode="academic_newsletter"] {
    --mode-accent: #ea580c;
    --mode-accent-soft: #fff7ed;
    --mode-accent-glow: rgba(234, 88, 12, 0.32);
}

.help-action-chip-replica {
    display: flex;
    justify-content: center;
    margin: 4px 0 12px;
    pointer-events: none;
}

.help-action-chip-row {
    flex-wrap: wrap;
    gap: 8px;
}

.help-action-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 7.25rem;
    max-width: 9.5rem;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 8px;
    background: #1f2937;
    color: rgba(255, 255, 255, 0.94);
    box-sizing: border-box;
}

.help-action-chip-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
    opacity: 1;
}

.help-action-chip-label {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

.help-scope-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 4px 0 12px;
    pointer-events: none;
}

.help-scope-choice {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid rgba(148, 163, 184, 0.65);
    border-radius: 50px;
    background: transparent;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.35;
}

.help-scope-choice strong {
    font-weight: 600;
}

.help-scope-choice.is-recommended {
    background: rgba(241, 245, 249, 0.85);
    border-color: #64748b;
    color: #0f172a;
}

.dark-theme .help-composer-box {
    background:
        linear-gradient(#1f2937, #1f2937) padding-box,
        linear-gradient(135deg, #c7d2fe, #93c5fd, #a5b4fc) border-box;
}

.dark-theme .help-intro-text {
    color: #d1d5db;
}

.dark-theme .help-mode-pill {
    background: var(--mode-accent-soft);
    color: var(--mode-accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--mode-accent) 25%, transparent),
                0 0 10px var(--mode-accent-glow);
}

.dark-theme .help-scope-choice {
    border-color: rgba(148, 163, 184, 0.42);
    color: #e2e8f0;
}

.dark-theme .help-scope-choice.is-recommended {
    background: rgba(51, 65, 85, 0.55);
    border-color: rgba(148, 163, 184, 0.75);
    color: #f8fafc;
}

.help-panel-summary {
    margin: 0 0 14px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #444;
}

.help-panel-internals {
    margin: -6px 0 14px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #444;
    white-space: pre-line;
}

.help-inline-icon {
    width: 18px;
    height: 18px;
    vertical-align: text-bottom;
    margin: 0 2px;
}

.help-panel-section {
    margin: 0 0 8px;
}

.help-panel-section h3 {
    margin: 0 0 6px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6b7280;
}

.help-example-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.help-example-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #1f2937;
    font-style: italic;
    font-weight: 600;
}

.dark-theme .help-chooser-action {
    background: #111827;
    color: #e5e7eb;
}

.dark-theme .help-chooser-action:hover {
    background: #1e3a5f;
    color: #93c5fd;
}

.dark-theme .help-modal-dialog {
    background: #1f2937;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.dark-theme .help-modal-title,
.dark-theme .help-panel-heading {
    color: #f3f4f6;
}

.dark-theme .help-modal-close {
    color: #9ca3af;
}

.dark-theme .help-panel-summary,
.dark-theme .help-panel-internals,
.dark-theme .help-example-text {
    color: #d1d5db;
}

.dark-theme .help-topic-pill {
    background: #111827;
    border-color: #4b5563;
    color: #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.dark-theme .help-topic-pill:hover,
.dark-theme .help-topic-pill[aria-expanded="true"] {
    border-color: #60a5fa;
    background: #1e3a5f;
    color: #93c5fd;
}

.dark-theme .help-topic-body.is-empty .help-topic-pill-wrap::before {
    background: radial-gradient(
        ellipse at center,
        rgba(96, 165, 250, 0.28) 0%,
        rgba(0, 132, 255, 0.12) 40%,
        transparent 72%
    );
}

.dark-theme .help-topic-menu {
    background: #111827;
    border-color: #4b5563;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
}

.dark-theme .help-topic-menu-item {
    color: #e5e7eb;
}

.dark-theme .help-topic-menu-item:hover,
.dark-theme .help-topic-menu-item:focus-visible {
    background: #374151;
    color: #93c5fd;
}

.dark-theme .help-topic-menu-item[aria-selected="true"] {
    background: #1e3a5f;
    color: #93c5fd;
}
