/*
 * Rust reference tools (BGL_Tools_Ref). Builds on tools.css: same panels,
 * slots and colours as the raid calculator.
 */

.bgl-ref code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; color: #f0e6d8; background: rgba(0, 0, 0, .35); padding: 1px 6px; border-radius: 3px; word-break: break-all; }
.bgl-ref__copy { cursor: copy; transition: background .2s, color .2s; }
.bgl-ref__copy:hover { background: rgba(205, 64, 43, .25); }
.bgl-ref__copy.is-copied, .bgl-ref__copybtn.is-copied, .bgl-ref__btn.is-copied { background: var(--t-green) !important; color: #fff !important; }
.bgl-ref__wait { padding: 18px; background: var(--t-panel); border-left: 3px solid var(--t-gold); }
.bgl-ref__small { font-size: 13px; color: var(--t-dim); }
.bgl-ref__empty { color: var(--t-dim); font-size: 14px; list-style: none; }
.bgl-ref__none { padding: 18px; text-align: center; color: var(--t-dim); }

/* search bar and chips */
.bgl-ref__bar { position: sticky; top: var(--brs-sticky, 0px); z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 18px; padding: 10px; background: var(--t-panel2); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.bgl-ref__bar input[type="search"] { flex: 1 1 260px; min-width: 0; height: 40px; padding: 0 12px; font-size: 15px; color: #fff; background: var(--t-slot); border: 1px solid var(--t-line); border-radius: 0; }
.bgl-ref__chips { display: flex; flex-wrap: wrap; gap: 4px; }
body.brs .bgl-ref__chips button, body.brs .bgl-ref__os button { position: static; min-height: 0; height: 32px; padding: 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; color: var(--t-text); background: var(--t-slot); border: 0; box-shadow: none; }
body.brs .bgl-ref__chips button.is-on, body.brs .bgl-ref__os button.is-on { background: var(--t-red); color: #fff; }
.bgl-ref__check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.bgl-ref__check input { width: 18px; height: 18px; accent-color: var(--t-red); }
.bgl-ref__toc { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; }
.bgl-ref__toc a { padding: 4px 9px; font-size: 13px; color: var(--t-text); background: var(--t-panel); text-decoration: none; }
.bgl-ref__toc a:hover { background: var(--t-red); color: #fff; }

/* groups and item grid */
.bgl-ref__group { margin: 0 0 26px; scroll-margin-top: 90px; }
.bgl-ref__group > h2 { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; font-size: 20px; text-transform: uppercase; }
.bgl-ref__group > h2 span { font-size: 13px; color: var(--t-dim); }
.bgl-ref__items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.bgl-ref__items li { margin: 0; }
.bgl-ref__items a { display: flex; gap: 10px; align-items: center; height: 100%; padding: 8px; color: var(--t-text); background: var(--t-panel); text-decoration: none; transition: background .15s; }
.bgl-ref__items a:hover { background: var(--t-slot-hi); }
.bgl-ref__items img { flex: none; width: 44px; height: 44px; object-fit: contain; padding: 3px; background: var(--t-slot); }
.bgl-ref__items span { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.bgl-ref__items b { overflow: hidden; color: #fff; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.bgl-ref__items code { align-self: flex-start; margin-top: 2px; font-size: 11.5px; padding: 0 4px; }
.bgl-ref__items small { font-size: 11.5px; color: var(--t-dim); }
.bgl-ref__items--small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* prefab finder */
.bgl-ref__pcount { font-size: 14px; color: var(--t-dim); }
.bgl-ref__plist { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; max-height: 560px; overflow: auto; }
.bgl-ref__plist li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin: 0; padding: 6px 8px; background: var(--t-panel); }
.bgl-ref__plist small { flex: none; font-size: 11.5px; color: var(--t-dim); }

/* item page */
.bgl-ref__back { margin: 0 0 14px; }
.bgl-ref__back a { color: var(--t-gold); text-decoration: none; font-weight: 700; }
.bgl-ref__hero { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: start; padding: 18px; background: var(--t-panel); }
.bgl-ref__hero > img { width: 150px; height: 150px; padding: 11px; object-fit: contain; background: var(--t-slot); }
.bgl-ref__desc { margin: 0 0 12px; font-size: 16px; }
.bgl-ref__facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 0 0 12px; }
.bgl-ref__facts div { padding: 8px 10px; background: var(--t-slot); }
.bgl-ref__facts dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t-dim); }
.bgl-ref__facts dd { margin: 2px 0 0; color: #fff; font-size: 15px; }
.bgl-ref__give { margin: 0; font-size: 14px; }
.bgl-ref__ing { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.bgl-ref__ing li { margin: 0; }
.bgl-ref__ing li > a, .bgl-ref__ing li:not(.bgl-ref__empty) { position: relative; display: flex; flex-direction: column; align-items: center; width: 92px; padding: 8px 6px; color: var(--t-text); background: var(--t-slot); text-align: center; text-decoration: none; }
.bgl-ref__ing li > a { width: 100%; padding: 0; background: none; }
.bgl-ref__ing img { width: 52px; height: 52px; object-fit: contain; }
.bgl-ref__ing b { position: absolute; top: 4px; right: 6px; font-size: 13px; color: #fff; text-shadow: 0 1px 2px #000; }
.bgl-ref__ing li > a b { top: -4px; right: 0; }
.bgl-ref__ing span { margin-top: 4px; font-size: 12px; line-height: 1.2; }
.bgl-ref__specs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.bgl-ref__specs li { margin: 0; padding: 7px 10px; font-size: 14px; background: var(--t-panel2); }
.bgl-ref__specs b { color: #fff; }

/* tables */
.bgl-ref__table td, .bgl-ref__table th { vertical-align: top; text-align: left; }
.bgl-ref__table th[scope="row"] { white-space: nowrap; }
.bgl-ref__flags { display: block; margin-top: 3px; font-size: 11.5px; color: var(--t-gold); }
.bgl-ref__compat td.is-ok { color: #8fd18f; font-weight: 700; }
.bgl-ref__compat td.is-no { color: #e8b04a; font-weight: 700; }

/* buttons */
body.brs .bgl-ref__btn, body.brs .bgl-ref__copybtn, body.brs .bgl-ref__gen button, body.brs .bgl-ref__x { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 0; height: 38px; padding: 0 14px; font-size: 14px; font-weight: 700; text-transform: uppercase; color: #fff; background: var(--t-red); border: 0; box-shadow: none; text-decoration: none; cursor: pointer; }
body.brs .bgl-ref__btn--ghost { background: var(--t-slot); color: var(--t-text); }
body.brs .bgl-ref__btn--sm { height: 30px; font-size: 12px; margin-top: 6px; }
body.brs .bgl-ref__btn[disabled] { opacity: .45; cursor: not-allowed; }
body.brs .bgl-ref__x { width: 30px; height: 30px; padding: 0; font-size: 18px; background: var(--t-slot); }
body.brs .bgl-ref__x:hover { background: var(--t-red); }
.bgl-ref__btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
.bgl-ref__spacer { flex: 1; }

/* hooks */
.bgl-ref__hooks { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 8px; }
.bgl-ref__hook { min-width: 0; padding: 12px; background: var(--t-panel); scroll-margin-top: 90px; }
.bgl-ref__hook header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.bgl-ref__hook h3 { margin: 0; font-size: 16px; }
.bgl-ref__hook h3 a { color: #fff; text-decoration: none; }
.bgl-ref__fw { display: flex; gap: 4px; }
.bgl-ref__fw b { padding: 2px 7px; font-size: 11px; text-transform: uppercase; background: var(--t-green); color: #fff; }
.bgl-ref__code { position: relative; margin: 0 0 8px; padding: 10px 12px; overflow: auto; font-size: 13px; line-height: 1.5; white-space: pre; background: #111110; border: 1px solid var(--t-line); }
.bgl-ref__code code { padding: 0; background: none; word-break: normal; white-space: pre; }
body.brs .bgl-ref__copybtn { position: absolute; top: 6px; right: 6px; height: 26px; padding: 0 8px; font-size: 11px; background: var(--t-slot-hi); }
.bgl-ref__hmeta { margin: 0; font-size: 13px; color: var(--t-dim); }
.bgl-ref__hmeta span { display: block; margin-top: 3px; word-break: break-word; }

/* forms: generator, calculator, editors */
.bgl-ref__app { margin: 0 0 24px; }
.bgl-ref__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.bgl-ref__fs { margin: 0 0 12px; padding: 12px 14px; border: 0; background: var(--t-panel); min-width: 0; }
.bgl-ref__fs legend, .bgl-ref__lab { float: none; width: auto; margin: 0 0 6px; padding: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t-gold); }
.bgl-ref__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--t-line); }
.bgl-ref__row label { margin: 0; font-size: 14px; line-height: 1.25; }
.bgl-ref__row label code { display: block; width: max-content; max-width: 100%; margin-top: 2px; font-size: 11px; color: var(--t-dim); }
.bgl-ref input[type="text"], .bgl-ref input[type="number"], .bgl-ref input[type="url"], .bgl-ref select, .bgl-ref textarea { width: 100%; min-width: 0; height: auto; min-height: 36px; padding: 6px 10px; font-size: 14px; color: #fff; background: var(--t-slot); border: 1px solid var(--t-line); border-radius: 0; box-shadow: none; }
.bgl-ref .bgl-ref__row input[type="checkbox"] { justify-self: start; width: 20px; height: 20px; accent-color: var(--t-red); }
.bgl-ref__gen { display: flex; gap: 4px; min-width: 0; }
.bgl-ref__gen input { flex: 1; }
.bgl-ref__add { display: flex; gap: 6px; margin: 10px 0; }
.bgl-ref__add input { flex: 1; }
.bgl-ref__extra { position: relative; padding-right: 36px; }
.bgl-ref__extra .bgl-ref__x { position: absolute; top: 8px; right: 0; }
.bgl-ref__out { position: sticky; top: calc(var(--brs-sticky, 0px) + 12px); min-width: 0; padding: 12px 14px; background: var(--t-panel); }
.bgl-ref__out h3 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 4px 0 8px; font-size: 15px; text-transform: uppercase; }
.bgl-ref__os { display: flex; gap: 3px; }
.bgl-ref__out .bgl-ref__code { max-height: 320px; }
.bgl-ref__craftlist { display: grid; gap: 4px; margin: 0 0 12px; padding: 0; list-style: none; }
.bgl-ref__craftlist li { display: grid; grid-template-columns: 40px minmax(0, 1fr) 84px 30px; gap: 10px; align-items: center; margin: 0; padding: 6px; background: var(--t-panel); }
.bgl-ref__craftlist li.bgl-ref__empty { display: block; padding: 14px; }
.bgl-ref__craftlist img { width: 40px; height: 40px; object-fit: contain; background: var(--t-slot); }
.bgl-ref__craftlist a { color: #fff; text-decoration: none; font-weight: 700; }

/* config editor */
.bgl-ref__json { min-height: 420px; font-family: ui-monospace, Consolas, monospace; font-size: 13px !important; line-height: 1.45; white-space: pre; tab-size: 2; resize: vertical; }
.bgl-ref__status { margin: 6px 0 0; padding: 8px 10px; font-size: 14px; background: var(--t-panel); }
.bgl-ref__status:empty { display: none; }
.bgl-ref__status.is-ok { border-left: 3px solid var(--t-green-hi); }
.bgl-ref__status.is-bad { border-left: 3px solid var(--t-red); color: #ffb7aa; }
.bgl-ref__tree { max-height: 620px; overflow: auto; padding: 8px; background: var(--t-panel); }
.bgl-ref__node { margin: 0 0 4px; }
.bgl-ref__node summary { padding: 6px 8px; font-weight: 700; color: #fff; background: var(--t-panel2); cursor: pointer; }
.bgl-ref__node summary small { color: var(--t-dim); font-weight: 400; }
.bgl-ref__nodebody { padding: 4px 0 4px 12px; border-left: 1px solid var(--t-line); }
.bgl-ref__leaf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; padding: 4px 0; }
.bgl-ref__leaf label { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.bgl-ref__leaf input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--t-red); }
.bgl-ref__arrrow { display: grid; grid-template-columns: minmax(0, 1fr) 30px; gap: 6px; align-items: start; }

/* CUI editor */
.bgl-ref__cuimain { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; margin: 0 0 12px; }
.bgl-ref__screen { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(180deg, #5f7487, #8c8a72 55%, #57513f); overflow: hidden; }
.bgl-ref__screen::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px); background-size: 5% 10%; pointer-events: none; }
.bgl-ref__stage { position: absolute; inset: 0; touch-action: none; }
.bgl-ref__el { position: absolute; display: flex; overflow: hidden; padding: 0 .3em; font-family: "Roboto Condensed", sans-serif; font-weight: 700; line-height: 1.1; cursor: move; outline: 1px dashed rgba(255, 255, 255, .25); user-select: none; }
.bgl-ref__el.is-label { background: transparent; }
.bgl-ref__el.is-sel { outline: 2px solid #ffd54a; z-index: 2; }
.bgl-ref__el span { pointer-events: none; white-space: pre-wrap; }
.bgl-ref__grip { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; background: #ffd54a; cursor: nwse-resize; opacity: 0; }
.bgl-ref__el.is-sel .bgl-ref__grip { opacity: 1; }
.bgl-ref__cuiside { min-width: 0; }
.bgl-ref__layers { margin: 0 0 12px; padding: 0; list-style: none; max-height: 220px; overflow: auto; background: var(--t-panel); }
.bgl-ref__layers li { display: grid; grid-template-columns: minmax(0, 1fr) auto 26px 26px; gap: 6px; align-items: center; margin: 0; padding: 5px 8px; border-bottom: 1px solid var(--t-line); cursor: pointer; }
.bgl-ref__layers li.is-sel { background: rgba(205, 64, 43, .25); }
.bgl-ref__layers span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.bgl-ref__layers small { color: var(--t-dim); font-size: 11px; }
body.brs .bgl-ref__layers button { position: static; min-height: 0; width: 26px; height: 26px; padding: 0; color: var(--t-text); background: var(--t-slot); border: 0; box-shadow: none; }
.bgl-ref__colour { display: flex; gap: 6px; align-items: center; }
.bgl-ref__colour input[type="color"] { width: 44px; height: 32px; padding: 0; border: 0; background: none; }
.bgl-ref__colour input[type="range"] { flex: 1; accent-color: var(--t-red); }
.bgl-ref__props .bgl-ref__row { grid-template-columns: 100px minmax(0, 1fr); }
.bgl-ref__cuiout { max-height: 360px; }

/* compatibility */
.bgl-ref__cs { min-height: 240px; margin: 0 0 12px; }
.bgl-ref__issues { display: grid; gap: 4px; margin: 0 0 12px; padding: 0; list-style: none; }
.bgl-ref__issues li { margin: 0; padding: 8px 10px; font-size: 14px; background: var(--t-panel); border-left: 3px solid var(--t-line); }
.bgl-ref__issues li.is-bad { border-left-color: var(--t-red); }
.bgl-ref__issues li.is-warn { border-left-color: var(--t-gold); }
.bgl-ref__issues li.is-ok { border-left-color: var(--t-green-hi); color: var(--t-dim); }
.bgl-ref__issues small { color: var(--t-dim); }
.bgl-ref__wipe b { color: #fff; }
.bgl-ref__countdown { color: var(--t-gold); font-weight: 700; }

/* more tools */
.bgl-ref__morelinks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; margin: 0 0 12px; }
.bgl-ref__morelinks a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; color: var(--t-text); background: var(--t-panel); text-decoration: none; font-weight: 700; }
.bgl-ref__morelinks a:hover { background: var(--t-slot-hi); color: #fff; }
.bgl-ref__morelinks img { width: 28px; height: 28px; object-fit: contain; }

@media (max-width: 900px) {
	.bgl-ref__cols, .bgl-ref__cuimain { grid-template-columns: minmax(0, 1fr); }
	.bgl-ref__out { position: static; }
	.bgl-ref__hooks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
	.bgl-ref__hero { grid-template-columns: minmax(0, 1fr); }
	.bgl-ref__hero > img { width: 110px; height: 110px; }
	.bgl-ref__row, .bgl-ref__leaf { grid-template-columns: minmax(0, 1fr); gap: 4px; }
	.bgl-ref__items { grid-template-columns: minmax(0, 1fr); }
	.bgl-ref__bar { position: static; }
	.bgl-ref__table th[scope="row"] { white-space: normal; }
}

/* ------------------------------------------------------------------
   Long lists (items, commands, hooks): groups down the side, one group
   on screen at a time, the search on top.
   ------------------------------------------------------------------ */
.bgl-ref__shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; margin: 0 0 22px; }
.bgl-ref__side { position: sticky; top: calc(var(--brs-sticky, 0px) + 12px); max-height: calc(100vh - var(--brs-sticky, 0px) - 24px); overflow-y: auto; padding: 8px; background: var(--t-panel); scrollbar-width: thin; }
body.brs .bgl-ref__sidehead { margin: 2px 6px 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--t-gold); }
.bgl-ref__nav { display: grid; gap: 3px; }
body.brs .bgl-ref__nav button { position: static; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 0; height: auto; padding: 5px 8px; font-size: 14px; font-weight: 700; line-height: 1.15; text-align: left; text-transform: uppercase; letter-spacing: .02em; color: var(--t-text); background: transparent; border: 0; box-shadow: none; transition: background .15s, color .15s; }
body.brs .bgl-ref__nav button:hover { background: var(--t-slot); color: #fff; }
body.brs .bgl-ref__nav button.is-on { background: var(--t-green); color: #fff; }
.bgl-ref__nav img { width: 32px; height: 32px; padding: 2px; object-fit: contain; background: var(--t-slot); }
.bgl-ref__nav button.is-on img { background: rgba(0, 0, 0, .25); }
.bgl-ref__nav span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bgl-ref__nav small { font-size: 12px; font-weight: 400; color: var(--t-dim); }
.bgl-ref__nav button.is-on small { color: #e6ecdc; }
.bgl-ref__main { min-width: 0; }
.bgl-ref__main > .bgl-ref__bar { margin-bottom: 12px; }
.bgl-ref__shell.is-own .bgl-ref__main > .bgl-ref__bar { display: none; }

/* One group at a time; while searching, every group with a match. */
.bgl-ref__shell .bgl-ref__group { display: none; margin: 0 0 16px; scroll-margin-top: 110px; }
.bgl-ref__shell .bgl-ref__group.is-on { display: block; }
/* Before the script runs, show only the first rows of the open group. */
.bgl-ref__shell:not(.is-ready) .bgl-ref__items > li:nth-child(n+61),
.bgl-ref__shell:not(.is-ready) .bgl-ref__cmds tbody tr:nth-child(n+51),
.bgl-ref__shell:not(.is-ready) .bgl-ref__hooks > article:nth-child(n+21) { display: none; }

.bgl-ref__gh { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; padding: 0 0 8px; font-size: 19px; line-height: 1.1; text-transform: uppercase; border-bottom: 1px solid var(--t-line); }
.bgl-ref__gh img { width: 32px; height: 32px; object-fit: contain; }
.bgl-ref__gh small { font-size: 13px; font-weight: 400; color: var(--t-dim); }
.bgl-ref__intro { margin: 0 0 10px; font-size: 14px; color: var(--t-dim); }
body.brs .bgl-ref__moreb { position: static; display: flex; gap: 8px; align-items: center; justify-content: center; width: 100%; min-height: 0; height: 40px; margin: 8px 0 0; padding: 0 14px; font-size: 14px; font-weight: 700; text-transform: uppercase; color: #fff; background: var(--t-slot); border: 0; box-shadow: none; }
body.brs .bgl-ref__moreb:hover { background: var(--t-green); }
.bgl-ref__moreb small { font-weight: 400; color: var(--t-dim); text-transform: none; }

/* compact item tiles */
.bgl-ref__shell .bgl-ref__items { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 4px; }
.bgl-ref__shell .bgl-ref__items a { gap: 8px; padding: 5px 6px; }
.bgl-ref__shell .bgl-ref__items img { width: 40px; height: 40px; }
.bgl-ref__shell .bgl-ref__items b { font-size: 13.5px; }
.bgl-ref__items span > code + small { margin-top: 1px; }

/* compact command table */
.bgl-ref__cmds { font-size: 13.5px; }
.bgl-ref__cmds th, .bgl-ref__cmds td { padding: 6px 8px; }
.bgl-ref__cmds thead th { font-size: 12px; }
.bgl-ref__cmds td:nth-child(2) { width: 120px; }
.bgl-ref__kind { font-size: 11.5px; color: var(--t-dim); text-transform: uppercase; }

/* compact hook cards */
.bgl-ref__shell .bgl-ref__hooks { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 6px; }
.bgl-ref__shell .bgl-ref__hook { padding: 9px 10px; }
.bgl-ref__shell .bgl-ref__hook header { flex-wrap: nowrap; margin: 0 0 6px; }
.bgl-ref__shell .bgl-ref__hook h3 { overflow: hidden; flex: 1; min-width: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
body.brs .bgl-ref__hook header .bgl-ref__copybtn { position: static; flex: none; height: 24px; padding: 0 8px; font-size: 11px; }
.bgl-ref__shell .bgl-ref__code { margin: 0 0 6px; padding: 6px 8px; font-size: 12.5px; white-space: nowrap; }
.bgl-ref__shell .bgl-ref__hmeta { font-size: 12.5px; line-height: 1.35; }
.bgl-ref__shell .bgl-ref__hmeta span { display: inline; margin: 0; }

/* stat strip and cards (compatibility) */
.bgl-ref__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 0 0 16px; }
.bgl-ref__stat { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--t-panel); }
.bgl-ref__stat img { flex: none; width: 44px; height: 44px; padding: 4px; object-fit: contain; background: var(--t-slot); }
.bgl-ref__stat small { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t-dim); }
.bgl-ref__stat p { margin: 2px 0 0; font-size: 15px; line-height: 1.3; }
.bgl-ref__stat b { color: #fff; }
.bgl-ref__card { min-width: 0; margin: 0 0 16px; padding: 12px 14px; background: var(--t-panel); }
.bgl-ref__compat th[scope="row"] a { display: flex; gap: 8px; align-items: center; color: #fff; text-decoration: none; }
.bgl-ref__compat th[scope="row"] img { flex: none; width: 36px; height: 36px; object-fit: cover; }
.bgl-ref__compat td span { display: inline-block; padding: 2px 8px; font-size: 12px; text-transform: uppercase; }
.bgl-ref__compat td.is-ok span { background: rgba(106, 130, 65, .35); }
.bgl-ref__compat td.is-no span { background: rgba(207, 156, 66, .2); }

/* the foot: explanation cards beside the other tools */
.bgl-ref__foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; margin: 0 0 20px; }
.bgl-ref__foot:not(:has(.bgl-ref__info)) { grid-template-columns: minmax(0, 1fr); }
.bgl-ref__info { display: grid; gap: 8px; }
.bgl-ref__infocard { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--t-panel); }
.bgl-ref__infocard > img { flex: none; width: 40px; height: 40px; padding: 3px; object-fit: contain; background: var(--t-slot); }
body.brs .bgl-ref__infocard h2 { margin: 0 0 4px; font-size: 16px; line-height: 1.2; text-transform: uppercase; }
.bgl-ref__infocard p { margin: 0; font-size: 14px; line-height: 1.45; }
.bgl-ref__more { padding: 12px 14px; background: var(--t-panel); }
body.brs .bgl-ref__more h2 { margin: 0 0 8px; font-size: 16px; text-transform: uppercase; }
.bgl-ref__more .bgl-ref__morelinks { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; margin: 0 0 8px; }
.bgl-ref__more .bgl-ref__morelinks a { padding: 6px 8px; font-size: 13.5px; background: var(--t-panel2); }
.bgl-ref__more .bgl-ref__small { margin: 0; }

@media (max-width: 1100px) {
	.bgl-ref__foot { grid-template-columns: minmax(0, 1fr); }
}
/* Tablets and phones: the groups become a strip of chips above the list. */
@media (max-width: 900px) {
	.bgl-ref__shell { grid-template-columns: minmax(0, 1fr); gap: 10px; }
	.bgl-ref__side { position: static; max-height: none; padding: 6px; overflow-x: auto; overflow-y: hidden; }
	.bgl-ref__sidehead { display: none; }
	.bgl-ref__nav { display: flex; gap: 4px; width: max-content; }
	body.brs .bgl-ref__nav button { grid-template-columns: 26px auto auto; width: auto; padding: 4px 10px 4px 4px; font-size: 13px; background: var(--t-slot); }
	.bgl-ref__nav img { width: 26px; height: 26px; }
	.bgl-ref__nav span { overflow: visible; }
	.bgl-ref__shell .bgl-ref__hooks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
	.bgl-ref__shell .bgl-ref__items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.bgl-ref__shell .bgl-ref__items a { gap: 6px; padding: 4px; }
	.bgl-ref__shell .bgl-ref__items img { width: 32px; height: 32px; padding: 2px; }
	.bgl-ref__shell .bgl-ref__items b { font-size: 12.5px; }
	.bgl-ref__shell .bgl-ref__items code, .bgl-ref__shell .bgl-ref__items small { overflow: hidden; max-width: 100%; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
	.bgl-ref__cmds td:nth-child(2) { width: auto; }
	.bgl-ref__infocard { padding: 10px; }
}

/* A row the list hides (search, "show more") stays hidden whatever the theme says. */
.bgl-ref [hidden] { display: none !important; }

/* Compact rows: the theme pads every table cell 14px 16px !important. */
body.brs .bgl-ref table.bgl-ref__table { border-spacing: 0 2px !important; }
body.brs .bgl-ref table.bgl-ref__table th,
body.brs .bgl-ref table.bgl-ref__table td { padding: 6px 10px !important; }

/* Compile any plugin on the real build (signed in) */
.bgl-ref__upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.bgl-ref__upload input[type="file"] { flex: 1 1 220px; min-width: 0; padding: 6px; background: var(--t-slot); color: var(--t-text); border: 1px solid rgba(255, 255, 255, .08); }
.bgl-ref__note { margin: 0 0 10px; padding: 8px 12px; font-size: 14px; background: var(--t-slot); border-left: 3px solid var(--t-red); }
.bgl-ref__note.is-ok { border-left-color: var(--t-green-hi); }
.bgl-ref__jobs { display: grid; gap: 6px; margin-top: 10px; }
.bgl-ref__job { background: var(--t-slot); padding: 8px 12px; }
.bgl-ref__job summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bgl-ref__job summary small { color: var(--t-dim); }
.bgl-ref__tag { margin-left: auto; padding: 2px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; background: rgba(255, 255, 255, .08); }
.bgl-ref__tag.is-ok { background: rgba(106, 130, 65, .45); color: #cfe8b0; }
.bgl-ref__tag.is-no { background: rgba(205, 64, 43, .35); color: #ffd2c9; }
.bgl-ref__res { margin: 6px 0 0; padding: 0; list-style: none; font-size: 14px; }
.bgl-ref__res > li { padding: 4px 0; border-top: 1px solid rgba(255, 255, 255, .06); }
.bgl-ref__res > li.is-ok b { color: #8fd18f; }
.bgl-ref__res > li.is-no b { color: #ff9b8a; }
.bgl-ref__res ul { margin: 4px 0 0 14px; padding: 0; font-size: 13px; color: var(--t-dim); }
.bgl-ref__res code { color: var(--t-text); }

/* Questions under the tools (faqs()). */
.bgl-ref__faq { margin: 0 0 12px; }
body.brs .bgl-ref__faq h2 { margin: 0 0 6px; font-size: 16px; text-transform: uppercase; }
.bgl-ref__faq details { border-top: 1px solid var(--t-line); }
.bgl-ref__faq summary { padding: 11px 4px; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.bgl-ref__faq details p { margin: 0 4px 12px; color: var(--t-text); line-height: 1.55; }
