/* Roster Studio uses the Hub shell and its existing navigation. */
body:has(#native-builder) > .hub-shell > .hub-main > #ec-main > .ec-page-hero,
body:has(#native-builder) > .hub-shell > .hub-main > .ec-footer { display: none; }
#ec-main:has(#native-builder) > .ec-content { padding: 0; }
.ec-hub-page:has(> #native-builder) { width: 100%; max-width: none; padding: 0; }
body:has(#native-builder) { overflow: hidden; }
@media (min-width: 961px) {
  body:has(#native-builder) > .hub-shell { grid-template-columns: 58px minmax(0,1fr); background: none; }
  body:has(#native-builder) .hub-side { padding: 10px 6px; border-right: 1px solid var(--ec-line); }
  body:has(#native-builder) .hub-menu > .ec-label { display: none; }
  body:has(#native-builder) .hub-menu a { justify-content: center; min-height: 42px; padding: 8px; position: relative; }
  body:has(#native-builder) .hub-menu a > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  body:has(#native-builder) .hub-menu a[href="/builder"] { color: var(--ec-accent-soft); background: var(--ec-panel-2); }
}
#native-builder {
  --nb-base: #10141b;
  --nb-panel: #151c26;
  --nb-deep: #121820;
  --nb-raised: #222c39;
  --nb-line: #343e4b;
  --nb-ink: #e8edf3;
  --nb-muted: #acb7c5;
  --nb-amber: #efc182;
  --nb-bronze: #a98056;
  --nb-error: #f48b7c;
  color: var(--nb-ink);
  background: var(--nb-base);
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr);
  height: var(--nb-viewport, calc(100dvh - 68px));
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  font-size: 14px;
}
#native-builder * { box-sizing: border-box; }
#native-builder h1,#native-builder h2,#native-builder h3,#native-builder p { margin: 0; }
#native-builder h2 { color: var(--nb-ink); font-size: 20px; line-height: 1.12; }
#native-builder h3 { color: var(--nb-amber); font-size: 15px; }
#native-builder .muted { color: var(--nb-muted); }
#native-builder .warn { color: var(--nb-error); }
#native-builder button { cursor: pointer; }
#native-builder button:disabled { cursor: default; opacity: .48; }
#native-builder button:focus-visible,#native-builder a:focus-visible,#native-builder input:focus-visible,#native-builder select:focus-visible,#native-builder textarea:focus-visible,#native-builder [tabindex]:focus-visible { outline: 2px solid var(--nb-amber); outline-offset: 2px; }
#native-builder input:not([type=checkbox]),#native-builder select,#native-builder textarea {
  width: 100%; min-width: 0; min-height: 36px; padding: 6px 9px; border: 1px solid var(--nb-line);
  border-radius: 5px; color: var(--nb-ink); background: var(--nb-deep); font: inherit;
}
#native-builder input[aria-invalid=true] { border-color: var(--nb-error); }
#native-builder select { color-scheme: dark; }
#native-builder label { display: grid; gap: 4px; min-width: 0; color: var(--nb-muted); font-size: 12px; }
#native-builder label > input,#native-builder label > select,#native-builder label > textarea { color: var(--nb-ink); }
#native-builder .btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 5px 9px; border-radius: 5px;
  font: inherit; font-weight: 650; line-height: 1.2;
}
#native-builder .btn.ghost { background: var(--nb-raised); border: 1px solid var(--nb-line); color: var(--nb-ink); }
#native-builder .btn.ghost:hover:not(:disabled) { border-color: var(--nb-bronze); }
#native-builder .btn.danger { color: var(--nb-error); }
.nb-toolbar {
  display: grid; grid-template-columns: minmax(180px,1fr) minmax(310px,1.6fr) auto; align-items: center;
  gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--nb-line);
  background: linear-gradient(115deg,#251c1c 0%,var(--nb-panel) 44%,var(--nb-deep) 100%); z-index: 2;
}
.nb-identity,.nb-toolbar-end,.nb-settings { min-width: 0; }
.nb-brand { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 10px; }
#native-builder .nb-brand h1 { color: var(--nb-amber); font: 700 21px/1.2 var(--ec-display,serif); }
.nb-back,.nb-title,.nb-validation,.nb-plus,.nb-remove { background: transparent; border: 0; color: inherit; font: inherit; }
.nb-back { padding: 0; font-size: 11px; color: var(--nb-muted); text-decoration: underline; text-underline-offset: 2px; }
.nb-title { display: flex; align-items: center; gap: 8px; width: 100%; padding: 3px 0; text-align: left; font-size: 18px; font-weight: 750; }
.nb-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-title span:last-child { flex: none; color: var(--nb-amber); font-size: 13px; }
#nb-save-status { min-height: 15px; color: var(--nb-muted); font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
.nb-settings { display: grid; grid-template-columns: minmax(0,1.25fr) 74px minmax(0,1fr); align-items: end; gap: 6px; }
.nb-faction-field { display: flex; align-items: center; gap: 5px; min-width: 0; }
.nb-faction-field img { width: 23px; height: 23px; object-fit: contain; }
.nb-toolbar-end { display: flex; align-items: center; gap: 8px; }
.nb-budget { display: grid; gap: 2px; min-width: 115px; color: var(--nb-amber); }
.nb-budget strong { font-size: 26px; line-height: 1.07; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nb-budget[data-budget=normal] { color: #e0d1b9; }
.nb-budget[data-budget=over] { color: var(--nb-error); }
.nb-budget progress { width: 100%; height: 4px; border: 0; border-radius: 9px; color: currentColor; background: var(--nb-line); }
.nb-budget progress::-webkit-progress-bar { background: var(--nb-line); border-radius: 9px; }
.nb-budget progress::-webkit-progress-value { background: currentColor; border-radius: 9px; }
.nb-budget progress::-moz-progress-bar { background: currentColor; border-radius: 9px; }
.nb-budget-caption,.nb-budget-models { font-size: 11px; white-space: nowrap; }
.nb-budget-models { color: var(--nb-muted); }
.nb-validation { justify-self: start; padding: 0; font-size: 11px; font-weight: 650; color: #a8d0ac; text-align: left; }
.nb-validation[data-issues=draft] { color: var(--nb-muted); }
.nb-budget[data-budget=near] .nb-validation[data-issues=no] { color: var(--nb-amber); }
.nb-validation[data-issues=yes] { color: var(--nb-error); text-decoration: underline; text-underline-offset: 2px; }
.nb-toolbar-actions { display: flex; align-items: center; gap: 5px; }
#native-builder .nb-save { background: var(--nb-amber); border-color: var(--nb-amber); color: #26190e; white-space: nowrap; }
.nb-actions { position: relative; }
.nb-actions summary { cursor: pointer; list-style: none; padding: 6px 8px; border: 1px solid var(--nb-line); border-radius: 5px; white-space: nowrap; }
.nb-actions summary::after { content: " ▾"; color: var(--nb-amber); }
.nb-menu { display: grid; position: absolute; z-index: 4; right: 0; top: calc(100% + 5px); width: max-content; max-width: 80vw; max-height: min(440px,50dvh); overflow: auto; padding: 5px; gap: 2px; background: var(--nb-panel); border: 1px solid var(--nb-bronze); border-radius: 7px; box-shadow: 0 12px 32px #0009; }
#native-builder .nb-menu > :is(button,a) { justify-content: start; border: 0; background: transparent; padding: 6px 10px; min-height: 32px; color: var(--nb-ink); text-align: left; }
#native-builder .nb-menu > :is(button,a):hover { background: var(--nb-raised); }
.nb-mobile-nav { display: none; }
.nb-layout { display: grid; grid-row: 3; grid-template-columns: minmax(232px,1fr) minmax(330px,1.55fr) minmax(248px,1fr); min-height: 0; min-width: 0; gap: 12px; padding: 12px; background: var(--nb-base); position: relative; }
.nb-pane { background: var(--nb-panel); min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--nb-line); border-radius: 8px; }
.nb-browse,.nb-party { display: grid; grid-template-rows: auto minmax(0,1fr); }
#nb-catalog-panel { display: grid; grid-template-rows: auto minmax(0,1fr); min-height: 0; }
.nb-scroll { min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #725945 var(--nb-deep); }
.nb-tabs { display: flex; gap: 4px; padding: 6px 8px; min-width: 0; }
.nb-browse > .nb-tabs,.nb-party-head { border-bottom: 1px solid var(--nb-line); background: var(--nb-deep); }
#native-builder .nb-tabs button { border-color: transparent; background: transparent; color: var(--nb-muted); }
#native-builder .nb-tabs button[aria-selected=true] { color: var(--nb-amber); border-color: var(--nb-line); background: var(--nb-panel); }
.nb-catalog-controls { display: grid; gap: 6px; padding: 8px; border-bottom: 1px solid var(--nb-line); }
.nb-search { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px; }
.nb-catalog-filters { display: grid; grid-template-columns: minmax(118px,1fr) auto; gap: 4px; }
.nb-count { color: var(--nb-muted); font-size: 11px; }
#nb-catalog { display: grid; align-content: start; gap: 5px; padding: 7px 8px 14px; }
.nb-catalog-row,.nb-roster-row { display: grid; grid-template-columns: minmax(0,1fr) auto; min-width: 0; background: var(--nb-deep); border: 1px solid var(--nb-line); border-radius: 7px; }
.nb-catalog-row:focus-within,.nb-roster-row:focus-within { border-color: var(--nb-bronze); }
.nb-catalog-unit,.nb-roster-tile {
  display: grid; grid-template-columns: 50px minmax(0,1fr) auto; align-items: center; gap: 7px; min-width: 0; min-height: 65px;
  text-align: left; border: 0; border-radius: 6px; padding: 5px; background: transparent; color: var(--nb-ink); font: inherit;
}
.nb-catalog-unit:has(> .nb-catalog-copy:first-child),.nb-roster-tile:has(> .nb-catalog-copy:first-child) { grid-template-columns: minmax(0,1fr) auto; }
.nb-catalog-upgrade { width: 100%; border: 1px solid var(--nb-line); background: var(--nb-deep); }
.nb-catalog-unit:hover,.nb-roster-tile:hover,.nb-catalog-unit[aria-pressed=true],.nb-roster-tile[aria-pressed=true] { background: var(--nb-raised); }
.nb-catalog-unit img,.nb-roster-tile img { width: 50px; height: 50px; object-fit: cover; object-position: center 25%; border-radius: 4px; background: var(--nb-raised); }
.nb-catalog-upgrade img { object-fit: contain; object-position: center; }
.nb-catalog-copy { display: grid; gap: 2px; min-width: 0; line-height: 1.15; overflow-wrap: anywhere; }
.nb-catalog-copy strong,.nb-catalog-name { font-size: 16px; font-weight: 720; line-height: 1.24; }
.nb-catalog-copy small,.nb-row-cost small { color: var(--nb-muted); font-size: 11px; }
.nb-catalog-copy .nb-unavailable { color: #e7a398; }
.nb-row-cost,.nb-catalog-cost { display: grid; text-align: right; color: var(--nb-amber); font-size: 12px; white-space: nowrap; }
.nb-plus,.nb-remove { align-self: center; width: 30px; height: 34px; border-radius: 4px; margin-right: 4px; font-size: 20px; color: var(--nb-amber); }
.nb-remove { color: var(--nb-muted); }
.nb-plus:hover:not(:disabled),.nb-remove:hover { background: var(--nb-raised); color: var(--nb-ink); }
#nb-catalog.nb-catalog-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.nb-catalog-grid .nb-catalog-row { position: relative; display: block; }
.nb-catalog-grid .nb-catalog-unit { display: grid; grid-template-columns: 1fr; width: 100%; align-content: start; padding: 5px 5px 7px; gap: 5px; }
.nb-catalog-grid .nb-catalog-unit img { width: 100%; height: 78px; }
.nb-catalog-grid .nb-row-cost { justify-self: start; }
.nb-catalog-grid .nb-plus { position: absolute; bottom: 2px; right: 0; }
.nb-catalog-grid .nb-catalog-copy,.nb-catalog-grid .nb-row-cost { padding-right: 24px; }
.nb-catalog-grid .nb-empty { grid-column: 1/-1; }
.nb-party { background: var(--nb-panel); }
.nb-party-head { display: flex; justify-content: space-between; align-items: center; padding-right: 8px; }
#nb-party-content,.nb-inspector { padding: 12px; }
.nb-roster-list { display: grid; gap: 6px; }
.nb-roster-row.is-leader { border-left: 3px solid var(--nb-amber); }
.nb-roster-tile .nb-catalog-copy strong { font-size: 17px; }
.nb-empty { display: grid; justify-items: start; gap: 8px; padding: 16px; color: var(--nb-muted); border: 1px dashed var(--nb-line); border-radius: 8px; }
.nb-party .nb-empty { margin-top: 14px; }
.nb-party textarea { min-height: 180px !important; resize: vertical; }
.nb-reserve { display: grid; gap: 8px; margin-top: 14px; padding: 10px; border: 1px solid var(--nb-line); border-radius: 7px; }
.nb-inspector { display: block; background: var(--nb-deep); overflow: auto; }
.nb-inspector > * + * { margin-top: 10px; }
.nb-inspector > .muted,.nb-inspector > .warn { margin-top: 9px !important; }
.nb-profile-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nb-profile-head > div { min-width: 0; overflow-wrap: anywhere; }
.nb-profile-head img { flex: 0 0 48px; width: 48px; height: 48px; object-fit: cover; object-position: center 25%; border-radius: 5px; }
.nb-profile-head .nb-upgrade-portrait { object-fit: contain; object-position: center; }
.nb-profile-head p { margin-top: 2px !important; font-size: 12px; }
.nb-profile-head strong { color: var(--nb-amber); }
.nb-profile-stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(43px,1fr)); gap: 4px; padding: 0; margin: 8px 0; }
.nb-profile-stats div { padding: 2px 3px; line-height: 1.2; background: var(--nb-panel); border: 1px solid var(--nb-line); border-radius: 4px; text-align: center; }
.nb-profile-stats dt { font-size: 10px; color: var(--nb-muted); }
.nb-profile-stats dd { margin: 0; color: var(--nb-amber); font-weight: 700; }
.nb-unit-settings,.nb-upgrade-actions,.nb-upgrades { display: grid; gap: 6px; }
.nb-upgrades:empty { display: none; }
.nb-upgrade { display: grid; gap: 5px; padding: 5px 0; border-bottom: 1px solid var(--nb-line); }
.nb-upgrade p,.nb-rule-group dd { white-space: pre-line; overflow-wrap: anywhere; }
.nb-upgrade details,.nb-spells { font-size: 13px; }
.nb-unit-settings .nb-spells label { display: flex !important; align-items: start; margin: 4px 0; }
.nb-inspector summary { cursor: pointer; }
.nb-rule-group dl { margin: 5px 0 0; }
.nb-rule-group dl div { padding: 5px 0; border-top: 1px solid var(--nb-line); }
.nb-rule-group dt { font-weight: 700; overflow-wrap: anywhere; }
.nb-rule-group dd { margin: 2px 0 0; font-size: 13px; line-height: 1.4; }
.nb-rule-group .nb-rule-meta { color: var(--nb-muted); font-size: 11px; }
.nb-dialog { width: min(100% - 24px,520px); max-height: 82dvh; padding: 14px; border: 1px solid var(--nb-bronze); border-radius: 9px; background: var(--nb-panel); color: var(--nb-ink); }
.nb-dialog::backdrop { background: #0009; }
.nb-dialog-head,.nb-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.nb-dialog-head { justify-content: space-between; margin-bottom: 10px; }
.nb-dialog > p { margin-bottom: 9px !important; }
.nb-filter-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.nb-saved,.nb-validation-list { display: grid; gap: 7px; margin: 0 0 12px; padding: 0; list-style: none; }
.nb-saved li,.nb-validation-list li { display: flex; gap: 8px; align-items: center; justify-content: space-between; border-top: 1px solid var(--nb-line); padding-top: 6px; }
.nb-print { display: none; }
@media (max-width: 1320px) {
  .nb-toolbar { gap: 6px; padding: 8px; }
  .nb-toolbar-end { gap: 5px; }
}
@media (max-width: 767px) {
  .nb-toolbar { grid-template-columns: 30px minmax(0,1fr) auto; gap: 6px; }
  .nb-brand { width: 30px; justify-content: center; }
  .nb-identity { grid-column: 2; min-width: 0; }
  .nb-budget { grid-column: 3; min-width: 0; }
  .nb-title { min-width: 0; }
  .nb-title span:first-child { min-width: 0; }
  #native-builder .nb-toolbar-actions { grid-column: 1 / -1; grid-row: 2; }
  .nb-toolbar-actions { grid-column: 1/-1; justify-content: flex-end; }
  .nb-toolbar-end { grid-column: 2; grid-row: 1; align-items: flex-end; flex-direction: column; gap: 3px; }
  .nb-budget { min-width: 0; }
  .nb-budget strong { font-size: 16px; }
  #native-builder .nb-save,#native-builder .nb-actions summary { font-size: 11px; padding: 4px; min-height: 25px; }
  #native-builder .nb-settings :is(select,input) { min-height: 33px; font-size: 12px; padding: 3px; }
  #native-builder .nb-faction-field img { width: 18px; height: 19px; }
}
@media (max-width: 1099px) and (max-height: 520px) {
  body:has(#native-builder) { overflow: auto; }
  #native-builder { min-height: 440px; }
}
@media (max-height: 440px) {
  .nb-toolbar { padding-block: 3px; }
  #nb-save-status { min-height: 0; }
  .nb-catalog-controls { gap: 3px; padding: 4px; }
}
@media print {
  body:has(#native-builder) { overflow: visible; background: white; }
  body:has(#native-builder) :is(.ec-header,.hub-side,.hub-scrim,.ec-footer,.ec-page-hero),#native-builder > :not(.nb-print) { display: none !important; }
  body:has(#native-builder) .hub-shell,#native-builder { display: block; height: auto; min-height: 0; overflow: visible; }
  #native-builder > .nb-print { display: block; background: white; color: #111; }
  #native-builder .nb-print :is(h1,h2,p) { color: #111; margin: 4px 0; }
  .nb-print article { break-inside: avoid; border-bottom: 1px solid #aaa; padding: 8px 0; }
}

/* Context controls stay attached to the selected model and its slots. */
.nb-toolbar { position: sticky; top: 0; }
#native-builder .nb-toolbar #nb-inspector-toggle { white-space: nowrap; }
.nb-drawer-scrim { display: none; }
.nb-roster-row { display: block; padding: 4px 6px 7px; }
.nb-roster-row:has(.nb-roster-tile[aria-pressed=true]) { border-color: var(--nb-bronze); }
.nb-roster-main { display: flex; align-items: center; gap: 4px; }
.nb-roster-tile { flex: 1; }
.nb-roster-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.nb-leader { color: var(--nb-amber); font-size: 11px; border: 1px solid var(--nb-bronze); border-radius: 4px; padding: 1px 4px; }
.nb-drag { color: var(--nb-muted); cursor: grab; user-select: none; }
.nb-entry-menu { position: relative; flex: none; }
.nb-entry-menu summary { display: grid; place-items: center; width: 36px; height: 36px; list-style: none; cursor: pointer; }
.nb-entry-menu summary::-webkit-details-marker { display: none; }
.nb-entry-menu[open] summary { background: var(--nb-raised); border-radius: 6px; }
.nb-entry-actions { position: absolute; top: 100%; right: 0; display: grid; min-width: max-content; max-width: min(230px,70vw); padding: 4px; gap: 2px; border: 1px solid var(--nb-bronze); border-radius: 6px; z-index: 3; background: var(--nb-panel); box-shadow: 0 8px 22px #0008; }
#native-builder .nb-entry-actions button { justify-content: start; }
.nb-model-slots { display: grid; gap: 4px; padding: 0 6px 2px; }
.nb-slot-count { color: var(--nb-muted); font-size: 11px; }
.nb-assigned { display: grid; gap: 4px; }
.nb-open-upgrades { justify-self: start; }
.nb-assigned-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 6px; align-items: center; padding: 2px 5px; border: 1px solid var(--nb-line); border-radius: 5px; }
.nb-assigned-name { background: transparent; border: 0; color: var(--nb-ink); display: flex; align-items: center; text-align: left; gap: 6px; min-width: 0; font: inherit; }
.nb-assigned-name span { overflow-wrap: anywhere; }
.nb-assigned-art { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; flex: none; }
.nb-image-fallback { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 4px; color: var(--nb-bronze); background: var(--nb-raised); }
.nb-profile-head .nb-image-fallback { width: 48px; height: 48px; flex: 0 0 48px; }
.nb-catalog-grid .nb-catalog-unit .nb-image-fallback { width: 100%; height: 78px; }
.nb-undo { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; padding: 8px; border: 1px solid var(--nb-line); border-radius: 6px; }
#native-builder .nb-add-model { margin-top: 8px; }
.nb-inspector-bar { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--nb-line); color: var(--nb-muted); font-size: 13px; font-weight: 650; }
.nb-inspector-bar .nb-remove { width: 28px; height: 24px; margin: 0; font-size: 16px; }
.nb-profile-head img { background: var(--nb-raised); }
.nb-load { display: grid; gap: 3px; color: var(--nb-muted); }
.nb-load meter { width: 100%; max-width: 190px; }
.nb-load meter::-webkit-meter-optimum-value { background: var(--nb-bronze); }
.nb-load.warn meter::-webkit-meter-optimum-value { background: var(--nb-error); }
.nb-rule { border-bottom: 1px solid var(--nb-line); padding: 4px 0; }
.nb-rule summary { min-height: 32px; padding: 5px 2px; color: var(--nb-ink); font-weight: 650; }
.nb-rule[open] summary { color: var(--nb-amber); }
#native-builder .nb-rule-description { margin: 4px 0 7px; white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; }
.nb-rule p.nb-rule-meta { color: var(--nb-muted); font-size: 11px; }
.nb-rule-group .nb-gear-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
.nb-gear-stats div { background: var(--nb-panel); padding: 4px; border-radius: 4px; }
.nb-gear-stats dt { color: var(--nb-muted); font-size: 11px; }
.nb-inspector-primary { position: sticky; bottom: -12px; background: var(--nb-deep); padding: 8px 0; }
.nb-inspector-primary button { width: 100%; }
.nb-unit-settings { border-top: 1px solid var(--nb-line); padding-top: 8px; }
.nb-error-context { border: 1px solid var(--nb-error); border-radius: 5px; padding: 6px 8px; }
.nb-picker-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#native-builder .nb-picker-controls select { width: auto; }
#native-builder .nb-check-inline { display: flex; gap: 4px; align-items: center; }
.nb-picker-detail:not(:empty) { padding: 8px; border: 1px solid var(--nb-bronze); border-radius: 6px; display: grid; gap: 6px; }
.nb-picker-detail p { white-space: pre-line; overflow-wrap: anywhere; }
.nb-picker-results { display: grid; gap: 4px; }
.nb-picker-item { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; min-height: 48px; text-align: left; gap: 6px; color: var(--nb-ink); background: var(--nb-panel); border: 1px solid var(--nb-line); border-radius: 6px; padding: 4px; font: inherit; }
.nb-picker-item[aria-pressed=true],.nb-picker-item:hover { border-color: var(--nb-bronze); }
.nb-detail-art { width: 90px; height: 90px; object-fit: contain; }
#native-builder .nb-plus,#native-builder .nb-remove,#native-builder .nb-catalog-unit,#native-builder .nb-roster-tile,#native-builder .btn { transition: background-color 150ms,border-color 150ms,color 150ms; }
#native-builder :is(.nb-plus,.nb-remove,.nb-catalog-unit,.nb-roster-tile,.btn):active:not(:disabled) { background-color: var(--nb-raised); }
@media (prefers-reduced-motion: reduce) {
  #native-builder :is(.nb-plus,.nb-remove,.nb-catalog-unit,.nb-roster-tile,.btn) { transition: none; }
}
@media (min-width: 1100px) {
  #native-builder[data-collapsed=true] .nb-layout { grid-template-columns: minmax(245px,1fr) minmax(340px,1.55fr); }
  #native-builder[data-collapsed=true] .nb-inspector { display: none; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .nb-layout { grid-template-columns: minmax(250px,1fr) minmax(315px,1.36fr); }
  #native-builder .nb-inspector { display: none; }
  #native-builder[data-drawer=true] .nb-inspector {
    display: block; position: absolute; top: 0; right: 0; bottom: 0; width: min(430px,58%);
    z-index: 5; border-radius: 0; box-shadow: -12px 0 30px #0008;
  }
  #native-builder[data-drawer=true] .nb-drawer-scrim {
    display: block; position: absolute; inset: 0;
    z-index: 4; background: #0006; border: 0;
  }
  #native-builder[data-drawer=true] .nb-layout { z-index: 3; }
  #native-builder :is(.nb-plus,.nb-remove) { width: 44px; height: 44px; }
  .nb-toolbar { grid-template-columns: minmax(145px,1fr) minmax(230px,1.25fr) auto; }
}
@media (max-width: 767px) {
  #native-builder { grid-template-rows: auto minmax(0,1fr) auto; }
  .nb-layout { grid-row: 2; grid-template-columns: minmax(0,1fr); padding: 4px; gap: 0; }
  .nb-mobile-nav { display: grid; grid-row: 3; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; padding: 4px 8px max(4px,env(safe-area-inset-bottom)); border-top: 1px solid var(--nb-line); background: var(--nb-deep); }
  #native-builder .nb-mobile-nav button[aria-pressed=true] { color: var(--nb-amber); border-color: var(--nb-bronze); }
  #native-builder:not([data-panel=catalog]) .nb-browse,#native-builder:not([data-panel=squad]) .nb-party,#native-builder:not([data-panel=inspector]) .nb-inspector { display: none; }
  #native-builder #nb-inspector-toggle { display: none; }
  #native-builder .nb-brand h1 { font-size: 16px; }
  #native-builder :is(.nb-plus,.nb-remove,.nb-entry-menu summary) { min-width: 44px; min-height: 44px; }
  #native-builder :is(.nb-mobile-nav,.nb-catalog-controls,.nb-tabs,.nb-inspector-primary) button { min-height: 44px; }
  .nb-drag { display: none; }
}
@media print {
  #native-builder .nb-layout,#native-builder .nb-mobile-nav { display: none !important; }
}

.nb-search input::-webkit-search-cancel-button { display: none; }
.nb-image-fallback.nb-assigned-art { width: 32px; height: 32px; }

.nb-editorial-description { white-space:pre-line; }

/* Compact faction selection */
.nb-faction-setting { grid-column: 1/-1; display: grid; gap: 4px; min-width: 0; color: var(--nb-muted); font-size: 12px; }
.nb-faction-icons { display: flex; flex-wrap: wrap; gap: 5px; }
#native-builder .nb-faction-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 6px; border: 1px solid var(--nb-line); border-radius: 6px; background: var(--nb-deep); color: var(--nb-ink); cursor: pointer; }
#native-builder .nb-faction-icon img { width: 26px; height: 26px; object-fit: contain; }
#native-builder .nb-faction-icon:hover { border-color: var(--nb-bronze); background: var(--nb-raised); }
#native-builder .nb-faction-icon[aria-pressed=true] { border-color: var(--nb-amber); background: #3a2d1c; box-shadow: inset 0 0 0 1px var(--nb-amber); }
#native-builder .nb-faction-icon:focus-visible { outline: 2px solid var(--nb-amber); outline-offset: 2px; }
#native-builder .nb-faction-icon:disabled { cursor: wait; opacity: .6; }
.nb-faction-icon img[src*="faction-sand"],.nb-faction-icon img[src*="faction-goblin"] { filter: invert(1); mix-blend-mode: screen; }
#native-builder .nb-settings { grid-template-columns: 74px minmax(0,1fr); }
@media (pointer: coarse) { #native-builder .nb-faction-icon { flex-basis: 44px; width: 44px; height: 44px; } }

#native-builder .nb-rule-link{border:0;padding:0;background:none;color:var(--nb-amber);font:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
#native-builder .nb-rule-link:hover,#native-builder .nb-rule-link:focus-visible{color:var(--nb-ink)}
#native-builder .nb-rule-spell h3{margin:8px 0 3px;font-size:14px;color:var(--nb-amber)}
#native-builder .nb-rule-spell{border-bottom:1px solid var(--nb-line);padding:5px 2px 9px}

#native-builder .nb-share-toolbar { white-space: nowrap; }
@media (max-width: 767px) { #native-builder .nb-share-toolbar { display: inline-flex; min-height: 36px; padding-inline: 8px; font-size: 11px; } }

#native-builder .nb-rule-upgrade-art{display:block;width:min(100%,160px);height:110px;object-fit:contain;object-position:left center;margin:6px 0 8px;padding:5px;border:1px solid var(--nb-line);border-radius:7px;background:var(--nb-deep)}

#native-builder .nb-rule-upgrades{display:grid;gap:4px;min-width:0}
