/* Shared help dialog and scoped sidebar help controls for the editor and saved-map manager. */
#gbHelpDialog { box-sizing:border-box; position:fixed; inset:0; width:calc(100vw - 32px); height:calc(100dvh - 32px); max-width:1680px; max-height:none; margin:auto; padding:0; overflow:hidden; border:2px solid #506e38; border-radius:7px; background:#f8f8f1; box-shadow:0 12px 65px #0007; }
#gbHelpDialog::backdrop { background:#142333b3; }
#gbHelpFrame { display:block; width:100%; height:100%; border:0; background:#f8f8f1; }
#gbHelpClose { box-sizing:border-box; position:absolute; z-index:3; right:8px; top:8px; display:flex; align-items:center; justify-content:center; width:32px; height:32px; margin:0; padding:0; border:2px solid #fff; border-radius:50%; background:#cf3026; color:#fff; font:27px/1 Arial,sans-serif; box-shadow:none; cursor:pointer; }
#gbHelpClose:hover { background:#a71e16; }
#gbHelpClose:focus-visible { outline:3px solid #e8ac25; outline-offset:2px; }
.gb-help-loading { position:absolute; left:24px; top:24px; font:16px Arial,sans-serif; }
#gbHelpDialog.gb-help-ready .gb-help-loading { display:none; }
html.gb-help-open, html.gb-help-open body { overflow:hidden!important; }
#mapToolbar #mapHelpButton { box-sizing:border-box; display:inline-flex; align-items:center; justify-content:center; flex:0 0 26px; width:26px; height:26px; min-width:26px; padding:0; margin:0; border:1px solid #d3e8ff; border-radius:50%; background:#2678bc; color:#fff; font:bold 20px/1 Arial,sans-serif; text-decoration:none; box-shadow:0 1px 2px #0003; cursor:pointer; }
#mapToolbar #mapHelpButton:hover { background:#145d99; }
.fm-handbook-link { display:inline-flex; align-items:center; gap:7px; margin:6px 0; padding:6px 10px; border:1px solid #bed1e1; border-radius:4px; background:#e9f4fb; color:#24567a!important; text-decoration:none; font:600 14px/1.2 Arial,sans-serif; }
.fm-handbook-link span { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; background:#2678bc; color:white; font:bold 17px/1 Arial,sans-serif; }
.fm-handbook-link:hover { background:#d8ebfa; }
.fm-handbook-link:focus-visible { outline:3px solid #e8ac25; outline-offset:2px; }
@media(max-width:600px) { #gbHelpDialog { width:calc(100vw - 8px); height:calc(100dvh - 8px); border-radius:4px; } }
@media print { #gbHelpDialog { display:none!important; } }

/* One help control across every classic sidebar panel; override old panel-specific sizes. */
#mapSidebar a.panel-help { box-sizing:border-box; position:static!important; display:inline-flex!important; align-items:center; justify-content:center; flex:0 0 32px!important; width:32px!important; height:32px!important; min-width:32px; min-height:32px; margin:0; padding:3px!important; border:1px solid transparent!important; border-radius:50%; background:transparent; box-shadow:none; text-decoration:none; cursor:pointer; vertical-align:middle; transition:background-color .15s,box-shadow .15s; }
#mapSidebar a.panel-help img { display:block; width:24px!important; height:24px!important; max-width:none; pointer-events:none; transition:filter .15s; }
#mapSidebar a.panel-help:hover { background:#deebf9; border-color:#8daed3!important; box-shadow:0 1px 3px #244f7733; }
#mapSidebar a.panel-help:hover img { filter:brightness(.8); }
#mapSidebar a.panel-help:focus-visible { outline:3px solid #e8ac25!important; outline-offset:2px!important; background:#deebf9; }
#mapSidebar a.panel-help:active { background:#bdd4ef; }
#mapSidebar .panel-help-footer { display:flex; justify-content:flex-end; clear:both; }
/* Keep a single compact gap above help, including rows shared with reset/delete actions. */
#mapSidebar .sidebarSection :is(.panel-help-footer, .key-settings-footer, .map-titles-footer, .mc-footer, .md-footer, .rc-footer, .pi-footer, .mb-footer, .ei-footer, .dp-footer, .dt-footer, .mm-footer) {
    align-items:center;
    gap:6px;
    margin:6px 0 0;
    padding:0;
    border-top:0;
}
#mapSidebar .sidebarSection { padding-bottom:10px; }
/* Trailing copy and empty live-status/list elements must not add a second footer gap. */
#mapSidebar #stSummary,
#mapSidebar #adPanelStatus,
#mapSidebar #heatMapsPanel > p:last-of-type,
#mapSidebar #piCount,
#mapSidebar #piStatus { margin-bottom:0; }
#mapSidebar #piList:empty,
#mapSidebar #piStatus:empty { margin:0; padding:0; }
#mapSidebar #piDone { display:block; }
#mapSidebar #saveDropDown a.panel-help { position:absolute!important; top:8px; right:8px; }
@media(prefers-reduced-motion:reduce) { #mapSidebar a.panel-help,#mapSidebar a.panel-help img { transition:none; } }

/* Keep help beside the final action or summary, reserving room for wrapped text. */
#mapSidebar .panel-help-row { display:flex; align-items:center; gap:8px; margin:6px 0 0; min-width:0; }
#mapSidebar .panel-help-row > :first-child { flex:1 1 auto; min-width:0; }
#mapSidebar .panel-help-row > p { margin:0; overflow-wrap:anywhere; }
#mapSidebar #startHereElements { display:grid; grid-template-columns:minmax(0,1fr) 32px; align-items:center; column-gap:8px; }
/* Legend redraws still insert legacy float spacers; these must not occupy grid cells. */
#mapSidebar #startHereElements > .clearfix,
#mapSidebar #startHereElements > div[style*="clear"] { display:none; }
#mapSidebar #startHereElements > .zoneDiv,
#mapSidebar #legendNamesTitle { grid-column:1 / -1; }
#mapSidebar #startHereElements > #addZone { grid-column:1; max-width:100%; margin:7px 0 0; }
#mapSidebar #startHereElements > .panel-help { grid-column:2; margin-top:7px; }
#mapSidebar .md-panel .md-help-row { margin:0; }
#mapSidebar .md-panel .md-footer:empty { display:none; }
