:root {
  color-scheme: light dark;
  --gap: 1rem;
  --card-bg: rgba(127, 127, 127, 0.08);
  --card-border: rgba(127, 127, 127, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0 var(--gap) 3rem;
  max-width: none;
  width: 90%;
  margin-inline: auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 1rem 0;
  border-bottom: 1px solid var(--card-border);
}

.controls-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

h1 {
  font-size: 1.25rem;
  margin: 0;
}

button {
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  cursor: pointer;
}

button:hover {
  background: rgba(127, 127, 127, 0.16);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button.is-active {
  background: rgba(127, 127, 127, 0.3);
  box-shadow: inset 0 0 0 2px currentColor;
}

.legend-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--card-border);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Archetype tiles — one per archetype regardless of what's currently loaded, but clickable:
   .is-active reuses the existing generic button.is-active styling (no separate rule needed). */
.legend-tile {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem 0.25rem 0.25rem;
  font-size: 0.75rem;
}

.legend-row .legend-icon {
  width: 28px;
  height: 28px;
  border-radius: 0.35rem;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
}

/* Named-set chips — text, not images: sets have no icon in the manifest (verified). */
.legend-row .legend-chip {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  white-space: nowrap;
}

/* Long-press popover for touch devices (see assets/touchTooltip.js) — a `title`-attribute
   equivalent, since native tooltips are hover-only and have no touch trigger. left/top are
   computed and clamped to the viewport in JS (not via a CSS transform), so it can flip below
   the target or shift horizontally near screen edges. white-space: pre-line preserves the same
   \n-separated text native title tooltips already render on desktop. */
.touch-tooltip {
  position: fixed;
  max-width: 240px;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  font-size: 0.75rem;
  white-space: pre-line;
  z-index: 1000;
  pointer-events: none;
}

.error-banner {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(200, 60, 60, 0.4);
  background: rgba(200, 60, 60, 0.08);
}

@keyframes action-banner-enter {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Equip-action feedback (v5) — floats over whatever's already on the page (see
   armorRenderer.js's showActionBanner), unlike .error-banner above which replaces #armor-root's
   content entirely. Appended to <body>, so it survives a renderLoading()/renderArmorBoard() swap
   underneath it during the post-equip refetch. */
.action-banner {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 1103; /* above .touch-tooltip (1000) and .equip-menu (1002) */
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(90vw, 420px);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  animation: action-banner-enter 160ms ease-out;
}

/* Without this, the [hidden] attribute never actually hides the banner: author-origin CSS (our
   own `display: flex` above) always beats the browser's UA-stylesheet `[hidden] { display: none }`
   rule of equal/lower specificity, regardless of source order. This higher-specificity rule
   (class + attribute) is what lets toggling `el.hidden` actually take effect. */
.action-banner[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .action-banner { animation: none; }
}

.action-banner--pending { background: rgba(60, 60, 60, 0.92); }
.action-banner--success { background: rgba(60, 140, 60, 0.92); }
.action-banner--error { background: rgba(160, 50, 50, 0.92); }

.action-banner__text { flex: 1; }

.action-banner__close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
}

@keyframes board-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.board,
.carousel {
  align-items: start; /* don't stretch a short cell (e.g. few spares) to match the tallest one in its row */
  gap: calc(var(--gap) * 2);
  margin-top: 1.5rem;
  animation: board-enter 220ms ease-out; /* .board/.carousel are built once and patched in place thereafter (see armorRenderer.js's reconcileFlatChildren), so this now plays once on first load rather than replaying on every reload/filter/auto-refresh */
}

@media (prefers-reduced-motion: reduce) {
  .board,
  .carousel {
    animation: none;
  }
}

.board {
  display: grid;
}

/* The carousel is a reused, unchanged copy of the old column-major board — hidden by default,
   only shown (as a flex row) below the matching breakpoint for the current character count. */
.carousel {
  display: none;
}

/* Character columns are locked to a fixed width (matches the 4-wide slot grid, see .slot-cell);
   Vault is the sole flexible track and absorbs whatever width is left, out to the page edge.
   Destiny caps an account at 3 character slots, so the count is always known and small — a
   filtered single-character view also lands on the "1" case, no separate rule needed for it. */
.board[data-character-count="1"] { grid-template-columns: 247px 1fr; }
.board[data-character-count="2"] { grid-template-columns: repeat(2, 247px) 1fr; }
.board[data-character-count="3"] { grid-template-columns: repeat(3, 247px) 1fr; }

/* Carousel breakpoints computed per character count: N * 247px column + N gaps (2rem each) +
   Vault's own 176px minimum, then scaled up to a viewport width accounting for body's 90% width
   and its own padding. Each count gets its own exact threshold instead of one static guess. Below
   the threshold, the row-major .board hides and the column-major .carousel takes over. */
@media (max-width: 540px) {
  .board[data-character-count="1"] { display: none; }
  .carousel[data-character-count="1"] { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .carousel[data-character-count="1"] > .column { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
}
@media (max-width: 850px) {
  .board[data-character-count="2"] { display: none; }
  .carousel[data-character-count="2"] { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .carousel[data-character-count="2"] > .column { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
}
@media (max-width: 1160px) {
  .board[data-character-count="3"] { display: none; }
  .carousel[data-character-count="3"] { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .carousel[data-character-count="3"] > .column { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
}

.column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 5px;
  background: var(--card-bg);
}

.column--vault {
  min-width: 176px; /* matches the Vault-minimum assumed by the carousel breakpoints above */
}

.column-header {
  border-radius: 0.5rem;
  background-size: cover;
  background-position: center;
  /* Fixed height (not aspect-ratio) now that character columns are a fixed 247px wide: 247px at the
     native 474/96 emblem ratio works out to ~50px. A fixed height also lets Vault's header match
     it exactly despite Vault's own width being flexible, where an aspect-ratio would not. */
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 0.65rem 0 20%; /* shifted right so the title clears the emblem's left-justified icon art */
  margin: -5px -5px 0.25rem;
}

.column-header.is-clickable {
  cursor: pointer;
}

.column-header.is-clickable:hover {
  filter: brightness(1.15);
}

.column-header.is-active {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85);
}

.column-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.column--vault .column-header {
  background: none;
  padding: 0 0.65rem;
  margin: 0 0 0.25rem;
  /* height: 46px is inherited from .column-header — same fixed value regardless of Vault's own
     (flexible) width, so every column's header lines up. */
}

.column--vault .column-title {
  color: inherit;
  text-shadow: none;
  opacity: 0.7;
}

/* .header-cell is the .board (row-major) equivalent of .column-header above — same look, just a
   direct grid child instead of nested in a per-character .column wrapper (which .board no longer has). */
.header-cell {
  border-radius: 0.5rem;
  background-size: cover;
  background-position: center;
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 0.65rem 0 20%; /* shifted right so the title clears the emblem's left-justified icon art */
}

.header-cell.is-clickable {
  cursor: pointer;
}

.header-cell.is-clickable:hover {
  filter: brightness(1.15);
}

.header-cell.is-active {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85);
}

.header-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.header-cell--vault {
  background: none;
  padding: 0 0.65rem;
}

.header-cell--vault .header-title {
  color: inherit;
  text-shadow: none;
  opacity: 0.7;
}

/* Fixed 4x3 grid per slot: column 1 (all 3 rows) holds the equipped item, columns 2-4 hold up to
   9 spares in row-major order. Row height is minmax(CARD_MAX, auto) rather than a hard px so a
   slot with 10+ spares grows a 4th+ line instead of clipping — width never changes either way.
   Shared by .slot-row (the .carousel's per-character column) and .slot-cell (.board's per-slot-band
   cell) — same 4x3 mechanics, different DOM context. */
.slot-row,
.slot-cell {
  display: grid;
  grid-template-columns: repeat(4, 55px);
  grid-template-rows: repeat(3, minmax(55px, auto));
  gap: 0.35rem;
}

.slot-row {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--card-border);
}

.slot-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* .board has no per-character wrapping box (unlike .carousel's .column), so each cell carries its
   own light card styling instead. */
.slot-cell,
.vault-cell {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 0.35rem;
}

.slot-equipped {
  grid-column: 1;
  grid-row: 1 / span 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-spares {
  grid-column: 2 / span 3;
  grid-row: 1 / span 3;
  display: grid;
  grid-template-columns: repeat(3, 55px);
  grid-auto-rows: 55px;
  gap: 0.35rem;
}

.column--vault .armor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 55px));
  gap: 0.35rem;
}

/* .vault-cell (.board only): a vertical stack of per-class sub-rows, one labeled group per class
   present in that slot, ordered to match the character columns' left-to-right order. */
.vault-cell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 176px; /* matches the Vault-minimum assumed by the carousel breakpoints above */
}

.vault-class-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.vault-class-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

.vault-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 55px));
  gap: 0.35rem;
}

.armor-card {
  position: relative; /* anchors .armor-card__masterwork-overlay and .armor-card__tier-badge */
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  border-radius: 0.5rem;
  width: 100%;
  max-width: 55px; /* locked max size, bumped 10% up from the previous 50px */
  aspect-ratio: 1;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.armor-card img {
  width: 100%;
  height: 100%;
  border-radius: 0.35rem;
  display: block;
}

/* Bungie's own global masterwork gold-glow asset (see DestinyInventoryItemConstantsDefinition,
   resolveMasterworkOverlayUrl()) — one shared image reused across every masterworked item, laid
   directly over the icon rather than drawn as a new per-item asset. pointer-events: none so it
   never blocks the icon's hover tooltip. */
.armor-card__masterwork-overlay {
  position: absolute;
  inset: 2px;
  width: auto;
  height: auto;
  pointer-events: none;
}

/* Visible stand-in for the gearTier diagnostic (see plan-v3.md) — raw ItemInstanceComponent.gearTier
   value, shown directly rather than logged, so old-vs-new differences (if any) are eyeballable at a
   glance. Bottom-right corner keeps it clear of the masterwork overlay, which covers the whole icon. */
.armor-card__tier-badge {
  position: absolute;
  bottom: 1px;
  right: 1px;
  min-width: 1.1em;
  padding: 0 3px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  border-radius: 0.2rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  pointer-events: none;
}

/* Legacy (pre-Armor 3.0) gear reads as visibly darker than reworked armor — every item
   still renders regardless of era. brightness() is theme-agnostic, unlike a flat overlay
   which would need separate light/dark tuning. */
.armor-card--legacy img {
  filter: brightness(0.35);
}

/* Third ("random") stat badge — opposite corner from the tier badge, same dark-pill treatment.
   Abbreviated name only; the value tracks the tier badge already shown, so it's redundant here
   (the full name + value is still in the tooltip, see buildTooltip). */
.armor-card__third-stat-badge {
  position: absolute;
  top: 1px;
  left: 1px;
  min-width: 1.1em;
  padding: 0 3px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  border-radius: 0.2rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  pointer-events: none;
}

/* T1-T3 are flagged red as a single "needs attention" group, scannable without reading the
   badge text. T4/T5 are intentionally left unstyled (default border) — that's where a
   well-rolled piece is expected to land, and leaving the border plain is what lets the
   masterwork gold overlay read clearly instead of competing with a colored ring. */
.armor-card--tier-1,
.armor-card--tier-2,
.armor-card--tier-3 {
  border-color: #d9534f;
  border-width: 2px;
}

/* Drag-and-drop equip (v5, see dragEquip.js) — one unified Pointer-Events-based drag system for
   both desktop mouse and mobile touch. */
.armor-card[data-draggable="true"] {
  cursor: grab;
}

.armor-card.is-dragging {
  opacity: 0.35;
  cursor: grabbing;
  transition: opacity 120ms;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  width: 55px;
  height: 55px;
  pointer-events: none;
  z-index: 1001; /* above .touch-tooltip (1000) */
  opacity: 0.85;
  will-change: transform;
}

/* .slot-equipped equips on drop; .slot-spares (vault items only) transfers without equipping;
   .vault-cell (character spares only) transfers to the vault — all three are hit-testable drop
   zones during an active drag, highlighted identically. */
.slot-equipped.is-drop-eligible,
.slot-spares.is-drop-eligible,
.vault-cell.is-drop-eligible {
  outline: 2px dashed rgba(120, 170, 255, 0.6);
  background: rgba(120, 170, 255, 0.08);
}

.slot-equipped.is-drop-target,
.slot-spares.is-drop-target,
.vault-cell.is-drop-target {
  outline: 2px solid rgba(120, 170, 255, 0.95);
  background: rgba(120, 170, 255, 0.22);
}

/* Archetype icon — bottom-left is the only free card corner: bottom-right is the tier badge,
   top-left the third-stat badge, top-right the equip-trigger, the masterwork overlay covers the
   whole card but is pointer-events: none. Selector needs the extra `.armor-card` qualifier to
   out-specificity the generic `.armor-card img` rule (which would otherwise stretch it to 100%). */
.armor-card .armor-card__archetype-icon {
  position: absolute;
  bottom: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 0.2rem;
  pointer-events: none;
}

/* Mobile vault equip/store menu trigger — top-right is the only free card corner: bottom-right is
   the tier badge, top-left the third-stat badge, the masterwork overlay covers the whole card but
   is pointer-events: none. */
.armor-card__equip-trigger {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 1.1em;
  padding: 0 3px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  border: none;
  border-radius: 0.2rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
}

.armor-card__equip-trigger:hover,
.armor-card__equip-trigger:focus-visible {
  background: rgba(0, 0, 0, 0.85);
}

/* Same visual language as .touch-tooltip (dark pill, 0.5rem radius, fixed position) but with real,
   clickable rows instead of pointer-events: none text (see equipMenu.js). */
.equip-menu {
  position: fixed;
  z-index: 1002;
  border-radius: 0.5rem;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Same [hidden]-vs-author-display gotcha as .action-banner above — this class + attribute
   selector has higher specificity than the plain class rule above, so it correctly wins. */
.equip-menu[hidden] {
  display: none;
}

.equip-menu__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
}

.equip-menu__emblem {
  width: 20px;
  height: 20px;
  border-radius: 0.25rem;
  background-size: cover;
  background-position: center;
  flex: none;
}

.equip-menu__label {
  flex: 1;
  white-space: nowrap;
}

.equip-menu__action {
  border: none;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font: inherit;
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

.equip-menu__action:hover,
.equip-menu__action:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

/* Item-detail modal (v5) — centered dialog with a dimmed backdrop, unlike the anchored popovers
   above (.touch-tooltip/.equip-menu). Same body-appended/hidden-toggle idiom, one z-index band
   above .action-banner (1103) so it can appear over an in-flight equip banner. Backdrop and modal
   are explicit siblings (not a single combined click-target element) — both get explicit
   position+z-index so the modal reliably paints above the backdrop regardless of default
   positioned-vs-in-flow paint-order rules. */
.item-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Same [hidden]-vs-author-display gotcha as .action-banner/.equip-menu above — this class +
   attribute selector has higher specificity than the plain class rule above, so it correctly wins. */
.item-detail-overlay[hidden] {
  display: none;
}

.item-detail-overlay__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.6);
}

/* Same dark-pill visual language as .touch-tooltip/.equip-menu (rgba(20,20,20,0.92), #fff text,
   0.5rem radius), just centered instead of anchored. */
.item-detail-overlay__modal {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 360px);
  max-height: min(85vh, 560px);
  overflow-y: auto;
  padding: 1rem;
  border-radius: 0.5rem;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.item-detail-overlay__close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
}

.item-detail-overlay__close:hover,
.item-detail-overlay__close:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0.35rem;
}

.item-detail-overlay__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-right: 1.5rem; /* keep the title clear of the close button */
}

.item-detail-overlay__icon-wrap {
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 0.5rem;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
}

.item-detail-overlay__icon {
  width: 100%;
  height: 100%;
  border-radius: 0.35rem;
  display: block;
}

.item-detail-overlay__icon-masterwork {
  position: absolute;
  inset: 2px;
  width: auto;
  height: auto;
  pointer-events: none;
}

.item-detail-overlay__title-block {
  min-width: 0; /* allow the title to wrap/truncate instead of overflowing the modal */
}

.item-detail-overlay__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.item-detail-overlay__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.item-detail-overlay__badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.14);
}

.item-detail-overlay__badge--masterwork {
  background: rgba(200, 170, 60, 0.35); /* echoes the gold masterwork glow, without a second image fetch */
}

.item-detail-overlay__section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.item-detail-overlay__section-heading {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
}

.item-detail-overlay__archetype-description {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  white-space: pre-line; /* preserves the "\n\nPrimary Stat: X\nSecondary Stat: Y" formatting already baked into the description text */
  color: rgba(255, 255, 255, 0.85);
}

.item-detail-overlay__row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.15rem 0;
}

.item-detail-overlay__row-label {
  color: rgba(255, 255, 255, 0.65);
}

.item-detail-overlay__set-bonus-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
}

.item-detail-overlay__set-bonus + .item-detail-overlay__set-bonus {
  margin-top: 0.3rem;
}

/* Definitions overlay — same body-appended/backdrop/dark-pill idiom as .item-detail-overlay
   above, just wider to fit two reference tables instead of one item's details. */
.definitions-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.definitions-overlay[hidden] {
  display: none;
}

.definitions-overlay__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.6);
}

.definitions-overlay__modal {
  position: relative;
  z-index: 1;
  width: min(95vw, 780px);
  max-height: min(85vh, 720px);
  overflow-y: auto;
  padding: 1rem;
  border-radius: 0.5rem;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.definitions-overlay__close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  cursor: pointer;
}

.definitions-overlay__close:hover,
.definitions-overlay__close:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0.35rem;
}

.definitions-overlay__section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.definitions-overlay__section:first-child {
  margin-top: 0;
  padding-top: 1.5rem; /* keep clear of the close button */
  border-top: none;
}

.definitions-overlay__section-heading {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.definitions-overlay__legend-caption {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
}

.definitions-overlay__empty {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

.definitions-overlay__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.definitions-overlay__table th,
.definitions-overlay__table td {
  border: 1px solid var(--card-border);
  padding: 0.3rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.definitions-overlay__table thead th {
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.definitions-overlay__table tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.definitions-overlay__stat-cell {
  text-align: center;
  vertical-align: middle;
}

.definitions-overlay__stat-cell--primary {
  color: #fff;
}

.definitions-overlay__stat-cell--secondary {
  color: rgba(255, 255, 255, 0.65);
}
