@import url("/_assets/b88d45443fa2dbfe501f/ui/pokemon-filter-ranges.css");

/* Trainer PC: a local steel chassis, using the game's fonts, controls and sprites. */
:is(.drawer.collection-drawer, .drawer.breeding-drawer) {
  --team-screen: #0b1420;
}
.drawer.collection-drawer {
  --team-chassis: #263a51;
  --team-chassis-edge: #48617f;
  --team-status: #78d5d1;
  --team-portrait: 40px;
  width: min(calc(1240px + var(--ui-nav-rail-size)), 100%);
}
.collection-drawer .drawer-panel {
  padding: 12px;
  background: var(--team-chassis);
  border-left: 1px solid var(--team-chassis-edge);
  box-shadow: inset 0 2px #627e9b, inset -2px -2px #182738;
}
.collection-drawer .drawer-head {
  position: relative;
  gap: 12px;
  padding: 0 4px 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.collection-drawer #drawer-kicker {
  display: none;
}
.collection-drawer .drawer-title-row {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.collection-drawer .drawer-head h2 {
  margin: 0;
  color: var(--ui-color-on-primary);
  font: 32px/1 var(--ui-font-display);
}
.collection-drawer .collection-summary {
  justify-items: end;
  gap: 1px;
  min-width: 142px;
  margin: 0;
  color: var(--ui-color-accent-strong);
  font: 600 9px/1.25 var(--ui-font-body);
  font-variant-numeric: tabular-nums;
}
.collection-drawer .collection-summary > strong {
  color: var(--ui-color-text);
  font: 700 16px/1.1 var(--ui-font-body);
}
.collection-drawer .team-terminal-storage {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 4px;
  overflow: hidden;
  background: #172738;
}
.collection-drawer .team-terminal-storage > i {
  display: block;
  height: 100%;
  max-width: 100%;
  background: var(--team-status);
}
.collection-drawer #drawer-close {
  width: 40px;
  height: 40px;
  border: 1px solid #68819c;
  background: #1d3045;
  color: var(--ui-color-on-primary);
  box-shadow: inset 1px 1px #526d89, 2px 2px #172638;
}
.collection-drawer #drawer-close:hover {
  border-color: var(--ui-color-primary);
  background: var(--ui-color-action);
}
.collection-drawer #drawer-content {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #59738e;
  background: var(--team-screen);
  box-shadow: 0 0 0 3px #172638;
}
.collection-drawer .team-header-capacity:not([hidden]) {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin: 0 auto 0 4px;
  padding: 5px 8px;
  font: 400 10px/1.25 var(--ui-font-body);
}
.collection-drawer .team-header-capacity > strong {
  flex-shrink: 0;
  font-size: 10px;
}
.collection-drawer .collection-layout {
  grid-template-columns: minmax(330px, 0.64fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  padding: 10px;
}
.collection-drawer .collection-layout :is(.team-panel, .depot-panel) {
  display: block;
  padding: 0;
  border: 0;
  scrollbar-color: var(--team-chassis-edge) var(--team-screen);
  scrollbar-gutter: stable;
}
.collection-drawer .team-panel-header,
.collection-drawer .depot-sticky {
  top: 0;
  margin: 0;
  background: var(--team-screen);
}
.collection-drawer .team-panel-header {
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--ui-color-border);
}
.collection-drawer .team-section-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--ui-color-accent);
  font: 700 9px/1.2 var(--ui-font-body);
  letter-spacing: 0.12em;
}
.collection-drawer .team-panel-header h3,
.collection-drawer .team-inventory-heading h3 {
  margin: 0;
  color: var(--ui-color-text);
  font: 700 17px/1.2 var(--ui-font-body);
}
.collection-drawer .team-slot-indicator {
  display: flex;
  gap: 5px;
}
.collection-drawer .team-slot-indicator > span {
  width: 13px;
  height: 20px;
  border: 1px solid var(--team-chassis-edge);
  background: var(--ui-color-surface-raised);
}
.collection-drawer .team-slot-indicator > .is-filled {
  border-color: #84b8c3;
  background: #426d7e;
  box-shadow: inset 0 3px #6598a7;
}

/* Identity and quality/IV stay together; Power occupies the same trailing column. */
.collection-drawer .team-card {
  margin-top: 6px;
  border: 1px solid var(--ui-color-border);
  border-left: 3px solid var(--quality-color, var(--ui-color-accent));
  background: var(--ui-color-surface-raised);
}
.collection-drawer .team-card[open]:not(.capture-focused) {
  border-color: var(--team-chassis-edge);
  border-left-color: var(--quality-color, var(--ui-color-accent));
}
.collection-drawer .team-card-main {
  gap: 5px;
  padding: 6px;
}
.collection-drawer .team-card-identity-row {
  display: grid;
  grid-template-columns: 22px var(--team-portrait) minmax(0, 1fr) 55px 10px;
  gap: 5px;
}
.collection-drawer .team-slot-number {
  color: var(--ui-color-accent);
  font: 700 10px/1 var(--ui-font-body);
  font-variant-numeric: tabular-nums;
  width: 22px;
  min-width: 22px;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
}
.collection-drawer .ui-sortable-grip:has(.team-slot-number) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  padding: 0;
  gap: 4px;
  letter-spacing: 0;
  line-height: 1;
}
:is(.collection-drawer, .breeding-drawer) :is(.team-card-main, .reserve-row, .depot-panel, .breeding-card) .depot-sprite {
  width: var(--team-portrait);
  height: var(--team-portrait);
  border-color: color-mix(in srgb, var(--quality-color, var(--ui-color-accent)) 40%, var(--ui-color-border));
  background: color-mix(in srgb, var(--quality-color, var(--ui-color-accent)) 7%, var(--team-screen));
}
:is(.collection-drawer, .breeding-drawer) :is(.team-card-main, .reserve-row, .depot-panel, .breeding-card) .depot-sprite .ot-pokemon-icon {
  width: calc(var(--team-portrait) - 4px);
  height: calc(var(--team-portrait) - 4px);
}
:is(.collection-drawer, .breeding-drawer) .team-card-title {
  gap: 2px;
}
:is(.collection-drawer, .breeding-drawer) .team-card-title > small {
  font: 600 10px/1.1 var(--ui-font-body);
  letter-spacing: 0.02em;
}
:is(.collection-drawer, .breeding-drawer) :is(.team-card-title, .depot-identity, .reserve-identity) > strong {
  color: var(--ui-color-text);
  font: 700 14px/1.15 var(--ui-font-body);
}
:is(.collection-drawer, .breeding-drawer) :is(.team-card-title, .depot-identity, .reserve-identity) > strong small {
  font: 500 10px/1.2 var(--ui-font-body);
  white-space: nowrap;
}
:is(.collection-drawer, .breeding-drawer) .team-quality-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 6px;
  font: 400 9px/1.2 var(--ui-font-body);
}
:is(.collection-drawer, .breeding-drawer) .quality-badge {
  padding: 1px 4px;
  font: 700 10px/1.2 var(--ui-font-body);
}
:is(.collection-drawer, .breeding-drawer) .type-badge {
  min-height: 14px;
  padding: 1px 4px;
  font: 700 9px/1.1 var(--ui-font-body);
}
:is(.collection-drawer, .breeding-drawer) .team-pokemon-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  color: var(--ui-color-text-muted);
  font: 500 11px/1.2 var(--ui-font-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
:is(.collection-drawer, .breeding-drawer) .team-power-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
:is(.collection-drawer, .breeding-drawer) .team-power-metric small {
  font: 600 9px/1.1 var(--ui-font-body);
  letter-spacing: 0.06em;
}
:is(.collection-drawer, .breeding-drawer) .team-power-metric strong {
  color: var(--ui-color-accent-strong);
  font: 700 17px/1.1 var(--ui-font-body);
}
:is(.collection-drawer, .breeding-drawer) .team-quality-line :is(.team-iv-metric, .depot-iv-toggle) {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-color-text-muted);
  font: 500 10px/1.2 var(--ui-font-body);
}
:is(.collection-drawer, .breeding-drawer) .team-quality-line .pokemon-iv-total {
  color: var(--ui-color-text);
  font: 700 11px/1.2 var(--ui-font-body);
}
:is(.collection-drawer, .breeding-drawer) .team-quality-line .pokemon-iv-max {
  color: var(--ui-color-text-muted);
  font-size: 10px;
  font-weight: 400;
}
:is(.collection-drawer, .breeding-drawer) .team-quality-line .depot-iv-toggle .ui-icon {
  width: 10px;
  height: 10px;
  color: var(--ui-color-accent);
}
.collection-drawer .team-active-moves {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding-top: 5px;
}
.collection-drawer .team-active-moves-label {
  display: contents;
}
.collection-drawer .team-active-moves-label > span,
.collection-drawer .team-active-move > span:not(.active-move-glyph, .active-move-empty-icon) {
  display: none;
}
.collection-drawer .team-active-moves-edit {
  grid-column: 2;
  grid-row: 1;
  min-height: 30px;
  padding: 4px 7px;
  background: transparent;
}
.collection-drawer .team-active-moves-list {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 5px;
}
.collection-drawer .team-active-move {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  min-height: 32px;
  padding: 3px;
  background: var(--team-screen);
  font: 600 10px/1.2 var(--ui-font-body);
}
.collection-drawer .team-active-move > :is(img, .active-move-glyph) {
  width: 24px;
  height: 24px;
}
.collection-drawer .team-card-body,
.collection-drawer .depot-detail {
  background: var(--team-screen);
}
.collection-drawer :is(.team-card-actions, .reserve-actions) button {
  min-height: 26px;
  padding: 4px 7px;
  font: 600 10px/1.2 var(--ui-font-body);
}
.collection-drawer .team-panel > .drawer-note {
  margin: 6px 2px 0;
  font: 400 10px/1.3 var(--ui-font-body);
}
.collection-drawer .team-reserves {
  margin-top: 8px;
  padding-top: 6px;
  border-top-color: var(--team-chassis-edge);
}
.collection-drawer .team-reserves h3 {
  color: var(--ui-color-text);
  font: 700 14px/1.2 var(--ui-font-body);
}
.collection-drawer .reserve-row {
  grid-template-columns: var(--team-portrait) minmax(0, 1fr) 55px;
  gap: 3px 7px;
  padding: 6px 0;
}
.collection-drawer .team-reserves > .drawer-note {
  margin: 3px 0 5px;
  font: 400 10px/1.3 var(--ui-font-body);
}
.collection-drawer .reserve-actions {
  align-items: center;
  gap: 4px;
}
.collection-drawer .reserve-actions .team-usage-tag {
  margin-left: auto;
}
.collection-drawer .team-usage-description {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.collection-drawer .team-usage-tag {
  grid-column: 1 / -1;
  color: var(--ui-color-text-muted);
  font: 500 10px/1.3 var(--ui-font-body);
  text-align: right;
  overflow-wrap: anywhere;
}
.collection-drawer :is(.team-usage-tag, .team-hunt-note) .ui-icon {
  width: 11px;
  height: 11px;
  margin-right: 4px;
  vertical-align: -1px;
}

/* The searchable manifest gets the larger surface; only its rows scroll. */
.collection-drawer .depot-sticky {
  z-index: 8;
  padding: 0 0 5px;
  border-bottom-color: var(--team-chassis-edge);
}
.collection-drawer .team-inventory-heading {
  align-items: baseline;
  gap: 10px;
  min-height: 22px;
  margin: 0 0 4px;
}
.collection-drawer .team-inventory-heading > span,
.collection-drawer .team-inventory-heading :is(small, strong) {
  color: var(--ui-color-text-muted);
  font: 500 11px/1.4 var(--ui-font-body);
}
.collection-drawer .team-inventory-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 155px;
  gap: 8px;
}
.collection-drawer :is(.depot-search, .team-sort-field, .iv-range-filter, .quality-filter) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  max-width: none;
  color: var(--ui-color-text-muted);
  font: 600 9px/1.2 var(--ui-font-body);
}
.collection-drawer :is(.depot-search input, .team-sort-field select, .iv-range-filter input) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--ui-color-border);
  border-radius: var(--ui-radius);
  background: var(--ui-color-surface-raised);
  color: var(--ui-color-text);
  font: 500 13px/1.2 var(--ui-font-body);
}
.collection-drawer .depot-sticky .depot-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 80px 80px;
  gap: 8px;
  margin: 4px 0 0;
}
.collection-drawer .depot-sticky .quality-filter,
.collection-drawer .depot-quality-mount {
  min-width: 0;
}
.collection-drawer .depot-quality-mount .custom-select-trigger {
  min-height: 30px;
  padding: 4px 8px;
  border-color: var(--ui-color-border);
  background: var(--ui-color-surface-raised);
}
.collection-drawer .depot-quality-mount .custom-select-primary {
  font: 500 13px/1.2 var(--ui-font-body);
}
.collection-drawer .depot-quality-mount .custom-select-option {
  padding: 9px;
}
.collection-drawer .team-status-filters,
.collection-drawer .team-filter-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
  color: var(--ui-color-text-muted);
  font: 500 11px/1.3 var(--ui-font-body);
}
.collection-drawer .team-status-filters button {
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--ui-color-border);
  background: transparent;
  color: var(--ui-color-text-muted);
  font: 600 10px/1.2 var(--ui-font-body);
}
.collection-drawer .team-inventory-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 5px;
}
.collection-drawer .team-inventory-controls .team-status-filters {
  margin: 0;
  gap: 3px;
}
.collection-drawer .team-filter-selection {
  display: flex;
  align-items: center;
  gap: 4px;
}
.collection-drawer .team-filter-selection button {
  min-height: 28px;
  padding: 4px 6px;
  font: 600 10px/1.2 var(--ui-font-body);
}
.collection-drawer .team-status-filters button[aria-pressed="true"] {
  border-color: var(--ui-color-primary);
  background: color-mix(in srgb, var(--ui-color-action) 17%, var(--team-screen));
  color: var(--ui-color-primary-hover);
}
.collection-drawer .team-status-filters button:hover {
  border-color: var(--ui-color-accent);
  color: var(--ui-color-text);
}
.collection-drawer .team-status-filters .team-filter-toggle {
  display: none;
}
.collection-drawer .team-status-filters .team-filter-toggle[aria-expanded="true"] {
  border-color: var(--ui-color-accent);
  background: var(--ui-color-surface-control);
  color: var(--ui-color-text);
}
.collection-drawer .team-filter-summary:empty,
.collection-drawer .team-filter-summary:has(> span:only-child) {
  display: none;
}
.collection-drawer .team-filter-summary button {
  min-height: 26px;
  padding: 4px 7px;
  border: 1px solid var(--team-chassis-edge);
  background: var(--ui-color-surface-control);
  color: var(--ui-color-accent-strong);
  font: 500 10px/1.2 var(--ui-font-body);
}
.collection-drawer .team-filter-summary button:not([data-clear-team-filter]) {
  border-color: transparent;
  background: transparent;
  color: var(--ui-color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.collection-drawer .team-filter-summary [data-clear-team-filter="quality"] { display: none; }
.collection-drawer .team-hunt-note {
  margin: 4px 0 0;
  padding: 4px 6px;
  border-left: 2px solid var(--ui-color-accent);
  background: var(--ui-color-surface-raised);
  color: var(--ui-color-text-muted);
  font: 400 11px/1.4 var(--ui-font-body);
}
.collection-drawer .depot-sticky .team-selection-bar {
  position: static;
  gap: 5px;
  min-height: 0;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  font: 500 11px/1.4 var(--ui-font-body);
}
.collection-drawer .depot-sticky .team-selection-bar.has-selection {
  padding-top: 7px;
  border-top: 1px solid var(--ui-color-border-subtle);
}
.collection-drawer .team-selection-bar .bulk-controls {
  gap: 5px;
}
.collection-drawer .team-selection-bar button {
  min-height: 28px;
  padding: 5px 8px;
  font: 600 10px/1.2 var(--ui-font-body);
}
.collection-drawer .depot-panel .depot-list {
  /* Measured row plus gap, used until the window measures its groups. */
  --team-row-height: 66px;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 0;
  margin-top: 5px;
}
.collection-drawer .team-window-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding-block-end: 4px;
}
.collection-drawer .depot-panel .depot-row {
  --team-portrait: 36px;
  grid-template-columns: 18px 36px minmax(0, 1fr) 54px 155px;
  gap: 6px;
  min-height: 60px;
  padding: 3px 6px;
  border: 1px solid var(--ui-color-border);
  border-left: 2px solid var(--quality-color, var(--ui-color-accent));
  background: var(--ui-color-surface-raised);
  cursor: default;
}
.collection-drawer .depot-panel .depot-row:hover {
  border-color: var(--team-chassis-edge);
  border-left-color: var(--quality-color, var(--ui-color-accent));
  background: #152333;
}
.collection-drawer .depot-panel .depot-row:is(.selected, :has(.depot-check input:checked)) {
  border-color: var(--ui-color-primary);
  background: color-mix(in srgb, var(--ui-color-action) 13%, var(--team-screen));
}
.collection-drawer .depot-check {
  width: 20px;
  height: 32px;
}
.collection-drawer .depot-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ui-color-action);
}
:is(.collection-drawer, .breeding-drawer) .depot-identity {
  gap: 2px;
}
:is(.collection-drawer, .breeding-drawer) .depot-identity > strong {
  white-space: normal;
  overflow-wrap: anywhere;
}
.collection-drawer .depot-identity > div {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.collection-drawer .depot-panel .depot-actions:has(> [data-reserve-pokemon]) {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  grid-template-columns: none;
  grid-column: 5;
  justify-content: flex-end;
  gap: 3px;
}
.collection-drawer .depot-panel .depot-actions button {
  min-height: 28px;
  padding: 4px 6px;
  font: 600 10px/1.2 var(--ui-font-body);
}
.collection-drawer .depot-panel .depot-actions > .pokemon-lock {
  width: 28px;
  height: 28px;
  padding: 4px;
}
.collection-drawer .depot-panel .depot-actions .team-usage-tag {
  flex-basis: 100%;
}
.collection-drawer .depot-panel .depot-actions > [data-equip-pokemon]:disabled {
  opacity: 0.45;
}
.collection-drawer .depot-detail {
  margin-top: -5px;
  border-color: var(--team-chassis-edge);
}
.collection-drawer .team-empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 28px 20px;
  margin-top: 8px;
  border: 1px dashed var(--team-chassis-edge);
  background: var(--ui-color-surface-raised);
  font: 400 13px/1.5 var(--ui-font-body);
}
.collection-drawer .team-empty-state strong {
  color: var(--ui-color-text);
  font-size: 15px;
}
.collection-drawer .team-empty-state button {
  min-height: 36px;
  padding: 7px 11px;
  font: 600 12px/1.3 var(--ui-font-body);
}
.collection-drawer :is(button, input, select, summary):focus-visible {
  outline: 2px solid var(--ui-color-focus);
  outline-offset: 2px;
}

/* Container breakpoints follow usable drawer space, including the navigation rail. */
@container collection-panel (max-width: 820px) {
  .collection-drawer .depot-sticky [data-team-advanced][data-expanded="false"] { display: none; }
  .collection-drawer .depot-sticky:has([data-team-advanced][data-expanded="false"]) .team-filter-summary [data-clear-team-filter="quality"] { display: inline-flex; }
  .collection-drawer .team-status-filters .team-filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
}
@container collection-panel (min-width: 781px) {
  .collection-drawer .collection-mobile-tabs { display: none; }
  .collection-drawer .collection-layout[data-active-tab] :is(.team-panel, .depot-panel) { display: block; }
}
@container collection-panel (max-width: 1050px) and (min-width: 781px) {
  .collection-drawer .collection-layout {
    --team-portrait: 36px;
    grid-template-columns: minmax(315px, 0.64fr) minmax(0, 1fr);
    gap: 12px;
    padding: 10px;
  }
  .collection-drawer .team-card-identity-row {
    grid-template-columns: 22px var(--team-portrait) minmax(0, 1fr) 50px 10px;
    gap: 5px;
  }
  .collection-drawer .depot-panel .depot-row {
    grid-template-columns: 18px var(--team-portrait) minmax(0, 1fr) 50px 137px;
    gap: 5px;
    padding: 4px;
  }
  .collection-drawer .depot-panel .depot-actions button { padding-inline: 4px; }
}
@container collection-panel (max-width: 780px) {
  .collection-drawer .collection-mobile-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: static;
    gap: 0;
    margin: 0;
    border-bottom: 1px solid var(--team-chassis-edge);
    background: var(--ui-color-surface-raised);
  }
  .collection-drawer .collection-mobile-tabs button {
    min-height: 44px;
    padding: 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--ui-color-text-muted);
    font: 600 12px/1.2 var(--ui-font-body);
  }
  .collection-drawer .collection-mobile-tabs button[aria-selected="true"] {
    border-bottom-color: var(--ui-color-primary);
    background: var(--team-screen);
    color: var(--ui-color-primary-hover);
  }
  .collection-drawer .collection-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 10px; }
  .collection-drawer .collection-layout[data-active-tab="team"] .depot-panel,
  .collection-drawer .collection-layout[data-active-tab="depot"] .team-panel { display: none; }
  .collection-drawer .team-inventory-heading { min-height: 0; }
  .collection-drawer .team-inventory-controls { display: grid; grid-template-columns: minmax(0, 1fr); }
  .collection-drawer .team-filter-selection { justify-content: flex-end; }
}
@container collection-panel (max-width: 540px) {
  .collection-drawer .collection-layout { --team-portrait: 36px; padding: 8px; }
  .collection-drawer .team-inventory-tools { grid-template-columns: minmax(0, 1fr) 125px; gap: 6px; }
  .collection-drawer .depot-sticky .depot-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .collection-drawer .team-status-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .collection-drawer .team-status-filters button { min-width: 0; min-height: 44px; padding: 4px 3px; font-size: 10px; }
  .collection-drawer .depot-panel .depot-list { --team-row-height: 106px; }
  .collection-drawer .depot-panel .depot-row {
    grid-template-columns: 20px var(--team-portrait) minmax(0, 1fr) 52px;
    gap: 4px 6px;
    min-height: 0;
    padding: 4px 6px;
  }
  .collection-drawer .depot-panel .depot-actions:has(> [data-reserve-pokemon]) {
    display: flex;
    grid-column: 2 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
    padding-top: 0;
  }
  .collection-drawer .depot-panel .depot-actions button { min-height: 34px; padding: 6px 10px; font-size: 11px; }
  .collection-drawer .depot-panel .depot-actions > .pokemon-lock { width: 34px; height: 34px; margin-right: auto; }
  .collection-drawer .depot-panel .depot-actions > [data-equip-pokemon] { min-width: 82px; }
  .collection-drawer .depot-actions .team-usage-tag { flex-basis: 100%; }
  .collection-drawer .team-card-identity-row { grid-template-columns: 22px var(--team-portrait) minmax(0, 1fr) 50px 10px; gap: 4px; }
  .collection-drawer .team-quality-line { gap: 1px 4px; }
  .collection-drawer .team-quality-line :is(.team-iv-metric, .depot-iv-toggle) { gap: 3px; }
}
@media (max-width: 650px) {
  .drawer.collection-drawer .drawer-panel { padding: 8px; }
  .collection-drawer .drawer-head { gap: 7px; padding: 0 0 7px; }
  .collection-drawer .drawer-title-row { gap: 7px; }
  .collection-drawer .drawer-head h2 { font-size: 28px; }
  .collection-drawer .team-header-capacity:not([hidden]) { margin: 0; padding: 4px; }
  .collection-drawer .team-header-capacity > strong { max-width: 60px; font-size: 9px; line-height: 1.15; }
  .collection-drawer .team-header-capacity > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .collection-drawer .collection-summary { min-width: 90px; font-size: 7px; }
  .collection-drawer .collection-summary > strong { font-size: 13px; }
  .collection-drawer #drawer-close { width: 44px; height: 44px; }
}
@media (pointer: coarse) {
  .collection-drawer :is(.team-status-filters, .team-filter-selection, .team-selection-bar, .depot-actions, .reserve-actions, .team-card-actions) button,
  .collection-drawer .depot-panel .depot-actions button,
  .collection-drawer :is(.depot-search input, .team-sort-field select, .iv-range-filter input),
  .collection-drawer .depot-quality-mount :is(.custom-select-trigger, .custom-select-option) { min-height: 44px; }
  .collection-drawer .depot-panel .depot-actions > .pokemon-lock { width: 44px; height: 44px; }
  .collection-drawer .depot-check { min-height: 44px; }
  .collection-drawer .depot-panel .depot-list { --team-row-height: 105px; }
  @container collection-panel (max-width: 540px) {
    .collection-drawer .depot-panel .depot-list { --team-row-height: 122px; }
  }
  .collection-drawer .team-active-move { flex-basis: 44px; width: 44px; min-height: 44px; }
  .collection-drawer .team-active-moves-edit { min-height: 44px; }
  .collection-drawer .team-quality-line .depot-iv-toggle { min-height: 24px; }
}
@media (max-height: 550px) {
  .collection-drawer .depot-sticky { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .collection-drawer :is(.team-card, .depot-row, .team-active-move) { transition: none; }
}

.collection-drawer .depot-toolbar > .ui-pokemon-iv-stats {
  grid-column: 1 / -1; min-width: 0;
}
.collection-drawer .depot-toolbar > .ui-pokemon-iv-stats { margin-top: 0; }

/* Quality: tier chips and the numeric range share one labelled field and row. */
.collection-drawer .team-quality-controls {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.collection-drawer .team-quality-controls > .depot-quality-mount {
  flex: 1 1 120px;
}
.collection-drawer .team-quality-range {
  flex: none;
  gap: 4px;
}
.collection-drawer .team-quality-range .ui-integer-field {
  width: 58px;
  height: auto;
  min-height: 30px;
  padding: 4px 8px;
  border-color: var(--ui-color-border);
  background: var(--ui-color-surface-raised);
  font: 500 13px/1.2 var(--ui-font-body);
}
/* Where the Inventory column is too narrow for chips plus range beside Tier/IV,
   Quality takes its own row and Tier/IV share the next one. */
@container collection-panel (max-width: 1000px) {
  .collection-drawer .depot-sticky .depot-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .collection-drawer .depot-sticky .depot-toolbar > .team-quality-filter { grid-column: 1 / -1; }
}
@container collection-panel (max-width: 340px) {
  .collection-drawer .team-quality-range .ui-integer-field { width: 50px; padding-inline: 6px; }
}
@media (pointer: coarse) {
  .collection-drawer .team-quality-range .ui-integer-field { min-height: 44px; }
}

/* Swap picker: one node in the layout grid. Over the team column when both
   columns show; pinned to the bottom of the visible panel in one column. */
.collection-drawer .collection-layout { grid-template-rows: minmax(0, 1fr); }
.collection-drawer .collection-layout > .team-panel { grid-area: 1 / 1; }
.collection-drawer .collection-layout > .depot-panel { grid-area: 1 / 2; }
.collection-drawer .collection-layout > .team-replace-panel {
  grid-area: 1 / 1;
  /* Above the panels' sticky headers (z-index up to 8). */
  z-index: 9;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  background: color-mix(in srgb, var(--team-screen) 86%, transparent);
  color: var(--ui-color-text);
  font: 400 12px/1.35 var(--ui-font-body);
  animation: team-replace-in 140ms ease-out;
}
.collection-drawer .team-replace-sheet {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--team-chassis-edge);
  border-top: 3px solid var(--ui-color-primary);
  background: var(--ui-color-surface-raised);
  box-shadow: 0 12px 28px rgb(0 0 0 / 45%);
}
.collection-drawer .team-replace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.collection-drawer .team-replace-sheet > .team-section-kicker { margin: 2px 0 -4px; }
.collection-drawer .team-replace-head strong {
  display: block;
  align-self: center;
  color: var(--ui-color-text);
  font: 700 15px/1.2 var(--ui-font-body);
}
.collection-drawer .team-replace-cancel {
  flex: none;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--ui-color-border);
  background: var(--ui-color-surface-control);
  color: var(--ui-color-text);
  font: 600 11px/1.2 var(--ui-font-body);
  cursor: pointer;
}
.collection-drawer .team-replace-cancel:hover { border-color: var(--ui-color-text-muted); }
.collection-drawer .team-replace-sheet > p {
  margin: 0;
  color: var(--ui-color-text-muted);
}
.collection-drawer .team-replace-choices {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.collection-drawer :is(.team-replace-incoming, .team-replace-choice) {
  display: grid;
  grid-template-columns: var(--team-portrait) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--ui-color-border);
  border-left: 3px solid var(--quality-color, var(--ui-color-accent));
  background: var(--team-screen);
  color: var(--ui-color-text);
  font: inherit;
  text-align: left;
}
.collection-drawer .team-replace-incoming {
  grid-template-columns: var(--team-portrait) minmax(0, 1fr) auto;
  border-color: color-mix(in srgb, var(--ui-color-success) 55%, var(--ui-color-border));
  border-left-color: var(--quality-color, var(--ui-color-accent));
}
.collection-drawer .team-replace-choice { cursor: pointer; }
.collection-drawer .team-replace-choice:hover,
.collection-drawer .team-replace-choice:focus-visible {
  border-color: var(--ui-color-primary);
  border-left-color: var(--quality-color, var(--ui-color-accent));
  background: color-mix(in srgb, var(--ui-color-primary) 10%, var(--team-screen));
}
.collection-drawer :is(.team-replace-incoming, .team-replace-choice) .depot-sprite {
  width: var(--team-portrait);
  height: var(--team-portrait);
  border-color: color-mix(in srgb, var(--quality-color, var(--ui-color-accent)) 40%, var(--ui-color-border));
  background: color-mix(in srgb, var(--quality-color, var(--ui-color-accent)) 7%, var(--team-screen));
}
.collection-drawer :is(.team-replace-incoming, .team-replace-choice) .depot-sprite .ot-pokemon-icon {
  width: calc(var(--team-portrait) - 4px);
  height: calc(var(--team-portrait) - 4px);
}
.collection-drawer :is(.team-replace-incoming, .team-replace-choice) .depot-identity > span {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.collection-drawer :is(.team-replace-incoming, .team-replace-choice) .depot-metrics { display: block; }
.collection-drawer .team-replace-outcome {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 82px;
}
.collection-drawer .team-replace-delta {
  font: 700 11px/1.2 var(--ui-font-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ui-color-text-muted);
}
.collection-drawer .team-replace-delta[data-trend="up"] { color: var(--ui-color-success); }
.collection-drawer .team-replace-delta[data-trend="down"] { color: var(--ui-color-danger); }
.collection-drawer .team-replace-cta {
  padding: 4px 8px;
  border: 1px solid var(--ui-color-primary);
  background: color-mix(in srgb, var(--ui-color-primary) 18%, transparent);
  color: var(--ui-color-text);
  font: 700 10px/1.2 var(--ui-font-body);
  white-space: nowrap;
}
@keyframes team-replace-in {
  from { opacity: 0; transform: translateY(6px); }
}
@container collection-panel (max-width: 780px) {
  .collection-drawer .collection-layout > :is(.team-panel, .depot-panel) { grid-area: 1 / 1; }
  .collection-drawer .collection-layout > .team-replace-panel {
    align-self: end;
    max-height: 78%;
    background: transparent;
  }
  .collection-drawer .team-replace-sheet { box-shadow: 0 -10px 26px rgb(0 0 0 / 55%); }
}
@container collection-panel (max-width: 540px) {
  .collection-drawer :is(.team-replace-incoming, .team-replace-choice) {
    grid-template-columns: var(--team-portrait) minmax(0, 1fr) auto;
    gap: 6px;
  }
  .collection-drawer .team-replace-choice .depot-metrics { display: none; }
  .collection-drawer .team-replace-outcome { min-width: 0; }
  .collection-drawer .collection-layout > .team-replace-panel { max-height: 88%; }
  .collection-drawer .team-replace-sheet { gap: 6px; padding: 8px; }
  /* The title already asks who leaves; the description stays for screen readers. */
  .collection-drawer .team-replace-sheet > p {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (pointer: coarse) {
  .collection-drawer :is(.team-replace-cancel, .team-replace-choice) { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .collection-drawer .collection-layout > .team-replace-panel { animation: none; }
}
.collection-drawer .ui-pokemon-iv-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 480px) {
  .collection-drawer .ui-pokemon-iv-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
