/* Mobile catalog controls stay visible above the item grid. */
@media (max-width: 820px) {
  .catalog-box,
  .inventory-box {
    overflow: hidden;
  }

  .catalog-box > .catalog-head {
    position: relative;
    z-index: 1;
    display: grid;
    height: 166px !important;
    min-height: 166px;
    flex: 0 0 166px;
    grid-template-columns: 44px minmax(0, 1fr) minmax(70px, .62fr) minmax(70px, .62fr);
    grid-template-rows: 44px 44px 44px;
    gap: 7px;
    align-items: stretch;
    padding: 10px;
  }

  .catalog-head > h2 {
    grid-column: 1 / 3;
    grid-row: 1;
    align-self: center;
    margin: 0;
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .catalog-head .game-switcher {
    display: grid;
    grid-column: 3 / 5;
    grid-row: 1;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-width: 0;
    padding: 3px;
  }

  .catalog-head .game-switcher button {
    width: 100%;
    height: 36px;
    grid-template-columns: 25px minmax(0, 1fr);
    gap: 5px;
    padding: 4px 7px;
  }

  .catalog-head .game-switcher img {
    width: 25px;
    height: 25px;
  }

  .catalog-head .game-switcher span {
    position: static;
    width: auto;
    height: auto;
    overflow: hidden;
    clip-path: none;
    color: #dce8d7;
    font-size: 10px;
    font-weight: 750;
    text-overflow: ellipsis;
  }

  .catalog-head #sort-btn {
    width: 44px;
    height: 44px;
    grid-column: 1;
    grid-row: 2;
  }

  .catalog-head > .catalog-search {
    width: auto;
    height: 44px;
    grid-column: 2 / 5;
    grid-row: 2;
    padding: 0 12px;
  }

  .catalog-head > .range {
    width: auto;
    height: 44px;
    padding: 0 11px;
  }

  .catalog-head > .range:nth-of-type(2) {
    grid-column: 1 / 3;
    grid-row: 3;
  }

  .catalog-head > .range:nth-of-type(3) {
    grid-column: 3 / 5;
    grid-row: 3;
  }

  .catalog-head > .search-button {
    display: none !important;
  }

  .catalog-head input,
  .store-filters input {
    font-size: 13px !important;
  }

  .catalog-head input::placeholder,
  .store-filters input::placeholder {
    color: #9ca698;
    opacity: 1;
  }

  .catalog-head button:focus-visible,
  .catalog-head input:focus-visible,
  .store-filters button:focus-visible,
  .store-filters input:focus-visible,
  .target-card:focus-visible,
  .inv:focus-visible,
  .store-card button:focus-visible {
    outline: 2px solid #a339ff;
    outline-offset: 2px;
  }

  .store-filters {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    display: grid;
    width: auto !important;
    height: 105px !important;
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 44px 44px;
    gap: 7px;
    padding: 10px;
  }

  .store-filters[hidden] {
    display: none;
  }

  .store-filters #store-sort {
    width: 44px !important;
    height: 44px !important;
    grid-column: 1;
    grid-row: 1;
  }

  .store-filters > .catalog-search {
    width: auto;
    height: 44px;
    grid-column: 2 / 4;
    grid-row: 1;
    padding: 0 12px;
  }

  .store-filters > .range {
    width: auto;
    height: 44px;
    padding: 0 11px;
  }

  .store-filters > .range:nth-of-type(2) {
    grid-column: 1 / 3;
    grid-row: 2;
  }

  .store-filters > .range:nth-of-type(3) {
    grid-column: 3;
    grid-row: 2;
  }

  .store-filters > .search-button {
    display: none !important;
  }

  .catalog-box .target-grid,
  .store-box .inventory-list,
  .store-box.catalog-active .inventory-list,
  .store-box:not(.catalog-active) .inventory-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px;
  }

  .catalog-box .target-grid {
    position: relative;
    z-index: 0;
    margin-top: 0;
  }

  .catalog-box .target-card {
    min-height: 170px;
    padding: 7px 8px 9px;
  }

  .catalog-box .target-card img {
    height: 103px;
    margin: 5px auto 3px;
  }

  .catalog-box .target-card b,
  .catalog-box .target-card small {
    font-size: 11px;
  }

  .store-box.catalog-active .store-card {
    min-height: 184px;
    padding: 7px;
  }

  .store-box.catalog-active .store-card img {
    height: 101px;
  }

  .store-box.catalog-active .store-card > b,
  .store-box.catalog-active .store-card small {
    font-size: 11px;
  }

  .store-box.catalog-active .store-card button {
    min-height: 44px;
    margin-top: 7px;
    font-size: 9px;
  }

  .store-box:not(.catalog-active) .inv {
    min-height: 166px;
  }

  .store-box:not(.catalog-active) .inv img {
    height: 102px;
  }
}

@media (min-width: 621px) and (max-width: 820px) {
  .catalog-box .target-grid,
  .store-box .inventory-list,
  .store-box.catalog-active .inventory-list,
  .store-box:not(.catalog-active) .inventory-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 365px) {
  .catalog-box > .catalog-head {
    grid-template-columns: 42px minmax(0, 1fr) minmax(62px, .58fr) minmax(62px, .58fr);
    gap: 6px;
    padding: 8px;
  }

  .catalog-head .game-switcher button {
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 3px;
    padding: 4px;
  }

  .catalog-head .game-switcher img {
    width: 23px;
    height: 23px;
  }

  .catalog-head .game-switcher span {
    font-size: 9px;
  }
}
